Skip to content

Commit

Permalink
ORV2-3027: added new term overweight test case
Browse files Browse the repository at this point in the history
ORV2-3027: added new term overweight test case
  • Loading branch information
bcgov-brwang committed Nov 18, 2024
1 parent e1a35c8 commit 3a66001
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,43 @@ jobs:
path: tests/cypress/videos/
overwrite: true
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`

new-term-overweight:
name: (BCEID) New Term Overweight
runs-on: ubuntu-22.04
defaults:
run:
working-directory: tests/
strategy:
matrix:
browser: [chrome, firefox, edge]
timeout-minutes: 5
steps:
- uses: actions/checkout@v4

- uses: cypress-io/[email protected]
name: Cypress run
env:
CYPRESS_baseUrl: https://${{ github.event.repository.name }}-${{ inputs.target || 'test' }}-frontend.apps.silver.devops.gov.bc.ca/
CYPRESS_bceid_username: ${{vars.BCEID_USERNAME}}
CYPRESS_bceid_password: ${{secrets.BCEID_PASSWORD}}
with:
browser: ${{ matrix.browser }}
config: pageLoadTimeout=10000,video=true
spec: cypress/e2e/bceid-new-term-overweight.cy.js
working-directory: tests

- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-screenshots
path: tests/cypress/screenshots/
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`

- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-videos
path: tests/cypress/videos/
overwrite: true
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
1 change: 1 addition & 0 deletions tests/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = defineConfig({
bceid_password: 'orbcTST2023+',
update_term_oversize_url: 'https://onroutebc-test-frontend.apps.silver.devops.gov.bc.ca/applications/581',
new_tros_url: 'https://onroutebc-test-frontend.apps.silver.devops.gov.bc.ca/create-application/TROS',
new_trow_url: 'https://onroutebc-test-frontend.apps.silver.devops.gov.bc.ca/create-application/TROW',
},
},
});
85 changes: 85 additions & 0 deletions tests/cypress/e2e/bceid-new-term-overweight.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
describe('Login Test for OnRouteBC', () => {
it('Should navigate to the login page, find the login button, and enter credentials', () => {
// Retrieve the environment variables
const username = Cypress.env('bceid_username');
const password = Cypress.env('bceid_password');
const new_trow_url = Cypress.env('new_tros_url');

// Step 1: Visit the base URL
cy.visit('/');

// Step 2: Find and click the login button by its idir
cy.get('#login-bceid').click();
cy.wait(5000);

// Step 3: Enter credentials
cy.get('#user').type(username);
cy.get('#password').type(password);
cy.wait(5000);

// Step 4: Submit the login form
cy.get('[name="btnSubmit"]').click();
cy.wait(5000);

cy.visit(new_trow_url);
cy.wait(5000);

// fill out the form
cy.get('#application-select-vehicle').type('123');
cy.wait(5000);

cy.get('[name="permitData.vehicleDetails.vin"]').click({ force: true }).type('115588');
cy.wait(5000);

cy.get('[name="permitData.vehicleDetails.plate"]').type('1B25F');
cy.wait(5000);

cy.get('[name="permitData.vehicleDetails.make"]').type('PHIL');
cy.wait(5000);

cy.get('[name="permitData.vehicleDetails.year"]').type('1992');
cy.wait(5000);

cy.get('[id="mui-component-select-permitData.vehicleDetails.countryCode"]').scrollIntoView().click();
cy.wait(5000);

cy.get('[data-value="CA"]').click();
cy.wait(5000);

cy.get('[id="mui-component-select-permitData.vehicleDetails.provinceCode"]').click();
cy.wait(5000);

cy.get('[data-value="BC"]').click();
cy.wait(5000);

cy.get('[id="mui-component-select-permitData.vehicleDetails.vehicleType"]').click(({ force: true }));
cy.wait(5000);

cy.get('[data-value="trailer"]').click();
cy.wait(5000);

cy.get('[id="mui-component-select-permitData.vehicleDetails.vehicleSubType"]').click({ force: true });
cy.wait(5000);

cy.get('[data-value="DOLLIES"]').click();
cy.wait(5000);

cy.get('[data-testid="continue-application-button"]').click({ force: true });
cy.wait(5000);

cy.get('input[type="checkbox"]').each(($checkbox) => {
cy.wrap($checkbox).click({ force: true });
});
cy.wait(5000);

cy.get('[data-testid="add-to-cart-btn"]').click({force: true});
cy.wait(5000);

cy.get('.shopping-cart-button').click({force: true});
cy.wait(5000);

cy.get('[data-testid="pay-now-btn"]').scrollIntoView().click({force: true});
cy.wait(5000);

});
});

0 comments on commit 3a66001

Please sign in to comment.