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
feat(test runner): add some fixture debugging (#8918)
Joel Einbinder40ae28e3bbd7
diff --git a/src/test/fixtures.ts b/src/test/fixtures.tsindex 9f31527d62..59bbcf607a 100644--- a/src/test/fixtures.ts+++ b/src/test/fixtures.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { formatLocation, wrapInPromise } from './util';+import { formatLocation, wrapInPromise, debugTest } from './util';import * as crypto from 'crypto';import { FixturesWithLocation, Location, WorkerInfo, TestInfo, TestStepInternal } from './types';@@ -67,6 +67,7 @@ class Fixture {let called = false;const setupFence = new Promise<void>((f, r) => { setupFenceFulfill = f; setupFenceReject = r; });const teardownFence = new Promise(f => this._teardownFenceCallback = f);+ debugTest(`setup ${this.registration.name}`);this._tearDownComplete = wrapInPromise(this.registration.fn(params, async (value: any) => {if (called)throw new Error(`Cannot provide fixture value for the second time`);@@ -94,6 +95,7 @@ class Fixture {await fixture.teardown();this.usages.clear();if (this._setup) {+ debugTest(`teardown ${this.registration.name}`);this._teardownFenceCallback();await this._tearDownComplete;}diff --git a/src/test/util.ts b/src/test/util.tsindex 13be2b2943..eee6da7e11 100644--- a/src/test/util.ts+++ b/src/test/util.ts@@ -21,6 +21,7 @@ import url from 'url';import type { TestError, Location } from './types';import { default as minimatch } from 'minimatch';import { errors } from '../..';+import debug from 'debug';export async function pollUntilDeadline(testInfo: TestInfoImpl, func: (remainingTime: number) => Promise<boolean>, pollTime: number | undefined, deadlinePromise: Promise<void>): Promise<void> {let defaultExpectTimeout = testInfo.project.expect?.timeout;@@ -189,3 +190,5 @@ export function expectType(receiver: any, type: string, matcherName: string) {export function sanitizeForFilePath(s: string) {return s.replace(/[\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/g, '-');}++export const debugTest = debug('pw:test');