I am using the jest-playwright library (https://github.com/playwright-community/jest-playwright) to perform end-to-end testing. In the jest.config.js file you can set an option to ignore SSL errors:
contextOptions: {
ignoreHTTPSErrors: true,
}
This works fine when running the tests with jest.
Now, I would want playwright to generate the code when clicking on website elements with the command npx playwright codegen example.com. However, playwright stops because of the SSL error when opening the website.
Is there an option to ignore SSL errors when using playwright code generation?
Another option is to configure the test to ignore the HTTPS errors.
import { test } from "@playwright/test";
test.use({
ignoreHTTPSErrors: true,
});
test("test", async ({ page }) => {
await page.goto(
"https://example.com/"
);
});
NB - test.use... is what's included when running npx playwright codegen --ignore-https-errors.
UPDATE The setting can also be included in your playwright.config.ts file (see docs).
import { defineConfig } from '@playwright/test';
export default defineConfig({
use: {
ignoreHTTPSErrors: true,
},
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With