-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add test for creating compliance report in the current year * Add checks to ensure title and status match, and the introduction is shown
- Loading branch information
Showing
3 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
frontend/cypress/e2e/Pages/ComplianceReport/ComplianceReport.test.js
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,59 @@ | ||
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor' | ||
|
||
const currentYear = new Date().getFullYear().toString() | ||
|
||
Given('the supplier is on the login page', () => { | ||
cy.clearAllCookies() | ||
cy.clearAllLocalStorage() | ||
cy.clearAllSessionStorage() | ||
cy.visit('/') | ||
cy.getByDataTest('login-container').should('exist') | ||
}) | ||
|
||
When('the supplier logs in with valid credentials', () => { | ||
cy.loginWith( | ||
'becid', | ||
Cypress.env('BCEID_TEST_USER'), | ||
Cypress.env('BCEID_TEST_PASS') | ||
) | ||
cy.visit('/') | ||
cy.getByDataTest('dashboard-container').should('exist') | ||
}) | ||
|
||
When('the supplier navigates to the compliance reports page', () => { | ||
cy.get('a[href="/compliance-reporting"]').click() | ||
}) | ||
|
||
When('the supplier creates a new compliance report', () => { | ||
cy.get('.MuiStack-root > :nth-child(1) > .MuiButtonBase-root').click() | ||
// Select and click the current year button | ||
cy.contains('.MuiList-root li', currentYear).click() | ||
}) | ||
|
||
Then('the compliance report introduction is shown', () => { | ||
// Assert the header | ||
cy.get('[data-test="compliance-report-header"]') | ||
.should('be.visible') | ||
.and('have.text', `${currentYear} Compliance report - Original Report`) | ||
|
||
// Assert the status | ||
cy.get('[data-test="compliance-report-status"]') | ||
.should('be.visible') | ||
.and('have.text', 'Status: Draft') | ||
|
||
// Assert the Introduction Header | ||
cy.contains('div.MuiTypography-h5', 'Introduction') | ||
.should('be.visible') | ||
.and('have.text', 'Introduction') | ||
|
||
// Assert the Welcome Message | ||
cy.contains( | ||
'h6', | ||
'Welcome to the British Columbia Low Carbon Fuel Standard Portal' | ||
) | ||
.should('be.visible') | ||
.and( | ||
'have.text', | ||
'Welcome to the British Columbia Low Carbon Fuel Standard Portal' | ||
) | ||
}) |
8 changes: 8 additions & 0 deletions
8
frontend/cypress/e2e/Pages/ComplianceReport/ComplianceReportManagement.feature
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,8 @@ | ||
Feature: Compliance Report Management | ||
|
||
Scenario: Supplier saves a draft compliance report | ||
Given the supplier is on the login page | ||
When the supplier logs in with valid credentials | ||
And the supplier navigates to the compliance reports page | ||
And the supplier creates a new compliance report | ||
Then the compliance report introduction is shown |
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