Skip to content

Commit 986991e

Browse files
committed
test: update regression tests
1 parent d9ac73a commit 986991e

9 files changed

+162
-34
lines changed

tests/playwright-test/ui-mode-metadata.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ test('should render html report git info metadata', async ({ runUITest }) => {
4141
});
4242

4343
await page.getByTitle('Run all').click();
44-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
44+
const statusLine = page.getByTestId('status-line');
45+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
46+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
47+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
48+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
4549
await page.getByTitle('Toggle output').click();
4650

4751
await expect(page.getByTestId('output')).toContainText('ci.link: https://playwright.dev');

tests/playwright-test/ui-mode-test-annotations.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ test('should display annotations', async ({ runUITest }) => {
3232
`,
3333
});
3434
await page.getByTitle('Run all').click();
35-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
35+
const statusLine = page.getByTestId('status-line');
36+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
37+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
38+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
39+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
3640
await page.getByRole('treeitem', { name: 'suite' }).locator('.codicon-chevron-right').click();
3741
await page.getByText('annotation test').click();
3842
await page.getByText('Annotations', { exact: true }).click();

tests/playwright-test/ui-mode-test-attachments.spec.ts

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ test('should contain text attachment', async ({ runUITest }) => {
3333
});
3434
await page.getByText('attach test').click();
3535
await page.getByTitle('Run all').click();
36-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
36+
const statusLine = page.getByTestId('status-line');
37+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
38+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
39+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
40+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
3741
await page.getByText('Attachments').click();
3842

3943
await page.locator('.tab-attachments').getByText('text attachment').click();
@@ -69,7 +73,11 @@ test('should contain binary attachment', async ({ runUITest }) => {
6973
});
7074
await page.getByText('attach test').click();
7175
await page.getByTitle('Run all').click();
72-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
76+
const statusLine = page.getByTestId('status-line');
77+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
78+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
79+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
80+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
7381
await page.getByText('Attachments').click();
7482
const downloadPromise = page.waitForEvent('download');
7583
await page.getByRole('link', { name: 'download' }).click();
@@ -89,7 +97,11 @@ test('should contain string attachment', async ({ runUITest }) => {
8997
});
9098
await page.getByText('attach test').click();
9199
await page.getByTitle('Run all').click();
92-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
100+
const statusLine = page.getByTestId('status-line');
101+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
102+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
103+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
104+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
93105
await page.getByText('Attachments').click();
94106
await page.getByText('attach "note"', { exact: true }).click();
95107
const downloadPromise = page.waitForEvent('download');
@@ -116,7 +128,11 @@ test('should linkify string attachments', async ({ runUITest, server }) => {
116128
});
117129
await page.getByText('attach test').click();
118130
await page.getByTitle('Run all').click();
119-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
131+
const statusLine = page.getByTestId('status-line');
132+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
133+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
134+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
135+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
120136
await page.getByText('Attachments').click();
121137

122138
const attachmentsPane = page.locator('.attachments-tab');
@@ -162,7 +178,11 @@ test('should link from attachment step to attachments view', async ({ runUITest
162178

163179
await page.getByText('attach test').click();
164180
await page.getByTitle('Run all').click();
165-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
181+
const statusLine = page.getByTestId('status-line');
182+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
183+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
184+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
185+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
166186
await page.getByRole('tab', { name: 'Attachments' }).click();
167187

168188
const panel = page.getByRole('tabpanel', { name: 'Attachments' });

tests/playwright-test/ui-mode-test-output.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,11 @@ test('should print beforeAll console messages once', async ({ runUITest }, testI
250250
await page.getByTitle('Run all').click();
251251
await page.getByText('Console').click();
252252
await page.getByText('print').click();
253-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
253+
const statusLine = page.getByTestId('status-line');
254+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
255+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
256+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
257+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
254258
await expect(page.locator('.console-tab .console-line-message')).toHaveText([
255259
'before all log',
256260
'test log',

tests/playwright-test/ui-mode-test-run.spec.ts

Lines changed: 56 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ test('should run visible', async ({ runUITest }) => {
8181
- treeitem "[icon-circle-slash] skipped"
8282
`);
8383

84-
await expect(page.getByTestId('status-line')).toHaveText('4/8 passed (50%)');
84+
const statusLine = page.getByTestId('status-line');
85+
await expect(statusLine.getByTestId('test-count')).toHaveText('8/8');
86+
await expect(statusLine.locator('.status-passed')).toHaveText('4');
87+
await expect(statusLine.locator('.status-failed')).toHaveText('3');
88+
await expect(statusLine.locator('.status-skipped')).toHaveText('1');
8589
});
8690

8791
test('should show running progress', async ({ runUITest }) => {
@@ -96,11 +100,21 @@ test('should show running progress', async ({ runUITest }) => {
96100
});
97101

98102
await page.getByTitle('Run all').click();
99-
await expect(page.getByTestId('status-line')).toHaveText('Running 1/4 passed (25%)');
103+
const statusLine = page.getByTestId('status-line');
104+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/4');
105+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
106+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
107+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
100108
await page.getByTitle('Stop').click();
101-
await expect(page.getByTestId('status-line')).toHaveText('1/4 passed (25%)');
109+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/4');
110+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
111+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
112+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
102113
await page.getByTitle('Reload').click();
103-
await expect(page.getByTestId('status-line')).toBeHidden();
114+
await expect(statusLine.getByTestId('test-count')).toBeHidden();
115+
await expect(statusLine.locator('.status-passed')).toBeHidden();
116+
await expect(statusLine.locator('.status-failed')).toBeHidden();
117+
await expect(statusLine.locator('.status-skipped')).toBeHidden();
104118
});
105119

106120
test('should run on hover', async ({ runUITest }) => {
@@ -491,7 +505,11 @@ test('should show time', async ({ runUITest }) => {
491505
- treeitem "[icon-circle-slash] skipped"
492506
`);
493507

494-
await expect(page.getByTestId('status-line')).toHaveText('4/8 passed (50%)');
508+
const statusLine = page.getByTestId('status-line');
509+
await expect(statusLine.getByTestId('test-count')).toHaveText('8/8');
510+
await expect(statusLine.locator('.status-passed')).toHaveText('4');
511+
await expect(statusLine.locator('.status-failed')).toHaveText('3');
512+
await expect(statusLine.locator('.status-skipped')).toHaveText('1');
495513
});
496514

497515
test('should show test.fail as passing', async ({ runUITest }) => {
@@ -522,7 +540,11 @@ test('should show test.fail as passing', async ({ runUITest }) => {
522540
- treeitem ${/\[icon-check\] should fail \d+m?s/}
523541
`);
524542

525-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
543+
const statusLine = page.getByTestId('status-line');
544+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
545+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
546+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
547+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
526548
});
527549

528550
test('should ignore repeatEach', async ({ runUITest }) => {
@@ -558,7 +580,11 @@ test('should ignore repeatEach', async ({ runUITest }) => {
558580
- treeitem ${/\[icon-check\] should pass/}
559581
`);
560582

561-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
583+
const statusLine = page.getByTestId('status-line');
584+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
585+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
586+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
587+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
562588
});
563589

564590
test('should remove output folder before test run', async ({ runUITest }) => {
@@ -593,7 +619,11 @@ test('should remove output folder before test run', async ({ runUITest }) => {
593619
- treeitem ${/\[icon-check\] should pass/}
594620
`);
595621

596-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
622+
const statusLine = page.getByTestId('status-line');
623+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
624+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
625+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
626+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
597627

598628
await page.getByTitle('Run all').click();
599629
await expect.poll(dumpTestTree(page)).toBe(`
@@ -608,7 +638,10 @@ test('should remove output folder before test run', async ({ runUITest }) => {
608638
- treeitem ${/\[icon-check\] should pass/}
609639
`);
610640

611-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
641+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
642+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
643+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
644+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
612645
});
613646

614647
test('should show proper total when using deps', async ({ runUITest }) => {
@@ -660,7 +693,11 @@ test('should show proper total when using deps', async ({ runUITest }) => {
660693
- treeitem "[icon-circle-outline] run @chromium chromium"
661694
`);
662695

663-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
696+
const statusLine = page.getByTestId('status-line');
697+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
698+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
699+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
700+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
664701

665702
await page.getByTitle('run @chromium').dblclick();
666703
await expect.poll(dumpTestTree(page)).toBe(`
@@ -680,7 +717,10 @@ test('should show proper total when using deps', async ({ runUITest }) => {
680717
- button "Watch"
681718
`);
682719

683-
await expect(page.getByTestId('status-line')).toHaveText('2/2 passed (100%)');
720+
await expect(statusLine.getByTestId('test-count')).toHaveText('2/2');
721+
await expect(statusLine.locator('.status-passed')).toHaveText('2');
722+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
723+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
684724
});
685725

686726
test('should respect --tsconfig option', {
@@ -746,7 +786,11 @@ test('should respect --tsconfig option', {
746786
- treeitem ${/\[icon-check\] test/}
747787
`);
748788

749-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
789+
const statusLine = page.getByTestId('status-line');
790+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
791+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
792+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
793+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
750794
});
751795

752796
test('should respect --ignore-snapshots option', {

tests/playwright-test/ui-mode-test-screencast.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ test('should show screenshots', async ({ runUITest }) => {
3535
`,
3636
});
3737
await page.getByTitle('Run all').click();
38-
await expect(page.getByTestId('status-line')).toHaveText('2/2 passed (100%)');
38+
const statusLine = page.getByTestId('status-line');
39+
await expect(statusLine.getByTestId('test-count')).toHaveText('2/2');
40+
await expect(statusLine.locator('.status-passed')).toHaveText('2');
41+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
42+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
3943

4044
await page.getByText('test 1', { exact: true }).click();
4145
await expect(page.getByTestId('actions-tree')).toContainText('expect.toBeVisible');

tests/playwright-test/ui-mode-test-setup.spec.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ test('should run global setup and teardown', async ({ runUITest }, testInfo) =>
4747
`
4848
}, undefined, { additionalArgs: ['--output=foo'] });
4949
await page.getByTitle('Run all').click();
50-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
50+
const statusLine = page.getByTestId('status-line');
51+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
52+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
53+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
54+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
5155

5256
await page.getByTitle('Toggle output').click();
5357
const output = page.getByTestId('output');
@@ -85,7 +89,11 @@ test('should teardown on sigint', async ({ runUITest, nodeVersion }) => {
8589
`
8690
});
8791
await page.getByTitle('Run all').click();
88-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
92+
const statusLine = page.getByTestId('status-line');
93+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
94+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
95+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
96+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
8997
await page.getByTitle('Toggle output').click();
9098
await expect(page.getByTestId('output')).toContainText('from-global-setup');
9199

@@ -335,7 +343,11 @@ for (const useWeb of [true, false]) {
335343
`
336344
}, null, { useWeb });
337345
await page.getByTitle('Run all').click();
338-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
346+
const statusLine = page.getByTestId('status-line');
347+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
348+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
349+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
350+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
339351
await testProcess.kill('SIGINT');
340352
await expect.poll(() => testProcess.outputLines()).toEqual([
341353
'from-global-teardown0000',
@@ -368,7 +380,11 @@ test('should restart webserver on reload', async ({ runUITest }) => {
368380
`
369381
}, { DEBUG: 'pw:webserver' });
370382
await page.getByTitle('Run all').click();
371-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
383+
const statusLine = page.getByTestId('status-line');
384+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
385+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
386+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
387+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
372388

373389
await page.getByTitle('Toggle output').click();
374390
await expect(page.getByTestId('output')).toContainText('[WebServer] listening');
@@ -381,5 +397,8 @@ test('should restart webserver on reload', async ({ runUITest }) => {
381397
await expect(page.getByTestId('output')).not.toContainText('set reuseExistingServer:true');
382398

383399
await page.getByTitle('Run all').click();
384-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
400+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
401+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
402+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
403+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
385404
});

tests/playwright-test/ui-mode-test-shortcut.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ test('should run tests', async ({ runUITest }) => {
3737
await page.getByPlaceholder('Filter (e.g. text, @tag)').fill('test 3');
3838
await page.keyboard.press('F5');
3939

40-
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
40+
const statusLine = page.getByTestId('status-line');
41+
await expect(statusLine.getByTestId('test-count')).toHaveText('1/1');
42+
await expect(statusLine.locator('.status-passed')).toHaveText('1');
43+
await expect(statusLine.locator('.status-failed')).toHaveText('0');
44+
await expect(statusLine.locator('.status-skipped')).toHaveText('0');
4145
await page.getByPlaceholder('Filter (e.g. text, @tag)').fill('');
4246

4347
// Only the filtered test was run.

0 commit comments

Comments
 (0)