-
Notifications
You must be signed in to change notification settings - Fork 71
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
Move functional tests to web
container; get them working w/client-side playback
#3117
Move functional tests to web
container; get them working w/client-side playback
#3117
Conversation
web
containerweb
container; get them working w/client-side playback
849cb4f
to
ab83718
Compare
ab83718
to
c6045a6
Compare
Codecov Report
@@ Coverage Diff @@
## develop #3117 +/- ##
===========================================
+ Coverage 82.32% 82.61% +0.29%
===========================================
Files 53 53
Lines 5737 5793 +56
===========================================
+ Hits 4723 4786 +63
+ Misses 1014 1007 -7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Looks like custom certs are supported; so maybe this will be quick. Though I probably shouldn't say that out loud 😛 |
Just realized this setup is super annoying: if you want to run the tests locally, with this as-is, you would have to re-run I'll switch things so that the necessary cert moves are made when initializing the test suite instead. UPDATE: done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this; I would love to add Firefox. Stay tuned, but let's land this now.
This overdue PR moves the Perma functional/end-to-end tests from a standalone playwright container into the main
web
container, and tweaks the tests and test setup so that it works with client-side playback.If the playwright tests are run from a separate container, as with our current setup, then they have to be run against an independently spun up web server and database; the usual Django test server and test database are not available. That's not great: each test run was creating persistent artifacts in our local database; we didn't have access nice pytest fixtures, etc. By moving everything into a single suite, we ensure we have access to all our standard conveniences.
The setup is complicated by Perma's need to be served over SSL: between cross-origin iframes, services workers, cross-origin fetch requests... client-side replay simply does not work without a real SSL setup with trusted certs. Flags to disable the browser's SSL cert verification (i.e.,
ignore_https_errors
) turn out to be insufficient. So, this PR does two things:mkcert
during the Perma local installation process as trusted certs to the web containerI'm adding the certs, including the rootCA cert, manually using
certutil
because I could not get it working usingmkcert -install
: even when I could see that that installed the rootCA cert installed in the nssdb, the other certs themselves were not being trusted; if I add just the certs without the rootCA, the browser complains about an untrusted CA.I'm using the same certs as development rather than installing mkcert on the web container and using it to generate testing-specific certs because of minio: the minio container is already running with the dev certificate, and from within the test suite, we can't change that without significant shenanigans. (And if the minio cert is untrusted, then the fetch of the warc will fail.)
This is currently only working with Chromium: Firefox, also installed into the container, is still objecting to the SSL cert situation. All I can figure out is... it's not looking at the NSS database in
$HOME/.pki/nssdb
; it's looking somewhere else. I've Googled around and seen a couple of other people complaining about custom certs + playwright + Docker, but not found anything definitive... including one comment on a Github issue that I can no longer find, stating that their browser was looking in/tmp/.pki/nssdb
.... I'd like to get this working with Firefox too, but don't want it to block any longer.I also set things up so that, when functional tests fail, a full-screen screenshot will be put in the
failed_test_files
directory, like we used to have. I don't think we'll be able to inspect them with our current CI setup, but they can be helpful locally to see what's going on. That directory is automatically cleared out by Playwright on every test run.Closes #3095 and #3086