Skip to content

Commit

Permalink
Test/187 make logo (#205)
Browse files Browse the repository at this point in the history
* adding banner page and logo test

* restructure test files
  • Loading branch information
mwalker-scottlogic authored Jul 12, 2024
1 parent 36c9708 commit d75e8fe
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 10 deletions.
11 changes: 11 additions & 0 deletions air-quality-ui/system_tests/pages/banner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Locator, type Page } from '@playwright/test'

export class Banner {
readonly page: Page
readonly logo: Locator

constructor(page: Page) {
this.page = page
this.logo = page.getByAltText('vAirify')
}
}
8 changes: 0 additions & 8 deletions air-quality-ui/system_tests/ui/aqi_snapshot.spec.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import { expect, test } from '../utils/fixtures'

test('vAirify logo is visible', async ({ vairifyCityPage, banner }) => {
await vairifyCityPage.gotoRioCityPage()
await expect(banner.logo).toBeVisible()
})

test('AQI snapshot assertion', async ({ vairifyCityPage }) => {
await vairifyCityPage.setupCityPageGraph()
await expect(vairifyCityPage.textFinder('Rio de Janeiro')).toBeVisible()
const chartShot = await vairifyCityPage.captureChartScreenshot()
expect(chartShot).toMatchSnapshot('rio-aqi-graph.png')
})

test('Mocked response breadcrumb', async ({
vairifySummaryPage,
vairifyCityPage,
Expand Down
3 changes: 3 additions & 0 deletions air-quality-ui/system_tests/ui/summary_page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { expect, test } from '../utils/fixtures'
test.beforeEach(async ({ vairifySummaryPage }) => {
await vairifySummaryPage.setupPage()
})
test('vAirify logo is visible', async ({ banner }) => {
await expect(banner.logo).toBeVisible()
})

test('Verify page title is vAirify', async ({ vairifySummaryPage }) => {
const title = await vairifySummaryPage.getTitle()
Expand Down
9 changes: 7 additions & 2 deletions air-quality-ui/system_tests/utils/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ import { test as base } from '@playwright/test'

import { apiForecastAqi } from './graph_aqi_mock'
import { apiForecast, apiSummary } from './mocked_api'
import { VairifyCityPage } from '../pages/vAirify_city_page'
import { VairifySummaryPage } from '../pages/vAirify_summary_page'
import { Banner } from '../pages/banner'
import { VairifyCityPage } from '../pages/city_page'
import { VairifySummaryPage } from '../pages/summary_page'

type Fixtures = {
banner: Banner
vairifySummaryPage: VairifySummaryPage
vairifyCityPage: VairifyCityPage
}
const test = base.extend<Fixtures>({
banner: async ({ page }, use) => {
await use(new Banner(page))
},
vairifySummaryPage: async ({ page }, use) => {
await use(new VairifySummaryPage(page, apiForecast, apiSummary))
},
Expand Down

0 comments on commit d75e8fe

Please sign in to comment.