Skip to content

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

fix(test): missing test coverage for browserType.connectOverCDP (#5408)

Joel Einbinderfa8e898c3c56
diff --git a/test/browsertype-basic.spec.ts b/test/browsertype-basic.spec.ts
index 099c10c4eb..1d16181b83 100644
--- a/test/browsertype-basic.spec.ts
+++ b/test/browsertype-basic.spec.ts
@@ -35,3 +35,9 @@ it('browserType.name should work', async ({browserType, isChromium, isFirefox, i
else
throw new Error('Unknown browser');
});
+it('should throw when trying to connect with not-chromium', (test, {browserName}) => {
+ test.skip(browserName === 'chromium');
+}, async ({browserType }) => {
+ const error = await browserType.connectOverCDP({wsEndpoint: 'foo'}).catch(e => e);
+ expect(error.message).toBe('Connecting over CDP is only supported in Chromium.');
+});
diff --git a/test/chromium/chromium.spec.ts b/test/chromium/chromium.spec.ts
index 55e0f0240d..6a98a915de 100644
--- a/test/chromium/chromium.spec.ts
+++ b/test/chromium/chromium.spec.ts
@@ -91,7 +91,7 @@ describe('chromium', (suite, { browserName }) => {
expect(serverRequest.headers.intervention).toContain('feature/5718547946799104');
});
- it('should connect to an existing cdp session 2', (test, {headful}) => {
+ it('should connect to an existing cdp session', (test, {headful}) => {
test.skip(headful, 'Chromium currently doesn\'t support --remote-debugging-port and --remote-debugging-pipe at the same time.');
}, async ({browserType, testWorkerIndex, browserOptions, createUserDataDir }) => {
const port = 9339 + testWorkerIndex;