Skip to content

Commit

Permalink
ORV2-3299: added additional test cases for IDIR and BCeID account (#1808
Browse files Browse the repository at this point in the history
)

Co-authored-by: cberg-aot <[email protected]>
Co-authored-by: Praveen Raju <[email protected]>
  • Loading branch information
3 people authored Feb 20, 2025
1 parent 4fd1f4c commit f0ce172
Show file tree
Hide file tree
Showing 7 changed files with 477 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/e2e-regression-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ jobs:
- 'bceid-new-term-oversize.cy.js'
- 'bceid-new-term-overweight.cy.js'
- 'bceid-update-term-oversize.cy.js'
- 'bceid-profile.cy.js'
- 'idir-amend-term-oversize.cy.js'
- 'idir-void-term-oversize.cy.js'
# - 'idir-void-term-oversize.cy.js'
- 'idir-general.cy.js'
- 'idir-global-search.cy.js'
- 'idir-settings.cy.js'

timeout-minutes: 10
steps:
Expand Down
130 changes: 130 additions & 0 deletions tests/cypress/e2e/bceid-profile.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
describe('Crud for trailer', () => {
it('Should company info displayed', () => {
// Retrieve the environment variables
const username = Cypress.env('bceid_username');
const password = Cypress.env('bceid_password');
const manage_profiles_url = '/manage-profiles';
const update_trailer_url = Cypress.env('update_trailer_url');
const manage_vehicle_url = '/manage-vehicles';
const wait_time = Cypress.env('wait_time');

// 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(wait_time);

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

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

// 1. Company info displayed – check
cy.visit(manage_profiles_url);
cy.wait(wait_time);

cy.contains('Doing Business As (DBA)')
.next() // Select the next sibling
.should('exist') // Ensure the next sibling exists
.and('not.be.empty') // Ensure it's not empty
.invoke('text') // Get the text content
.should('not.match', /^\s*$/); // Ensure it is not just whitespace

cy.contains('Company Mailing Address')
.next()
.should('exist')
.and('not.be.empty')
.invoke('text')
.should('not.match', /^\s*$/);

cy.contains('Company Contact Details')
.next()
.should('exist')
.and('not.be.empty')
.invoke('text')
.should('not.match', /^\s*$/);

cy.contains('Company Primary Contact')
.next()
.should('exist')
.and('not.be.empty')
.invoke('text')
.should('not.match', /^\s*$/);

// 2. Can update company info – check
cy.contains('button', 'Edit').should('exist').click();
cy.wait(wait_time);

cy.get('[name="alternateName"]').clear().type('onRouteBC Test 1');
cy.wait(wait_time);

cy.get('[name="mailingAddress.addressLine1"]').clear().type('123 Main Street');
cy.wait(wait_time);

cy.contains('button', 'Save').should('exist').click();
cy.wait(wait_time);

// 3. My information displayed – check
cy.visit(manage_profiles_url);
cy.wait(wait_time);

cy.contains('.tab__label', 'My Information').should('exist').click();
cy.wait(wait_time);

cy.get('h3.css-jbf51a').should('exist')
.next()
.should('exist')
.and('not.be.empty')
.invoke('text')
.should('not.match', /^\s*$/);


// 4. Can update my info – check
cy.contains('button', 'Edit').should('exist').click();
cy.wait(wait_time);

cy.get('[name="firstName"]').clear().type('ORBC');
cy.wait(wait_time);

cy.contains('button', 'Save').should('exist').click();
cy.wait(wait_time);

// 5. Users displayed – check
cy.contains('.tab__label', 'Add / Manage Users').should('exist').click();
cy.wait(wait_time);
cy.contains('td', 'ORBCTST1').should('exist');

// 6. Can edit users – check
cy.get('#actions-button').click();
cy.wait(wait_time);

cy.get('.onroutebc-table-row-actions__menu-item').click();
cy.wait(wait_time);

cy.get('[name="phone1Extension"]').clear().type('1234');
cy.wait(wait_time);

cy.contains('button', 'Save').should('exist').click();
cy.wait(wait_time);

// 7. User sort works - check
cy.get('div.Mui-TableHeadCell-Content-Wrapper').contains('First Name').click();
cy.wait(wait_time);

cy.get('div.Mui-TableHeadCell-Content-Wrapper').contains('Last Name').click();
cy.wait(wait_time);

cy.get('div.Mui-TableHeadCell-Content-Wrapper').contains('User Group').click();
cy.wait(wait_time);

cy.get('div.Mui-TableHeadCell-Content-Wrapper').contains('Date Created').click();
cy.wait(wait_time);

});
});

77 changes: 77 additions & 0 deletions tests/cypress/e2e/idir-general.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
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('idir_username');
const password = Cypress.env('idir_password');
const home_url = '/idir/welcome';
const report_url = 'idir/reports';
const wait_time = Cypress.env('wait_time');

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

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


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

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


// Home page – check
cy.visit(home_url);
cy.wait(wait_time);

// 1. Sticky sidebar appears – check
cy.get('button.nav-button.nav-button--home.nav-button--active').should('exist');
cy.wait(wait_time);

cy.get('button.nav-button.nav-button--report').should('exist');
cy.wait(wait_time);

cy.get('button.nav-button.nav-button--bfct').should('exist');
cy.wait(wait_time);

// 2. Global search available – check
cy.get('button.search-button').should('exist');
cy.wait(wait_time);

// Sticky sidebar
// 1. Home button works – check
cy.get('button.nav-button.nav-button--home').click();
cy.wait(wait_time);

// 2. Report button works – check
cy.get('button.nav-button.nav-button--report').click();
cy.wait(wait_time);

cy.get('button[aria-label="View Report"]').click();
cy.wait(wait_time);

cy.visit(report_url);
cy.wait(wait_time);

cy.contains('span', 'Payment and Refund Detail').should('be.visible').click();
cy.wait(wait_time);

cy.get('button[aria-label="View Report"]').click();
cy.wait(wait_time);










});
});
121 changes: 121 additions & 0 deletions tests/cypress/e2e/idir-global-search.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
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('idir_username');
const password = Cypress.env('idir_password');
const home_url = '/idir/welcome';
const report_url = 'idir/reports';
const wait_time = Cypress.env('wait_time');

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

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


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

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


// Home page – check
cy.visit(home_url);
cy.wait(wait_time);

// 1. Can search permits by permit number (checked with active and expired permits) – check
cy.get('.search-button').click();
cy.wait(wait_time);

cy.get('input[type="text"]')
.should('be.visible')
.type('1');
cy.wait(wait_time);

cy.get('.search-by__search').click();
cy.wait(wait_time);

cy.get('.onroutebc-chip.permit-chip.permit-chip--expired').should('exist');
cy.wait(wait_time);

cy.get('.PrivateSwitchBase-input.MuiSwitch-input').click();
cy.wait(wait_time);

cy.contains('p', 'No records to display').should('exist');
cy.wait(wait_time);

cy.get('.PrivateSwitchBase-input.MuiSwitch-input').click();
cy.wait(wait_time);

// Can view permit pdf
cy.get('.MuiTypography-root.MuiTypography-body2.MuiLink-root.MuiLink-underlineAlways.MuiLink-button.custom-action-link')
.first()
.click();
cy.wait(wait_time);

// Can view receipt pdf
cy.get('button#actions-button')
.first()
.click({force: true});
cy.wait(wait_time);

cy.get('li[data-option-value="viewReceipt"]')
.click({force: true});
cy.wait(wait_time);

cy.visit(home_url);
cy.wait(wait_time);

cy.get('.search-button').click();
cy.wait(wait_time);

cy.get('input[type="text"]')
.should('be.visible')
.type('1');
cy.wait(wait_time);

cy.get('.search-by__search').click();
cy.wait(wait_time);

cy.get('button#actions-button')
.first()
.click({force: true});
cy.wait(wait_time);

cy.get('li[data-option-value="resend"]')
.click({force: true});
cy.wait(wait_time);

cy.get('input.PrivateSwitchBase-input[type="checkbox"]').eq(1).click({ force: true });
cy.wait(wait_time);

cy.get('input[data-testid="input-email"]').type('[email protected]');
cy.wait(wait_time);

// cy.get('button').contains('Resend').click();
// cy.wait(wait_time);

// cy.get('button#actions-button')
// .first()
// .click({force: true});
// cy.wait(wait_time);

// cy.get('li[data-option-value="resend"]')
// .click({force: true});
// cy.wait(wait_time);

// Can cancel the resend
cy.get('button')
.contains('Cancel')
.click();
cy.wait(wait_time);


});
});
Loading

0 comments on commit f0ce172

Please sign in to comment.