Skip to content

Commit

Permalink
add slight delay before test screenshot so p5 has time for first render
Browse files Browse the repository at this point in the history
  • Loading branch information
PWhiddy committed Sep 5, 2023
1 parent 9e8a69e commit 7242e6c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
17 changes: 15 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"@rollup/plugin-node-resolve": "^15.2.1",
"chai": "^4.3.8",
"mocha": "^10.2.0",
"p5": "^1.7.0",
"png-js": "^1.0.0",
"puppeteer": "^21.1.0",
"rollup": "^3.28.1",
Expand Down
2 changes: 1 addition & 1 deletion test/p5Examples/basicP5Test.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<!-- keep the line below for OpenProcessing compatibility -->
<!-- <script src="https://openprocessing.org/openprocessing_sketch.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/p5@1.7.0/lib/p5.js"></script>
<script src="../../node_modules/p5/lib/p5.js"></script>
<script type="module" src="../../dist/shader-park-p5.js"></script>
<script>
let sdf;
Expand Down
2 changes: 2 additions & 0 deletions test/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ describe('Compiling, rendering, checking pixels', () => {
logs.push(msg);
});
await page.goto(pagename);
// For some reason p5 hasn't rendered yet, so it needs extra time
await page.waitForTimeout(50);
await page.screenshot({ path: outpath, fullPage: true });
for (const perr of pageErrors) {
assert.fail(`Page javascript error: ${perr}`);
Expand Down

0 comments on commit 7242e6c

Please sign in to comment.