diff --git a/packages/html-reporter/src/filter.ts b/packages/html-reporter/src/filter.ts
index 97cf675936..f8c61ba902 100644
--- a/packages/html-reporter/src/filter.ts
+++ b/packages/html-reporter/src/filter.ts
@@ -98,27 +98,7 @@ export class Filter {
}
matches(test: TestCaseSummary): boolean {
- if (!(test as any).searchValues) {
- let status = 'passed';
- if (test.outcome === 'unexpected')
- status = 'failed';
- if (test.outcome === 'flaky')
- status = 'flaky';
- if (test.outcome === 'skipped')
- status = 'skipped';
- const searchValues: SearchValues = {
- text: (status + ' ' + test.projectName + ' ' + test.tags.join(' ') + ' ' + test.location.file + ' ' + test.path.join(' ') + ' ' + test.title).toLowerCase(),
- project: test.projectName.toLowerCase(),
- status: status as any,
- file: test.location.file,
- line: String(test.location.line),
- column: String(test.location.column),
- labels: test.tags.map(tag => tag.toLowerCase()),
- };
- (test as any).searchValues = searchValues;
- }
-
- const searchValues = (test as any).searchValues as SearchValues;
+ const searchValues = cacheSearchValues(test);
if (this.project.length) {
const matches = !!this.project.find(p => searchValues.project.includes(p));
if (!matches)
@@ -128,6 +108,9 @@ export class Filter {
const matches = !!this.status.find(s => searchValues.status.includes(s));
if (!matches)
return false;
+ } else {
+ if (searchValues.status === 'skipped')
+ return false;
}
if (this.text.length) {
for (const text of this.text) {
@@ -159,3 +142,29 @@ type SearchValues = {
labels: string[];
};
+const searchValuesSymbol = Symbol('searchValues');
+
+function cacheSearchValues(test: TestCaseSummary): SearchValues {
+ const cached = (test as any)[searchValuesSymbol] as SearchValues | undefined;
+ if (cached)
+ return cached;
+
+ let status: SearchValues['status'] = 'passed';
+ if (test.outcome === 'unexpected')
+ status = 'failed';
+ if (test.outcome === 'flaky')
+ status = 'flaky';
+ if (test.outcome === 'skipped')
+ status = 'skipped';
+ const searchValues: SearchValues = {
+ text: (status + ' ' + test.projectName + ' ' + test.tags.join(' ') + ' ' + test.location.file + ' ' + test.path.join(' ') + ' ' + test.title).toLowerCase(),
+ project: test.projectName.toLowerCase(),
+ status,
+ file: test.location.file,
+ line: String(test.location.line),
+ column: String(test.location.column),
+ labels: test.tags.map(tag => tag.toLowerCase()),
+ };
+ (test as any)[searchValuesSymbol] = searchValues;
+ return searchValues;
+}
diff --git a/packages/html-reporter/src/headerView.spec.tsx b/packages/html-reporter/src/headerView.spec.tsx
index a0b27e6943..64ed858475 100644
--- a/packages/html-reporter/src/headerView.spec.tsx
+++ b/packages/html-reporter/src/headerView.spec.tsx
@@ -28,7 +28,7 @@ test('should render counters', async ({ mount }) => {
skipped: 10,
ok: false,
}} filterText='' setFilterText={() => {}}>);
- await expect(component.locator('a', { hasText: 'All' }).locator('.counter')).toHaveText('100');
+ await expect(component.locator('a', { hasText: 'All' }).locator('.counter')).toHaveText('90');
await expect(component.locator('a', { hasText: 'Passed' }).locator('.counter')).toHaveText('42');
await expect(component.locator('a', { hasText: 'Failed' }).locator('.counter')).toHaveText('31');
await expect(component.locator('a', { hasText: 'Flaky' }).locator('.counter')).toHaveText('17');
diff --git a/packages/html-reporter/src/headerView.tsx b/packages/html-reporter/src/headerView.tsx
index 04513eb7dc..1dc5420eec 100644
--- a/packages/html-reporter/src/headerView.tsx
+++ b/packages/html-reporter/src/headerView.tsx
@@ -66,7 +66,7 @@ const StatsNavView: React.FC<{
}> = ({ stats }) => {
return