Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cdd 2285 - Addition of About Tab and dropdown functionality on mobile #588

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1761f36
CDD-2285: add in an about tab and move description into field
luketowell Jan 28, 2025
c88d9a6
CDD-2285: Updated the tests to handle the new about tab
luketowell Jan 28, 2025
e49e9d8
Merge branch 'main' into feature/CDD-2285
luketowell Jan 29, 2025
29b2ddc
feature/CDD-2285: created a new dropdown tab component
luketowell Jan 30, 2025
6ce1867
feature/CDD-2285: Added tests to test the functionality of the dropdo…
luketowell Feb 4, 2025
9472cbb
Merge branch 'main' into feature/CDD-2285
luketowell Feb 4, 2025
9b968e7
feature/CDD-2285: updated after reviewing sonar suggestions
luketowell Feb 4, 2025
baa7262
feature/CDD-2285: Updated the e2e tests for playwright
luketowell Feb 4, 2025
301f401
feature/CDD-2285: Updated the e2e tests for playwright
luketowell Feb 4, 2025
987dc7d
feature/CDD-2285: updated the desktop tests to use desktop functionality
luketowell Feb 5, 2025
22001e1
feature/CDD-2285: updated the desktop tests to use desktop and tablet…
luketowell Feb 5, 2025
74ca0f7
feature/CDD-2285: added mobile specific tests for the download functi…
luketowell Feb 5, 2025
dddf8ce
feature/CDD-2285: updated tests and removed the dropdownTab testId
luketowell Feb 10, 2025
2f5fa84
feature/CDD-2285: updated tests and removed the dropdownTab testId
luketowell Feb 10, 2025
05a5f37
Merge branch 'main' into feature/CDD-2285
luketowell Feb 10, 2025
5b15427
feature/CDD-2285: Updated the dropdownTab css to align text
luketowell Feb 11, 2025
89b9293
feature/CDD-2285: handle selected view by state management
luketowell Feb 12, 2025
f093fa7
feature/CDD-2285: Updated the functionality to manage state through a…
luketowell Feb 12, 2025
a80fd60
feature/CDD-2285: Updated the test functionality
luketowell Feb 12, 2025
c088e90
feature/CDD-2285: Updated the chart title and the aria-label for the …
luketowell Feb 13, 2025
1fbbb99
feature/CDD-2285: Updated the id of dropdown tab and removed the drop…
luketowell Feb 13, 2025
7c9eb32
feature/CDD-2285: Moved the onChangeFunction inline
luketowell Feb 13, 2025
59060ed
feature/CDD-2285: fix responsive chart issue
luketowell Feb 13, 2025
5ee1225
feature/CDD-2285: fix e2e test with updated name
luketowell Feb 13, 2025
1d535d8
feature/CDD-2285: Updated hard coded strings to be fetched from il8n …
luketowell Feb 14, 2025
af697d7
feature/CDD-2285: repair functionality so that space bar also updates…
luketowell Feb 14, 2025
a508099
feature/CDD-2285: resolved issue with the selection of tabs using spa…
luketowell Feb 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions e2e/fixtures/app.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,8 @@ export class App {
}
}

async hasTopicCard({ name, description }: { name: string; description: string }) {
async hasTopicCard({ name }: { name: string }) {
const card = this.page.getByRole('article', { name, exact: true })
await expect(card.getByRole('paragraph')).toContainText(description)
await expect(card.getByAltText(`Mocked alt text - Refer to tabular data.`)).toBeVisible()
}

Expand Down Expand Up @@ -368,11 +367,15 @@ export class App {

// Chart downloads

async canDownloadChart(cards: string[], format: 'csv' | 'json') {
async canDownloadChart(cards: string[], format: 'csv' | 'json', device: 'desktop' | 'mobile' | 'tablet') {
for (const name of cards) {
const card = this.page.getByTestId(`chart-row-card-${name}`)

await card.getByRole('tab', { name: 'Download' }).click()
if (device === 'mobile') {
await card.getByTestId('DropdownSelect').selectOption('Download')
} else {
await card.getByRole('tab', { name: 'Download' }).click()
}

await card.getByLabel(format.toUpperCase()).click()

Expand Down
253 changes: 172 additions & 81 deletions e2e/tests/topics/respiratory-viruses/covid-19.e2e.ts

Large diffs are not rendered by default.

172 changes: 123 additions & 49 deletions e2e/tests/topics/respiratory-viruses/influenza.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,24 @@ test.describe('Influenza page', () => {
await test.step('displays chart cards for "Healthcare"', async () => {
await app.hasTopicCard({
name: 'Line chart with overlaying line comparing hospital admission rates of patients admitted to hospital with Influenza',
description:
'Weekly admissions rates of patients admitted to hospital with Influenza as a weekly time series, shown as the rate per 100,000 people.',
})
await app.hasTopicCard({
name: 'Line chart comparing Influenza hospital admission rates by age',
description: 'Age breakdown of people admitted to hospital, shown as the rate per 100,000 people.',
})
await app.hasTopicCard({
name: 'Line chart with overlaying line comparing ICU admission rates of patients admitted to hospital with Influenza',
description:
'Weekly admissions rates of patients admitted to ICU with Influenza as a weekly time series, shown as the rate per 100,000 people.',
})
await app.hasTopicCard({
name: 'Line chart comparing Influenza ICU admission rates by age',
description: 'Age breakdown of people admitted to ICU, shown as the rate per 100,000 people.',
})
})
await test.step('displays chart cards for "Testing"', async () => {
7
await app.hasTopicCard({
name: 'Bar chart with overlaying line comparing positivity for Influenza tests',
description:
'Weekly admissions rates of patients admitted to hospital with Influenza as a weekly time series, shown as the rate per 100,000 people.',
})
await app.hasTopicCard({
name: 'Line chart comparing weekly positivity for Influenza tests by age',
description: 'Weekly time series of positivity for people testing positive for Influenza broken down by age.',
})
})

Expand All @@ -73,44 +64,6 @@ test.describe('Influenza page', () => {
})
})

test('downloads a csv version of each chart', async ({ influenzaPage, app }) => {
await test.step('loads the page', async () => {
await influenzaPage.goto()
})
await test.step('downloads charts', async () => {
await app.canDownloadChart(
[
'line-chart-with-overlaying-line-comparing-hospital-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-hospital-admission-rates-by-age',
'line-chart-with-overlaying-line-comparing-icu-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-icu-admission-rates-by-age',
'bar-chart-with-overlaying-line-comparing-positivity-for-influenza-tests',
'line-chart-comparing-weekly-positivity-for-influenza-tests-by-age',
],
'csv'
)
})
})

test('downloads a json version of each chart', async ({ influenzaPage, app }) => {
await test.step('loads the page', async () => {
await influenzaPage.goto()
})
await test.step('downloads charts', async () => {
await app.canDownloadChart(
[
'line-chart-with-overlaying-line-comparing-hospital-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-hospital-admission-rates-by-age',
'line-chart-with-overlaying-line-comparing-icu-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-icu-admission-rates-by-age',
'bar-chart-with-overlaying-line-comparing-positivity-for-influenza-tests',
'line-chart-comparing-weekly-positivity-for-influenza-tests-by-age',
],
'json'
)
})
})

test('Area selection already chosen upon visiting the page', async ({ influenzaPage, app }) => {
await test.step('loads the page', async () => {
await app.goto('/topics/influenza?areaType=Lower+Tier+Local+Authority&areaName=Southampton')
Expand Down Expand Up @@ -218,6 +171,45 @@ test.describe('Influenza page - mobile @mobileOnly', () => {
await influenzaPage.goto()
await app.hasNav()
})
test('downloads a json version of each chart', async ({ influenzaPage, app }) => {
await test.step('loads the page', async () => {
await influenzaPage.goto()
})
await test.step('downloads charts', async () => {
await app.canDownloadChart(
[
'line-chart-with-overlaying-line-comparing-hospital-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-hospital-admission-rates-by-age',
'line-chart-with-overlaying-line-comparing-icu-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-icu-admission-rates-by-age',
'bar-chart-with-overlaying-line-comparing-positivity-for-influenza-tests',
'line-chart-comparing-weekly-positivity-for-influenza-tests-by-age',
],
'json',
'mobile'
)
})
})

test('downloads a csv version of each chart', async ({ influenzaPage, app }) => {
await test.step('loads the page', async () => {
await influenzaPage.goto()
})
await test.step('downloads charts', async () => {
await app.canDownloadChart(
[
'line-chart-with-overlaying-line-comparing-hospital-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-hospital-admission-rates-by-age',
'line-chart-with-overlaying-line-comparing-icu-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-icu-admission-rates-by-age',
'bar-chart-with-overlaying-line-comparing-positivity-for-influenza-tests',
'line-chart-comparing-weekly-positivity-for-influenza-tests-by-age',
],
'csv',
'mobile'
)
})
})
})

test.describe('Influenza page - tablet @tabletOnly', () => {
Expand All @@ -227,6 +219,46 @@ test.describe('Influenza page - tablet @tabletOnly', () => {
await influenzaPage.goto()
await app.hasNav()
})

test('downloads a json version of each chart', async ({ influenzaPage, app }) => {
await test.step('loads the page', async () => {
await influenzaPage.goto()
})
await test.step('downloads charts', async () => {
await app.canDownloadChart(
[
'line-chart-with-overlaying-line-comparing-hospital-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-hospital-admission-rates-by-age',
'line-chart-with-overlaying-line-comparing-icu-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-icu-admission-rates-by-age',
'bar-chart-with-overlaying-line-comparing-positivity-for-influenza-tests',
'line-chart-comparing-weekly-positivity-for-influenza-tests-by-age',
],
'json',
'tablet'
)
})
})

test('downloads a csv version of each chart', async ({ influenzaPage, app }) => {
await test.step('loads the page', async () => {
await influenzaPage.goto()
})
await test.step('downloads charts', async () => {
await app.canDownloadChart(
[
'line-chart-with-overlaying-line-comparing-hospital-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-hospital-admission-rates-by-age',
'line-chart-with-overlaying-line-comparing-icu-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-icu-admission-rates-by-age',
'bar-chart-with-overlaying-line-comparing-positivity-for-influenza-tests',
'line-chart-comparing-weekly-positivity-for-influenza-tests-by-age',
],
'csv',
'tablet'
)
})
})
})

test.describe('Influenza page - desktop @desktopOnly', () => {
Expand All @@ -236,6 +268,46 @@ test.describe('Influenza page - desktop @desktopOnly', () => {
await influenzaPage.goto()
await app.hasNav()
})

test('downloads a json version of each chart', async ({ influenzaPage, app }) => {
await test.step('loads the page', async () => {
await influenzaPage.goto()
})
await test.step('downloads charts', async () => {
await app.canDownloadChart(
[
'line-chart-with-overlaying-line-comparing-hospital-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-hospital-admission-rates-by-age',
'line-chart-with-overlaying-line-comparing-icu-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-icu-admission-rates-by-age',
'bar-chart-with-overlaying-line-comparing-positivity-for-influenza-tests',
'line-chart-comparing-weekly-positivity-for-influenza-tests-by-age',
],
'json',
'desktop'
)
})
})

test('downloads a csv version of each chart', async ({ influenzaPage, app }) => {
await test.step('loads the page', async () => {
await influenzaPage.goto()
})
await test.step('downloads charts', async () => {
await app.canDownloadChart(
[
'line-chart-with-overlaying-line-comparing-hospital-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-hospital-admission-rates-by-age',
'line-chart-with-overlaying-line-comparing-icu-admission-rates-of-patients-admitted-to-hospital-with-influenza',
'line-chart-comparing-influenza-icu-admission-rates-by-age',
'bar-chart-with-overlaying-line-comparing-positivity-for-influenza-tests',
'line-chart-comparing-weekly-positivity-for-influenza-tests-by-age',
],
'csv',
'desktop'
)
})
})
})

test.describe('Influenza page - no JS', () => {
Expand All @@ -255,7 +327,8 @@ test.describe('Influenza page - no JS', () => {
'bar-chart-with-overlaying-line-comparing-positivity-for-influenza-tests',
'line-chart-comparing-weekly-positivity-for-influenza-tests-by-age',
],
'csv'
'csv',
'desktop'
)
})
})
Expand All @@ -274,7 +347,8 @@ test.describe('Influenza page - no JS', () => {
'bar-chart-with-overlaying-line-comparing-positivity-for-influenza-tests',
'line-chart-comparing-weekly-positivity-for-influenza-tests-by-age',
],
'json'
'json',
'desktop'
)
})
})
Expand Down
Loading
Loading