Skip to content

Commit

Permalink
Tests: Cypress folder and test cases (#122)
Browse files Browse the repository at this point in the history
* fix: add cypress files

* tests(cypress): add timeouts and cy origin to some test cases

---------

Co-authored-by: Derek Roberts <derek.roberts@gmail.com>
Co-authored-by: iatdaitan <86745196+iatdaitan@users.noreply.github.com>
  • Loading branch information
3 people authored May 16, 2023
1 parent 9063586 commit 9f5efec
Show file tree
Hide file tree
Showing 12 changed files with 479 additions and 119 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,8 @@ snyk.sarif

# Artifacts
*.jar

# Cypress
frontend/cypress/videos
frontend/cypress/screenshots
frontend/cypress/downloads
4 changes: 2 additions & 2 deletions frontend/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { defineConfig } from 'cypress';

export default defineConfig({
e2e: {
baseUrl: 'https://nr-spar-webapp-test-frontend.apps.silver.devops.gov.bc.ca/',
baseUrl: 'http://localhost:3000/',
viewportWidth: 1280,
viewportHeight: 720,
experimentalWebKitSupport: true,
env: {
apiUrl: 'https://nrbestapi-test-service-api.apps.silver.devops.gov.bc.ca'
keycloakLoginUrl: 'https://logontest7.gov.bc.ca'
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
setupNodeEvents(on, config) {
Expand Down
10 changes: 7 additions & 3 deletions frontend/cypress/e2e/smoke-test/login-page.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,20 @@ describe('Login page test', () => {

it('navigate to the user form page IDIR', () => {
cy.getByDataTest('landing-button__idir').click();
cy.get('#idirLogo').should('be.visible');
cy.origin(Cypress.env('keycloakLoginUrl'), () => {
cy.get('#idirLogo', { timeout: 6000 }).should('be.visible');
});
});

it('navigate to the user form page BCeID', () => {
cy.getByDataTest('landing-button__bceid').click();
cy.get('#bceidLogo').should('be.visible');
cy.origin(Cypress.env('keycloakLoginUrl'), () => {
cy.get('#bceidLogo', { timeout: 6000 }).should('be.visible');
});
});

it('try to access system using a link without user connected', () => {
cy.visit('https://nr-spar-webapp-test-frontend.apps.silver.devops.gov.bc.ca/');
cy.visit('/dashboard');
cy.getByDataTest('landing-title').should('have.text', loginPageData.title);
});

Expand Down
Loading

0 comments on commit 9f5efec

Please sign in to comment.