Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: two-line trace view (4) (#36070)
Pavel Feldman9a53dc2d07fd
diff --git a/docs/src/test-reporter-api/class-teststep.md b/docs/src/test-reporter-api/class-teststep.mdindex 1272eb546f..a8d1c12110 100644--- a/docs/src/test-reporter-api/class-teststep.md+++ b/docs/src/test-reporter-api/class-teststep.md@@ -9,10 +9,13 @@ Represents a step in the [TestRun].- type: <[string]>Step category to differentiate steps with different origin and verbosity. Built-in categories are:-* `hook` for fixtures and hooks initialization and teardown* `expect` for expect calls+* `fixture` for fixtures setup and teardown+* `hook` for hooks initialization and teardown* `pw:api` for Playwright API calls.* `test.step` for test.step API calls.+* `test.attach` for test attachmen calls.+## property: TestStep.duration* since: v1.10diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.tsindex bea4d31157..978c75c23b 100644--- a/packages/playwright/src/index.ts+++ b/packages/playwright/src/index.ts@@ -23,6 +23,7 @@ import { setBoxedStackPrefixes, createGuid, currentZone, debugMode, jsonStringifimport { currentTestInfo } from './common/globals';import { rootTestType } from './common/testType';import { attachErrorContext } from './errorContext';+import { stepTitle } from './util';import type { Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, ScreenshotMode, TestInfo, TestType, VideoMode } from '../types/test';import type { ContextReuseMode } from './common/config';@@ -270,7 +271,7 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({if (zone.apiName)data.apiName = zone.apiName;if (zone.title)- data.title = zone.title;+ data.title = stepTitle(zone.category, zone.title);data.stepId = zone.stepId;return;}diff --git a/packages/playwright/src/matchers/expect.ts b/packages/playwright/src/matchers/expect.tsindex 06c4243e32..fe28be1932 100644--- a/packages/playwright/src/matchers/expect.ts+++ b/packages/playwright/src/matchers/expect.ts@@ -62,12 +62,13 @@ import {printReceived,} from '../common/expectBundle';import { currentTestInfo } from '../common/globals';-import { filteredStackTrace, trimLongString } from '../util';+import { filteredStackTrace } from '../util';import { TestInfoImpl } from '../worker/testInfo';import type { ExpectMatcherStateInternal } from './matchers';import type { Expect } from '../../types/test';import type { TestStepInfoImpl } from '../worker/testInfo';+import type { TestStepCategory } from '../util';// #region@@ -343,9 +344,9 @@ class ExpectMetaInfoProxyHandler implements ProxyHandler<any> {const customMessage = this._info.message || '';const argsSuffix = computeArgsSuffix(matcherName, args);- const defaultTitle = `Expect ${this._info.poll ? 'poll ' : ''}${this._info.isSoft ? 'soft ' : ''}${this._info.isNot ? 'not ' : ''}${matcherName}${argsSuffix}`;- const apiName = `expect${this._info.poll ? '.poll ' : ''}${this._info.isSoft ? '.soft ' : ''}${this._info.isNot ? '.not' : ''}.${matcherName}${argsSuffix}`;+ const defaultTitle = `${this._info.poll ? 'poll ' : ''}${this._info.isSoft ? 'soft ' : ''}${this._info.isNot ? 'not ' : ''}${matcherName}${argsSuffix}`;const title = customMessage || defaultTitle;+ const apiName = `expect${this._info.poll ? '.poll ' : ''}${this._info.isSoft ? '.soft ' : ''}${this._info.isNot ? '.not' : ''}.${matcherName}${argsSuffix}`;// This looks like it is unnecessary, but it isn't - we need to filter// out all the frames that belong to the test runner from caught runtime errors.@@ -354,9 +355,9 @@ class ExpectMetaInfoProxyHandler implements ProxyHandler<any> {// toPass and poll matchers can contain other steps, expects and API calls,// so they behave like a retriable step.const stepInfo = {- category: (matcherName === 'toPass' || this._info.poll) ? 'step' : 'expect',+ category: (matcherName === 'toPass' || this._info.poll) ? 'test.step' : 'expect' as TestStepCategory,apiName,- title: trimLongString(title, 1024),+ title,params: args[0] ? { expected: args[0] } : undefined,infectParentStepsWithError: this._info.isSoft,};diff --git a/packages/playwright/src/reporters/html.ts b/packages/playwright/src/reporters/html.tsindex 374013d834..0834c4ef27 100644--- a/packages/playwright/src/reporters/html.ts+++ b/packages/playwright/src/reporters/html.ts@@ -26,7 +26,7 @@ import { yazl } from 'playwright-core/lib/zipBundle';import { CommonReporterOptions, formatError, formatResultFailure, internalScreen } from './base';import { codeFrameColumns } from '../transform/babelBundle';-import { resolveReporterOutputPath, stripAnsiEscapes } from '../util';+import { resolveReporterOutputPath, stripAnsiEscapes, stepTitle } from '../util';import type { ReporterV2 } from './reporterV2';import type { HtmlReporterOptions as HtmlReporterConfigOptions, Metadata, TestAnnotation } from '../../types/test';@@ -34,6 +34,7 @@ import type * as api from '../../types/testReporter';import type { HTMLReport, Stats, TestAttachment, TestCase, TestCaseSummary, TestFile, TestFileSummary, TestResult, TestStep } from '@html-reporter/types';import type { ZipFile } from 'playwright-core/lib/zipBundle';import type { TransformCallback } from 'stream';+import type { TestStepCategory } from '../util';type TestEntry = {testCase: TestCase;@@ -523,7 +524,7 @@ class HtmlBuilder {private _createTestStep(dedupedStep: DedupedStep, result: api.TestResult): TestStep {const { step, duration, count } = dedupedStep;const skipped = dedupedStep.step.annotations?.find(a => a.type === 'skip');- let title = step.title;+ let title = stepTitle(step.category as TestStepCategory, step.title);if (skipped)title = `${title} (skipped${skipped.description ? ': ' + skipped.description : ''})`;const testStep: TestStep = {diff --git a/packages/playwright/src/util.ts b/packages/playwright/src/util.tsindex c53afede79..167679ac9a 100644--- a/packages/playwright/src/util.ts+++ b/packages/playwright/src/util.ts@@ -19,7 +19,7 @@ import path from 'path';import url from 'url';import util from 'util';-import { parseStackFrame, sanitizeForFilePath, calculateSha1, isRegExp, isString, stringifyStackFrames } from 'playwright-core/lib/utils';+import { parseStackFrame, sanitizeForFilePath, calculateSha1, isRegExp, isString, stringifyStackFrames, escapeWithQuotes } from 'playwright-core/lib/utils';import { colors, debug, mime, minimatch } from 'playwright-core/lib/utilsBundle';import type { Location } from './../types/testReporter';@@ -419,3 +419,23 @@ export const ansiRegex = new RegExp('([\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zAexport function stripAnsiEscapes(str: string): string {return str.replace(ansiRegex, '');}++export type TestStepCategory = 'expect' | 'fixture' | 'hook' | 'pw:api' | 'test.step' | 'test.attach';++export function stepTitle(category: TestStepCategory, title: string): string {+ switch (category) {+ case 'fixture':+ return `Fixture ${escapeWithQuotes(title, '"')}`;+ case 'expect':+ return `Expect ${escapeWithQuotes(title, '"')}`;+ case 'test.step':+ return `Step ${escapeWithQuotes(title, '"')}`;+ case 'test.attach':+ return `Attach ${escapeWithQuotes(title, '"')}`;+ case 'hook':+ case 'pw:api':+ return title;+ default:+ return `[${category}] ${title}`;+ }+}diff --git a/packages/playwright/src/worker/fixtureRunner.ts b/packages/playwright/src/worker/fixtureRunner.tsindex 51bd517dde..8a792eebfd 100644--- a/packages/playwright/src/worker/fixtureRunner.ts+++ b/packages/playwright/src/worker/fixtureRunner.ts@@ -16,7 +16,7 @@import { ManualPromise } from 'playwright-core/lib/utils';-import { fixtureParameterNames } from '../common/fixtures';+import { fixtureParameterNames } from '../common/fixtures';import { filterStackFile, formatLocation } from '../util';import type { TestInfoImpl } from './testInfo';@@ -47,7 +47,7 @@ class Fixture {const isUserFixture = this.registration.location && filterStackFile(this.registration.location.file);const title = this.registration.customTitle || this.registration.name;const location = isUserFixture ? this.registration.location : undefined;- this._stepInfo = shouldGenerateStep ? { title: `fixture: ${title}`, category: 'fixture', location } : undefined;+ this._stepInfo = shouldGenerateStep ? { title, category: 'fixture', location } : undefined;this._setupDescription = {title,phase: 'setup',diff --git a/packages/playwright/src/worker/testInfo.ts b/packages/playwright/src/worker/testInfo.tsindex 9e7f040b7c..0a7736d3a6 100644--- a/packages/playwright/src/worker/testInfo.ts+++ b/packages/playwright/src/worker/testInfo.ts@@ -31,7 +31,7 @@ import type { FullConfigInternal, FullProjectInternal } from '../common/config';import type { AttachmentPayload, StepBeginPayload, StepEndPayload, TestInfoErrorImpl, WorkerInitParams } from '../common/ipc';import type { TestCase } from '../common/test';import type { StackFrame } from '@protocol/channels';-+import type { TestStepCategory } from '../util';export interface TestStepInternal {complete(result: { error?: Error | unknown, suggestedRebaseline?: string }): void;@@ -39,7 +39,7 @@ export interface TestStepInternal {attachmentIndices: number[];stepId: string;title: string;- category: string;+ category: TestStepCategory;location?: Location;boxedStack?: StackFrame[];steps: TestStepInternal[];@@ -329,7 +329,12 @@ export class TestInfoImpl implements TestInfo {location: data.location,};this._onStepBegin(payload);- this._tracing.appendBeforeActionForStep(stepId, parentStep?.stepId, { title: data.title, params: data.params, stack: data.location ? [data.location] : [] });+ this._tracing.appendBeforeActionForStep(stepId, parentStep?.stepId, {+ title: data.title,+ category: data.category,+ params: data.params,+ stack: data.location ? [data.location] : []+ });return step;}@@ -412,8 +417,8 @@ export class TestInfoImpl implements TestInfo {async attach(name: string, options: { path?: string, body?: string | Buffer, contentType?: string } = {}) {const step = this._addStep({- title: `attach "${name}"`,- category: 'attach',+ title: name,+ category: 'test.attach',});this._attach(await normalizeAndSaveAttachment(this.outputPath(), name, options), step.stepId);step.complete({});@@ -425,7 +430,7 @@ export class TestInfoImpl implements TestInfo {this._stepMap.get(stepId)!.attachmentIndices.push(index);} else {const callId = `attach@${createGuid()}`;- this._tracing.appendBeforeActionForStep(callId, undefined, { title: `Attach "${attachment.name}"`, stack: [] });+ this._tracing.appendBeforeActionForStep(callId, undefined, { title: attachment.name, category: 'test.attach', stack: [] });this._tracing.appendAfterActionForStep(callId, undefined, [attachment]);}diff --git a/packages/playwright/src/worker/testTracing.ts b/packages/playwright/src/worker/testTracing.tsindex 40ce2af375..b9294415b0 100644--- a/packages/playwright/src/worker/testTracing.ts+++ b/packages/playwright/src/worker/testTracing.ts@@ -20,7 +20,7 @@ import path from 'path';import { ManualPromise, SerializedFS, calculateSha1, createGuid, monotonicTime } from 'playwright-core/lib/utils';import { yauzl, yazl } from 'playwright-core/lib/zipBundle';-import { filteredStackTrace } from '../util';+import { filteredStackTrace, stepTitle } from '../util';import type { TestInfoImpl } from './testInfo';import type { PlaywrightWorkerOptions, TestInfo, TraceMode } from '../../types/test';@@ -28,6 +28,7 @@ import type { TestInfoErrorImpl } from '../common/ipc';import type { SerializedError, StackFrame } from '@protocol/channels';import type * as trace from '@trace/trace';import type EventEmitter from 'events';+import type { TestStepCategory } from '../util';export type Attachment = TestInfo['attachments'][0];export const testTraceEntryName = 'test.trace';@@ -47,7 +48,6 @@ export class TestTracing {private _tracesDir: string;private _contextCreatedEvent: trace.ContextCreatedTraceEvent;private _didFinishTestFunctionAndAfterEachHooks = false;- private _lastActionId = 0;constructor(testInfo: TestInfoImpl, artifactsDir: string) {this._testInfo = testInfo;@@ -267,7 +267,7 @@ export class TestTracing {});}- appendBeforeActionForStep(callId: string, parentId: string | undefined, options: { title: string, params?: Record<string, any>, stack: StackFrame[] }) {+ appendBeforeActionForStep(callId: string, parentId: string | undefined, options: { title: string, category: TestStepCategory, params?: Record<string, any>, stack: StackFrame[] }) {this._appendTraceEvent({type: 'before',callId,@@ -276,7 +276,7 @@ export class TestTracing {startTime: monotonicTime(),class: 'Test',method: 'step',- title: options.title,+ title: stepTitle(options.category, options.title),params: Object.fromEntries(Object.entries(options.params || {}).map(([name, value]) => [name, generatePreview(value)])),stack: options.stack,});diff --git a/packages/playwright/types/testReporter.d.ts b/packages/playwright/types/testReporter.d.tsindex 2baa87b70d..bbf22d3bc6 100644--- a/packages/playwright/types/testReporter.d.ts+++ b/packages/playwright/types/testReporter.d.ts@@ -753,10 +753,12 @@ export interface TestStep {/*** Step category to differentiate steps with different origin and verbosity. Built-in categories are:- * - `hook` for fixtures and hooks initialization and teardown* - `expect` for expect calls+ * - `fixture` for fixtures setup and teardown+ * - `hook` for hooks initialization and teardown* - `pw:api` for Playwright API calls.* - `test.step` for test.step API calls.+ * - `test.attach` for test attachmen calls.*/category: string;diff --git a/packages/trace-viewer/src/ui/actionList.css b/packages/trace-viewer/src/ui/actionList.cssindex 26bc56165b..5d4abc9331 100644--- a/packages/trace-viewer/src/ui/actionList.css+++ b/packages/trace-viewer/src/ui/actionList.css@@ -31,13 +31,10 @@white-space: pre;overflow: hidden;text-overflow: ellipsis;- text-transform: uppercase;- font-weight: 600;}.action-title-param {color: var(--vscode-editorBracketHighlight-foreground1);- text-transform: none;}.action-location {diff --git a/tests/library/inspector/pause.spec.ts b/tests/library/inspector/pause.spec.tsindex d27a941fb0..f2cb367d36 100644--- a/tests/library/inspector/pause.spec.ts+++ b/tests/library/inspector/pause.spec.ts@@ -290,8 +290,8 @@ it.describe('pause', () => {await recorderPage.waitForSelector('.source-line-paused:has-text("page.pause({ __testHookKeepTestTimeout: true }); // 2")');expect(await sanitizeLog(recorderPage)).toEqual(['Pause- XXms',- 'Expect toHaveText(page.locator(\'button\'))- XXms',- 'Expect not toHaveText(page.locator(\'button\'))- XXms',+ 'Expect "toHaveText"(page.locator(\'button\'))- XXms',+ 'Expect "not toHaveText"(page.locator(\'button\'))- XXms','Pause',]);await recorderPage.click('[title="Resume (F8)"]');diff --git a/tests/library/trace-viewer.spec.ts b/tests/library/trace-viewer.spec.tsindex 87f7681cb0..35ca0c5272 100644--- a/tests/library/trace-viewer.spec.ts+++ b/tests/library/trace-viewer.spec.ts@@ -127,7 +127,7 @@ test('should show tracing.group in the action list with location', async ({ runA/Navigate/,/inner group 1/,/inner group 2/,- /Expect toBeVisible/,+ /toBeVisible/,]);await traceViewer.selectAction('inner group 1');@@ -152,9 +152,9 @@ test('should open simple trace viewer', async ({ showTraceViewer }) => {/Create page/,/Navigate to "data:"/,/Set content/,- /Expect toHaveText.*locator/,- /Expect toBeHidden.*getByTestId/,- /Expect toBeHidden.*getByTestId/,+ /toHaveText.*locator/,+ /toBeHidden.*getByTestId/,+ /toBeHidden.*getByTestId/,/Evaluate/,/Evaluate/,/Click/,@@ -200,7 +200,7 @@ test('should show action context on locators and other common actions', async ({/Set content/,/Click.*locator\('input'\)/,/Click.*getByRole\('textbox'\)/,- /Expect toHaveText.*locator\('input'\)/,+ /toHaveText.*locator\('input'\)/,/Press "Enter".*locator\('input'\)/,/Type "Hello world.*/,/Press "Control\+c"/,@@ -305,7 +305,7 @@ test('should show params and return value', async ({ showTraceViewer }) => {await traceViewer.selectAction(`locator('button')`);await expect(traceViewer.callLines).toContainText([- /Expect toHaveText/,+ /toHaveText/,/start:[\d\.]+m?s/,/duration:[\d]+ms/,/locator:locator\('button'\)/,@@ -1828,9 +1828,9 @@ test('should render blob trace received from message', async ({ showTraceViewer/Create page/,/Navigate to "data:"/,/Set content/,- /Expect toHaveText.*locator/,- /Expect toBeHidden.*getByTestId/,- /Expect toBeHidden.*getByTestId/,+ /toHaveText.*locator/,+ /toBeHidden.*getByTestId/,+ /toBeHidden.*getByTestId/,/Evaluate/,/Evaluate/,/Click.*getByText\('Click'\)/,diff --git a/tests/page/expect-boolean.spec.ts b/tests/page/expect-boolean.spec.tsindex e254db7a95..16bc1c636a 100644--- a/tests/page/expect-boolean.spec.ts+++ b/tests/page/expect-boolean.spec.ts@@ -56,7 +56,7 @@ test.describe('toBeChecked', () => {const locator = page.locator('input');const error = await expect(locator).toBeChecked({ timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).toBeChecked()`);- expect(stripAnsi(error.message)).toContain(`- Expect toBeChecked with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toBeChecked" with timeout 1000ms`);});test('with not', async ({ page }) => {@@ -76,7 +76,7 @@ test.describe('toBeChecked', () => {const locator = page.locator('input');const error = await expect(locator).not.toBeChecked({ timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).not.toBeChecked()`);- expect(stripAnsi(error.message)).toContain(`- Expect not toBeChecked with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "not toBeChecked" with timeout 1000ms`);expect(stripAnsi(error.message)).toContain(`locator resolved to <input checked type="checkbox"/>`);});@@ -85,7 +85,7 @@ test.describe('toBeChecked', () => {const locator = page.locator('input');const error = await expect(locator).toBeChecked({ checked: false, timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).toBeChecked({ checked: false })`);- expect(stripAnsi(error.message)).toContain(`- Expect toBeChecked with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toBeChecked" with timeout 1000ms`);expect(stripAnsi(error.message)).toContain(`locator resolved to <input checked type="checkbox"/>`);});@@ -94,7 +94,7 @@ test.describe('toBeChecked', () => {const locator = page.locator('input');const error = await expect(locator).toBeChecked({ indeterminate: true, timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).toBeChecked({ indeterminate: true })`);- expect(stripAnsi(error.message)).toContain(`- Expect toBeChecked with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toBeChecked" with timeout 1000ms`);});test('fail missing', async ({ page }) => {@@ -102,7 +102,7 @@ test.describe('toBeChecked', () => {const locator2 = page.locator('input2');const error = await expect(locator2).not.toBeChecked({ timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).not.toBeChecked()`);- expect(stripAnsi(error.message)).toContain(`- Expect not toBeChecked with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "not toBeChecked" with timeout 1000ms`);expect(stripAnsi(error.message)).toContain(`- waiting for locator(\'input2\')`);});@@ -440,7 +440,7 @@ test.describe('toBeHidden', () => {const locator = page.locator('button');const error = await expect(locator).not.toBeHidden({ timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).not.toBeHidden()`);- expect(stripAnsi(error.message)).toContain(`- Expect not toBeHidden with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "not toBeHidden" with timeout 1000ms`);});test('with impossible timeout .not', async ({ page }) => {diff --git a/tests/page/expect-misc.spec.ts b/tests/page/expect-misc.spec.tsindex 4e03044cfb..b60968331d 100644--- a/tests/page/expect-misc.spec.ts+++ b/tests/page/expect-misc.spec.ts@@ -69,7 +69,7 @@ test.describe('toHaveCount', () => {const locator = page.locator('span');const error = await expect(locator).toHaveCount(0, { timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).toHaveCount(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect toHaveCount with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toHaveCount" with timeout 1000ms`);});test('fail zero 2', async ({ page }) => {@@ -77,7 +77,7 @@ test.describe('toHaveCount', () => {const locator = page.locator('span');const error = await expect(locator).not.toHaveCount(1, { timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).not.toHaveCount(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect not toHaveCount with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "not toHaveCount" with timeout 1000ms`);});});@@ -110,7 +110,7 @@ test.describe('toHaveJSProperty', () => {const locator = page.locator('div');const error = await expect(locator).toHaveJSProperty('foo', 'error', { timeout: 200 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 200ms waiting for expect(locator).toHaveJSProperty(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect toHaveJSProperty with timeout 200ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toHaveJSProperty" with timeout 200ms`);});test('pass number', async ({ page }) => {@@ -126,7 +126,7 @@ test.describe('toHaveJSProperty', () => {const locator = page.locator('div');const error = await expect(locator).toHaveJSProperty('foo', 1, { timeout: 200 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 200ms waiting for expect(locator).toHaveJSProperty(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect toHaveJSProperty with timeout 200ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toHaveJSProperty" with timeout 200ms`);});test('pass boolean', async ({ page }) => {@@ -142,7 +142,7 @@ test.describe('toHaveJSProperty', () => {const locator = page.locator('div');const error = await expect(locator).toHaveJSProperty('foo', true, { timeout: 200 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 200ms waiting for expect(locator).toHaveJSProperty(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect toHaveJSProperty with timeout 200ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toHaveJSProperty" with timeout 200ms`);});test('pass boolean 2', async ({ page }) => {@@ -158,7 +158,7 @@ test.describe('toHaveJSProperty', () => {const locator = page.locator('div');const error = await expect(locator).toHaveJSProperty('foo', true, { timeout: 200 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 200ms waiting for expect(locator).toHaveJSProperty(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect toHaveJSProperty with timeout 200ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toHaveJSProperty" with timeout 200ms`);});test('pass undefined', async ({ page }) => {@@ -212,7 +212,7 @@ test.describe('toHaveClass', () => {const locator = page.locator('div');const error = await expect(locator).toHaveClass('foo bar baz', { timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).toHaveClass(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect toHaveClass with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toHaveClass" with timeout 1000ms`);});test('pass with array', async ({ page }) => {@@ -226,7 +226,7 @@ test.describe('toHaveClass', () => {const locator = page.locator('div');const error = await expect(locator).toHaveClass(['foo', 'bar', /[a-z]az/], { timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).toHaveClass(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect toHaveClass with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toHaveClass" with timeout 1000ms`);});});@@ -252,7 +252,7 @@ test.describe('toContainClass', () => {const locator = page.locator('div');const error = await expect(locator).toContainClass('does-not-exist', { timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).toContainClass(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect toContainClass with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toContainClass" with timeout 1000ms`);});test('pass with array', async ({ page }) => {@@ -269,7 +269,7 @@ test.describe('toContainClass', () => {const locator = page.locator('div');const error = await expect(locator).toContainClass(['foo', 'bar', 'baz'], { timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).toContainClass(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect toContainClass with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toContainClass" with timeout 1000ms`);});});@@ -283,7 +283,7 @@ test.describe('toHaveTitle', () => {await page.setContent('<title>Bye</title>');const error = await expect(page).toHaveTitle('Hello', { timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(page).toHaveTitle(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect toHaveTitle with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toHaveTitle" with timeout 1000ms`);});});@@ -353,12 +353,12 @@ test.describe('toHaveAttribute', () => {{const error = await expect(locator).toHaveAttribute('disabled', '', { timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).toHaveAttribute(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect toHaveAttribute with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toHaveAttribute" with timeout 1000ms`);}{const error = await expect(locator).toHaveAttribute('disabled', /.*/, { timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).toHaveAttribute(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect toHaveAttribute with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toHaveAttribute" with timeout 1000ms`);}await expect(locator).not.toHaveAttribute('disabled', '');await expect(locator).not.toHaveAttribute('disabled', /.*/);@@ -372,12 +372,12 @@ test.describe('toHaveAttribute', () => {{const error = await expect(locator).not.toHaveAttribute('checked', '', { timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).not.toHaveAttribute(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect not toHaveAttribute with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "not toHaveAttribute" with timeout 1000ms`);}{const error = await expect(locator).not.toHaveAttribute('checked', /.*/, { timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).not.toHaveAttribute(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect not toHaveAttribute with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "not toHaveAttribute" with timeout 1000ms`);}});diff --git a/tests/page/expect-to-have-text.spec.ts b/tests/page/expect-to-have-text.spec.tsindex aec9ecb24d..8f6cc170b3 100644--- a/tests/page/expect-to-have-text.spec.ts+++ b/tests/page/expect-to-have-text.spec.ts@@ -209,7 +209,7 @@ test.describe('toHaveText with array', () => {const locator = page.locator('p');const error = await expect(locator).not.toHaveText([], { timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).not.toHaveText(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect not toHaveText with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "not toHaveText" with timeout 1000ms`);});test('pass eventually empty', async ({ page }) => {@@ -227,7 +227,7 @@ test.describe('toHaveText with array', () => {const error = await expect(locator).toHaveText(['Text 1', /Text \d/, 'Extra'], { timeout: 1000 }).catch(e => e);expect(stripAnsi(error.message)).toContain('- "Extra"');expect(stripAnsi(error.message)).toContain(`Timed out 1000ms waiting for expect(locator).toHaveText(expected)`);- expect(stripAnsi(error.message)).toContain(`- Expect toHaveText with timeout 1000ms`);+ expect(stripAnsi(error.message)).toContain(`- Expect "toHaveText" with timeout 1000ms`);expect(stripAnsi(error.message)).toContain('waiting for locator(\'div\')');expect(stripAnsi(error.message)).toContain('locator resolved to 2 elements');});diff --git a/tests/playwright-test/aria-snapshot-file.spec.ts b/tests/playwright-test/aria-snapshot-file.spec.tsindex 36b8d8697b..768b8d0e72 100644--- a/tests/playwright-test/aria-snapshot-file.spec.ts+++ b/tests/playwright-test/aria-snapshot-file.spec.ts@@ -172,7 +172,7 @@ for (const updateSnapshots of ['all', 'changed', 'missing', 'none']) {const data = fs.readFileSync(snapshotOutputPath);expect(data.toString()).toBe('- heading "New content" [level=1]');} else {- expect(result.output).toContain(`Expect toMatchAriaSnapshot`);+ expect(result.output).toContain(`Expect "toMatchAriaSnapshot"`);}});}diff --git a/tests/playwright-test/playwright.connect.spec.ts b/tests/playwright-test/playwright.connect.spec.tsindex b9d32c5a0f..34575c0ced 100644--- a/tests/playwright-test/playwright.connect.spec.ts+++ b/tests/playwright-test/playwright.connect.spec.ts@@ -215,16 +215,16 @@ test('should record trace', async ({ runInlineTest }) => {const trace = await parseTrace(test.info().outputPath('test-results', 'a-fail', 'trace.zip'));expect(trace.titles).toEqual(['Before Hooks',- 'fixture: context',+ 'Fixture "context"','Create context',- 'fixture: page',+ 'Fixture "page"','Create page',- 'Expect toBe',+ 'Expect "toBe"','After Hooks',- 'fixture: page',- 'fixture: context',+ 'Fixture "page"',+ 'Fixture "context"','Attach "error-context-0"','Worker Cleanup',- 'fixture: browser',+ 'Fixture "browser"',]);});diff --git a/tests/playwright-test/playwright.reuse.browser.spec.ts b/tests/playwright-test/playwright.reuse.browser.spec.tsindex ef66ab29cb..bce0515314 100644--- a/tests/playwright-test/playwright.reuse.browser.spec.ts+++ b/tests/playwright-test/playwright.reuse.browser.spec.ts@@ -105,10 +105,10 @@ test('should produce correct test steps', async ({ runInlineTest, runServer }) ='reporter.ts': `class Reporter {onStepBegin(test, result, step) {- console.log('%% onStepBegin ' + step.title);+ console.log('%% onStepBegin [' + step.category + '] ' + step.title);}onStepEnd(test, result, step) {- console.log('%% onStepEnd ' + step.title);+ console.log('%% onStepEnd [' + step.category + '] ' + step.title);}}module.exports = Reporter;@@ -125,27 +125,27 @@ test('should produce correct test steps', async ({ runInlineTest, runServer }) =expect(result.exitCode).toBe(0);expect(result.passed).toBe(1);expect(result.outputLines).toEqual([- 'onStepBegin Before Hooks',- 'onStepBegin fixture: browser',- 'onStepBegin connect',- 'onStepEnd connect',- 'onStepEnd fixture: browser',- 'onStepBegin fixture: context',- 'onStepEnd fixture: context',- 'onStepBegin fixture: page',- 'onStepBegin Create page',- 'onStepEnd Create page',- 'onStepEnd fixture: page',- 'onStepEnd Before Hooks',- 'onStepBegin Navigate to "about:blank"',- 'onStepEnd Navigate to "about:blank"',- 'onStepBegin Evaluate',- 'onStepEnd Evaluate',- 'onStepBegin After Hooks',- 'onStepBegin fixture: page',- 'onStepEnd fixture: page',- 'onStepBegin fixture: context',- 'onStepEnd fixture: context',- 'onStepEnd After Hooks'+ 'onStepBegin [hook] Before Hooks',+ 'onStepBegin [fixture] browser',+ 'onStepBegin [pw:api] connect',+ 'onStepEnd [pw:api] connect',+ 'onStepEnd [fixture] browser',+ 'onStepBegin [fixture] context',+ 'onStepEnd [fixture] context',+ 'onStepBegin [fixture] page',+ 'onStepBegin [pw:api] Create page',+ 'onStepEnd [pw:api] Create page',+ 'onStepEnd [fixture] page',+ 'onStepEnd [hook] Before Hooks',+ 'onStepBegin [pw:api] Navigate to "about:blank"',+ 'onStepEnd [pw:api] Navigate to "about:blank"',+ 'onStepBegin [pw:api] Evaluate',+ 'onStepEnd [pw:api] Evaluate',+ 'onStepBegin [hook] After Hooks',+ 'onStepBegin [fixture] page',+ 'onStepEnd [fixture] page',+ 'onStepBegin [fixture] context',+ 'onStepEnd [fixture] context',+ 'onStepEnd [hook] After Hooks']);});diff --git a/tests/playwright-test/playwright.reuse.spec.ts b/tests/playwright-test/playwright.reuse.spec.tsindex cc2c071a07..6f863fd717 100644--- a/tests/playwright-test/playwright.reuse.spec.ts+++ b/tests/playwright-test/playwright.reuse.spec.ts@@ -128,16 +128,16 @@ test('should reuse context with trace if mode=when-possible', async ({ runInlineexpect(trace1.actionTree).toEqual(['Before Hooks',' beforeAll hook',- ' fixture: browser',+ ' Fixture "browser"',' Launch browser',- ' fixture: context',- ' fixture: page',+ ' Fixture "context"',+ ' Fixture "page"',' Create page','Set content','Click','After Hooks',- ' fixture: page',- ' fixture: context',+ ' Fixture "page"',+ ' Fixture "context"',]);expect(trace1.traceModel.storage().snapshotsForTest().length).toBeGreaterThan(0);expect(fs.existsSync(testInfo.outputPath('test-results', 'reuse-one', 'trace-1.zip'))).toBe(false);@@ -145,15 +145,15 @@ test('should reuse context with trace if mode=when-possible', async ({ runInlineconst trace2 = await parseTrace(testInfo.outputPath('test-results', 'reuse-two', 'trace.zip'));expect(trace2.actionTree).toEqual(['Before Hooks',- ' fixture: context',- ' fixture: page',- 'Expect toBe',+ ' Fixture "context"',+ ' Fixture "page"',+ 'Expect "toBe"','Set content','Fill "value"','Click','After Hooks',- ' fixture: page',- ' fixture: context',+ ' Fixture "page"',+ ' Fixture "context"',' afterAll hook',]);expect(trace2.traceModel.storage().snapshotsForTest().length).toBeGreaterThan(0);diff --git a/tests/playwright-test/playwright.trace.spec.ts b/tests/playwright-test/playwright.trace.spec.tsindex 256ce335d4..c65a8c8907 100644--- a/tests/playwright-test/playwright.trace.spec.ts+++ b/tests/playwright-test/playwright.trace.spec.ts@@ -89,20 +89,20 @@ test('should record api trace', async ({ runInlineTest, server }, testInfo) => {const trace1 = await parseTrace(testInfo.outputPath('test-results', 'a-pass', 'trace.zip'));expect(trace1.actionTree).toEqual(['Before Hooks',- ' fixture: request',+ ' Fixture "request"',' Create request context',- ' fixture: browser',+ ' Fixture "browser"',' Launch browser',- ' fixture: context',+ ' Fixture "context"',' Create context',- ' fixture: page',+ ' Fixture "page"',' Create page','Navigate to "about:blank"','Fetch "/empty.html"','After Hooks',- ' fixture: page',- ' fixture: context',- ' fixture: request',+ ' Fixture "page"',+ ' Fixture "context"',+ ' Fixture "request"',]);const trace2 = await parseTrace(testInfo.outputPath('test-results', 'a-api-pass', 'trace.zip'));expect(trace2.actionTree).toEqual([@@ -114,22 +114,22 @@ test('should record api trace', async ({ runInlineTest, server }, testInfo) => {const trace3 = await parseTrace(testInfo.outputPath('test-results', 'a-fail', 'trace.zip'));expect(trace3.actionTree).toEqual(['Before Hooks',- ' fixture: request',+ ' Fixture "request"',' Create request context',- ' fixture: context',+ ' Fixture "context"',' Create context',- ' fixture: page',+ ' Fixture "page"',' Create page','Navigate to "about:blank"','Fetch "/empty.html"',- 'Expect toBe',+ 'Expect "toBe"','After Hooks',- ' fixture: page',- ' fixture: context',- ' fixture: request',+ ' Fixture "page"',+ ' Fixture "context"',+ ' Fixture "request"','Attach "error-context-0"','Worker Cleanup',- ' fixture: browser',+ ' Fixture "browser"',]);});@@ -316,23 +316,23 @@ test('should not override trace file in afterAll', async ({ runInlineTest, serveexpect(trace1.actionTree).toEqual(['Before Hooks',- ' fixture: browser',+ ' Fixture "browser"',' Launch browser',- ' fixture: context',+ ' Fixture "context"',' Create context',- ' fixture: page',+ ' Fixture "page"',' Create page','Navigate to "about:blank"','After Hooks',- ' fixture: page',- ' fixture: context',+ ' Fixture "page"',+ ' Fixture "context"',' afterAll hook',- ' fixture: request',+ ' Fixture "request"',' Create request context',' Fetch "/empty.html"',- ' fixture: request',+ ' Fixture "request"','Worker Cleanup',- ' fixture: browser',+ ' Fixture "browser"',]);expect(trace1.errors).toEqual([`'oh no!'`]);@@ -530,7 +530,7 @@ test('should include attachments by default', async ({ runInlineTest, server },const trace = await parseTrace(testInfo.outputPath('test-results', 'a-pass', 'trace.zip'));expect(trace.titles).toEqual(['Before Hooks',- `attach "foo"`,+ 'Attach "foo"','After Hooks',]);expect(trace.actions[1].attachments).toEqual([{@@ -560,7 +560,7 @@ test('should opt out of attachments', async ({ runInlineTest, server }, testInfoconst trace = await parseTrace(testInfo.outputPath('test-results', 'a-pass', 'trace.zip'));expect(trace.titles).toEqual(['Before Hooks',- `attach "foo"`,+ `Attach "foo"`,'After Hooks',]);expect(trace.actions[1].attachments).toEqual(undefined);@@ -618,22 +618,22 @@ test('should expand expect.toPass', async ({ runInlineTest }, testInfo) => {const trace = await parseTrace(testInfo.outputPath('test-results', 'a-pass', 'trace.zip'));expect(trace.actionTree).toEqual(['Before Hooks',- ' fixture: browser',+ ' Fixture "browser"',' Launch browser',- ' fixture: context',+ ' Fixture "context"',' Create context',- ' fixture: page',+ ' Fixture "page"',' Create page',- 'Expect toPass',+ 'Step "toPass"',' Navigate to "data:"',- ' Expect toBe',+ ' Expect "toBe"',' Navigate to "data:"',- ' Expect toBe',+ ' Expect "toBe"',' Navigate to "data:"',- ' Expect toBe',+ ' Expect "toBe"','After Hooks',- ' fixture: page',- ' fixture: context',+ ' Fixture "page"',+ ' Fixture "context"',]);});@@ -657,18 +657,18 @@ test('should show non-expect error in trace', async ({ runInlineTest }, testInfoconst trace = await parseTrace(testInfo.outputPath('test-results', 'a-fail', 'trace.zip'));expect(trace.actionTree).toEqual(['Before Hooks',- ' fixture: browser',+ ' Fixture "browser"',' Launch browser',- ' fixture: context',+ ' Fixture "context"',' Create context',- ' fixture: page',+ ' Fixture "page"',' Create page',- 'Expect toBe',+ 'Expect "toBe"','After Hooks',- ' fixture: page',- ' fixture: context',+ ' Fixture "page"',+ ' Fixture "context"','Worker Cleanup',- ' fixture: browser',+ ' Fixture "browser"',]);expect(trace.errors).toEqual(['ReferenceError: undefinedVariable1 is not defined']);});@@ -785,16 +785,16 @@ test('should use custom expect message in trace', async ({ runInlineTest }, testconst trace = await parseTrace(testInfo.outputPath('test-results', 'a-fail', 'trace.zip'));expect(trace.actionTree).toEqual(['Before Hooks',- ' fixture: browser',+ ' Fixture "browser"',' Launch browser',- ' fixture: context',+ ' Fixture "context"',' Create context',- ' fixture: page',+ ' Fixture "page"',' Create page',- 'expect to have text: find a hotel',+ 'Expect "expect to have text: find a hotel"','After Hooks',- ' fixture: page',- ' fixture: context',+ ' Fixture "page"',+ ' Fixture "context"',]);});@@ -936,64 +936,64 @@ test('should record nested steps, even after timeout', async ({ runInlineTest },expect(trace.actionTree).toEqual(['Before Hooks',' beforeAll hook',- ' fixture: browser',+ ' Fixture "browser"',' Launch browser',- ' fixture: barPage',- ' barPage setup',+ ' Fixture "barPage"',+ ' Expect "barPage setup"',' Create page',- ' step in barPage setup',+ ' Step "step in barPage setup"',' Set content',- ' beforeAll start',+ ' Expect "beforeAll start"',' Set content',- ' step in beforeAll',+ ' Step "step in beforeAll"',' Set content',- ' fixture: barPage',- ' barPage teardown',- ' step in barPage teardown',+ ' Fixture "barPage"',+ ' Expect "barPage teardown"',+ ' Step "step in barPage teardown"',' Close context',' beforeEach hook',- ' fixture: context',+ ' Fixture "context"',' Create context',- ' fixture: page',+ ' Fixture "page"',' Create page',- ' fixture: fooPage',- ' fooPage setup',+ ' Fixture "fooPage"',+ ' Expect "fooPage setup"',' Set content',- ' step in fooPage setup',+ ' Step "step in fooPage setup"',' Set content',- ' beforeEach start',+ ' Expect "beforeEach start"',' Set content',- ' step in beforeEach',+ ' Step "step in beforeEach"',' Set content','After Hooks',' afterEach hook',- ' afterEach start',+ ' Expect "afterEach start"',' Set content',- ' step in afterEach',+ ' Step "step in afterEach"',' Set content',- ' fixture: fooPage',- ' fooPage teardown',+ ' Fixture "fooPage"',+ ' Expect "fooPage teardown"',' Set content',- ' step in fooPage teardown',+ ' Step "step in fooPage teardown"',' Set content',- ' fixture: page',- ' fixture: context',+ ' Fixture "page"',+ ' Fixture "context"',' afterAll hook',- ' fixture: barPage',- ' barPage setup',+ ' Fixture "barPage"',+ ' Expect "barPage setup"',' Create page',- ' step in barPage setup',+ ' Step "step in barPage setup"',' Set content',- ' afterAll start',+ ' Expect "afterAll start"',' Set content',- ' step in afterAll',+ ' Step "step in afterAll"',' Set content',- ' fixture: barPage',- ' barPage teardown',- ' step in barPage teardown',+ ' Fixture "barPage"',+ ' Expect "barPage teardown"',+ ' Step "step in barPage teardown"',' Close context','Worker Cleanup',- ' fixture: browser',+ ' Fixture "browser"',]);});@@ -1023,19 +1023,19 @@ test('should not produce an action entry for calling a binding', async ({ runInlconst trace = await parseTrace(testInfo.outputPath('test-results', 'a-passes', 'trace.zip'));expect(trace.actionTree).toEqual(['Before Hooks',- ' fixture: browser',+ ' Fixture "browser"',' Launch browser',- ' fixture: context',+ ' Fixture "context"',' Create context',- ' fixture: page',+ ' Fixture "page"',' Create page','Expose binding','Evaluate',- 'Expect toBe',- 'Expect toBe',+ 'Expect "toBe"',+ 'Expect "toBe"','After Hooks',- ' fixture: page',- ' fixture: context',+ ' Fixture "page"',+ ' Fixture "context"',]);});@@ -1071,8 +1071,8 @@ test('should attribute worker fixture teardown to the right test', async ({ runIconst trace1 = await parseTrace(testInfo.outputPath('test-results', 'a-one', 'trace.zip'));expect(trace1.actionTree).toEqual(['Before Hooks',- ' fixture: foo',- ' step in foo setup',+ ' Fixture "foo"',+ ' Expect "step in foo setup"','After Hooks',]);const trace2 = await parseTrace(testInfo.outputPath('test-results', 'a-two', 'trace.zip'));@@ -1080,8 +1080,8 @@ test('should attribute worker fixture teardown to the right test', async ({ runI'Before Hooks','After Hooks','Worker Cleanup',- ' fixture: foo',- ' step in foo teardown',+ ' Fixture "foo"',+ ' Expect "step in foo teardown"',]);});@@ -1182,12 +1182,12 @@ test('should not corrupt actions when no library trace is present', async ({ runconst trace = await parseTrace(tracePath);expect(trace.actionTree).toEqual(['Before Hooks',- ' fixture: foo',- ' Expect toBe',- 'Expect toBe',+ ' Fixture "foo"',+ ' Expect "toBe"',+ 'Expect "toBe"','After Hooks',- ' fixture: foo',- ' Expect toBe',+ ' Fixture "foo"',+ ' Expect "toBe"','Attach "error-context-0"','Worker Cleanup',]);@@ -1213,15 +1213,15 @@ test('should record trace for manually created context in a failed test', asyncconst trace = await parseTrace(tracePath);expect(trace.actionTree).toEqual(['Before Hooks',- ' fixture: browser',+ ' Fixture "browser"',' Launch browser','Create page','Set content',- 'Expect toBe',+ 'Expect "toBe"','After Hooks','Attach "error-context-0"','Worker Cleanup',- ' fixture: browser',+ ' Fixture "browser"',]);// Check console events to make sure that library trace is recorded.expect(trace.events).toContainEqual(expect.objectContaining({ type: 'console', text: 'from the page' }));@@ -1256,18 +1256,18 @@ test('should not nest top level expect into unfinished api calls ', {const trace = await parseTrace(tracePath);expect(trace.actionTree).toEqual(['Before Hooks',- ' fixture: browser',+ ' Fixture "browser"',' Launch browser',- ' fixture: context',+ ' Fixture "context"',' Create context',- ' fixture: page',+ ' Fixture "page"',' Create page','Navigate to "/index"','Fetch "/hang"',- 'Expect toBeVisible',+ 'Expect "toBeVisible"','After Hooks',- ' fixture: page',- ' fixture: context',+ ' Fixture "page"',+ ' Fixture "context"',]);});@@ -1296,18 +1296,18 @@ test('should record trace after fixture teardown timeout', {const trace = await parseTrace(tracePath);expect(trace.actionTree).toEqual(['Before Hooks',- ' fixture: browser',+ ' Fixture "browser"',' Launch browser',- ' fixture: context',+ ' Fixture "context"',' Create context',- ' fixture: page',+ ' Fixture "page"',' Create page',- ' fixture: fixture',+ ' Fixture "fixture"','Evaluate','After Hooks',- ' fixture: fixture',+ ' Fixture "fixture"','Worker Cleanup',- ' fixture: browser',+ ' Fixture "browser"',]);// Check console events to make sure that library trace is recorded.expect(trace.events).toContainEqual(expect.objectContaining({ type: 'console', text: 'from the page' }));@@ -1333,12 +1333,12 @@ test('should record trace snapshot for more obscure commands', async ({ runInlinconst trace = await parseTrace(tracePath);expect(trace.actionTree).toEqual(['Before Hooks',- ' fixture: browser',+ ' Fixture "browser"',' Launch browser','Create page','Set content','Query count',- 'Expect toBe',+ 'Expect "toBe"','Bounding box','After Hooks',]);diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.tsindex 116cde07a9..2b7be0dbab 100644--- a/tests/playwright-test/reporter-blob.spec.ts+++ b/tests/playwright-test/reporter-blob.spec.ts@@ -711,7 +711,7 @@ test('generate html with attachment urls', async ({ runInlineTest, mergeReports,await expect(page).toHaveTitle('Playwright Trace Viewer');await expect(page.getByTestId('actions-tree')).toMatchAriaSnapshot(`- tree:- - treeitem /Expect toBe \\d+[hmsp]+/ [selected]+ - treeitem /Expect "toBe" \\d+[hmsp]+/ [selected]`);});@@ -1210,15 +1210,15 @@ test('preserve steps in html report', async ({ runInlineTest, mergeReports, showawait page.getByText('Before Hooks').click();await page.getByText('beforeAll hook').click();- await expect(page.getByText('EXPECT toBe')).toBeVisible();+ await expect(page.getByText('Expect "toBe"')).toBeVisible();// Collapse hooks.await page.getByText('Before Hooks').click();- await expect(page.getByText('EXPECT toBe')).not.toBeVisible();+ await expect(page.getByText('Expect "toBe"')).not.toBeVisible();// Check that 'my step' location is relative.await expect(page.getByText('— tests/a.test.js:7')).toBeVisible();await page.getByText('my step').click();- await expect(page.getByText('EXPECT toBe')).toBeVisible();+ await expect(page.getByText('Expect "toBe"')).toBeVisible();});test('support fileName option', async ({ runInlineTest, mergeReports }) => {diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.tsindex 3bf35b26d8..1a37a6f3ca 100644--- a/tests/playwright-test/reporter-html.spec.ts+++ b/tests/playwright-test/reporter-html.spec.ts@@ -771,7 +771,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {await showReport();await page.getByRole('link', { name: 'example' }).click();await page.click('text=step title');- await page.click('text=EXPECT toBe');+ await page.click('text=Expect "toBe"');await expect(page.getByTestId('test-snippet')).toContainText([`await test.step('step title', async () => {`,'expect(1).toBe(1);',@@ -801,7 +801,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {await showReport();await page.getByRole('link', { name: 'example' }).click();- await page.click('text=skipped step title (skipped)');+ await page.click('text=Step "skipped step title" (skipped)');await expect(page.getByTestId('test-snippet')).toContainText(`await test.step.skip('skipped step title', async () => {`);});@@ -826,7 +826,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {await showReport();await page.getByRole('link', { name: 'example' }).click();- await page.click('text=step title (skipped: conditional step.skip)');+ await page.click('text=Step "step title" (skipped: conditional step.skip)');await expect(page.getByTestId('test-snippet')).toContainText(`await test.step('step title', async (step) => {`);});@@ -1215,8 +1215,8 @@ for (const useIntermediateMergeReport of [true, false] as const) {await page.locator('text=sample').first().click();await expect(page.locator('.tree-item-title')).toContainText([- /Expect toBe.*10/,- /Expect toEqual.*20/,+ /Expect "toBe".*10/,+ /Expect "toEqual".*20/,]);});@@ -1243,11 +1243,11 @@ for (const useIntermediateMergeReport of [true, false] as const) {await showReport();await page.getByRole('link', { name: 'sample' }).click();await page.getByText('Before Hooks').click();- await expect(page.getByText('fixture: custom fixture name')).toBeVisible();+ await expect(page.getByText('Fixture "custom fixture name"')).toBeVisible();await expect(page.locator('.tree-item-title')).toHaveText([/Before Hooks/,- /fixture: custom fixture/,- /fixture: fixture2/,+ /Fixture "custom fixture name"/,+ /Fixture "fixture2"/,/After Hooks/,]);});@@ -1266,7 +1266,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {await expect(page.locator('text=a.spec.js')).toBeVisible();await page.locator('text=sample').first().click();await expect(page.locator('.tree-item-title')).toContainText([- /Expect toBe/,+ /Expect "toBe"/,]);});diff --git a/tests/playwright-test/reporter.spec.ts b/tests/playwright-test/reporter.spec.tsindex 6f7403d35c..1e28e8b288 100644--- a/tests/playwright-test/reporter.spec.ts+++ b/tests/playwright-test/reporter.spec.ts@@ -87,7 +87,7 @@ class Reporter {onStepEnd(test, result, step) {if (this.options.printSteps) {- console.log('onStepEnd: ' + step.title);+ console.log('onStepEnd: [' + step.category + '] ' + step.title);if (step.error)this.printErrors([step.error]);}@@ -479,8 +479,8 @@ var import_test = __toModule(require("@playwright/test"));expect(result.output).toBe(`onBegin: 1 tests totalonTestBegin: > a.spec.js > test; retry #0-onStepEnd: Before Hooks-onStepEnd: Expect toBe+onStepEnd: [hook] Before Hooks+onStepEnd: [expect] toBeerror: Error: expect(received).toBe(expected) // Object.is equality @ a.spec.js:5======3 | test('test', async () => {@@ -491,7 +491,7 @@ onStepEnd: Expect toBe7 | });8 |======-onStepEnd: step+onStepEnd: [test.step] steperror: Error: expect(received).toBe(expected) // Object.is equality @ a.spec.js:5======3 | test('test', async () => {@@ -502,8 +502,8 @@ onStepEnd: step7 | });8 |======-onStepEnd: After Hooks-onStepEnd: Worker Cleanup+onStepEnd: [hook] After Hooks+onStepEnd: [hook] Worker CleanuponTestEnd: > a.spec.js > test; retry #0error: Error: expect(received).toBe(expected) // Object.is equality @ a.spec.js:5======@@ -775,7 +775,7 @@ test('step.attach attachments are reported on right steps', async ({ runInlineTetest('attachments are reported in onStepEnd', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/14364' } }, async ({ runInlineTest }) => {class TestReporter implements Reporter {onStepEnd(test: TestCase, result: TestResult, step: TestStep) {- console.log(`%%${step.title}: ${result.attachments.length} attachments in result`);+ console.log(`%%[${step.category}] ${step.title}: ${result.attachments.length} attachments in result`);}}const result = await runInlineTest({@@ -794,9 +794,9 @@ test('attachments are reported in onStepEnd', { annotation: { type: 'issue', des}, { 'reporter': '', 'workers': 1 });expect(result.outputLines).toEqual([- 'Before Hooks: 0 attachments in result',- 'step: 1 attachments in result',- 'attach "4": 2 attachments in result',- 'After Hooks: 2 attachments in result',+ '[hook] Before Hooks: 0 attachments in result',+ '[test.step] step: 1 attachments in result',+ '[test.attach] 4: 2 attachments in result',+ '[hook] After Hooks: 2 attachments in result',]);});diff --git a/tests/playwright-test/test-step.spec.ts b/tests/playwright-test/test-step.spec.tsindex 467364f905..1c99f4f950 100644--- a/tests/playwright-test/test-step.spec.ts+++ b/tests/playwright-test/test-step.spec.ts@@ -138,11 +138,11 @@ test('should report api step hierarchy', async ({ runInlineTest }) => {expect(result.exitCode).toBe(0);expect(result.output).toBe(`hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create pagetest.step |outer step 1 @ a.test.ts:4test.step | inner step 1.1 @ a.test.ts:5@@ -151,8 +151,8 @@ test.step |outer step 2 @ a.test.ts:8test.step | inner step 2.1 @ a.test.ts:9test.step | inner step 2.2 @ a.test.ts:10hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | context`);});@@ -207,18 +207,18 @@ test('should not report nested after hooks', async ({ runInlineTest }) => {expect(result.exitCode).toBe(1);expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create pagetest.step |my step @ a.test.ts:4hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | contexthook |Worker Cleanup-fixture | fixture: browser+fixture | browser|Test timeout of 2000ms exceeded.`);});@@ -265,20 +265,20 @@ test('should report test.step from fixtures', async ({ runInlineTest }) => {expect(result.exitCode).toBe(0);expect(result.outputLines).toEqual([`begin Before Hooks`,- `begin fixture: foo`,+ `begin foo`,`begin setup foo`,`end setup foo`,- `end fixture: foo`,+ `end foo`,`end Before Hooks`,`begin test step`,`begin inside foo`,`end inside foo`,`end test step`,`begin After Hooks`,- `begin fixture: foo`,+ `begin foo`,`begin teardown foo`,`end teardown foo`,- `end fixture: foo`,+ `end foo`,`end After Hooks`,]);});@@ -302,7 +302,7 @@ test('should report expect step locations', async ({ runInlineTest }) => {expect(result.exitCode).toBe(0);expect(result.output).toBe(`hook |Before Hooks-expect |Expect toBeTruthy @ a.test.ts:4+expect |toBeTruthy @ a.test.ts:4hook |After Hooks`);});@@ -355,8 +355,8 @@ test('should report custom expect steps', async ({ runInlineTest }) => {expect(result.exitCode).toBe(1);expect(result.output).toBe(`hook |Before Hooks-expect |Expect toBeWithinRange @ a.test.ts:32-expect |Expect toBeFailingAsync @ a.test.ts:33+expect |toBeWithinRange @ a.test.ts:32+expect |toBeFailingAsync @ a.test.ts:33expect |↪ error: Error: It fails!hook |After Hookshook |Worker Cleanup@@ -487,7 +487,7 @@ test.step |outer @ a.test.ts:4test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step | inner @ a.test.ts:5test.step | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | Expect soft toBe @ a.test.ts:6+expect | soft toBe @ a.test.ts:6expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step |passing @ a.test.ts:9hook |After Hooks@@ -548,11 +548,11 @@ hook | beforeAll hook @ a.test.ts:3test.step | in beforeAll @ a.test.ts:4hook | beforeEach hook @ a.test.ts:11test.step | in beforeEach @ a.test.ts:12-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create pagetest.step |grand @ a.test.ts:20test.step | parent1 @ a.test.ts:22@@ -560,12 +560,12 @@ test.step | child1 @ a.test.ts:23pw:api | Click locator('body') @ a.test.ts:24test.step | parent2 @ a.test.ts:27test.step | child2 @ a.test.ts:28-expect | Expect toBeVisible @ a.test.ts:29+expect | toBeVisible @ a.test.ts:29hook |After Hookshook | afterEach hook @ a.test.ts:15test.step | in afterEach @ a.test.ts:16-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | contexthook | afterAll hook @ a.test.ts:7test.step | in afterAll @ a.test.ts:8`);@@ -603,7 +603,7 @@ test('should not mark page.close as failed when page.click fails', async ({ runIexpect(stripAnsi(result.output)).toBe(`hook |Before Hookshook | beforeAll hook @ a.test.ts:5-fixture | fixture: browser+fixture | browserpw:api | Launch browserpw:api | Create page @ a.test.ts:6pw:api |Set content @ a.test.ts:15@@ -613,7 +613,7 @@ hook |After Hookshook | afterAll hook @ a.test.ts:9pw:api | Close context @ a.test.ts:10hook |Worker Cleanup-fixture | fixture: browser+fixture | browser|Test timeout of 2000ms exceeded.|Error: page.click: Target page, context or browser has been closed`);@@ -637,12 +637,12 @@ test('should not propagate errors from within toPass', async ({ runInlineTest })expect(result.exitCode).toBe(0);expect(result.output).toBe(`hook |Before Hooks-step |Expect toPass @ a.test.ts:7-expect | Expect toBe @ a.test.ts:6+test.step |toPass @ a.test.ts:7+expect | toBe @ a.test.ts:6expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | Expect toBe @ a.test.ts:6+expect | toBe @ a.test.ts:6expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | Expect toBe @ a.test.ts:6+expect | toBe @ a.test.ts:6hook |After Hooks`);});@@ -664,9 +664,9 @@ test('should show final toPass error', async ({ runInlineTest }) => {expect(result.exitCode).toBe(1);expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-step |Expect toPass @ a.test.ts:6-step |↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | Expect toBe @ a.test.ts:5+test.step |toPass @ a.test.ts:6+test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equality+expect | toBe @ a.test.ts:5expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalityhook |After Hookshook |Worker Cleanup@@ -703,13 +703,13 @@ test.step |first outer @ a.test.ts:4test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step | first inner @ a.test.ts:5test.step | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | Expect soft toBe @ a.test.ts:6+expect | soft toBe @ a.test.ts:6expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step |second outer @ a.test.ts:10test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step | second inner @ a.test.ts:11test.step | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | Expect toBe @ a.test.ts:12+expect | toBe @ a.test.ts:12expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalityhook |After Hookshook |Worker Cleanup@@ -748,13 +748,13 @@ test('should not propagate nested hard errors', async ({ runInlineTest }) => {hook |Before Hookstest.step |first outer @ a.test.ts:4test.step | first inner @ a.test.ts:5-expect | Expect toBe @ a.test.ts:7+expect | toBe @ a.test.ts:7expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step |second outer @ a.test.ts:13test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step | second inner @ a.test.ts:14test.step | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | Expect toBe @ a.test.ts:15+expect | toBe @ a.test.ts:15expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalityhook |After Hookshook |Worker Cleanup@@ -783,7 +783,7 @@ test.step |boxed step @ a.test.ts:3test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equality @ a.test.ts:4test.step | at a.test.ts:4:27test.step | at a.test.ts:3:26-expect | Expect toBe @ a.test.ts:4+expect | toBe @ a.test.ts:4expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equality @ a.test.ts:4expect | at a.test.ts:4:27expect | at a.test.ts:3:26@@ -818,7 +818,7 @@ hook |Before Hookstest.step |boxed step @ a.test.ts:8test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equality @ a.test.ts:8test.step | at a.test.ts:8:21-expect | Expect toBe @ a.test.ts:5+expect | toBe @ a.test.ts:5expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equality @ a.test.ts:8expect | at a.test.ts:8:21hook |After Hooks@@ -851,7 +851,7 @@ hook |Before Hookstest.step |boxed step @ a.test.ts:8test.step |↪ error: Error: expect(received).toBe(expected) // Object.is equality @ a.test.ts:8test.step | at a.test.ts:8:21-expect | Expect soft toBe @ a.test.ts:5+expect | soft toBe @ a.test.ts:5expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equality @ a.test.ts:8expect | at a.test.ts:8:21hook |After Hooks@@ -882,21 +882,21 @@ test('should not generate dupes for named expects', async ({ runInlineTest }) =>expect(result.exitCode).toBe(0);expect(result.output).toBe(`hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create pagepw:api |Set content @ a.test.ts:4expect |Checking color @ a.test.ts:6hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | context`);});-test('step inside Expect toPass', async ({ runInlineTest }) => {+test('step inside toPass', async ({ runInlineTest }) => {test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30322' });const result = await runInlineTest({'reporter.ts': stepIndentReporter,@@ -930,21 +930,21 @@ test('step inside Expect toPass', async ({ runInlineTest }) => {expect(stripAnsi(result.output)).toBe(`hook |Before Hookstest.step |step 1 @ a.test.ts:4-step | Expect toPass @ a.test.ts:11+test.step | toPass @ a.test.ts:11test.step | step 2, attempt: 0 @ a.test.ts:7test.step | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | Expect toBe @ a.test.ts:9+expect | toBe @ a.test.ts:9expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitytest.step | step 2, attempt: 1 @ a.test.ts:7-expect | Expect toBe @ a.test.ts:9+expect | toBe @ a.test.ts:9test.step | step 3 @ a.test.ts:12test.step | step 4 @ a.test.ts:13-expect | Expect toBe @ a.test.ts:14+expect | toBe @ a.test.ts:14hook |After Hooks`);});-test('library API call inside Expect toPass', async ({ runInlineTest }) => {+test('library API call inside toPass', async ({ runInlineTest }) => {test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30322' });const result = await runInlineTest({'reporter.ts': stepIndentReporter,@@ -971,24 +971,24 @@ test('library API call inside Expect toPass', async ({ runInlineTest }) => {expect(result.exitCode).toBe(0);expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create page-step |Expect toPass @ a.test.ts:11+test.step |toPass @ a.test.ts:11pw:api | Navigate to "about:blank" @ a.test.ts:6test.step | inner step attempt: 0 @ a.test.ts:7test.step | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | Expect toBe @ a.test.ts:9+expect | toBe @ a.test.ts:9expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitypw:api | Navigate to "about:blank" @ a.test.ts:6test.step | inner step attempt: 1 @ a.test.ts:7-expect | Expect toBe @ a.test.ts:9+expect | toBe @ a.test.ts:9hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | context`);});@@ -1022,25 +1022,25 @@ test('library API call inside expect.poll', async ({ runInlineTest }) => {expect(result.exitCode).toBe(0);expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create page-step |Expect poll toHaveLength @ a.test.ts:14+test.step |poll toHaveLength @ a.test.ts:14pw:api | Navigate to "about:blank" @ a.test.ts:7test.step | inner step attempt: 0 @ a.test.ts:8-expect | Expect toBe @ a.test.ts:10-expect | Expect toHaveLength @ a.test.ts:6+expect | toBe @ a.test.ts:10+expect | toHaveLength @ a.test.ts:6expect | ↪ error: Error: expect(received).toHaveLength(expected)pw:api | Navigate to "about:blank" @ a.test.ts:7test.step | inner step attempt: 1 @ a.test.ts:8-expect | Expect toBe @ a.test.ts:10-expect | Expect toHaveLength @ a.test.ts:6+expect | toBe @ a.test.ts:10+expect | toHaveLength @ a.test.ts:6hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | context`);});@@ -1073,26 +1073,26 @@ test('web assertion inside expect.poll', async ({ runInlineTest }) => {expect(result.exitCode).toBe(0);expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create pagepw:api |Set content @ a.test.ts:4-step |Expect poll toBe @ a.test.ts:13-expect | Expect toHaveText @ a.test.ts:7+test.step |poll toBe @ a.test.ts:13+expect | toHaveText @ a.test.ts:7test.step | iteration 1 @ a.test.ts:9-expect | Expect toBeVisible @ a.test.ts:10-expect | Expect toBe @ a.test.ts:6+expect | toBeVisible @ a.test.ts:10+expect | toBe @ a.test.ts:6expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equality-expect | Expect toHaveText @ a.test.ts:7+expect | toHaveText @ a.test.ts:7test.step | iteration 2 @ a.test.ts:9-expect | Expect toBeVisible @ a.test.ts:10-expect | Expect toBe @ a.test.ts:6+expect | toBeVisible @ a.test.ts:10+expect | toBe @ a.test.ts:6hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | context`);});@@ -1122,26 +1122,26 @@ test('should report expect steps', async ({ runInlineTest }) => {expect(result.exitCode).toBe(1);expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-expect |Expect toBeTruthy @ a.test.ts:4-expect |Expect toBeTruthy @ a.test.ts:5+expect |toBeTruthy @ a.test.ts:4+expect |toBeTruthy @ a.test.ts:5expect |↪ error: Error: expect(received).toBeTruthy()hook |After Hookshook |Worker Cleanup|Error: expect(received).toBeTruthy()hook |Before Hooks-expect |Expect not toBeTruthy @ a.test.ts:8+expect |not toBeTruthy @ a.test.ts:8hook |After Hookshook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create page-expect |Expect not toHaveTitle @ a.test.ts:11+expect |not toHaveTitle @ a.test.ts:11hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | context`);});@@ -1206,13 +1206,13 @@ hook |After Hookshook | afterAll hook @ a.test.ts:31pw:api | Close context @ a.test.ts:32hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create page-fixture | fixture: request+fixture | requestpw:api | Create request contextpw:api |Wait for navigation @ a.test.ts:5pw:api |Navigate to "data:" @ a.test.ts:6@@ -1223,9 +1223,9 @@ pw:api |↪ error: <error message>pw:api |Fetch "/empty.html" @ a.test.ts:11pw:api |↪ error: <error message>hook |After Hooks-fixture | fixture: request-fixture | fixture: page-fixture | fixture: context+fixture | request+fixture | page+fixture | context`);});@@ -1249,20 +1249,20 @@ test('should report api step failure', async ({ runInlineTest }) => {expect(result.exitCode).toBe(1);expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create pagepw:api |Set content @ a.test.ts:4pw:api |Click locator('input') @ a.test.ts:5pw:api |↪ error: TimeoutError: page.click: Timeout 1ms exceeded.hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | contexthook |Worker Cleanup-fixture | fixture: browser+fixture | browser|TimeoutError: page.click: Timeout 1ms exceeded.`);});@@ -1286,17 +1286,17 @@ test('should show nice stacks for locators', async ({ runInlineTest }) => {expect(result.output).not.toContain('Internal error');expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create pagepw:api |Set content @ a.test.ts:4pw:api |Evaluate locator('button') @ a.test.ts:6hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | context`);});@@ -1372,11 +1372,11 @@ test('should show tracing.group nested inside test.step', async ({ runInlineTestexpect(result.exitCode).toBe(0);expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create pagetest.step |my step 1 @ a.test.ts:4test.step | my step 2 @ a.test.ts:5@@ -1384,8 +1384,8 @@ pw:api | Trace "my group 1" @ a.test.ts:6pw:api | Trace "my group 2" @ a.test.ts:7pw:api | Set content @ a.test.ts:8hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | context`);});@@ -1422,11 +1422,11 @@ test('calls from waitForEvent callback should be under its parent step', {expect(result.output).not.toContain('Internal error');expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create pagepw:api |Navigate to "/empty.html" @ a.test.ts:4pw:api |Set content @ a.test.ts:5@@ -1435,11 +1435,11 @@ pw:api | Wait for event "response" @ a.test.ts:7pw:api | Click locator('div') @ a.test.ts:14pw:api | Get content @ a.test.ts:8pw:api | Get content @ a.test.ts:9-expect | Expect toContainText @ a.test.ts:10-expect |Expect toBe @ a.test.ts:18+expect | toContainText @ a.test.ts:10+expect |toBe @ a.test.ts:18hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | context`);});@@ -1466,16 +1466,16 @@ test('reading network request / response should not be listed as step', {expect(result.exitCode).toBe(0);expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create pagepw:api |Navigate to "/empty.html" @ a.test.ts:10hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | context`);});@@ -1507,19 +1507,19 @@ test('calls from page.route callback should be under its parent step', {expect(result.output).not.toContain('Internal error');expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create pagetest.step |custom step @ a.test.ts:4pw:api | Navigate to "/empty.html" @ a.test.ts:12pw:api | Fetch "/empty.html" @ a.test.ts:6-expect | Expect toBe @ a.test.ts:8+expect | toBe @ a.test.ts:8hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | context`);});@@ -1556,7 +1556,7 @@ test.step |outer step 1 @ a.test.ts:4 (skipped)test.step |outer step 2 @ a.test.ts:11test.step | inner step 2.1 @ a.test.ts:12 (skipped)test.step | inner step 2.2 @ a.test.ts:13-expect | Expect toBe @ a.test.ts:14+expect | toBe @ a.test.ts:14hook |After Hooks`);});@@ -1585,7 +1585,7 @@ test('skip test.step.skip body', async ({ runInlineTest }) => {hook |Before Hookstest.step |outer step 2 @ a.test.ts:5test.step | inner step 2 @ a.test.ts:6 (skipped)-expect |Expect toBe @ a.test.ts:10+expect |toBe @ a.test.ts:10hook |After Hooks`);});@@ -1628,7 +1628,7 @@ test.step | inner step 1.3 @ a.test.ts:11test.step |outer step 2 @ a.test.ts:13test.step | inner step 2.1 @ a.test.ts:14 (skipped)test.step | inner step 2.2 @ a.test.ts:15-expect | Expect toBe @ a.test.ts:16+expect | toBe @ a.test.ts:16hook |After Hooks`);});@@ -1685,33 +1685,33 @@ test('show api calls inside expects', async ({ runInlineTest }) => {expect(result.report.stats.expected).toBe(1);expect(stripAnsi(result.output)).toBe(`hook |Before Hooks-fixture | fixture: browser+fixture | browserpw:api | Launch browser-fixture | fixture: context+fixture | contextpw:api | Create context-fixture | fixture: page+fixture | pagepw:api | Create pagepw:api |Set content @ a.test.ts:16-expect |Expect toBeInvisible @ a.test.ts:17-step | Expect poll toBe @ a.test.ts:7+expect |toBeInvisible @ a.test.ts:17+test.step | poll toBe @ a.test.ts:7pw:api | Is visible locator('div') @ a.test.ts:7-expect | Expect toBe @ a.test.ts:7+expect | toBe @ a.test.ts:7expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitypw:api | Is visible locator('div') @ a.test.ts:7-expect | Expect toBe @ a.test.ts:7+expect | toBe @ a.test.ts:7expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitypw:api | Is visible locator('div') @ a.test.ts:7-expect | Expect toBe @ a.test.ts:7+expect | toBe @ a.test.ts:7expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitypw:api | Is visible locator('div') @ a.test.ts:7-expect | Expect toBe @ a.test.ts:7+expect | toBe @ a.test.ts:7expect | ↪ error: Error: expect(received).toBe(expected) // Object.is equalitypw:api | Is visible locator('div') @ a.test.ts:7-expect | Expect toBe @ a.test.ts:7+expect | toBe @ a.test.ts:7pw:api |Wait for timeout @ a.test.ts:18pw:api |Set content @ a.test.ts:19hook |After Hooks-fixture | fixture: page-fixture | fixture: context+fixture | page+fixture | context`);});diff --git a/tests/playwright-test/to-have-screenshot.spec.ts b/tests/playwright-test/to-have-screenshot.spec.tsindex b91e350307..330a7991d9 100644--- a/tests/playwright-test/to-have-screenshot.spec.ts+++ b/tests/playwright-test/to-have-screenshot.spec.ts@@ -50,7 +50,7 @@ test('should fail to screenshot a page with infinite animation', async ({ runInl});expect(result.exitCode).toBe(1);expect(result.output).toContain(`Timeout 2000ms exceeded`);- expect(result.output).toContain(`Expect toHaveScreenshot with timeout 2000ms`);+ expect(result.output).toContain(`Expect "toHaveScreenshot" with timeout 2000ms`);expect(result.output).toContain(`generating new stable screenshot expectation`);expect(fs.existsSync(testInfo.outputPath('test-results', 'a-is-a-test', 'is-a-test-1-actual.png'))).toBe(true);expect(fs.existsSync(testInfo.outputPath('test-results', 'a-is-a-test', 'is-a-test-1-expected.png'))).toBe(false);@@ -238,7 +238,7 @@ test('should report toHaveScreenshot step with expectation name in title', async'reporter.ts': `class Reporter {onStepEnd(test, result, step) {- console.log('%% end ' + step.title);+ console.log('%% end [' + step.category + '] ' + step.title);}}module.exports = Reporter;@@ -256,18 +256,18 @@ test('should report toHaveScreenshot step with expectation name in title', asyncexpect(result.exitCode).toBe(0);expect(result.outputLines).toEqual([- `end Launch browser`,- `end fixture: browser`,- `end Create context`,- `end fixture: context`,- `end Create page`,- `end fixture: page`,- `end Before Hooks`,- `end Expect toHaveScreenshot(foo.png)`,- `end Expect toHaveScreenshot(is-a-test-1.png)`,- `end fixture: page`,- `end fixture: context`,- `end After Hooks`,+ `end [pw:api] Launch browser`,+ `end [fixture] browser`,+ `end [pw:api] Create context`,+ `end [fixture] context`,+ `end [pw:api] Create page`,+ `end [fixture] page`,+ `end [hook] Before Hooks`,+ `end [expect] toHaveScreenshot(foo.png)`,+ `end [expect] toHaveScreenshot(is-a-test-1.png)`,+ `end [fixture] page`,+ `end [fixture] context`,+ `end [hook] After Hooks`,]);});@@ -389,7 +389,7 @@ test('should fail to screenshot an element with infinite animation', async ({ ru});expect(result.exitCode).toBe(1);expect(result.output).toContain(`Timeout 2000ms exceeded`);- expect(result.output).toContain(`Expect toHaveScreenshot with timeout 2000ms`);+ expect(result.output).toContain(`Expect "toHaveScreenshot" with timeout 2000ms`);expect(fs.existsSync(testInfo.outputPath('test-results', 'a-is-a-test', 'is-a-test-1-previous.png'))).toBe(true);expect(fs.existsSync(testInfo.outputPath('test-results', 'a-is-a-test', 'is-a-test-1-actual.png'))).toBe(true);expect(fs.existsSync(testInfo.outputPath('test-results', 'a-is-a-test', 'is-a-test-1-expected.png'))).toBe(false);@@ -683,7 +683,7 @@ test('should attach missing expectations to right step', async ({ runInlineTestclass Reporter {onStepEnd(test, result, step) {if (step.attachments.length > 0)- console.log(\`%%\${step.title}: \${step.attachments.map(a => a.name).join(", ")}\`);+ console.log(\`%%[\${step.category}] \${step.title}: \${step.attachments.map(a => a.name).join(", ")}\`);}}module.exports = Reporter;@@ -700,7 +700,7 @@ test('should attach missing expectations to right step', async ({ runInlineTest}, { reporter: '' });expect(result.exitCode).toBe(1);- expect(result.outputLines).toEqual(['Expect toHaveScreenshot(snapshot.png): snapshot-expected.png, snapshot-actual.png']);+ expect(result.outputLines).toEqual(['[expect] toHaveScreenshot(snapshot.png): snapshot-expected.png, snapshot-actual.png']);});test('shouldn\'t write missing expectations locally for negated matcher', async ({ runInlineTest }, testInfo) => {diff --git a/tests/playwright-test/ui-mode-test-progress.spec.ts b/tests/playwright-test/ui-mode-test-progress.spec.tsindex 6fcf6eccd1..ada6a788b6 100644--- a/tests/playwright-test/ui-mode-test-progress.spec.ts+++ b/tests/playwright-test/ui-mode-test-progress.spec.ts@@ -285,7 +285,7 @@ test('should show live trace for serial', async ({ runUITest, server, createLatc).toHaveText([/Before Hooks[\d.]+m?s/,/Uncheck.*locator/,- /Expect not toBeChecked/,+ /Expect "not toBeChecked"/,]);});@@ -325,7 +325,7 @@ test('should show live trace from hooks', async ({ runUITest, createLatch }) =>).toHaveText([/Before Hooks/,/beforeAll hook/,- /fixture: browser/,+ /Fixture "browser"/,/Create page/,]);latch1.open();diff --git a/tests/playwright-test/ui-mode-trace.spec.ts b/tests/playwright-test/ui-mode-trace.spec.tsindex a26dc44dfd..abf82ccf64 100644--- a/tests/playwright-test/ui-mode-trace.spec.ts+++ b/tests/playwright-test/ui-mode-trace.spec.ts@@ -41,9 +41,9 @@ test('should merge trace events', async ({ runUITest }) => {).toHaveText([/Before Hooks[\d.]+m?s/,/Set content/,- /Expect toBe/,+ /Expect "toBe"/,/Click.*getByRole/,- /Expect toBe/,+ /Expect "toBe"/,/After Hooks[\d.]+m?s/,]);});@@ -68,7 +68,7 @@ test('should merge web assertion events', async ({ runUITest }, testInfo) => {).toHaveText([/Before Hooks[\d.]+m?s/,/Set content/,- /Expect toBeVisible.*locator/,+ /Expect "toBeVisible".*locator/,/After Hooks[\d.]+m?s/,]);});@@ -93,7 +93,7 @@ test('should merge screenshot assertions', async ({ runUITest }, testInfo) => {).toHaveText([/Before Hooks[\d.]+m?s/,/Set content/,- /Expect toHaveScreenshot[\d.]+m?s/,+ /Expect "toHaveScreenshot"[\d.]+m?s/,/After Hooks[\d.]+m?s/,/Worker Cleanup[\d.]+m?s/,]);@@ -110,7 +110,7 @@ test('should locate sync assertions in source', async ({ runUITest }) => {});await page.getByText('trace test').dblclick();- await page.getByText('EXPECT toBe').click();+ await page.getByText('Expect "toBe"').click();await expect(page.locator('.CodeMirror .source-line-running'),@@ -140,7 +140,7 @@ test('should show snapshots for sync assertions', async ({ runUITest }) => {/Before Hooks[\d.]+m?s/,/Set content/,/Click.*getByRole/,- /Expect toBe/,+ /Expect "toBe"/,/After Hooks[\d.]+m?s/,]);@@ -178,9 +178,9 @@ test('should show snapshots for steps', {await expect(page.getByTestId('actions-tree')).toMatchAriaSnapshot(`- tree:- treeitem /Before Hooks \\d+[hmsp]+/- - treeitem /first \\d+[hmsp]+/- - treeitem /middle \\d+[hmsp]+/- - treeitem /last \\d+[hmsp]+/+ - treeitem /Step "first" \\d+[hmsp]+/+ - treeitem /Step "middle" \\d+[hmsp]+/+ - treeitem /Step "last" \\d+[hmsp]+/- treeitem /After Hooks \\d+[hmsp]+/`);@@ -302,7 +302,7 @@ test('should not show caught errors in the errors tab', async ({ runUITest }, te).toHaveText([/Before Hooks[\d.]+m?s/,/Set content/,- /Expect toBeChecked.*locator/,+ /Expect "toBeChecked".*locator/,/After Hooks/,]);@@ -416,7 +416,7 @@ test('should work behind reverse proxy', { annotation: { type: 'issue', descript- treeitem /Before Hooks \\d+[hmsp]+/- treeitem /Set content \\d+[hmsp]+/- treeitem /Click.*getByRole/- - treeitem /Expect toBe/+ - treeitem /Expect "toBe"/- treeitem /After Hooks \\d+[hmsp]+/`);@@ -473,8 +473,8 @@ test('should show custom fixture titles in actions tree', async ({ runUITest })const listItem = page.getByTestId('actions-tree').getByRole('treeitem');await expect(listItem, 'action list').toHaveText([/Before Hooks[\d.]+m?s/,- /My Custom Fixture[\d.]+m?s/,- /fixture2[\d.]+m?s/,+ /Fixture "My Custom Fixture"[\d.]+m?s/,+ /Fixture "fixture2"[\d.]+m?s/,/After Hooks[\d.]+m?s/,]);});@@ -512,8 +512,8 @@ test('attachments tab shows all but top-level .push attachments', async ({ runUI- tree:- treeitem /step/:- group:- - treeitem /attach \\"foo-attach\\"/- - treeitem /attach \\"bar-attach\\"/+ - treeitem /Attach \\"foo-attach\\"/+ - treeitem /Attach \\"bar-attach\\"/`);await page.getByRole('tab', { name: 'Attachments' }).click();await expect(page.getByRole('tabpanel', { name: 'Attachments' })).toMatchAriaSnapshot(`