From 3a6600110576e0e134394f1613402a258e6cd005 Mon Sep 17 00:00:00 2001 From: bcgov-brwang <87880048+bcgov-brwang@users.noreply.github.com> Date: Mon, 18 Nov 2024 13:22:23 -0800 Subject: [PATCH] ORV2-3027: added new term overweight test case ORV2-3027: added new term overweight test case --- .github/workflows/.tests.yml | 40 +++++++++ tests/cypress.config.js | 1 + .../e2e/bceid-new-term-overweight.cy.js | 85 +++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 tests/cypress/e2e/bceid-new-term-overweight.cy.js diff --git a/.github/workflows/.tests.yml b/.github/workflows/.tests.yml index ae4d0c980..32cc87fa7 100644 --- a/.github/workflows/.tests.yml +++ b/.github/workflows/.tests.yml @@ -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/github-action@v6.7.7 + 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` diff --git a/tests/cypress.config.js b/tests/cypress.config.js index d3981f491..99940b3e0 100644 --- a/tests/cypress.config.js +++ b/tests/cypress.config.js @@ -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', }, }, }); diff --git a/tests/cypress/e2e/bceid-new-term-overweight.cy.js b/tests/cypress/e2e/bceid-new-term-overweight.cy.js new file mode 100644 index 000000000..8a71c151a --- /dev/null +++ b/tests/cypress/e2e/bceid-new-term-overweight.cy.js @@ -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); + + }); +});