mirror of
https://github.com/microsoft/playwright.git
synced 2024-11-24 06:49:04 +03:00
cherry-pick(#29821): feat(ui mode): text filter should filter by explicit tags
Fixes #29815.
This commit is contained in:
parent
9749f75426
commit
f822d650b2
@ -949,8 +949,8 @@ function filterTree(rootItem: GroupItem, filterText: string, statusFilters: Map<
|
||||
const filtersStatuses = [...statusFilters.values()].some(Boolean);
|
||||
|
||||
const filter = (testCase: TestCaseItem) => {
|
||||
const title = testCase.tests[0].titlePath().join(' ').toLowerCase();
|
||||
if (!tokens.every(token => title.includes(token)) && !testCase.tests.some(t => runningTestIds?.has(t.id)))
|
||||
const titleWithTags = [...testCase.tests[0].titlePath(), ...testCase.tests[0].tags].join(' ').toLowerCase();
|
||||
if (!tokens.every(token => titleWithTags.includes(token)) && !testCase.tests.some(t => runningTestIds?.has(t.id)))
|
||||
return false;
|
||||
testCase.children = (testCase.children as TestItem[]).filter(test => {
|
||||
return !filtersStatuses || runningTestIds?.has(test.test.id) || statusFilters.get(test.status);
|
||||
|
@ -24,7 +24,7 @@ const basicTestTree = {
|
||||
test('passes', () => {});
|
||||
test('fails', () => { expect(1).toBe(2); });
|
||||
test.describe('suite', () => {
|
||||
test('inner passes', () => {});
|
||||
test('inner passes', { tag: '@smoke' }, () => {});
|
||||
test('inner fails', () => { expect(1).toBe(2); });
|
||||
});
|
||||
`,
|
||||
@ -46,6 +46,16 @@ test('should filter by title', async ({ runUITest }) => {
|
||||
`);
|
||||
});
|
||||
|
||||
test('should filter by explicit tags', async ({ runUITest }) => {
|
||||
const { page } = await runUITest(basicTestTree);
|
||||
await page.getByPlaceholder('Filter').fill('@smoke inner');
|
||||
await expect.poll(dumpTestTree(page)).toBe(`
|
||||
▼ ◯ a.test.ts
|
||||
▼ ◯ suite
|
||||
◯ inner passes
|
||||
`);
|
||||
});
|
||||
|
||||
test('should filter by status', async ({ runUITest }) => {
|
||||
const { page } = await runUITest(basicTestTree);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user