generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: e2e regression tests added to repo. (and some loadtests) (#1703)
- Loading branch information
Showing
28 changed files
with
9,070 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const { defineConfig } = require("cypress"); | ||
|
||
module.exports = defineConfig({ | ||
video: true, | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
baseUrl: 'https://onroutebc-test-frontend.apps.silver.devops.gov.bc.ca', | ||
env: { | ||
idir_username: '', | ||
idir_password: '', | ||
bceid_username: '', | ||
bceid_password: '', | ||
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', | ||
new_power_unit_url: 'https://onroutebc-test-frontend.apps.silver.devops.gov.bc.ca/manage-vehicles/add-powerunit', | ||
update_power_unit_url: 'https://onroutebc-test-frontend.apps.silver.devops.gov.bc.ca/manage-vehicles/power-units/106', | ||
manage_vehicle_url: 'https://onroutebc-test-frontend.apps.silver.devops.gov.bc.ca/manage-vehicles', | ||
new_trailer_url: 'https://onroutebc-test-frontend.apps.silver.devops.gov.bc.ca/manage-vehicles/add-trailer', | ||
update_trailer_url: 'https://onroutebc-test-frontend.apps.silver.devops.gov.bc.ca/manage-vehicles/trailers/106', | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
describe('Crud for power unit', () => { | ||
it('Should create, update or delete a power unit', () => { | ||
// Retrieve the environment variables | ||
const username = Cypress.env('bceid_username'); | ||
const password = Cypress.env('bceid_password'); | ||
const new_power_unit_url = '/manage-vehicles/add-powerunit'; | ||
const update_power_unit_url = Cypress.env('update_power_unit_url'); | ||
const manage_vehicle_url = '/manage-vehicles'; | ||
|
||
// 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_power_unit_url); | ||
cy.wait(5000); | ||
|
||
// create new power unit | ||
// cy.get('[name="unitNumber"]').type('MCL37'); | ||
// cy.wait(5000); | ||
|
||
cy.get('[name="make"]').type('Toyota'); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="year"]').type('2002'); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="vin"]').type('MCL37A'); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="plate"]').type('VB0007'); | ||
cy.wait(5000); | ||
|
||
cy.get('[id="mui-component-select-powerUnitTypeCode"]').click({ force: true }); | ||
cy.wait(5000); | ||
|
||
cy.get('[data-value="BUSCRUM"]').click(); | ||
cy.wait(5000); | ||
|
||
cy.get('[id="mui-component-select-countryCode"]').scrollIntoView().click(); | ||
cy.wait(5000); | ||
|
||
cy.get('[data-value="CA"]').click(); | ||
cy.wait(5000); | ||
|
||
cy.get('[id="mui-component-select-provinceCode"]').click(); | ||
cy.wait(5000); | ||
|
||
cy.get('[data-value="AB"]').click(); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="licensedGvw"]').type('2000'); | ||
cy.wait(5000); | ||
|
||
cy.get('.css-xie432').click(); | ||
cy.wait(5000); | ||
|
||
// update power unit | ||
cy.visit(manage_vehicle_url); | ||
cy.wait(5000); | ||
|
||
cy.get('.css-15mydm5').first().scrollIntoView().wait(3000).click({ force: true }); | ||
cy.wait(5000); | ||
|
||
cy.xpath("//li[text()='Edit']").click(); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="make"]').clear().type('Toyota'); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="year"]').clear().type('2021'); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="licensedGvw"]').clear().type('3000'); | ||
cy.wait(5000); | ||
|
||
cy.get('.css-xie432').click(); | ||
cy.wait(5000); | ||
|
||
// delete power unit | ||
cy.visit(manage_vehicle_url); | ||
cy.wait(5000); | ||
|
||
cy.xpath("(//input[@type='checkbox'])[2]") | ||
.then(($checkbox) => { | ||
if (!$checkbox.prop('checked')) { // Check if it's not selected | ||
cy.wrap($checkbox).click(); // Select it if not already checked | ||
} | ||
}); | ||
cy.wait(5000); | ||
|
||
cy.get('.delete-btn--active').click(); | ||
cy.wait(5000); | ||
|
||
cy.get('.css-1a53fri').click(); | ||
cy.wait(5000); | ||
|
||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
describe('Crud for trailer', () => { | ||
it('Should create, update or delete a trailer', () => { | ||
// Retrieve the environment variables | ||
const username = Cypress.env('bceid_username'); | ||
const password = Cypress.env('bceid_password'); | ||
const new_trailer_url = '/manage-vehicles/add-trailer'; | ||
const update_trailer_url = Cypress.env('update_trailer_url'); | ||
const manage_vehicle_url = '/manage-vehicles'; | ||
|
||
// 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_trailer_url); | ||
cy.wait(5000); | ||
|
||
// create new trailer | ||
// cy.get('[name="unitNumber"]').type('TCL37'); | ||
// cy.wait(5000); | ||
|
||
cy.get('[name="make"]').type('NISSAN'); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="year"]').type('2005'); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="vin"]').type('TCL37A'); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="plate"]').type('VT0007'); | ||
cy.wait(5000); | ||
|
||
cy.get('[id="mui-component-select-trailerTypeCode"]').click({ force: true }); | ||
cy.wait(5000); | ||
|
||
cy.get('[data-value="BOOSTER"]').click(); | ||
cy.wait(5000); | ||
|
||
cy.get('[id="mui-component-select-countryCode"]').scrollIntoView().click(); | ||
cy.wait(5000); | ||
|
||
cy.get('[data-value="CA"]').click(); | ||
cy.wait(5000); | ||
|
||
cy.get('[id="mui-component-select-provinceCode"]').click(); | ||
cy.wait(5000); | ||
|
||
cy.get('[data-value="BC"]').click(); | ||
cy.wait(5000); | ||
|
||
cy.get('.css-xie432').click(); | ||
cy.wait(5000); | ||
|
||
// update power unit | ||
cy.visit(manage_vehicle_url); | ||
cy.wait(5000); | ||
|
||
cy.get('.tab__label').contains('Trailer').click(); | ||
cy.wait(5000); | ||
|
||
cy.get('.css-15mydm5').first().scrollIntoView().wait(3000).click({ force: true }); | ||
cy.wait(5000); | ||
|
||
cy.xpath("//li[text()='Edit']").click(); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="make"]').clear().type('BMW'); | ||
cy.wait(5000); | ||
|
||
// cy.get('[name="unitNumber"]').clear().type('TCL37'); | ||
// cy.wait(5000); | ||
|
||
cy.get('[name="year"]').clear().type('2021'); | ||
cy.wait(5000); | ||
|
||
cy.get('.css-xie432').click(); | ||
cy.wait(5000); | ||
|
||
|
||
// delete trailer | ||
cy.visit(manage_vehicle_url); | ||
cy.wait(5000); | ||
|
||
cy.get('.tab__label').contains('Trailer').click(); | ||
cy.wait(5000); | ||
|
||
cy.xpath("(//input[@type='checkbox'])[2]") | ||
.then(($checkbox) => { | ||
if (!$checkbox.prop('checked')) { // Check if it's not selected | ||
cy.wrap($checkbox).click(); // Select it if not already checked | ||
} | ||
}); | ||
cy.wait(5000); | ||
|
||
cy.get('.delete-btn--active').click(); | ||
cy.wait(5000); | ||
|
||
cy.get('.css-1a53fri').click(); | ||
cy.wait(5000); | ||
|
||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_tros_url = '/create-application/TROS'; | ||
|
||
// 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_tros_url); | ||
cy.wait(5000); | ||
|
||
// fill out the form | ||
cy.get('#application-select-vehicle').type('MCL36'); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="permitData.vehicleDetails.vin"]').click({ force: true }).type('MCL36A'); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="permitData.vehicleDetails.plate"]').type('L4NDO'); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="permitData.vehicleDetails.make"]').type('BMW'); | ||
cy.wait(5000); | ||
|
||
cy.get('[name="permitData.vehicleDetails.year"]').type('2020'); | ||
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="powerUnit"]').click(); | ||
cy.wait(5000); | ||
|
||
cy.get('[id="mui-component-select-permitData.vehicleDetails.vehicleSubType"]').click({ force: true }); | ||
cy.wait(5000); | ||
|
||
cy.get('[data-value="REGTRCK"]').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); | ||
|
||
}); | ||
}); |
Oops, something went wrong.