-
-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to handle mixed content errors on playwright #2540
Comments
This might be the way, can you play with it? // @web/test-runner-playwright/src/PlaywrightLauncher.ts
export type CreateBrowserContextFn = (args: CreateArgs) => BrowserContext | Promise<BrowserContext>;
export class PlaywrightLauncher implements BrowserLauncher {
// ...
private createBrowserContextFn: CreateBrowserContextFn;
// ...
} You can pass it via |
Thanks for the hint: function createBrowserContext({ browser, config }) {
// ignore HTTPS errors
const context = browser.newContext({
ignoreHTTPSErrors: true
})
return context
}
....
export default {
// https://modern-web.dev/docs/test-runner/browser-launchers/playwright/#testing-multiple-browsers
// Requires: @web/test-runner-playwright
browsers: [
playwrightLauncher({
product: 'chromium', createBrowserContext
}), // { headless: false, devtools: true } }),
playwrightLauncher({ product: 'firefox', createBrowserContext }),
playwrightLauncher({ product: 'webkit', createBrowserContext }),
],
.... This actually works for chromium but not for firefox and webkit, will do some more tests to dfind out how to make others working |
It should work also for firefox and webkit based on docs but I them are not working as expected.... any other hint? |
Ok fixed. The solution described above was correct I only had to do test in series instead of parallel. This can be closed but I suggest to add an example on docs with the createBrowserContext like this. Thanks again for the support given so far 🙏🏼 |
did you have to set "concurrent: 1"? if so, then it might be related to a recent change in Chrome which cuts resources in inactive tabs, which are heavily used by WTR, so that many tests don't work in there |
Nope I simply had to wait for ws tests to end before running wss tests, at start I was just starting both one after the other: https://github.com/mqttjs/MQTT.js/blob/main/test/browser/test.js#L60 Tests are passing: https://github.com/mqttjs/MQTT.js/actions/runs/6782443335/job/18434666671#step:6:33 🎉 |
When I run tests using playwrightLauncher tests are not working, what I'm tring to do is to connect to a wss that is not allowed from a non secure context. How can I make it work?
There should be an option on playwright named
ignoreHTTPSErrors
that should do the trick but I don't understand where I should use it: https://playwright.dev/docs/api/class-browser#browser-new-contextThe text was updated successfully, but these errors were encountered: