Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/web/axios-1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
conbrad authored Nov 14, 2023
2 parents ea3056b + 65a8eb5 commit 8266157
Showing 1 changed file with 19 additions and 60 deletions.
79 changes: 19 additions & 60 deletions web/cypress/e2e/fire-behaviour-advisory-calculator-page.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,13 @@ describe('FireBAT Calculator Page', () => {
wind_speed: parseFloat(windSpeed)
})
}).as('calculateResults')

visitAndAddRow()

cy.wait('@getStations')

cy.setFBAGrassCurePercentage(grassCure, 1)

cy.setFBAWindSpeed(windSpeed, 1)

cy.selectFBAStationInDropdown(stationCode, 1)

cy.selectFBAFuelTypeInDropdown(fuelType.friendlyName, 1)

cy.wait('@calculateResults')

cy.rowCountShouldBe(1)
cy.url().should('contain', `s=${stationCode}&f=${fuelType.name.toLowerCase()}&c=${grassCure}&w=${windSpeed}`)
})
Expand All @@ -54,17 +46,14 @@ describe('FireBAT Calculator Page', () => {
cy.getByTestId('tooltip-fire-size').invoke('attr', 'style').should('eq', 'left: 0px;')
})
})
xdescribe('Dropdowns', () => {
xit('Can select station if successfully received stations', () => {
describe('Dropdowns', () => {
it('Can select station if successfully received stations', () => {
cy.intercept('GET', 'api/stations/*', { fixture: 'weather-stations.json' }).as('getStations')

visitAndAddRow()

cy.wait('@getStations')

const stationCode = 322
cy.setFBAGrassCurePercentage('1', 1)
cy.selectFBAStationInDropdown(stationCode, 1)

cy.rowCountShouldBe(1)
cy.url().should('contain', `s=${stationCode}`)
})
Expand All @@ -74,10 +63,9 @@ describe('FireBAT Calculator Page', () => {
visitAndAddRow()

cy.wait('@getStations')

const fuelType = FuelTypes.get()['c1']
cy.setFBAGrassCurePercentage('1', 1)
cy.selectFBAFuelTypeInDropdown(fuelType.friendlyName, 1)

cy.rowCountShouldBe(1)
cy.url().should('contain', `f=${fuelType.name.toLowerCase()}`)
})
Expand All @@ -95,33 +83,25 @@ describe('FireBAT Calculator Page', () => {
crown_base_height: fuelType.crown_base_height
})
}).as('calculateResults')

visitAndAddRow()

cy.wait('@getStations')

cy.setFBAGrassCurePercentage('1', 1)
cy.selectFBAStationInDropdown(stationCode, 1)

cy.selectFBAFuelTypeInDropdown(fuelType.friendlyName, 1)

cy.rowCountShouldBe(1)
cy.url().should('contain', `s=${stationCode}&f=${fuelType.name.toLowerCase()}`)

cy.wait('@calculateResults')
})
it('Does not call backend when station and grass fuel type are set without grass cure percentage', () => {
cy.intercept('GET', 'api/stations/*', { fixture: 'weather-stations.json' }).as('getStations')
cy.intercept('POST', 'api/fba-calc/stations', _ => {
throw new Error('API request made without grass cure percentage set')
})

visitAndAddRow()

cy.wait('@getStations')

const stationCode = 322
cy.setFBAGrassCurePercentage('1', 1)
cy.selectFBAStationInDropdown(stationCode, 1)

cy.selectFBAFuelTypeInDropdown(FuelTypes.get()['o1a'].friendlyName, 1)
cy.getByTestId(`fuel-type-dropdown-fba-1`).find('input').clear()
cy.selectFBAFuelTypeInDropdown(FuelTypes.get()['o1b'].friendlyName, 1)
Expand All @@ -140,72 +120,53 @@ describe('FireBAT Calculator Page', () => {
it('Disables remove row(s) button when table is empty', () => {
cy.intercept('GET', 'api/stations/*', { fixture: 'weather-stations.json' }).as('getStations')
cy.visit(FIRE_BEHAVIOR_CALC_ROUTE)

cy.getByTestId('remove-rows').should('have.class', 'Mui-disabled')
})

xit('Enables remove row(s) button when table is not empty', () => {
it('Enables remove row(s) button when table is not empty', () => {
cy.intercept('GET', 'api/stations/*', { fixture: 'weather-stations.json' }).as('getStations')

visitAndAddRow()

cy.wait('@getStations')

const stationCode = 322
cy.setFBAGrassCurePercentage('1', 1)
cy.selectFBAStationInDropdown(stationCode, 1)

cy.getByTestId('remove-rows').should('not.have.class', 'Mui-disabled')
})

xit('Rows can be added and removed', () => {
it('Rows can be added and removed', () => {
cy.intercept('GET', 'api/stations/*', { fixture: 'weather-stations.json' }).as('getStations')

visitAndAddRow()

cy.wait('@getStations')

const stationCode = 322
cy.setFBAGrassCurePercentage('1', 1)
cy.selectFBAStationInDropdown(stationCode, 1)

cy.rowCountShouldBe(1)
cy.url().should('contain', `s=${stationCode}`)

cy.getByTestId('select-all').click()

cy.getByTestId('remove-rows').click()

cy.getByTestId('fba-instructions').should('be.visible')

cy.url().should('not.contain', `s=${stationCode}`)
})
xit('Specific rows can be removed', () => {
it('Specific rows can be removed', () => {
cy.intercept('GET', 'api/stations/*', { fixture: 'weather-stations.json' }).as('getStations')

visitAndAddRow()

cy.wait('@getStations')

const stationCode = 322
cy.setFBAGrassCurePercentage('1', 1)
cy.selectFBAStationInDropdown(stationCode, 1)

cy.rowCountShouldBe(1)
cy.url().should('contain', `s=${stationCode}`)

cy.setSelectedRow()

cy.getByTestId('remove-rows').click()

cy.getByTestId('fba-instructions').should('be.visible')

cy.url().should('not.contain', `s=${stationCode}`)
})
})

xdescribe('Export data to CSV', () => {
describe('Export data to CSV', () => {
it('Disables the Export button when 0 rows are selected', () => {
cy.intercept('GET', 'api/stations/*', { fixture: 'weather-stations.json' }).as('getStations')
visitAndAddRow()
cy.wait('@getStations')
cy.setFBAGrassCurePercentage('1', 1)
cy.selectFBAStationInDropdown(322, 1)
cy.selectFBAFuelTypeInDropdown('C3', 1)
cy.getByTestId('export').should('be.visible')
Expand All @@ -216,18 +177,18 @@ describe('FireBAT Calculator Page', () => {
cy.intercept('GET', 'api/stations/*', { fixture: 'weather-stations.json' }).as('getStations')
visitAndAddRow()
cy.wait('@getStations')
cy.setFBAGrassCurePercentage('1', 1)
cy.selectFBAStationInDropdown(322, 1)
cy.selectFBAFuelTypeInDropdown('C4', 1)
cy.getByTestId('select-all').click()
cy.getByTestId('export').should('be.enabled')
})
})

xdescribe('Filter columns dialog', () => {
describe('Filter columns dialog', () => {
it('Disables the Filter Columns dialog open button when 0 rows are in table', () => {
cy.intercept('GET', 'api/stations/*', { fixture: 'weather-stations.json' }).as('getStations')
cy.visit(FIRE_BEHAVIOR_CALC_ROUTE)

cy.getByTestId('filter-columns-btn').should('be.disabled')
})

Expand All @@ -236,14 +197,12 @@ describe('FireBAT Calculator Page', () => {
cy.intercept('POST', 'api/fba-calc/stations', {
fixture: 'fba-calc/322_209_response.json'
}).as('calculateResults')

visitAndAddRow()
cy.wait('@getStations')
cy.setFBAGrassCurePercentage('1', 1)
cy.selectFBAStationInDropdown(322, 1)
cy.selectFBAFuelTypeInDropdown('C4', 1)

cy.wait('@calculateResults')

cy.getByTestId('filter-columns-btn').should('be.enabled')
})

Expand All @@ -252,14 +211,14 @@ describe('FireBAT Calculator Page', () => {
cy.intercept('POST', 'api/fba-calc/stations', {
fixture: 'fba-calc/322_209_response.json'
}).as('calculateResults')

visitAndAddRow()
cy.wait('@getStations')

cy.setFBAGrassCurePercentage('1', 1)
cy.selectFBAStationInDropdown(322, 1)
cy.selectFBAFuelTypeInDropdown('C4', 1)

cy.getByTestId('add-row').click()
cy.setFBAGrassCurePercentage('1', 1)
cy.selectFBAStationInDropdown(209, 2)
cy.selectFBAFuelTypeInDropdown('C1', 2)

Expand Down

0 comments on commit 8266157

Please sign in to comment.