Skip to content

Commit 4e46a6c

Browse files
authored
Merge pull request #85 from nbogie/nb-add-browser-based-tests
Add automated browser-based tests to check examples on web editor for console errors
2 parents 5122a84 + 6dcf90f commit 4e46a6c

11 files changed

Lines changed: 1199 additions & 26 deletions
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Playwright Tests
2+
on:
3+
push:
4+
branches: [ main, master ]
5+
pull_request:
6+
branches: [ main, master ]
7+
jobs:
8+
test:
9+
timeout-minutes: 20
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v6
13+
- uses: actions/setup-node@v6
14+
with:
15+
node-version: lts/*
16+
- name: Install dependencies
17+
run: npm ci
18+
- name: Install Playwright Browsers
19+
run: npx playwright install --with-deps
20+
- name: Run Playwright tests
21+
run: npx playwright test
22+
- uses: actions/upload-artifact@v6
23+
if: ${{ !cancelled() }}
24+
with:
25+
name: playwright-report
26+
path: playwright-report/
27+
retention-days: 30

.gitignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@ out/
44
.DS_Store
55
/src/.DS_Store
66
.vscode
7-
playwright-report
8-
test-results
7+
local.code-workspace
8+
9+
# Playwright
10+
/test-results/
11+
/playwright-report/
12+
/blob-report/
13+
/playwright/.cache/
14+
/playwright/.auth/

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ p5.sound.js extends the musical and sonic capabilities of [p5.js](https://p5js.o
44

55
## Examples
66

7-
- p5.sound example on p5.js editor [here](https://editor.p5js.org/thomasjohnmartinez/collections/Dp0zGclVL)
7+
- A set of p5.sound examples are in this repo at [examples/](examples/)
8+
- The original examples can be found on the p5.js web editor [here](https://editor.p5js.org/thomasjohnmartinez/collections/Dp0zGclVL). Note that these may differ from the above set.
89
- Legacy p5.js Sound Tutorial by Dan Shiffman on [YouTube](https://www.youtube.com/playlist?list=PLRqwX-V7Uu6aFcVjlDAkkGIixw70s7jpW)
910

1011
## Documentation
@@ -76,3 +77,32 @@ building reference pages (optional)
7677
```
7778
npx yuidoc .
7879
```
80+
81+
## Testing the examples
82+
83+
The library is configured to use [Playwright](https://playwright.dev/) to automatically test the [local](./examples) and [web-editor-hosted](https://editor.p5js.org/thomasjohnmartinez/collections/Dp0zGclVL) sets of p5.sound.js examples by automatically controlling a browser (firefox or chromium).
84+
85+
If you haven't used Playwright on your system before, you'll have to run the following command _once_ to allow it to download the browsers it uses:
86+
87+
### Setting up playwright
88+
```bash
89+
npx playwright install
90+
```
91+
92+
### Starting the tests
93+
1. Launch playwright's test-runner UI:
94+
```bash
95+
npm run test:integration:ui
96+
```
97+
98+
2. Choose example set(s) and browser(s)
99+
From the GUI, click "projects" and choose which examples ("web-" and/or "local-") and which browsers ("chromium" and/or "firefox") you wish to test.
100+
101+
3. Run the tests!
102+
click the green play button at the top of the list of tests.
103+
104+
If a test fails, you can inspect its console log, the test actions, and even screenshots of what it looked like while it was running.
105+
106+
There are also various other ways to run the tests automatically without any interaction.
107+
108+
For more information, read [tests/integration/about-these-tests.md](tests/integration/about-these-tests.md)

0 commit comments

Comments
 (0)