mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: partially hide built-in fixture steps (#23005)
This commit is contained in:
parent
576d91fe80
commit
4c4085e105
@ -49,6 +49,8 @@ export type FixtureRegistration = {
|
||||
super?: FixtureRegistration;
|
||||
// Whether this fixture is an option override value set from the config.
|
||||
optionOverride?: boolean;
|
||||
// Do not generate the step for this fixture.
|
||||
hideStep?: boolean;
|
||||
};
|
||||
export type LoadError = {
|
||||
message: string;
|
||||
@ -101,7 +103,7 @@ export class FixturePool {
|
||||
for (const entry of Object.entries(fixtures)) {
|
||||
const name = entry[0];
|
||||
let value = entry[1];
|
||||
let options: { auto: FixtureAuto, scope: FixtureScope, option: boolean, timeout: number | undefined, customTitle: string | undefined } | undefined;
|
||||
let options: { auto: FixtureAuto, scope: FixtureScope, option: boolean, timeout: number | undefined, customTitle: string | undefined, hideStep: boolean | undefined } | undefined;
|
||||
if (isFixtureTuple(value)) {
|
||||
options = {
|
||||
auto: value[1].auto ?? false,
|
||||
@ -109,6 +111,7 @@ export class FixturePool {
|
||||
option: !!value[1].option,
|
||||
timeout: value[1].timeout,
|
||||
customTitle: (value[1] as any)._title,
|
||||
hideStep: (value[1] as any)._hideStep,
|
||||
};
|
||||
value = value[0];
|
||||
}
|
||||
@ -125,9 +128,9 @@ export class FixturePool {
|
||||
continue;
|
||||
}
|
||||
} else if (previous) {
|
||||
options = { auto: previous.auto, scope: previous.scope, option: previous.option, timeout: previous.timeout, customTitle: previous.customTitle };
|
||||
options = { auto: previous.auto, scope: previous.scope, option: previous.option, timeout: previous.timeout, customTitle: previous.customTitle, hideStep: undefined };
|
||||
} else if (!options) {
|
||||
options = { auto: false, scope: 'test', option: false, timeout: undefined, customTitle: undefined };
|
||||
options = { auto: false, scope: 'test', option: false, timeout: undefined, customTitle: undefined, hideStep: undefined };
|
||||
}
|
||||
|
||||
if (!kScopeOrder.includes(options.scope)) {
|
||||
@ -149,7 +152,7 @@ export class FixturePool {
|
||||
}
|
||||
|
||||
const deps = fixtureParameterNames(fn, location, e => this._onLoadError(e));
|
||||
const registration: FixtureRegistration = { id: '', name, location, scope: options.scope, fn, auto: options.auto, option: options.option, timeout: options.timeout, customTitle: options.customTitle, deps, super: previous, optionOverride: isOptionsOverride };
|
||||
const registration: FixtureRegistration = { id: '', name, location, scope: options.scope, fn, auto: options.auto, option: options.option, timeout: options.timeout, customTitle: options.customTitle, hideStep: options.hideStep, deps, super: previous, optionOverride: isOptionsOverride };
|
||||
registrationId(registration);
|
||||
this.registrations.set(name, registration);
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
|
||||
browserName: [({ defaultBrowserType }, use) => use(defaultBrowserType), { scope: 'worker', option: true }],
|
||||
playwright: [async ({}, use) => {
|
||||
await use(require('playwright-core'));
|
||||
}, { scope: 'worker' }],
|
||||
}, { scope: 'worker', _hideStep: true } as any],
|
||||
headless: [({ launchOptions }, use) => use(launchOptions.headless ?? true), { scope: 'worker', option: true }],
|
||||
channel: [({ launchOptions }, use) => use(launchOptions.channel), { scope: 'worker', option: true }],
|
||||
launchOptions: [{}, { scope: 'worker', option: true }],
|
||||
@ -131,13 +131,17 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
|
||||
},
|
||||
});
|
||||
await use(browser);
|
||||
await browser.close();
|
||||
await (browser as any)._wrapApiCall(async () => {
|
||||
await browser.close();
|
||||
}, true);
|
||||
return;
|
||||
}
|
||||
|
||||
const browser = await playwright[browserName].launch();
|
||||
await use(browser);
|
||||
await browser.close();
|
||||
await (browser as any)._wrapApiCall(async () => {
|
||||
await browser.close();
|
||||
}, true);
|
||||
}, { scope: 'worker', timeout: 0 }],
|
||||
|
||||
acceptDownloads: [({ contextOptions }, use) => use(contextOptions.acceptDownloads ?? true), { option: true }],
|
||||
@ -383,8 +387,9 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
|
||||
let counter = 0;
|
||||
await Promise.all([...contexts.keys()].map(async context => {
|
||||
(context as any)[kStartedContextTearDown] = true;
|
||||
await context.close();
|
||||
|
||||
await (context as any)._wrapApiCall(async () => {
|
||||
await context.close();
|
||||
}, true);
|
||||
const testFailed = testInfo.status !== testInfo.expectedStatus;
|
||||
const preserveVideo = captureVideo && (videoMode === 'on' || (testFailed && videoMode === 'retain-on-failure') || (videoMode === 'on-first-retry' && testInfo.retry === 1));
|
||||
if (preserveVideo) {
|
||||
|
||||
@ -40,15 +40,21 @@ export function filterStackTrace(e: Error): { message: string, stack: string } {
|
||||
};
|
||||
}
|
||||
|
||||
export function filterStackFile(file: string) {
|
||||
if (!process.env.PWDEBUGIMPL && file.startsWith(PLAYWRIGHT_TEST_PATH))
|
||||
return false;
|
||||
if (!process.env.PWDEBUGIMPL && file.startsWith(PLAYWRIGHT_CORE_PATH))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function filteredStackTrace(rawStack: RawStack): StackFrame[] {
|
||||
const frames: StackFrame[] = [];
|
||||
for (const line of rawStack) {
|
||||
const frame = parseStackTraceLine(line);
|
||||
if (!frame || !frame.file)
|
||||
continue;
|
||||
if (!process.env.PWDEBUGIMPL && frame.file.startsWith(PLAYWRIGHT_TEST_PATH))
|
||||
continue;
|
||||
if (!process.env.PWDEBUGIMPL && frame.file.startsWith(PLAYWRIGHT_CORE_PATH))
|
||||
if (!filterStackFile(frame.file))
|
||||
continue;
|
||||
frames.push(frame);
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { formatLocation, debugTest } from '../util';
|
||||
import { formatLocation, debugTest, filterStackFile, serializeError } from '../util';
|
||||
import { ManualPromise, zones } from 'playwright-core/lib/utils';
|
||||
import type { TestInfoImpl, TestStepInternal } from './testInfo';
|
||||
import type { FixtureDescription, TimeoutManager } from './timeoutManager';
|
||||
@ -76,7 +76,8 @@ class Fixture {
|
||||
|
||||
// Break the regustration function into before/after steps. Create these before/after stacks
|
||||
// w/o scopes, and create single mutable step that will be converted into the after step.
|
||||
const shouldGenerateStep = !this.registration.name.startsWith('_') && !this.registration.option && this.registration.scope === 'test';
|
||||
const shouldGenerateStep = !this.registration.hideStep && !this.registration.name.startsWith('_') && !this.registration.option;
|
||||
const isInternalFixture = this.registration.location && filterStackFile(this.registration.location.file);
|
||||
let mutableStepOnStack: TestStepInternal | undefined;
|
||||
let afterStep: TestStepInternal | undefined;
|
||||
|
||||
@ -97,6 +98,7 @@ class Fixture {
|
||||
wallTime: Date.now(),
|
||||
title: `fixture: ${this.registration.name}`,
|
||||
category: 'fixture',
|
||||
location: isInternalFixture ? this.registration.location : undefined,
|
||||
}, testInfo._afterHooksStep);
|
||||
mutableStepOnStack!.stepId = afterStep.stepId;
|
||||
}
|
||||
@ -121,6 +123,7 @@ class Fixture {
|
||||
await testInfo._runAsStep({
|
||||
title: `fixture: ${this.registration.name}`,
|
||||
category: 'fixture',
|
||||
location: isInternalFixture ? this.registration.location : undefined,
|
||||
}, async step => {
|
||||
mutableStepOnStack = step;
|
||||
return await this.registration.fn(params, useFunc, info);
|
||||
@ -137,8 +140,10 @@ class Fixture {
|
||||
await useFuncStarted;
|
||||
if (shouldGenerateStep) {
|
||||
mutableStepOnStack?.complete({});
|
||||
this._selfTeardownComplete?.finally(() => {
|
||||
this._selfTeardownComplete?.then(() => {
|
||||
afterStep?.complete({});
|
||||
}).catch(e => {
|
||||
afterStep?.complete({ error: serializeError(e) });
|
||||
});
|
||||
}
|
||||
testInfo._timeoutManager.setCurrentFixture(undefined);
|
||||
|
||||
@ -131,7 +131,14 @@ function mergeActions(contexts: ContextEntry[]) {
|
||||
}
|
||||
|
||||
const result = [...map.values()];
|
||||
result.sort((a1, a2) => a1.wallTime - a2.wallTime);
|
||||
result.sort((a1, a2) => {
|
||||
if (a2.parentId === a1.callId)
|
||||
return -1;
|
||||
if (a1.parentId === a2.callId)
|
||||
return 1;
|
||||
return a1.wallTime - a2.wallTime || a1.startTime - a2.startTime;
|
||||
});
|
||||
|
||||
for (let i = 1; i < result.length; ++i)
|
||||
(result[i] as any)[prevInListSymbol] = result[i - 1];
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ export const Workbench: React.FunctionComponent<{
|
||||
|
||||
const callTab: TabbedPaneTabModel = {
|
||||
id: 'call',
|
||||
title: showSourcesFirst ? 'Log' : 'Call',
|
||||
title: 'Call',
|
||||
render: () => <CallTab action={activeAction} sdkLanguage={sdkLanguage} />
|
||||
};
|
||||
const sourceTab: TabbedPaneTabModel = {
|
||||
|
||||
@ -192,7 +192,7 @@ test('should not spin forever', async ({ runInlineTest }) => {
|
||||
expect(() => {
|
||||
log?.push('poll');
|
||||
throw new Error('Polling');
|
||||
}).toPass().catch();
|
||||
}).toPass().catch(() => {});
|
||||
});
|
||||
test('should not see toPass', async () => {
|
||||
log = [];
|
||||
|
||||
@ -146,6 +146,7 @@ test('should reuse context with trace if mode=when-possible', async ({ runInline
|
||||
const trace1 = await parseTrace(testInfo.outputPath('test-results', 'reuse-one', 'trace.zip'));
|
||||
expect(trace1.apiNames).toEqual([
|
||||
'Before Hooks',
|
||||
'fixture: browser',
|
||||
'browserType.launch',
|
||||
'fixture: context',
|
||||
'fixture: page',
|
||||
|
||||
@ -92,6 +92,7 @@ test('should record api trace', async ({ runInlineTest, server }, testInfo) => {
|
||||
'fixture: request',
|
||||
'apiRequest.newContext',
|
||||
'tracing.start',
|
||||
'fixture: browser',
|
||||
'browserType.launch',
|
||||
'fixture: context',
|
||||
'browser.newContext',
|
||||
@ -103,7 +104,6 @@ test('should record api trace', async ({ runInlineTest, server }, testInfo) => {
|
||||
'After Hooks',
|
||||
'fixture: page',
|
||||
'fixture: context',
|
||||
'browserContext.close',
|
||||
'fixture: request',
|
||||
'tracing.stopChunk',
|
||||
'apiRequestContext.dispose',
|
||||
@ -135,11 +135,9 @@ test('should record api trace', async ({ runInlineTest, server }, testInfo) => {
|
||||
'After Hooks',
|
||||
'fixture: page',
|
||||
'fixture: context',
|
||||
'browserContext.close',
|
||||
'fixture: request',
|
||||
'tracing.stopChunk',
|
||||
'apiRequestContext.dispose',
|
||||
'browser.close',
|
||||
'tracing.stopChunk',
|
||||
]);
|
||||
});
|
||||
@ -328,6 +326,7 @@ test('should not override trace file in afterAll', async ({ runInlineTest, serve
|
||||
|
||||
expect(trace1.apiNames).toEqual([
|
||||
'Before Hooks',
|
||||
'fixture: browser',
|
||||
'browserType.launch',
|
||||
'fixture: context',
|
||||
'browser.newContext',
|
||||
@ -338,7 +337,6 @@ test('should not override trace file in afterAll', async ({ runInlineTest, serve
|
||||
'After Hooks',
|
||||
'fixture: page',
|
||||
'fixture: context',
|
||||
'browserContext.close',
|
||||
'afterAll hook',
|
||||
'fixture: request',
|
||||
'apiRequest.newContext',
|
||||
@ -347,7 +345,7 @@ test('should not override trace file in afterAll', async ({ runInlineTest, serve
|
||||
'fixture: request',
|
||||
'tracing.stopChunk',
|
||||
'apiRequestContext.dispose',
|
||||
'browser.close',
|
||||
'fixture: browser',
|
||||
]);
|
||||
|
||||
const error = await parseTrace(testInfo.outputPath('test-results', 'a-test-2', 'trace.zip')).catch(e => e);
|
||||
|
||||
@ -278,8 +278,10 @@ test('should report expect steps', async ({ runInlineTest }) => {
|
||||
`begin {\"title\":\"After Hooks\",\"category\":\"hook\"}`,
|
||||
`end {\"title\":\"After Hooks\",\"category\":\"hook\"}`,
|
||||
`begin {\"title\":\"Before Hooks\",\"category\":\"hook\"}`,
|
||||
`begin {\"title\":\"fixture: browser\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"browserType.launch\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browserType.launch\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"fixture: browser\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserType.launch\",\"category\":\"pw:api\"}]}`,
|
||||
`begin {\"title\":\"fixture: context\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"browser.newContext\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browser.newContext\",\"category\":\"pw:api\"}`,
|
||||
@ -288,7 +290,7 @@ test('should report expect steps', async ({ runInlineTest }) => {
|
||||
`begin {\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"fixture: page\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}]}`,
|
||||
`end {\"title\":\"Before Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"browserType.launch\",\"category\":\"pw:api\"},{\"title\":\"fixture: context\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browser.newContext\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: page\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}]}]}`,
|
||||
`end {\"title\":\"Before Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"fixture: browser\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserType.launch\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: context\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browser.newContext\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: page\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}]}]}`,
|
||||
`begin {\"title\":\"expect.not.toHaveTitle\",\"category\":\"expect\"}`,
|
||||
`end {\"title\":\"expect.not.toHaveTitle\",\"category\":\"expect\"}`,
|
||||
`begin {\"title\":\"After Hooks\",\"category\":\"hook\"}`,
|
||||
@ -296,9 +298,7 @@ test('should report expect steps', async ({ runInlineTest }) => {
|
||||
`end {\"title\":\"fixture: page\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"fixture: context\",\"category\":\"fixture\"}`,
|
||||
`end {\"title\":\"fixture: context\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"browserContext.close\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browserContext.close\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"After Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"fixture: page\",\"category\":\"fixture\"},{\"title\":\"fixture: context\",\"category\":\"fixture\"},{\"title\":\"browserContext.close\",\"category\":\"pw:api\"}]}`,
|
||||
`end {\"title\":\"After Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"fixture: page\",\"category\":\"fixture\"},{\"title\":\"fixture: context\",\"category\":\"fixture\"}]}`,
|
||||
]);
|
||||
});
|
||||
|
||||
@ -347,8 +347,10 @@ test('should report api steps', async ({ runInlineTest }) => {
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.outputLines).toEqual([
|
||||
`begin {\"title\":\"Before Hooks\",\"category\":\"hook\"}`,
|
||||
`begin {\"title\":\"fixture: browser\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"browserType.launch\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browserType.launch\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"fixture: browser\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserType.launch\",\"category\":\"pw:api\"}]}`,
|
||||
`begin {\"title\":\"fixture: context\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"browser.newContext\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browser.newContext\",\"category\":\"pw:api\"}`,
|
||||
@ -361,7 +363,7 @@ test('should report api steps', async ({ runInlineTest }) => {
|
||||
`begin {\"title\":\"apiRequest.newContext\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"apiRequest.newContext\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"fixture: request\",\"category\":\"fixture\",\"steps\":[{\"title\":\"apiRequest.newContext\",\"category\":\"pw:api\"}]}`,
|
||||
`end {\"title\":\"Before Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"browserType.launch\",\"category\":\"pw:api\"},{\"title\":\"fixture: context\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browser.newContext\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: page\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: request\",\"category\":\"fixture\",\"steps\":[{\"title\":\"apiRequest.newContext\",\"category\":\"pw:api\"}]}]}`,
|
||||
`end {\"title\":\"Before Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"fixture: browser\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserType.launch\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: context\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browser.newContext\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: page\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: request\",\"category\":\"fixture\",\"steps\":[{\"title\":\"apiRequest.newContext\",\"category\":\"pw:api\"}]}]}`,
|
||||
`begin {\"title\":\"page.waitForNavigation\",\"category\":\"pw:api\"}`,
|
||||
`begin {\"title\":\"page.goto(data:text/html,<button></button>)\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"page.waitForNavigation\",\"category\":\"pw:api\",\"steps\":[{\"title\":\"page.goto(data:text/html,<button></button>)\",\"category\":\"pw:api\"}]}`,
|
||||
@ -383,9 +385,7 @@ test('should report api steps', async ({ runInlineTest }) => {
|
||||
`end {\"title\":\"fixture: page\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"fixture: context\",\"category\":\"fixture\"}`,
|
||||
`end {\"title\":\"fixture: context\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"browserContext.close\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browserContext.close\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"After Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"fixture: request\",\"category\":\"fixture\",\"steps\":[{\"title\":\"apiRequestContext.dispose\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: page\",\"category\":\"fixture\"},{\"title\":\"fixture: context\",\"category\":\"fixture\"},{\"title\":\"browserContext.close\",\"category\":\"pw:api\"}]}`,
|
||||
`end {\"title\":\"After Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"fixture: request\",\"category\":\"fixture\",\"steps\":[{\"title\":\"apiRequestContext.dispose\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: page\",\"category\":\"fixture\"},{\"title\":\"fixture: context\",\"category\":\"fixture\"}]}`,
|
||||
`begin {\"title\":\"Before Hooks\",\"category\":\"hook\"}`,
|
||||
`begin {\"title\":\"beforeAll hook\",\"category\":\"hook\"}`,
|
||||
`begin {\"title\":\"browser.newPage\",\"category\":\"pw:api\"}`,
|
||||
@ -432,8 +432,10 @@ test('should report api step failure', async ({ runInlineTest }) => {
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.outputLines).toEqual([
|
||||
`begin {\"title\":\"Before Hooks\",\"category\":\"hook\"}`,
|
||||
`begin {\"title\":\"fixture: browser\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"browserType.launch\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browserType.launch\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"fixture: browser\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserType.launch\",\"category\":\"pw:api\"}]}`,
|
||||
`begin {\"title\":\"fixture: context\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"browser.newContext\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browser.newContext\",\"category\":\"pw:api\"}`,
|
||||
@ -442,7 +444,7 @@ test('should report api step failure', async ({ runInlineTest }) => {
|
||||
`begin {\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"fixture: page\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}]}`,
|
||||
`end {\"title\":\"Before Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"browserType.launch\",\"category\":\"pw:api\"},{\"title\":\"fixture: context\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browser.newContext\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: page\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}]}]}`,
|
||||
`end {\"title\":\"Before Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"fixture: browser\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserType.launch\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: context\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browser.newContext\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: page\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}]}]}`,
|
||||
`begin {\"title\":\"page.setContent\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"page.setContent\",\"category\":\"pw:api\"}`,
|
||||
`begin {\"title\":\"page.click(input)\",\"category\":\"pw:api\"}`,
|
||||
@ -452,11 +454,9 @@ test('should report api step failure', async ({ runInlineTest }) => {
|
||||
`end {\"title\":\"fixture: page\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"fixture: context\",\"category\":\"fixture\"}`,
|
||||
`end {\"title\":\"fixture: context\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"browserContext.close\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browserContext.close\",\"category\":\"pw:api\"}`,
|
||||
`begin {\"title\":\"browser.close\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browser.close\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"After Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"fixture: page\",\"category\":\"fixture\"},{\"title\":\"fixture: context\",\"category\":\"fixture\"},{\"title\":\"browserContext.close\",\"category\":\"pw:api\"},{\"title\":\"browser.close\",\"category\":\"pw:api\"}]}`,
|
||||
`begin {\"title\":\"fixture: browser\",\"category\":\"fixture\"}`,
|
||||
`end {\"title\":\"fixture: browser\",\"category\":\"fixture\"}`,
|
||||
`end {\"title\":\"After Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"fixture: page\",\"category\":\"fixture\"},{\"title\":\"fixture: context\",\"category\":\"fixture\"},{\"title\":\"fixture: browser\",\"category\":\"fixture\"}]}`,
|
||||
]);
|
||||
});
|
||||
|
||||
@ -506,8 +506,10 @@ test('should show nice stacks for locators', async ({ runInlineTest }) => {
|
||||
expect(result.output).not.toContain('Internal error');
|
||||
expect(result.outputLines).toEqual([
|
||||
`begin {"title":"Before Hooks","category":"hook"}`,
|
||||
`begin {\"title\":\"fixture: browser\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"browserType.launch\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browserType.launch\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"fixture: browser\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserType.launch\",\"category\":\"pw:api\"}]}`,
|
||||
`begin {\"title\":\"fixture: context\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"browser.newContext\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"browser.newContext\",\"category\":\"pw:api\"}`,
|
||||
@ -516,7 +518,7 @@ test('should show nice stacks for locators', async ({ runInlineTest }) => {
|
||||
`begin {"title":"browserContext.newPage","category":"pw:api"}`,
|
||||
`end {"title":"browserContext.newPage","category":"pw:api"}`,
|
||||
`end {\"title\":\"fixture: page\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}]}`,
|
||||
`end {\"title\":\"Before Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"browserType.launch\",\"category\":\"pw:api\"},{\"title\":\"fixture: context\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browser.newContext\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: page\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}]}]}`,
|
||||
`end {\"title\":\"Before Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"fixture: browser\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserType.launch\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: context\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browser.newContext\",\"category\":\"pw:api\"}]},{\"title\":\"fixture: page\",\"category\":\"fixture\",\"steps\":[{\"title\":\"browserContext.newPage\",\"category\":\"pw:api\"}]}]}`,
|
||||
`begin {"title":"page.setContent","category":"pw:api"}`,
|
||||
`end {"title":"page.setContent","category":"pw:api"}`,
|
||||
`begin {"title":"locator.evaluate(button)","category":"pw:api"}`,
|
||||
@ -526,9 +528,7 @@ test('should show nice stacks for locators', async ({ runInlineTest }) => {
|
||||
`end {\"title\":\"fixture: page\",\"category\":\"fixture\"}`,
|
||||
`begin {\"title\":\"fixture: context\",\"category\":\"fixture\"}`,
|
||||
`end {\"title\":\"fixture: context\",\"category\":\"fixture\"}`,
|
||||
`begin {"title":"browserContext.close","category":"pw:api"}`,
|
||||
`end {"title":"browserContext.close","category":"pw:api"}`,
|
||||
`end {\"title\":\"After Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"fixture: page\",\"category\":\"fixture\"},{\"title\":\"fixture: context\",\"category\":\"fixture\"},{\"title\":\"browserContext.close\",\"category\":\"pw:api\"}]}`,
|
||||
`end {\"title\":\"After Hooks\",\"category\":\"hook\",\"steps\":[{\"title\":\"fixture: page\",\"category\":\"fixture\"},{\"title\":\"fixture: context\",\"category\":\"fixture\"}]}`,
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@ -96,8 +96,14 @@ test('should report api step hierarchy', async ({ runInlineTest }) => {
|
||||
title: 'Before Hooks',
|
||||
steps: [
|
||||
{
|
||||
category: 'pw:api',
|
||||
title: 'browserType.launch',
|
||||
category: 'fixture',
|
||||
title: 'fixture: browser',
|
||||
steps: [
|
||||
{
|
||||
category: 'pw:api',
|
||||
title: 'browserType.launch',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
category: 'fixture',
|
||||
@ -191,10 +197,6 @@ test('should report api step hierarchy', async ({ runInlineTest }) => {
|
||||
category: 'fixture',
|
||||
title: 'fixture: context',
|
||||
},
|
||||
{
|
||||
category: 'pw:api',
|
||||
title: 'browserContext.close',
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
@ -271,8 +273,14 @@ test('should not report nested after hooks', async ({ runInlineTest }) => {
|
||||
title: 'Before Hooks',
|
||||
steps: [
|
||||
{
|
||||
category: 'pw:api',
|
||||
title: 'browserType.launch',
|
||||
category: 'fixture',
|
||||
title: 'fixture: browser',
|
||||
steps: [
|
||||
{
|
||||
category: 'pw:api',
|
||||
title: 'browserType.launch',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
category: 'fixture',
|
||||
@ -318,12 +326,8 @@ test('should not report nested after hooks', async ({ runInlineTest }) => {
|
||||
title: 'fixture: context',
|
||||
},
|
||||
{
|
||||
category: 'pw:api',
|
||||
title: 'browserContext.close',
|
||||
},
|
||||
{
|
||||
category: 'pw:api',
|
||||
title: 'browser.close',
|
||||
category: 'fixture',
|
||||
title: 'fixture: browser',
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -414,8 +418,14 @@ test('should report expect step locations', async ({ runInlineTest }) => {
|
||||
title: 'Before Hooks',
|
||||
steps: [
|
||||
{
|
||||
category: 'pw:api',
|
||||
title: 'browserType.launch',
|
||||
category: 'fixture',
|
||||
title: 'fixture: browser',
|
||||
steps: [
|
||||
{
|
||||
category: 'pw:api',
|
||||
title: 'browserType.launch',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
category: 'fixture',
|
||||
@ -460,10 +470,6 @@ test('should report expect step locations', async ({ runInlineTest }) => {
|
||||
category: 'fixture',
|
||||
title: 'fixture: context',
|
||||
},
|
||||
{
|
||||
category: 'pw:api',
|
||||
title: 'browserContext.close',
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
@ -682,8 +688,14 @@ test('should nest steps based on zones', async ({ runInlineTest }) => {
|
||||
location: { file: 'a.test.ts', line: 'number', column: 'number' }
|
||||
},
|
||||
{
|
||||
title: 'browserType.launch',
|
||||
category: 'pw:api'
|
||||
category: 'fixture',
|
||||
title: 'fixture: browser',
|
||||
steps: [
|
||||
{
|
||||
category: 'pw:api',
|
||||
title: 'browserType.launch',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
category: 'fixture',
|
||||
@ -784,10 +796,6 @@ test('should nest steps based on zones', async ({ runInlineTest }) => {
|
||||
category: 'fixture',
|
||||
title: 'fixture: context',
|
||||
},
|
||||
{
|
||||
title: 'browserContext.close',
|
||||
category: 'pw:api'
|
||||
},
|
||||
{
|
||||
title: 'afterAll hook',
|
||||
category: 'hook',
|
||||
@ -850,8 +858,11 @@ test('should not mark page.close as failed when page.click fails', async ({ runI
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
category: 'pw:api',
|
||||
title: 'browserType.launch',
|
||||
category: 'fixture',
|
||||
title: 'fixture: browser',
|
||||
steps: [
|
||||
{ title: 'browserType.launch', category: 'pw:api' },
|
||||
]
|
||||
},
|
||||
{
|
||||
category: 'pw:api',
|
||||
@ -911,8 +922,8 @@ test('should not mark page.close as failed when page.click fails', async ({ runI
|
||||
],
|
||||
},
|
||||
{
|
||||
category: 'pw:api',
|
||||
title: 'browser.close',
|
||||
category: 'fixture',
|
||||
title: 'fixture: browser',
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -939,7 +950,13 @@ test('should nest page.continue insize page.goto steps', async ({ runInlineTest
|
||||
title: 'Before Hooks',
|
||||
category: 'hook',
|
||||
steps: [
|
||||
{ title: 'browserType.launch', category: 'pw:api' },
|
||||
{
|
||||
category: 'fixture',
|
||||
title: 'fixture: browser',
|
||||
steps: [
|
||||
{ title: 'browserType.launch', category: 'pw:api' },
|
||||
]
|
||||
},
|
||||
{
|
||||
category: 'fixture',
|
||||
title: 'fixture: context',
|
||||
@ -991,7 +1008,6 @@ test('should nest page.continue insize page.goto steps', async ({ runInlineTest
|
||||
category: 'fixture',
|
||||
title: 'fixture: context',
|
||||
},
|
||||
{ title: 'browserContext.close', category: 'pw:api' },
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
@ -207,6 +207,7 @@ test('should report toHaveScreenshot step with expectation name in title', async
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.outputLines).toEqual([
|
||||
`end browserType.launch`,
|
||||
`end fixture: browser`,
|
||||
`end browser.newContext`,
|
||||
`end fixture: context`,
|
||||
`end browserContext.newPage`,
|
||||
@ -216,7 +217,6 @@ test('should report toHaveScreenshot step with expectation name in title', async
|
||||
`end expect.toHaveScreenshot(is-a-test-1.png)`,
|
||||
`end fixture: page`,
|
||||
`end fixture: context`,
|
||||
`end browserContext.close`,
|
||||
`end After Hooks`,
|
||||
]);
|
||||
});
|
||||
|
||||
@ -109,7 +109,6 @@ test('should update trace live', async ({ runUITest, server }) => {
|
||||
/After Hooks[\d.]+m?s/,
|
||||
/fixture: page[\d.]+m?s/,
|
||||
/fixture: context[\d.]+m?s/,
|
||||
/browserContext.close[\d.]+m?s/,
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@ -46,7 +46,6 @@ test('should merge trace events', async ({ runUITest, server }) => {
|
||||
/After Hooks[\d.]+m?s/,
|
||||
/fixture: page[\d.]+m?s/,
|
||||
/fixture: context[\d.]+m?s/,
|
||||
/browserContext.close[\d.]+m?s/,
|
||||
]);
|
||||
});
|
||||
|
||||
@ -74,7 +73,6 @@ test('should merge web assertion events', async ({ runUITest }, testInfo) => {
|
||||
/After Hooks[\d.]+m?s/,
|
||||
/fixture: page[\d.]+m?s/,
|
||||
/fixture: context[\d.]+m?s/,
|
||||
/browserContext.close[\d.]+m?s/,
|
||||
]);
|
||||
});
|
||||
|
||||
@ -149,7 +147,6 @@ test('should show snapshots for sync assertions', async ({ runUITest, server })
|
||||
/After Hooks[\d.]+m?s/,
|
||||
/fixture: page[\d.]+m?s/,
|
||||
/fixture: context[\d.]+m?s/,
|
||||
/browserContext.close[\d.]+m?s/,
|
||||
]);
|
||||
|
||||
await expect(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user