diff --git a/air-quality-ui/system_tests/pages/banner.ts b/air-quality-ui/system_tests/pages/banner.ts index c4cceb43..1dccd198 100644 --- a/air-quality-ui/system_tests/pages/banner.ts +++ b/air-quality-ui/system_tests/pages/banner.ts @@ -6,6 +6,7 @@ export class Banner extends BasePage { readonly page: Page readonly calendarIcon: Locator + readonly dateOkButton: Locator readonly datePicker: Locator readonly datePickerNextMonthButton: Locator readonly datePickerTimeOptions: Locator @@ -22,6 +23,7 @@ export class Banner extends BasePage { this.page = page this.calendarIcon = page.getByTestId('CalendarIcon') + this.dateOkButton = page.getByRole('button', { name: 'Ok' }) this.datePicker = page.getByRole('textbox', { name: 'Forecast Base Date' }) this.datePickerNextMonthButton = page.getByLabel('Next month') this.datePickerTimeOptions = page.locator('ul > [role="option"]') @@ -71,6 +73,10 @@ export class Banner extends BasePage { } } + async confirmDate() { + await this.dateOkButton.click() + } + async setBaseTime(baseTime: string): Promise { await this.datePicker.fill(baseTime) } diff --git a/air-quality-ui/system_tests/ui/city_page/city_page.spec.ts b/air-quality-ui/system_tests/ui/city_page/city_page.spec.ts index caa51893..3c4f1f06 100644 --- a/air-quality-ui/system_tests/ui/city_page/city_page.spec.ts +++ b/air-quality-ui/system_tests/ui/city_page/city_page.spec.ts @@ -104,7 +104,7 @@ test.use({ viewport: { width: 1920, height: 1080 }, }) test.describe('City graph snapshots', () => { - test.beforeEach(async ({ cityPage, page }) => { + test.beforeEach(async ({ cityPage, page, banner }) => { const mockedForecastResponse = [ createForecastAPIResponseData({ base_time: '2024-07-01T00:00:00Z', @@ -321,6 +321,7 @@ test.describe('City graph snapshots', () => { await gotoPage(page, '/city/Rio%20de%20Janeiro') await cityPage.waitForAllGraphsToBeVisible() await cityPage.setBaseTime('01/07/2024 00:00') + await banner.confirmDate() }) test('AQI snapshot', async ({ cityPage }) => { @@ -400,7 +401,7 @@ test.use({ viewport: { width: 1920, height: 1080 }, }) test.describe('Charts are fully visible in 1920x1080 viewport', () => { - test.beforeEach(async ({ page, cityPage }) => { + test.beforeEach(async ({ page, cityPage, banner }) => { const mockedForecastResponse = [ createForecastAPIResponseData({ base_time: '2024-07-01T00:00:00Z', @@ -431,6 +432,7 @@ test.describe('Charts are fully visible in 1920x1080 viewport', () => { await cityPage.waitForAllGraphsToBeVisible() await cityPage.setBaseTime('01/07/2024 00:00') + await banner.confirmDate() }) test('AQI chart element is visible in fullscreen view', async ({ diff --git a/air-quality-ui/system_tests/ui/city_page/city_page_api_calls.spec.ts b/air-quality-ui/system_tests/ui/city_page/city_page_api_calls.spec.ts index 9d400295..59e7526b 100644 --- a/air-quality-ui/system_tests/ui/city_page/city_page_api_calls.spec.ts +++ b/air-quality-ui/system_tests/ui/city_page/city_page_api_calls.spec.ts @@ -95,6 +95,7 @@ test.describe('API calls on changing forecast base time in UI', () => { banner, }) => { await banner.clickOnDay(3) + await banner.confirmDate() expect(requestArray.length).toEqual(1) }) @@ -106,6 +107,7 @@ test.describe('API calls on changing forecast base time in UI', () => { ) await banner.clickOnDay(3) + await banner.confirmDate() expect(requestArray[0]).toContain(`base_time=${expectedForecastBaseTime}`) }) }) diff --git a/air-quality-ui/system_tests/ui/summary_page/summary_page_api_calls.spec.ts b/air-quality-ui/system_tests/ui/summary_page/summary_page_api_calls.spec.ts index 51027712..b6ba7a36 100644 --- a/air-quality-ui/system_tests/ui/summary_page/summary_page_api_calls.spec.ts +++ b/air-quality-ui/system_tests/ui/summary_page/summary_page_api_calls.spec.ts @@ -137,6 +137,7 @@ test.describe('API calls on changing forecast base time in UI', () => { banner, }) => { await banner.clickOnDay(3) + await banner.confirmDate() expect(requestArray.length).toEqual(1) }) @@ -151,6 +152,7 @@ test.describe('API calls on changing forecast base time in UI', () => { await encodeDateToURIComponent(systemDate) await banner.clickOnDay(3) + await banner.confirmDate() expect(requestArray[0]).toContain( `location_type=city&valid_time_from=${expectedValidTimeFrom}&valid_time_to=${systemDateUriEncoded}&base_time=${expectedForecastBaseTime}`, ) @@ -179,6 +181,7 @@ test.describe('API calls on changing forecast base time in UI', () => { banner, }) => { await banner.clickOnDay(3) + await banner.confirmDate() expect(requestArray.length).toEqual(41) }) @@ -229,6 +232,7 @@ test.describe('API calls on changing forecast base time in UI', () => { '2024-07-08T12%3A00%3A00.000Z', ] await banner.clickOnDay(3) + await banner.confirmDate() for (const request in requestArray) { expect(requestArray[request]).toContain( `measurement_base_time=${expectedMeasurementBaseTimeArray[request]}&measurement_time_range=90&location_type=city`,