Closed koenvo closed 12 months ago
Very cool, and high quality pr 😍 Do the test really test it since it is the same server and port? If you revert the changes, does the test fail?
Very cool, and high quality pr 😍 Do the test really test it since it is the same server and port? If you revert the changes, does the test fail?
You're welcome. Happy to contribute!
Good call here. Normally I would write the failing test first 🙃
Output with the changes reverted:
FAILED tests/integration/server_test.py::test_run_in_iframe[flask-chromium] - playwright._impl._api_types.TimeoutError: Timeout 18000ms exceeded.
FAILED tests/integration/server_test.py::test_run_in_iframe[starlette-chromium] - playwright._impl._api_types.TimeoutError: Timeout 18000ms exceeded.
I did some local testing, and managed to pass the test after disabling your feature. I think it is because it is running on the same server.
Then I made it run on a different port, and it still passes the test (I can see with --headed and PWDEBUG=1 that the page really loads in the iframe). If I test this with python http.server
like in the docs, it does fail.
I think there is still something happening I don't understand.
e.g. try changing localhost to xlocalhost in the check of starlette and flask and the test pass 🤷
Interesting issue. Some things I found:
flask
server both flask
and starlette
tests succeed. When I only fix starlette
the flask
test will fail.about:black
and http://localhost
are considered cross-origins which is good for the test.StaticFiles
(starlette) on localhost
it's seems not to be cross-origin for cookies on localhost
on a different port (cookies are seem to be specified on domain only).Ah, we can use page_session.context.clear_cookies()
for this.
2.
http://localhost
are considered cross-origins which is good for the test.
I didn't know! Where did you find this?
Ok, I can confirm that now with clearing the cookies, it fails without your changes.
Ah, we can use
page_session.context.clear_cookies()
for this. Right! I was thinking about restarting the entire webserver but this is what I was actually looking for.
http://localhost
are considered cross-origins which is good for the test.I didn't know! Where did you find this?
Test it and use
PWDEBUG
to see if the cookies get accepted. By default thepage_session.url
isabout:blank
Great work, thanks Koen!
When developing a solara application that will run in an iframe there is an issue with the session_id cookie. The development server will run on
http://localhost
which requiresSameSite=None; Secure
to be set on the cookies.