diff --git a/docs/src/test-api/class-test.md b/docs/src/test-api/class-test.md index b6dc2bcad83ed..e689a32ec5cef 100644 --- a/docs/src/test-api/class-test.md +++ b/docs/src/test-api/class-test.md @@ -100,7 +100,7 @@ test('update user settings', { }); ``` -The built-in `exclusive` lock runs the test only when no other tests are running. +The built-in `-exclusive-` lock runs the test only when no other tests are running. Learn more about [test locks](../test-parallel.md#test-locks). @@ -1992,4 +1992,3 @@ test('test with locale', async ({ page }) => { An object with local options. - diff --git a/docs/src/test-parallel-js.md b/docs/src/test-parallel-js.md index 32eb0dae88509..1bb3eafe1488f 100644 --- a/docs/src/test-parallel-js.md +++ b/docs/src/test-parallel-js.md @@ -163,10 +163,10 @@ test.describe.configure({ lock: 'user-settings' }); Playwright acquires all the locks of a test before the test starts and releases them when it finishes. -The built-in `exclusive` lock runs a test in isolation: it starts only when no other tests are running, and no other tests start until it finishes. All other tests continue to run in parallel with each other. This is useful for a few tests that are sensitive to any concurrent activity, for example tests that measure performance or restart a shared service. +The built-in `-exclusive-` lock runs a test in isolation: it starts only when no other tests are running, and no other tests start until it finishes. All other tests continue to run in parallel with each other. This is useful for a few tests that are sensitive to any concurrent activity, for example tests that measure performance or restart a shared service. ```js -test('restart the server', { lock: 'exclusive' }, async () => { +test('restart the server', { lock: '-exclusive-' }, async () => { // No other test runs while this one is running. }); ``` diff --git a/packages/playwright/src/runner/dispatcher.ts b/packages/playwright/src/runner/dispatcher.ts index b574f4d2efb24..7ada9a8016bee 100644 --- a/packages/playwright/src/runner/dispatcher.ts +++ b/packages/playwright/src/runner/dispatcher.ts @@ -34,7 +34,7 @@ import type { TestError, TestResult, TestStep } from '../../types/testReporter'; export type EnvByProjectId = Map>; -const exclusiveLock = 'exclusive'; +const exclusiveLock = '-exclusive-'; export class Dispatcher { // Worker slot is claimed when it has jobDispatcher assigned. diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index bbefcf570beb0..80f8178b6c26c 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -2898,7 +2898,7 @@ export interface TestType { * }); * ``` * - * The built-in `exclusive` lock runs the test only when no other tests are running. + * The built-in `-exclusive-` lock runs the test only when no other tests are running. * * Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks). * @param title Test title. @@ -2997,7 +2997,7 @@ export interface TestType { * }); * ``` * - * The built-in `exclusive` lock runs the test only when no other tests are running. + * The built-in `-exclusive-` lock runs the test only when no other tests are running. * * Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks). * @param title Test title. diff --git a/tests/playwright-test/test-locks.spec.ts b/tests/playwright-test/test-locks.spec.ts index 3f9b0fa23ccf8..3c30d9f7e1fba 100644 --- a/tests/playwright-test/test-locks.spec.ts +++ b/tests/playwright-test/test-locks.spec.ts @@ -63,7 +63,7 @@ test('should not run tests with the same lock at the same time', async ({ runInl expect(conflictingOverlaps(result.outputLines, [['test1', 'test2']])).toEqual([]); }); -test('should run tests with different locks at the same time', async ({ runInlineTest }) => { +test('should run tests with different locks at the same time', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/43797' } }, async ({ runInlineTest }) => { const result = await runInlineTest({ 'playwright.config.ts': ` export default { fullyParallel: true }; @@ -81,7 +81,7 @@ test('should run tests with different locks at the same time', async ({ runInlin 'a.test.ts': ` import { test } from '@playwright/test'; import { signalAndWait } from './helper'; - test('test1', { lock: 'lock-a' }, async () => { + test('test1', { lock: 'exclusive' }, async () => { // Only finishes when both tests run at the same time. await signalAndWait('a.txt', 'b.txt'); }); @@ -241,7 +241,7 @@ test('should validate lock in test details', async ({ runInlineTest }) => { expect(result.output).toContain('details.lock'); }); -test('should run tests with the exclusive lock in isolation', async ({ runInlineTest }) => { +test('should run tests with the exclusive lock in isolation', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/43797' } }, async ({ runInlineTest }) => { const result = await runInlineTest({ 'playwright.config.ts': ` export default { fullyParallel: true }; @@ -249,7 +249,7 @@ test('should run tests with the exclusive lock in isolation', async ({ runInline 'a.test.ts': ` import { test } from '@playwright/test'; ${lockedTest('test1', 500)} - ${lockedTest('test2', 500, 'exclusive')} + ${lockedTest('test2', 500, '-exclusive-')} ${lockedTest('test3', 500)} `, 'b.test.ts': ` @@ -264,14 +264,14 @@ test('should run tests with the exclusive lock in isolation', async ({ runInline expect(conflictingOverlaps(result.outputLines, others.map(name => ['test2', name]))).toEqual([]); }); -test('should retry tests with the exclusive lock in isolation', async ({ runInlineTest }) => { +test('should retry tests with the exclusive lock in isolation', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/43797' } }, async ({ runInlineTest }) => { const result = await runInlineTest({ 'playwright.config.ts': ` export default { fullyParallel: true, retries: 1 }; `, 'a.test.ts': ` import { test, expect } from '@playwright/test'; - test('test1', { lock: 'exclusive' }, async ({}, testInfo) => { + test('test1', { lock: '-exclusive-' }, async ({}, testInfo) => { console.log('\\n%%begin:test1-' + testInfo.retry); await new Promise(f => setTimeout(f, 500)); console.log('\\n%%end:test1-' + testInfo.retry);