mirror of
https://github.com/microsoft/playwright.git
synced 2024-10-27 13:50:25 +03:00
fix(html): label not matched if first with describe (#22680)
This commit is contained in:
parent
16f664e22c
commit
7937699b28
@ -108,7 +108,7 @@ export class Filter {
|
|||||||
if (test.outcome === 'skipped')
|
if (test.outcome === 'skipped')
|
||||||
status = 'skipped';
|
status = 'skipped';
|
||||||
const searchValues: SearchValues = {
|
const searchValues: SearchValues = {
|
||||||
text: (status + ' ' + test.projectName + ' ' + test.path.join(' ') + test.title).toLowerCase(),
|
text: (status + ' ' + test.projectName + ' ' + test.path.join(' ') + ' ' + test.title).toLowerCase(),
|
||||||
project: test.projectName.toLowerCase(),
|
project: test.projectName.toLowerCase(),
|
||||||
status: status as any,
|
status: status as any,
|
||||||
};
|
};
|
||||||
|
@ -118,7 +118,7 @@ const LabelsClickView: React.FC<React.PropsWithChildren<{
|
|||||||
return labels.length > 0 ? (
|
return labels.length > 0 ? (
|
||||||
<>
|
<>
|
||||||
{labels.map(tag => (
|
{labels.map(tag => (
|
||||||
<span style={{ margin: '6px 0 0 6px', cursor: 'pointer' }} className={'label label-color-' + (hashStringToInt(tag))} onClick={e => onClickHandle(e, tag)}>
|
<span key={tag} style={{ margin: '6px 0 0 6px', cursor: 'pointer' }} className={'label label-color-' + (hashStringToInt(tag))} onClick={e => onClickHandle(e, tag)}>
|
||||||
{tag}
|
{tag}
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
|
@ -1261,18 +1261,23 @@ test.describe('labels', () => {
|
|||||||
expect((await firstTitle.boundingBox()).height).toBeGreaterThanOrEqual(100);
|
expect((await firstTitle.boundingBox()).height).toBeGreaterThanOrEqual(100);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should show filtered tests by labels when click on label', async ({ runInlineTest, showReport, page }) => {
|
test('with describe. should show filtered tests by labels when click on label', async ({ runInlineTest, showReport, page }) => {
|
||||||
const result = await runInlineTest({
|
const result = await runInlineTest({
|
||||||
'a.test.js': `
|
'a.test.js': `
|
||||||
const { expect, test } = require('@playwright/test');
|
const { expect, test } = require('@playwright/test');
|
||||||
test('@regression passes', async ({}) => {
|
test.describe('Error Pages', () => {
|
||||||
expect(1).toBe(1);
|
test('@regression passes', async ({}) => {
|
||||||
|
expect(1).toBe(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
'b.test.js': `
|
'b.test.js': `
|
||||||
const { expect, test } = require('@playwright/test');
|
const { expect, test } = require('@playwright/test');
|
||||||
test('@smoke fails', async ({}) => {
|
|
||||||
expect(1).toBe(2);
|
test.describe('Error Pages', () => {
|
||||||
|
test('@smoke fails', async ({}) => {
|
||||||
|
expect(1).toBe(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
}, { reporter: 'dot,html' }, { PW_TEST_HTML_REPORT_OPEN: 'never' });
|
}, { reporter: 'dot,html' }, { PW_TEST_HTML_REPORT_OPEN: 'never' });
|
||||||
@ -1284,7 +1289,7 @@ test.describe('labels', () => {
|
|||||||
await showReport();
|
await showReport();
|
||||||
|
|
||||||
const searchInput = page.locator('.subnav-search-input');
|
const searchInput = page.locator('.subnav-search-input');
|
||||||
const smokeLabelButton = page.locator('.test-file-test', { has: page.getByText('@smoke fails', { exact: true }) }).locator('.label', { hasText: 'smoke' });
|
const smokeLabelButton = page.locator('.test-file-test', { has: page.getByText('Error Pages › @smoke fails', { exact: true }) }).locator('.label', { hasText: 'smoke' });
|
||||||
|
|
||||||
await expect(smokeLabelButton).toBeVisible();
|
await expect(smokeLabelButton).toBeVisible();
|
||||||
await smokeLabelButton.click();
|
await smokeLabelButton.click();
|
||||||
@ -1292,9 +1297,9 @@ test.describe('labels', () => {
|
|||||||
await expect(page.locator('.test-file-test')).toHaveCount(1);
|
await expect(page.locator('.test-file-test')).toHaveCount(1);
|
||||||
await expect(page.locator('.chip', { hasText: 'a.test.js' })).toHaveCount(0);
|
await expect(page.locator('.chip', { hasText: 'a.test.js' })).toHaveCount(0);
|
||||||
await expect(page.locator('.chip', { hasText: 'b.test.js' })).toHaveCount(1);
|
await expect(page.locator('.chip', { hasText: 'b.test.js' })).toHaveCount(1);
|
||||||
await expect(page.locator('.test-file-test .test-file-title')).toHaveText('@smoke fails');
|
await expect(page.locator('.test-file-test .test-file-title')).toHaveText('Error Pages › @smoke fails');
|
||||||
|
|
||||||
const regressionLabelButton = page.locator('.test-file-test', { has: page.getByText('@regression passes', { exact: true }) }).locator('.label', { hasText: 'regression' });
|
const regressionLabelButton = page.locator('.test-file-test', { has: page.getByText('Error Pages › @regression passes', { exact: true }) }).locator('.label', { hasText: 'regression' });
|
||||||
|
|
||||||
await expect(regressionLabelButton).not.toBeVisible();
|
await expect(regressionLabelButton).not.toBeVisible();
|
||||||
|
|
||||||
@ -1310,7 +1315,7 @@ test.describe('labels', () => {
|
|||||||
await expect(page.locator('.test-file-test')).toHaveCount(1);
|
await expect(page.locator('.test-file-test')).toHaveCount(1);
|
||||||
await expect(page.locator('.chip', { hasText: 'a.test.js' })).toHaveCount(1);
|
await expect(page.locator('.chip', { hasText: 'a.test.js' })).toHaveCount(1);
|
||||||
await expect(page.locator('.chip', { hasText: 'b.test.js' })).toHaveCount(0);
|
await expect(page.locator('.chip', { hasText: 'b.test.js' })).toHaveCount(0);
|
||||||
await expect(page.locator('.test-file-test .test-file-title')).toHaveText('@regression passes');
|
await expect(page.locator('.test-file-test .test-file-title')).toHaveText('Error Pages › @regression passes');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('click label should change URL', async ({ runInlineTest, showReport, page }) => {
|
test('click label should change URL', async ({ runInlineTest, showReport, page }) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user