Skip to content

Commit e4fe0dd

Browse files
committed
chore: Resolving upstream conflicts;
Merge remote-tracking branch 'origin/main' into rogeruiz/1277/section-table-improvements
2 parents 27bcbba + dc38ce5 commit e4fe0dd

73 files changed

Lines changed: 1949 additions & 999 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

client/e2e/activity-log.spec.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ test.describe('Activity log', () => {
1010
await deleteAllConfigurations();
1111
});
1212

13-
test('Check empty state', async ({ activityLogPage, page }) => {
13+
test('Check empty state', async ({
14+
activityLogPage,
15+
page,
16+
makeAxeBuilder,
17+
}) => {
1418
await activityLogPage.goto();
1519

1620
await expect(page.getByLabel('Condition').getByRole('option')).toHaveText([
@@ -22,12 +26,14 @@ test.describe('Activity log', () => {
2226
await expect(
2327
page.getByRole('navigation', { name: 'Pagination' }).getByRole('button')
2428
).toHaveCount(1);
29+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
2530
});
2631

2732
test('Check that condition filters are sorted alphabetically by name', async ({
2833
activityLogPage,
2934
api,
3035
page,
36+
makeAxeBuilder,
3137
}) => {
3238
const conditionOne = 'Coal Workers’ Pneumoconiosis (CWP)';
3339
const conditionTwo = 'COVID-19';
@@ -43,11 +49,13 @@ test.describe('Activity log', () => {
4349
conditionTwo,
4450
conditionThree,
4551
]);
52+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
4653
});
4754

4855
test('Check entries from configuration creation', async ({
4956
activityLogPage,
5057
api,
58+
makeAxeBuilder,
5159
}) => {
5260
const conditionOne = 'COVID-19';
5361
const conditionTwo = 'Zika Virus Disease';
@@ -70,22 +78,26 @@ test.describe('Activity log', () => {
7078
await activityLogPage.selectConditionFromDropdown(conditionOne);
7179
const conditionOneOnlyRows = await activityLogPage.getTableRows();
7280
expect(conditionOneOnlyRows).toHaveLength(1);
81+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
7382
});
7483

7584
test('Check individual custom code entries from CSV upload', async ({
7685
page,
7786
api,
7887
activityLogPage,
88+
makeAxeBuilder,
7989
}) => {
8090
const condition = 'Lead in Blood';
8191
const config = await api.createConfiguration(condition);
8292

8393
// Create 50 codes to upload
84-
const systems = ['LOINC', 'ICD-10', 'SNOMED', 'RxNorm', 'CVX'];
94+
const systems = ['loinc', 'icd10', 'snomed', 'rxnorm', 'cvx', 'other'];
95+
const systemNames = ['LOINC', 'ICD-10', 'SNOMED', 'RxNorm', 'CVX', 'Other'];
8596
const customCodes = Array.from({ length: 50 }, (_, i) => ({
8697
code: `mc-${i + 1}`,
8798
name: `mock code ${i + 1}`,
88-
system: systems[i % systems.length],
99+
system_key: systems[i % systems.length],
100+
system_display_name: systemNames[i % systems.length],
89101
}));
90102

91103
await api.uploadCustomCodeCsv(config.id, customCodes);
@@ -97,6 +109,7 @@ test.describe('Activity log', () => {
97109
expect(expectedRow?.action).toContain(expectedAction);
98110

99111
const modalButton = page.getByRole('button', { name: 'View all' });
112+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
100113
await expect(modalButton).toBeVisible();
101114
await expect(modalButton).toBeEnabled();
102115
await modalButton.click();
@@ -124,5 +137,6 @@ test.describe('Activity log', () => {
124137
await expect(
125138
page.getByRole('heading', { name: 'Activity log' })
126139
).toBeVisible();
140+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
127141
});
128142
});

client/e2e/configuration.spec.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ test.describe('Configuration detail flow', () => {
1010
await deleteAllConfigurations();
1111
});
1212

13+
test('Validate code set table appearance', async ({
14+
page,
15+
configurationsPage,
16+
configurationPage,
17+
}) => {
18+
const condition = 'Anotia';
19+
await configurationsPage.createConfiguration(condition);
20+
await configurationPage.goToBuildTab();
21+
await page.getByLabel('View TES code set information for Anotia').click();
22+
23+
await expect(page.getByRole('columnheader')).toHaveText([
24+
'Code',
25+
'Code system',
26+
'Display name',
27+
]);
28+
});
29+
1330
test('Check code set status and individual grouper statuses', async ({
1431
page,
1532
configurationsPage,
@@ -272,6 +289,9 @@ test.describe('Configuration detail flow', () => {
272289
await test.step('Configure standard sections', async () => {
273290
await test.step('Select and check options', async () => {
274291
await page.getByRole('button', { name: 'Sections' }).click();
292+
293+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
294+
275295
const admissionDiagnosisCheckboxText = 'Include Admission Diagnosis';
276296
await page
277297
.getByRole('checkbox', { name: admissionDiagnosisCheckboxText })
@@ -353,6 +373,8 @@ test.describe('Configuration detail flow', () => {
353373
await configurationPage.goToBuildTab();
354374
await configurationPage.deleteCodeSet(additionalCodeSetName);
355375

376+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
377+
356378
await page.getByRole('button', { name: 'Custom codes' }).click();
357379
await configurationPage.deleteCustomCode(customCodeName);
358380
await expect(page.getByText('Deleted code')).toBeVisible();
@@ -363,6 +385,9 @@ test.describe('Configuration detail flow', () => {
363385

364386
await test.step('Delete custom section', async () => {
365387
await page.getByRole('button', { name: 'Sections' }).click();
388+
389+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
390+
366391
await page
367392
.getByRole('button', {
368393
name: `Delete custom section ${customSectionName}`,
@@ -402,7 +427,11 @@ test.describe('Configuration detail flow', () => {
402427

403428
await test.step('Upload custom code CSV', async () => {
404429
await page.getByRole('button', { name: 'Custom codes' }).click();
430+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
431+
405432
await page.getByRole('button', { name: 'Import from CSV' }).click();
433+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
434+
406435
await expect(
407436
page.getByRole('heading', {
408437
name: 'Import from CSV',
@@ -419,6 +448,9 @@ test.describe('Configuration detail flow', () => {
419448
const deleteAllButton = page.getByRole('button', {
420449
name: 'Undo & delete codes',
421450
});
451+
452+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
453+
422454
await expect(saveAllButton).toBeVisible();
423455
await expect(deleteAllButton).toBeVisible();
424456

@@ -438,6 +470,8 @@ test.describe('Configuration detail flow', () => {
438470
await expect(deleteButton).toBeVisible();
439471

440472
await editButton.click();
473+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
474+
441475
await expect(
442476
page.getByRole('heading', { name: 'Edit 12345', level: 2 })
443477
).toBeVisible();
@@ -472,6 +506,8 @@ test.describe('Configuration detail flow', () => {
472506
level: 2,
473507
})
474508
).toBeVisible();
509+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
510+
475511
await page.getByRole('button', { name: 'Yes, save codes' }).click();
476512

477513
const savedCodeTableRows = page.locator('table tbody tr');
@@ -483,6 +519,8 @@ test.describe('Configuration detail flow', () => {
483519

484520
await test.step('Activate modified draft', async () => {
485521
await configurationPage.goToActivateTab();
522+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
523+
486524
await expect(page.getByText('Switch to version 2')).toBeVisible();
487525
await expect(page.getByText('Turn off configuration')).toBeVisible();
488526

client/e2e/configurations.spec.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test.describe('Configurations screen', () => {
99

1010
test.afterEach(async () => await deleteAllConfigurations());
1111

12-
test('Check empty page state', async ({ page }) => {
12+
test('Check empty page state', async ({ page, makeAxeBuilder }) => {
1313
await expect(
1414
page.getByRole('heading', {
1515
name: 'Configurations',
@@ -25,12 +25,14 @@ test.describe('Configurations screen', () => {
2525
await expect(page.getByRole('cell')).toHaveText(
2626
'No configurations available'
2727
);
28+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
2829
});
2930

3031
test('Check table with configurations', async ({
3132
page,
3233
api,
3334
configurationsPage,
35+
makeAxeBuilder,
3436
}) => {
3537
const config = await api.createConfiguration('Anotia');
3638

@@ -46,20 +48,27 @@ test.describe('Configurations screen', () => {
4648
await configurationsPage.search('ano');
4749
await expect(conditionCell).toHaveText(config.name);
4850

51+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
52+
4953
await configurationsPage.search('covid');
5054
await expect(conditionCell).toHaveText('No configurations available');
5155

56+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
57+
5258
await configurationsPage.clearSearch();
5359

5460
await conditionCell.click();
5561
await expect(
5662
page.getByRole('heading', { name: config.name, level: 1 })
5763
).toBeVisible();
64+
65+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
5866
});
5967

6068
test('Navigates to the active config when one exists', async ({
6169
api,
6270
page,
71+
makeAxeBuilder,
6372
}) => {
6473
// create and activate config
6574
const condition = 'Anotia';
@@ -75,11 +84,14 @@ test.describe('Configurations screen', () => {
7584

7685
await expect(page.getByText('Viewing: Version 1')).toBeVisible();
7786
await expect(page.getByRole('link', { name: 'Go to draft' })).toBeVisible();
87+
88+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
7889
});
7990

8091
test('Navigates to the draft config when only a draft and inactive configs exist', async ({
8192
api,
8293
page,
94+
makeAxeBuilder,
8395
}) => {
8496
// create and activate config
8597
const condition = 'Anotia';
@@ -96,11 +108,14 @@ test.describe('Configurations screen', () => {
96108
await page.getByText(condition).click();
97109

98110
await expect(page.getByText('Editing: Version 2')).toBeVisible();
111+
112+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
99113
});
100114

101115
test('Navigates to the latest inactive config when only inactive configs exist', async ({
102116
api,
103117
page,
118+
makeAxeBuilder,
104119
}) => {
105120
// create and activate config
106121
const condition = 'Anotia';
@@ -117,5 +132,7 @@ test.describe('Configurations screen', () => {
117132
await page.getByText(condition).click();
118133

119134
await expect(page.getByText('Viewing: Version 2')).toBeVisible();
135+
136+
await expect(makeAxeBuilder).toHaveNoAxeViolations();
120137
});
121138
});

client/e2e/fixtures/api.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ type Condition = {
1010
display_name: string;
1111
};
1212

13-
type CustomCode = { code: string; system: string; name: string };
13+
type CustomCode = {
14+
code: string;
15+
system_key: string;
16+
system_display_name: string;
17+
name: string;
18+
};
1419

1520
export class Api {
1621
constructor(private request: APIRequestContext) {}

client/e2e/fixtures/index.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ type Fixtures = {
2323
const extendedTest = baseTest.extend<Fixtures>({
2424
makeAxeBuilder: async ({ page }, use) => {
2525
const makeAxeBuilder = () =>
26-
new AxeBuilder({ page }).withTags(['wcag21aa']);
26+
new AxeBuilder({ page })
27+
.withTags(['wcag2a', 'wcag21aa'])
28+
.exclude('#refinement-diff'); // react-diff-viewer has known a11y issues we can't fix ourselves
2729
await use(makeAxeBuilder);
2830
},
2931
api: async ({ request }, use) => {
@@ -47,17 +49,16 @@ const extendedExpect = baseExpect.extend({
4749
async toHaveNoAxeViolations(makeAxeBuilder: () => AxeBuilder) {
4850
const assertionName = 'toHaveNoAxeViolations';
4951
const axe = makeAxeBuilder();
50-
let pass: boolean;
52+
let pass = false;
5153
// eslint-disable-next-line @typescript-eslint/no-explicit-any
52-
let results: any;
54+
let violations: any[] = [];
5355
try {
54-
results = await axe.analyze();
56+
const results = await axe.analyze();
57+
violations = results.violations ?? [];
58+
pass = violations.length === 0;
5559
} catch {
5660
pass = false;
5761
}
58-
const violations = results.violations ?? [];
59-
60-
pass = violations.length === 0;
6162

6263
const message = pass
6364
? () =>

client/e2e/pages/ConfigurationPage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export class ConfigurationPage {
5050
await this.page
5151
.getByRole('listitem')
5252
.filter({ hasText: conditionName })
53-
.click();
53+
.hover();
54+
await this.page.getByLabel(`Add ${conditionName}`).click();
5455
await this.page.getByRole('button', { name: 'Close drawer' }).click();
5556
}
5657

0 commit comments

Comments
 (0)