diff --git a/frontend/cypress/e2e/Pages/ComplianceReport/ComplianceReport.test.js b/frontend/cypress/e2e/Pages/ComplianceReport/ComplianceReport.test.js new file mode 100644 index 000000000..7190e79a9 --- /dev/null +++ b/frontend/cypress/e2e/Pages/ComplianceReport/ComplianceReport.test.js @@ -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' + ) +}) diff --git a/frontend/cypress/e2e/Pages/ComplianceReport/ComplianceReportManagement.feature b/frontend/cypress/e2e/Pages/ComplianceReport/ComplianceReportManagement.feature new file mode 100644 index 000000000..01361dcff --- /dev/null +++ b/frontend/cypress/e2e/Pages/ComplianceReport/ComplianceReportManagement.feature @@ -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 diff --git a/frontend/src/views/ComplianceReports/EditViewComplianceReport.jsx b/frontend/src/views/ComplianceReports/EditViewComplianceReport.jsx index e05a6c55a..4ba45bf38 100644 --- a/frontend/src/views/ComplianceReports/EditViewComplianceReport.jsx +++ b/frontend/src/views/ComplianceReports/EditViewComplianceReport.jsx @@ -180,7 +180,11 @@ export const EditViewComplianceReport = () => { data={modalData} /> - + {compliancePeriod + ' ' + t('report:complianceReport')} -{' '} {reportData?.report.nickname} @@ -188,6 +192,7 @@ export const EditViewComplianceReport = () => { variant="h6" color="primary" style={{ marginLeft: '0.25rem' }} + data-test="compliance-report-status" > Status: {currentStatus}