Skip to content

Commit 709eaeb

Browse files
committed
flip ordering
1 parent d29bb82 commit 709eaeb

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

packages/html-reporter/src/filter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export class Filter {
163163
for (const sortToken of this.sort) {
164164
let comparison = 0;
165165
if (sortToken.name === 'duration')
166-
comparison = a.duration - b.duration;
166+
comparison = b.duration - a.duration;
167167
if (comparison !== 0)
168168
return sortToken.not ? -comparison : comparison;
169169
}

tests/playwright-test/reporter-html.spec.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3269,6 +3269,10 @@ test('should support sorting by duration', async ({ runInlineTest, showReport, p
32693269
test('very slow test', async ({}) => {
32703270
await new Promise(resolve => setTimeout(resolve, 150));
32713271
});
3272+
test('known slow', async ({}) => {
3273+
test.slow();
3274+
await new Promise(resolve => setTimeout(resolve, 75));
3275+
});
32723276
`,
32733277
}, { reporter: 'dot,html' }, { PLAYWRIGHT_HTML_OPEN: 'never' });
32743278

@@ -3286,28 +3290,34 @@ test('should support sorting by duration', async ({ runInlineTest, showReport, p
32863290
- region:
32873291
- link "very fast test"
32883292
- link "very slow test"
3293+
- link "known slow"
32893294
`);
32903295

32913296
await searchInput.fill('o:duration');
32923297
await expect(page.getByRole('main')).toMatchAriaSnapshot(`
32933298
- button [expanded]
32943299
- region:
3295-
- link "very fast test"
3296-
- link "fast test"
3297-
- link "medium test"
3298-
- link "slow test"
32993300
- link "very slow test"
3301+
- link "slow test"
3302+
- link "known slow"
3303+
- link "medium test"
3304+
- link "fast test"
3305+
- link "very fast test"
33003306
`);
33013307

3308+
await searchInput.fill('o:duration !@slow');
3309+
await expect(page.getByRole('link', { name: 'known slow' })).not.toBeVisible();
3310+
33023311
await searchInput.fill('!o:duration');
33033312
await expect(page.getByRole('main')).toMatchAriaSnapshot(`
33043313
- button [expanded]
33053314
- region:
3306-
- link "very slow test"
3307-
- link "slow test"
3308-
- link "medium test"
3309-
- link "fast test"
33103315
- link "very fast test"
3316+
- link "fast test"
3317+
- link "medium test"
3318+
- link "known slow"
3319+
- link "slow test"
3320+
- link "very slow test"
33113321
`);
33123322

33133323
await searchInput.clear();
@@ -3321,6 +3331,7 @@ test('should support sorting by duration', async ({ runInlineTest, showReport, p
33213331
- region:
33223332
- link "very fast test"
33233333
- link "very slow test"
3334+
- link "known slow"
33243335
`);
33253336
});
33263337

0 commit comments

Comments
 (0)