Skip to content

Commit 4309f5f

Browse files
Feat/html reporter filter improvements (#38514)
1 parent 771d6af commit 4309f5f

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

packages/html-reporter/src/headerView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const GlobalFilterView: React.FC<{
7878
}>
7979
{icons.search()}
8080
{/* Use navigationId to reset defaultValue */}
81-
<input name='q' spellCheck={false} className='form-control subnav-search-input input-contrast width-full' value={filterText} onChange={e => {
81+
<input name='q' spellCheck={false} className='form-control subnav-search-input input-contrast width-full' aria-label='Search tests' placeholder='Search tests' value={filterText} onChange={e => {
8282
setFilterText(e.target.value);
8383
}}></input>
8484
</form>

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
17591759

17601760
await showReport();
17611761

1762-
const searchInput = page.locator('.subnav-search-input');
1762+
const searchInput = page.getByLabel('Search tests');
17631763

17641764
await expect(page.locator('.test-file-test .label')).toHaveCount(6);
17651765
await expect(page.locator('.test-file-test', { has: page.getByText('chromium', { exact: true }) }).locator('.label')).toHaveText(['chromium', 'flaky']);
@@ -1839,7 +1839,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
18391839

18401840
await showReport();
18411841

1842-
const searchInput = page.locator('.subnav-search-input');
1842+
const searchInput = page.getByPlaceholder('Search tests');
18431843
const smokeLabelButton = page.locator('.test-file-test', { has: page.getByText('Error Pages › @smoke fails', { exact: true }) }).locator('.label', { hasText: 'smoke' });
18441844

18451845
await expect(smokeLabelButton).toBeVisible();
@@ -1916,7 +1916,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
19161916

19171917
await showReport();
19181918
const tags = ['smoke-p1', 'issue[123]', 'issue#123', '$$$', 'tl/dr'];
1919-
const searchInput = page.locator('.subnav-search-input');
1919+
const searchInput = page.getByLabel('Search tests');
19201920

19211921
for (const tag of tags) {
19221922
const tagButton = page.locator('.label').getByText(tag, { exact: true });
@@ -1959,7 +1959,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
19591959

19601960
await showReport();
19611961
const tags = ['smoke-p1 with other text', 'issue[123] issue[456]', 'issue#123 issue#456', '$$$ ???', 'tl/dr didn\'t read'];
1962-
const searchInput = page.locator('.subnav-search-input');
1962+
const searchInput = page.getByPlaceholder('Search tests');
19631963

19641964
for (const tag of tags) {
19651965
const tagButton = page.locator('.label').getByText(tag, { exact: true });
@@ -2003,7 +2003,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
20032003

20042004
await showReport();
20052005

2006-
const searchInput = page.locator('.subnav-search-input');
2006+
const searchInput = page.getByLabel('Search tests');
20072007

20082008
const smokeLabelButton = page.locator('.test-file-test', { has: page.getByText('@smoke fails', { exact: true }) }).locator('.label', { hasText: 'smoke' });
20092009
await smokeLabelButton.click();
@@ -2070,7 +2070,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
20702070
return total;
20712071
}
20722072

2073-
const searchInput = page.locator('.subnav-search-input');
2073+
const searchInput = page.getByPlaceholder('Search tests');
20742074
await expect(page.getByTestId('filtered-tests-count')).not.toBeVisible();
20752075
await expect(page.getByTestId('overall-duration')).toHaveText(`Total time: ${msToString(result.report.stats.duration)}`);
20762076

@@ -2132,7 +2132,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
21322132

21332133
await showReport();
21342134

2135-
const searchInput = page.locator('.subnav-search-input');
2135+
const searchInput = page.getByLabel('Search tests');
21362136
const passedNavMenu = page.locator('.subnav-item:has-text("Passed")');
21372137
const failedNavMenu = page.locator('.subnav-item:has-text("Failed")');
21382138
const allNavMenu = page.locator('.subnav-item:has-text("All")');
@@ -2198,7 +2198,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
21982198

21992199
await showReport();
22002200

2201-
const searchInput = page.locator('.subnav-search-input');
2201+
const searchInput = page.getByPlaceholder('Search tests');
22022202

22032203
await searchInput.fill('@smoke');
22042204
await searchInput.press('Enter');
@@ -2267,7 +2267,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
22672267
await expect(page.locator('.test-file-test .test-file-title', { hasText: '@company_information fails' })).toHaveCount(1);
22682268
await expect(page.locator('.test-file-test .test-file-title', { hasText: '@company_information_widget fails' })).toHaveCount(1);
22692269

2270-
const searchInput = page.locator('.subnav-search-input');
2270+
const searchInput = page.getByLabel('Search tests');
22712271
const companyLabelButton = page.locator('.test-file-test', { has: page.getByText('@company passes') }).locator('.label', { hasText: 'company' });
22722272
const companyInformationLabelButton = page.locator('.test-file-test', { has: page.getByText('@company_information fails') }).locator('.label', { hasText: 'company_information' });
22732273
const companyInformationWidgetLabelButton = page.locator('.test-file-test', { has: page.getByText('@company_information_widget fails') }).locator('.label', { hasText: 'company_information_widget' });
@@ -2337,7 +2337,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
23372337
const smokeButton = page.locator('.label', { hasText: 'smoke' }).first();
23382338
const regressionButton = page.locator('.label', { hasText: 'regression' }).first();
23392339
const flakyButton = page.locator('.label', { hasText: 'flaky' }).first();
2340-
const searchInput = page.locator('.subnav-search-input');
2340+
const searchInput = page.getByPlaceholder('Search tests');
23412341

23422342
await expect(page.locator('.chip')).toHaveCount(3);
23432343
await expect(page.locator('.chip', { hasText: 'a.test.js' })).toHaveCount(1);
@@ -2480,7 +2480,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
24802480
await expect(page.locator('.test-file-test .label').getByText('Monitoring', { exact: true })).toHaveCount(3);
24812481
await expect(page.locator('.test-file-test .label').getByText('Notifications', { exact: true })).toHaveCount(3);
24822482

2483-
const searchInput = page.locator('.subnav-search-input');
2483+
const searchInput = page.getByLabel('Search tests');
24842484

24852485
const monitoringLabelButton = page.locator('.label').getByText('Monitoring', { exact: true });
24862486
await monitoringLabelButton.first().click();
@@ -2619,7 +2619,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
26192619

26202620
await showReport();
26212621

2622-
const searchInput = page.locator('.subnav-search-input');
2622+
const searchInput = page.getByPlaceholder('Search tests');
26232623

26242624
await searchInput.fill('file-a');
26252625
await expect(page.getByText('file-a.test.js', { exact: true })).toBeVisible();
@@ -2669,7 +2669,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
26692669

26702670
await showReport();
26712671

2672-
const searchInput = page.locator('.subnav-search-input');
2672+
const searchInput = page.getByLabel('Search tests');
26732673

26742674
await searchInput.fill('s:failed');
26752675
await expect(page.getByText('a.test.js', { exact: true })).toBeVisible();
@@ -2698,7 +2698,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
26982698

26992699
await showReport();
27002700

2701-
const searchInput = page.locator('.subnav-search-input');
2701+
const searchInput = page.getByPlaceholder('Search tests');
27022702

27032703
await test.step('filter by type and value', async () => {
27042704
await searchInput.fill('annot:key=value');
@@ -2749,7 +2749,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
27492749

27502750
await showReport();
27512751

2752-
const searchInput = page.locator('.subnav-search-input');
2752+
const searchInput = page.getByLabel('Search tests');
27532753

27542754
await searchInput.fill('a.test.js:3:11');
27552755
await expect(page.getByText('a.test.js:3', { exact: true })).toBeVisible();

0 commit comments

Comments
 (0)