feat: exposes tags in testInfo
This commit is contained in:
parent
d5d4f591f3
commit
664e1f766e
|
|
@ -81,6 +81,7 @@ export class TestInfoImpl implements TestInfo {
|
|||
readonly titlePath: string[];
|
||||
readonly file: string;
|
||||
readonly line: number;
|
||||
readonly tags: string[]|undefined;
|
||||
readonly column: number;
|
||||
readonly fn: Function;
|
||||
expectedStatus: TestStatus;
|
||||
|
|
@ -156,6 +157,7 @@ export class TestInfoImpl implements TestInfo {
|
|||
this.file = test?.location.file ?? '';
|
||||
this.line = test?.location.line ?? 0;
|
||||
this.column = test?.location.column ?? 0;
|
||||
this.tags = test?.tags ?? [];
|
||||
this.fn = test?.fn ?? (() => {});
|
||||
this.expectedStatus = test?.expectedStatus ?? 'skipped';
|
||||
|
||||
|
|
|
|||
|
|
@ -146,3 +146,32 @@ test('should enforce @ symbol', async ({ runInlineTest }) => {
|
|||
expect(result.exitCode).toBe(1);
|
||||
expect(result.output).toContain(`Error: Tag must start with "@" symbol, got "foo" instead.`);
|
||||
});
|
||||
|
||||
test('should be included in testInfo', async ({ runInlineTest }, testInfo) => {
|
||||
const result = await runInlineTest({
|
||||
'a.test.ts': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('test without tag', async ({}, testInfo) => {
|
||||
expect(testInfo.tags).toStrictEqual([]);
|
||||
});
|
||||
test('test with tag',{ tag: '@tag1' }, async ({}, testInfo) => {
|
||||
expect(testInfo.tags).toStrictEqual(["@tag1"]);
|
||||
});
|
||||
`,
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
});
|
||||
|
||||
test('should be included in testInfo if comming from describe', async ({ runInlineTest }, testInfo) => {
|
||||
const result = await runInlineTest({
|
||||
'a.test.ts': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test.describe('describe with tag', { tag: '@tag1' }, async ()=>{
|
||||
test('test with tag', async ({}, testInfo) => {
|
||||
expect(testInfo.tags).toStrictEqual(["@tag1"]);
|
||||
});
|
||||
});
|
||||
`,
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue