Skip to content

Commit

Permalink
Incorporated tests from qa-ofmcc-1250-crm-login.
Browse files Browse the repository at this point in the history
  • Loading branch information
weskubo-cgi authored and weskubo-cgi committed Aug 15, 2024
1 parent e42612a commit d432f40
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 33 deletions.
25 changes: 2 additions & 23 deletions .github/workflows/deploy-to-openshift-backend-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,30 +202,9 @@ jobs:
# target: 'https://${{ env.HOST_ROUTE }}/api'

cypress-run:
name: Run Cypress E2E tests
needs: openshift-ci-cd
runs-on: ubuntu-24.04
environment: dev
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH }}
- name: Cypress run
uses: cypress-io/github-action@v6
with:
working-directory: ./testing
#project: ./testing
browser: electron
wait-on: 'https://${{ env.HOST_ROUTE }}'
env:
CYPRESS_AAD_USERNAME: ${{ secrets.CYPRESS_AAD_USERNAME }}
CYPRESS_AAD_PASSWORD: ${{ secrets.CYPRESS_AAD_PASSWORD }}
CYPRESS_PORTAL_USERNAME: ${{ secrets.CYPRESS_PORTAL_USERNAME }}
CYPRESS_PORTAL_PASSWORD: ${{ secrets.CYPRESS_PORTAL_PASSWORD }}
CYPRESS_CRM_URL: ${{ secrets.CYPRESS_CRM_URL }}
CYPRESS_CRM_BASE_URL: ${{ secrets.CYPRESS_CRM_BASE_URL }}
CYPRESS_PORTAL_URL: 'https://${{ env.HOST_ROUTE }}/'
uses: ./.github/workflows/cypress-e2e.yml
secrets: inherit

zap-scan:
name: ZAP Scan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,52 @@ describe('Login to CRM via AAD', () => {
})
})

it.skip('failed login', () => {
it('navigate to organization', () => {
cy.webExceptions(CRM_BASE_URL)
cy.visit('https://google.ca')
cy.loginToAAD('[email protected]', 'password', CRM_URL, CRM_BASE_URL)

// Validate urror
cy.get('div[role="alert"]')
.contains(
'This username may be incorrect. Make sure you typed it correctly. Otherwise, contact your admin.'
)
.should('exist')
cy.loginToAAD(AAD_USERNAME, AAD_PASSWORD, CRM_URL, CRM_BASE_URL)
cy.visit(CRM_URL)
cy.origin(CRM_BASE_URL, () => {
cy.on('uncaught:exception', (e) => {
return false
})

cy.get('ul[aria-label="Childcare Providers"]')
.contains('Organization-Facilities')
.click()
cy.get(
'input[aria-label="Organization-Facility Filter by keyword"]'
).type('Test-1088 Organization{enter}')
cy.wait(5000)
cy.get('div[row-index="0"]')
.find('input[type="checkbox"]')
.click({ force: true })
cy.get('ul[aria-label="Organization-Facility Commands"]')
.find('button')
// XXX This should be Edit but for some reason it's not displaying
// Test is still valid as Org can be actioned with either button
.contains('Activate')
.click()
})
})

it('failed login', () => {
cy.webExceptions(CRM_BASE_URL)
cy.visit('https://google.ca')
//cy.loginToAAD('[email protected]', 'password', CRM_URL, CRM_BASE_URL)
cy.visit(CRM_BASE_URL)
cy.origin('login.microsoftonline.com', () => {
cy.get('input[type="email"]').type('[email protected]', {
log: false,
})
cy.get('input[type="submit"]').click()

// Validate error
cy.get('div[role="alert"]')
.contains(
'This username may be incorrect. Make sure you typed it correctly. Otherwise, contact your admin.'
)
.should('exist')
})
})
})
1 change: 0 additions & 1 deletion testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"report": "npx cypress run --spec ./cypress/e2e/examples/portal-automation/assistance_request.cy.js --browser electron --headed",
"cy:open": "cypress open",
"cy:run": "cypress run --browser electron --headless ",
"cy:run-one": "cypress run --browser electron --headed --spec "
Expand Down

0 comments on commit d432f40

Please sign in to comment.