diff --git a/test/browsertype-launch-server.spec.ts b/test/browsertype-launch-server.spec.ts
index f9e457768b..423213e55d 100644
--- a/test/browsertype-launch-server.spec.ts
+++ b/test/browsertype-launch-server.spec.ts
@@ -49,7 +49,8 @@ describe('lauch server', suite => {
it('should fire close event', async ({browserType, defaultBrowserOptions}) => {
const browserServer = await browserType.launchServer(defaultBrowserOptions);
const [result] = await Promise.all([
- new Promise(f => (browserServer as any).on('close', (exitCode, signal) => f({ exitCode, signal }))),
+ // @ts-expect-error The signal parameter is not documented.
+ new Promise(f => browserServer.on('close', (exitCode, signal) => f({ exitCode, signal }))),
browserServer.close(),
]);
expect(result['exitCode']).toBe(0);
diff --git a/test/browsertype-launch.spec.ts b/test/browsertype-launch.spec.ts
index de4bcdb009..5190f0fe49 100644
--- a/test/browsertype-launch.spec.ts
+++ b/test/browsertype-launch.spec.ts
@@ -92,7 +92,8 @@ it('should report launch log', test => {
it('should accept objects as options', test => {
test.slow();
}, async ({browserType, defaultBrowserOptions}) => {
- const browser = await browserType.launch({ ...defaultBrowserOptions, process } as any);
+ // @ts-expect-error process is not a real option.
+ const browser = await browserType.launch({ ...defaultBrowserOptions, process });
await browser.close();
});
diff --git a/test/chromium/session.spec.ts b/test/chromium/session.spec.ts
index 7f79605254..614a47edc4 100644
--- a/test/chromium/session.spec.ts
+++ b/test/chromium/session.spec.ts
@@ -40,7 +40,8 @@ describe('session', suite => {
});
it('should only accept a page', async function({page}) {
- const error = await (page.context() as ChromiumBrowserContext).newCDPSession(page.context() as any).catch(e => e);
+ // @ts-expect-error newCDPSession expects a Page
+ const error = await (page.context() as ChromiumBrowserContext).newCDPSession(page.context()).catch(e => e);
expect(error.message).toContain('page: expected Page');
});
@@ -84,7 +85,8 @@ describe('session', suite => {
expect(error.message).toContain('ThisCommand.DoesNotExist');
async function theSourceOfTheProblems() {
- await client.send('ThisCommand.DoesNotExist' as any);
+ // @ts-expect-error invalid command
+ await client.send('ThisCommand.DoesNotExist');
}
});
diff --git a/test/geolocation.spec.ts b/test/geolocation.spec.ts
index 4b0905485e..3e00f4173e 100644
--- a/test/geolocation.spec.ts
+++ b/test/geolocation.spec.ts
@@ -74,7 +74,8 @@ it('should isolate contexts', async ({page, server, context, browser}) => {
it('should throw with missing latitude', async ({context}) => {
let error = null;
try {
- await context.setGeolocation({longitude: 10} as any);
+ // @ts-expect-error setGeolocation must have latitude
+ await context.setGeolocation({longitude: 10});
} catch (e) {
error = e;
}
@@ -93,7 +94,8 @@ it('should not modify passed default options object', async ({browser}) => {
it('should throw with missing longitude in default options', async ({browser}) => {
let error = null;
try {
- const context = await browser.newContext({ geolocation: {latitude: 10} as any });
+ // @ts-expect-error geolocation must have longitude
+ const context = await browser.newContext({ geolocation: {latitude: 10} });
await context.close();
} catch (e) {
error = e;
diff --git a/test/page-add-init-script.spec.ts b/test/page-add-init-script.spec.ts
index c49791cd64..c3855c4eec 100644
--- a/test/page-add-init-script.spec.ts
+++ b/test/page-add-init-script.spec.ts
@@ -39,7 +39,8 @@ it('should work with content', async ({ page, server }) => {
});
it('should throw without path and content', async ({ page, server }) => {
- const error = await page.addInitScript({ foo: 'bar' } as any).catch(e => e);
+ // @ts-expect-error foo is not a real option of addInitScript
+ const error = await page.addInitScript({ foo: 'bar' }).catch(e => e);
expect(error.message).toContain('Either path or content property must be present');
});
diff --git a/test/page-emulate-media.spec.ts b/test/page-emulate-media.spec.ts
index bf1a19a24f..f706aa8072 100644
--- a/test/page-emulate-media.spec.ts
+++ b/test/page-emulate-media.spec.ts
@@ -34,7 +34,8 @@ it('should emulate type', async ({page, server}) => {
it('should throw in case of bad type argument', async ({page, server}) => {
let error = null;
- await page.emulateMedia({ media: 'bad' as any}).catch(e => error = e);
+ // @ts-expect-error 'bad' is not a valid media type
+ await page.emulateMedia({ media: 'bad'}).catch(e => error = e);
expect(error.message).toContain('media: expected one of (screen|print|null)');
});
@@ -62,7 +63,8 @@ it('should default to light', async ({page, server}) => {
it('should throw in case of bad argument', async ({page, server}) => {
let error = null;
- await page.emulateMedia({ colorScheme: 'bad' as any}).catch(e => error = e);
+ // @ts-expect-error 'bad' is not a valid media type
+ await page.emulateMedia({ colorScheme: 'bad' }).catch(e => error = e);
expect(error.message).toContain('colorScheme: expected one of (dark|light|no-preference|null)');
});
diff --git a/test/page-fill.spec.ts b/test/page-fill.spec.ts
index 2e26c670a2..746618ceb8 100644
--- a/test/page-fill.spec.ts
+++ b/test/page-fill.spec.ts
@@ -138,7 +138,8 @@ it('should throw when element is not an ,