Skip to content

Commit

Permalink
Merge branch 'release-0.2.0' into feat/prashanth-email-trigger-1226
Browse files Browse the repository at this point in the history
  • Loading branch information
prv-proton authored Dec 10, 2024
2 parents e490114 + f437eec commit 44c414e
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,68 @@ When('the supplier creates a new compliance report', () => {
cy.contains('.MuiList-root li', currentYear).click()
})

When('the supplier navigates to the fuel supply page', () => {
cy.get(
'[data-test="schedule-list"] > :nth-child(1) > .MuiTypography-root'
).click()

cy.contains('.MuiTypography-h5', 'Add new supply of fuel').should(
'be.visible'
)
})

When('the supplier enters a valid fuel supply row', () => {
// First, ensure the grid is loaded
cy.get('.ag-root').should('be.visible')

cy.wait(1000)

// Set "Fuel type" to "CNG"
cy.get('div[col-id="fuelType"][title="Select the fuel type from the list"]')
.click()
.find('input')
.type('CNG{enter}')

cy.wait(800)

// Set "Fuel category" to "Gasoline"
cy.get(
'div[col-id="fuelCategory"][title="Select the fuel category from the list"]'
)
.click()
.find('input')
.type('Gasoline{enter}')
cy.wait(800)

// Set "Determining carbon intensity" to "Default carbon intensity - section 19 (b) (ii)"
cy.get(
'div[col-id="provisionOfTheAct"][title="Act Relied Upon to Determine Carbon Intensity: Identify the appropriate provision of the Act relied upon to determine the carbon intensity of each fuel."]'
).click()

cy.get('body').click()
cy.contains('Row updated successfully.').should('be.visible')
cy.wait(700)
cy.get('.ag-body-horizontal-scroll-viewport').scrollTo(1000, 0)
cy.wait(1200)

// Set "Quantity" to "10,000"
cy.get('div.ag-cell[col-id="quantity"]')
.click()
.wait(1200)
.find('input')
.type('10000{enter}')

cy.contains('Row updated successfully.').should('be.visible')
})

When('saves and returns to the report', () => {
cy.get('.MuiButton-contained').click()

cy.get('[data-test="compliance-report-status"]')
.should('be.visible')
.and('have.text', 'Status: Draft')
})

Then('the compliance report introduction is shown', () => {
// Assert the header
cy.get('[data-test="compliance-report-header"]')
Expand Down Expand Up @@ -57,3 +119,24 @@ Then('the compliance report introduction is shown', () => {
'Welcome to the British Columbia Low Carbon Fuel Standard Portal'
)
})

Then('the compliance report summary includes the quantity', () => {
cy.wait(2000)
cy.get(
'[data-test="renewable-summary"] > .MuiTable-root > .MuiTableBody-root > :nth-child(2) > :nth-child(3) > span'
)
.should('be.visible')
.and('have.text', '10,000')

cy.get(
'[data-test="renewable-summary"] > .MuiTable-root > .MuiTableBody-root > :nth-child(3) > :nth-child(3) > span'
)
.should('be.visible')
.and('have.text', '10,000')

cy.get(
'[data-test="renewable-summary"] > .MuiTable-root > .MuiTableBody-root > :nth-child(4) > :nth-child(3) > span'
)
.should('be.visible')
.and('have.text', '500')
})
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ Feature: Compliance Report Management
And the supplier navigates to the compliance reports page
And the supplier creates a new compliance report
Then the compliance report introduction is shown
When the supplier navigates to the fuel supply page
And the supplier enters a valid fuel supply row
And saves and returns to the report
Then the compliance report summary includes the quantity
4 changes: 2 additions & 2 deletions frontend/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import theme from '@/themes'
import './i18n'
import { KeycloakProvider } from '@/components/KeycloakProvider'
import { getKeycloak } from '@/utils/keycloak'
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'
import { LocalizationProvider } from '@mui/x-date-pickers'
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'

const queryClient = new QueryClient()
const keycloak = getKeycloak()
Expand All @@ -19,7 +19,7 @@ if (root) {
<KeycloakProvider authClient={keycloak}>
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<LocalizationProvider dateAdapter={AdapterDateFns}>
<CssBaseline />
<App />
</LocalizationProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ export const ActivityLinksList = () => {
}, [t, navigate, compliancePeriod, complianceReportId])

return (
<List component="div" sx={{ maxWidth: '100%', listStyleType: 'disc' }}>
<List
data-test="schedule-list"
component="div"
sx={{ maxWidth: '100%', listStyleType: 'disc' }}
>
{activityList.map((activity, index) => (
<StyledListItem
sx={{ cursor: 'pointer' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const ComplianceReportSummary = ({
</AccordionSummary>
<AccordionDetails>
<SummaryTable
data-test="renewable-summary"
title={t('report:renewableFuelTargetSummary')}
columns={
summaryData
Expand All @@ -128,12 +129,14 @@ const ComplianceReportSummary = ({
useParenthesis={true}
/>
<SummaryTable
data-test="low-carbon-summary"
title={t('report:lowCarbonFuelTargetSummary')}
columns={lowCarbonColumns(t)}
data={summaryData?.lowCarbonFuelTargetSummary}
width={'80.65%'}
/>
<SummaryTable
data-test="non-compliance-summary"
title={t('report:nonCompliancePenaltySummary')}
columns={nonComplianceColumns(t)}
data={summaryData?.nonCompliancePenaltySummary}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const SummaryTable = ({
}
return (
<TableContainer
{...props}
component={Paper}
sx={{ margin: '20px 0', border: '1px solid #495057', width }}
>
Expand Down
28 changes: 4 additions & 24 deletions frontend/src/views/FuelCodes/_schema.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,45 +76,25 @@ export const fuelCodeColDefs = (t) => [
{
field: 'applicationDate',
headerName: t('fuelCode:fuelCodeColLabels.applicationDate'),
filter: 'agDateColumnFilter',
filterParams: {
filterOptions: ['equals', 'lessThan', 'greaterThan', 'inRange'],
suppressAndOrCondition: true,
maxValidYear: 2400
},
filter: false,
cellRenderer: TextRenderer
},
{
field: 'approvalDate',
headerName: t('fuelCode:fuelCodeColLabels.approvalDate'),
filter: 'agDateColumnFilter',
filterParams: {
filterOptions: ['equals', 'lessThan', 'greaterThan', 'inRange'],
suppressAndOrCondition: true,
maxValidYear: 2400
},
filter: false,
cellRenderer: TextRenderer
},
{
field: 'effectiveDate',
headerName: t('fuelCode:fuelCodeColLabels.effectiveDate'),
filter: 'agDateColumnFilter',
filterParams: {
filterOptions: ['equals', 'lessThan', 'greaterThan', 'inRange'],
suppressAndOrCondition: true,
maxValidYear: 2400
},
filter: false,
cellRenderer: TextRenderer
},
{
field: 'expirationDate',
headerName: t('fuelCode:fuelCodeColLabels.expirationDate'),
filter: 'agDateColumnFilter',
filterParams: {
filterOptions: ['equals', 'lessThan', 'greaterThan', 'inRange'],
suppressAndOrCondition: true,
maxValidYear: 2400
},
filter: false,
cellRenderer: TextRenderer
},
{
Expand Down

0 comments on commit 44c414e

Please sign in to comment.