Add automated browser-based tests to check examples on web editor for console errors#85
Add automated browser-based tests to check examples on web editor for console errors#85nbogie wants to merge 7 commits into
Conversation
(generated by playwright)
|
update: silenced the headless firefox test run to match chrome. |
|
Minor extra notes from trying this with @ogbabydiesal :
As next steps Tommy will work on creating an Thanks so much for getting this started! |
|
I am happy to alter it to work from (copied from my discord response:) If the examples are going to continue to be published on the web editor (I hope so - I love the availability and the subsequent discoverability in the collection), then I'd probably argue mildly that we might try to have the tests be capable of running against sketches in both locations, assuming it doesn't add a lot of maintenance. In the end the actual test process doesn't change wherever they are, only some implementation details for each step.
Pros of running the automated tests against the editor:
Cons of running the automated tests against the editor:
|
|
hey @nbogie I created a repo with collection in the examples folder, there's only one for now but this would be the folder hierarchy if you'd like to test with that. I'll add the rest soon https://github.com/processing/p5.sound.js.git I hear you about running the tests in the editor as that is how many people will interact with them first, if your into the idea of running them both places, and it isn't too much work you can use that repo! |
|
@ogbabydiesal not sure if that's the intended link but can you make the |
|
Hi @ksen0 @ogbabydiesal (Sorry if this work is already underway elsewhere). |
Addresses #84
What is this?
Adds playwright-based config and tests to check the p5.sound examples in place on the web editor, checking they load and don't have any errors in the console.
How to run the tests (with test-runner UI)
This is recommended as it allows easier exploration of test failures:
in the gui that opens, click "projects" and ensure "firefox" and "chromium" are checked. (see image)
Also in the gui, press the play button on the top test or above it. (see image)
Alternative: How to run the tests (unattended):
This will present a html report when it finishes.
What are the additions and changes?
package.jsonplaywright.config.js, specifying, for example, where the tests are (./tests/) and which browsers to use.tests/integration/test-examples-on-web-editor.spec.jsThis is the main test file that instructs playwright what web pages to load , what to click, and what to check for.tests/integration/about-these-tests.mddocumenting the testing (and some problems faced in automated testing of the web editor)..github/workflows/playwright.yml.DISABLED- this is untested.Limitations:
.github/workflows/playwright.yml.DISABLEDAI usage disclosure
Claude Code did most of the implementation on this, including research into chrome and firefox support for pre-emptive grants of microphone + video, troubleshooting the main issue with testing the web editor, and the bulk of the write-up
about-these-tests.md. That said, I've reworked the code to how I want it, I have read and understood each line, and the PR write-up is all mine.