diff --git a/packages/playwright/src/program.ts b/packages/playwright/src/program.ts index d494602dc8..071b07dd45 100644 --- a/packages/playwright/src/program.ts +++ b/packages/playwright/src/program.ts @@ -158,6 +158,9 @@ async function runTests(args: string[], opts: { [key: string]: any }) { const cliOverrides = overridesFromOptions(opts); if (opts.ui || opts.uiHost || opts.uiPort) { + if (opts.onlyChanged) + throw new Error('--only-changed is not supported in UI mode'); + const status = await testServer.runUIMode(opts.config, { host: opts.uiHost, port: opts.uiPort ? +opts.uiPort : undefined, diff --git a/tests/playwright-test/only-changed.spec.ts b/tests/playwright-test/only-changed.spec.ts index 4d1e71749b..aa27dc7e46 100644 --- a/tests/playwright-test/only-changed.spec.ts +++ b/tests/playwright-test/only-changed.spec.ts @@ -243,4 +243,8 @@ test.describe('should work the same if being called in subdirectory', () => { }); }); - +test('UI mode is not supported', async ({ runInlineTest }) => { + const result = await runInlineTest({}, { 'only-changed': true, 'ui': true }); + expect(result.exitCode).toBe(1); + expect(result.output).toContain('--only-changed is not supported in UI mode'); +}); \ No newline at end of file