Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: remove PW_TEST_DISABLE_TRACING and _playwrightInstance (#36282)

Dmitry Gozman5d0d573718fa
diff --git a/packages/playwright-core/src/client/playwright.ts b/packages/playwright-core/src/client/playwright.ts
index cc58a7b9e5..fac9a671ed 100644
--- a/packages/playwright-core/src/client/playwright.ts
+++ b/packages/playwright-core/src/client/playwright.ts
@@ -65,7 +65,6 @@ export class Playwright extends ChannelOwner<channels.PlaywrightChannel> {
this.devices = this._connection.localUtils()?.devices ?? {};
this.selectors = new Selectors(this._connection._platform);
this.errors = { TimeoutError };
- (global as any)._playwrightInstance = this;
}
static from(channel: channels.PlaywrightChannel): Playwright {
diff --git a/packages/playwright/src/worker/testTracing.ts b/packages/playwright/src/worker/testTracing.ts
index b9294415b0..3d43274710 100644
--- a/packages/playwright/src/worker/testTracing.ts
+++ b/packages/playwright/src/worker/testTracing.ts
@@ -68,9 +68,6 @@ export class TestTracing {
}
private _shouldCaptureTrace() {
- if (process.env.PW_TEST_DISABLE_TRACING)
- return false;
-
if (this._options?.mode === 'on')
return true;
diff --git a/tests/playwright-test/playwright.trace.spec.ts b/tests/playwright-test/playwright.trace.spec.ts
index f945076393..08d49c00e7 100644
--- a/tests/playwright-test/playwright.trace.spec.ts
+++ b/tests/playwright-test/playwright.trace.spec.ts
@@ -382,24 +382,6 @@ test('should respect --trace', async ({ runInlineTest }, testInfo) => {
expect(fs.existsSync(testInfo.outputPath('test-results', 'a-test-1', 'trace.zip'))).toBeTruthy();
});
-test('should respect PW_TEST_DISABLE_TRACING', async ({ runInlineTest }, testInfo) => {
- const result = await runInlineTest({
- 'playwright.config.ts': `
- export default { use: { trace: 'on' } };
- `,
- 'a.spec.ts': `
- import { test, expect } from '@playwright/test';
- test('test 1', async ({ page }) => {
- await page.goto('about:blank');
- });
- `,
- }, {}, { PW_TEST_DISABLE_TRACING: '1' });
-
- expect(result.exitCode).toBe(0);
- expect(result.passed).toBe(1);
- expect(fs.existsSync(testInfo.outputPath('test-results', 'a-test-1', 'trace.zip'))).toBe(false);
-});
-
for (const mode of ['off', 'retain-on-failure', 'on-first-retry', 'on-all-retries', 'retain-on-first-failure']) {
test(`trace:${mode} should not create trace zip artifact if page test passed`, async ({ runInlineTest }) => {
const result = await runInlineTest({
@@ -1010,7 +992,7 @@ test('should not produce an action entry for calling a binding', async ({ runInl
wasCalled = true;
return 'foo';
});
-
+
const output = await page.evaluate(() => window['customBinding']());
expect(wasCalled).toBe(true);
expect(output).toBe('foo');