[BUG] Webkit (docker image) cookie added but ignored
Context:
- Playwright Version: [1.7.1]
- Operating System: [Windows, WSL 2 (Ubuntu 20.04)]
- Node.js version: [14.15.4]
- Browser: [WebKit]
- Extra: [Docker image (mcr.microsoft.com/playwright:focal and bionic)]
Host OS (WSL):

Docker:

Code Snippet
it('Should login', async () => {
await page.goto(ADMIN_URL);
await page.fill(LOGIN_FORM_EMAIL, '[email protected]');
await page.fill(LOGIN_FORM_PASSWORD, 'password');
await page.click(LOGIN_FORM_SUBMIT);
await page.waitForLoadState('networkidle');
expect(
await page.isVisible("text=Hi Bart, you're managing Zeigo")
).toBeTruthy();
});
Describe the bug
After doing the login process, the cookie is added to the browser context, (using jest-playwright) when accessing the other pages where the cookie auth is required to allow the user to enter, the cookie is ignored and cannot access the page. The cookie isn't been used and the backend just received an undefined cookie. Only affects when using WebKit with the docker.
Tested on OS X (with the latest update), without the docker instance, ran it locally, and it worked just fine.
Does this line fail in docker but pass in vanilla WSL? Or does it pass in both, but then cookies don't work later when running in docker?
expect(
await page.isVisible("text=Hi Bart, you're managing Zeigo")
).toBeTruthy();
Tested on vanilla WSL, getting the same issue. It might not be docker problem but a Linux (Ubuntu 20.04) one ? Side note, tested on OS X, and it worked fine.
The line above, test if the user has login with success then it should redirect them to the main page of the app, but like the cookie (it does get created with success) isn't been used it never manages to access this page.
Let me know if you need any more information, and thank you for the fast feedback.
But to clarify the login process succeeds, but subsequent requests do not contain the cookie? Can you try dumping document.cookie after the login process to verify that it was actually added?
Also do you have any page.routes set up? Maybe a proxy? I'm just fishing for some more info. It's hard to guess what's going on without a repro.
I know it's a little confusion, took me a while to figure out (the core issue), here's the process:
- user login
- when successful creates a cookie and append it to the browser (session)
- to access the app the browser sends the newly created cookie to backend
- if the cookie is valid allow to fetch data and access the secure pages
Cookie dump (from the browser context)
// using jest-playwright
console.log(await context.cookies());
{
name: // value are created can't share it because of private repo
value: // value are created can't share it because of private repo
domain: // value are created can't share it because of private repo
path: '/',
expires: 1613035398,
httpOnly: true,
secure: true,
sameSite: 'Strict'
}
Haven't set up a route within playwright, but we do use a nginx container to create reserve proxy (only on dev environment)
Unfortunately, I can't share the repo like it's private.
I'll close this as a part of the bug triaging process. We have hundreds of bugs and feature requests with dozens and even hundreds of upvotes, while this one only has a few thumbs up. Please feel free to open a new bug and link this one if you'd like to see it addressed.
Hi. Having similar issue where the playwright docker image is being told to drive a safari/webkit browser, but no matter what we give it for the new browser context, it seems to be being ignored... in this case, the browser is expecting US format dates but we are expecting to give it UK format.
const context = await browser.newContext(
{
locale: 'en-GB',
}
);
Any follow up links re this sort of issue?
We are also experiencing the issue; it works launching Playwright directly but not within Docker.
I'm also experiencing this issue on v 1.57.0 and up. Like others have mentioned, the tests pass on Mac OS but fail in Ubuntu. I thought it was the official docker image, but it also occurs in the GHA base Ubuntu image.
I'm currently trying to debug it and will post an update if I find the root cause