Skip to content

Commit

Permalink
use waitForSelector instead of waitForFunction to work around CSP hei…
Browse files Browse the repository at this point in the history
…senbug (#4385)
  • Loading branch information
Rich-Harris committed Mar 18, 2022
1 parent a57f234 commit 30ca8b3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/kit/test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,8 @@ export const test = base.extend({
if (javaScriptEnabled) {
page.addInitScript({
content: `
window.started = false;
addEventListener('sveltekit:start', () => {
window.started = true;
document.body.classList.add('started');
});
`
});
Expand All @@ -116,7 +114,7 @@ export const test = base.extend({
async function (url, opts) {
const res = await goto.call(page, url, opts);
if (javaScriptEnabled) {
await page.waitForFunction(() => window.started, undefined, { timeout: 5000 });
await page.waitForSelector('body.started', { timeout: 5000 });
}
return res;
};
Expand Down

0 comments on commit 30ca8b3

Please sign in to comment.