diff --git a/js/__tests__/baseline.integration-test.js b/js/__tests__/baseline.integration-test.js index d0e93677..910d7d3a 100644 --- a/js/__tests__/baseline.integration-test.js +++ b/js/__tests__/baseline.integration-test.js @@ -20,37 +20,48 @@ test("can load a skin via the query params", async () => { // If this test starts to fail, check that the cache-bust location of the skin has not changed. `http://localhost:8080/?skinUrl=_/skins/MacOSXAqua1-5-88dbd4e043795c98625462a908a2d965.wsz#{"disableMarquee":true}` ); + await page.evaluate(() => window.__webamp.skinIsLoaded()); expect(await page.screenshot()).toMatchImageSnapshot(); }); test("should render the Topaz skin", async () => { await page.goto(`http://localhost:8080/#{"disableMarquee":true}`); - expect(page).toUploadFile("#webamp-file-input", "./skins/TopazAmp1-2.wsz"); + await expect(page).toUploadFile( + "#webamp-file-input", + "./skins/TopazAmp1-2.wsz" + ); + await page.evaluate(() => window.__webamp.skinIsLoaded()); expect(await page.screenshot()).toMatchImageSnapshot(); }); test("should render a skin that defines transparent regions", async () => { await page.goto(`http://localhost:8080/#{"disableMarquee":true}`); - expect(page).toUploadFile( + await expect(page).toUploadFile( "#webamp-file-input", "./skins/Green-Dimension-V2.wsz" ); - await new Promise(resolve => setTimeout(resolve, 200)); + await page.evaluate(() => window.__webamp.skinIsLoaded()); expect(await page.screenshot()).toMatchImageSnapshot(); }); test("uses the volume spirtes as a fallback when balance spirtes are missing", async () => { await page.goto(`http://localhost:8080/#{"disableMarquee":true}`); - expect(page).toUploadFile("#webamp-file-input", "./skins/AmigaPPC-dark.wsz"); - await new Promise(resolve => setTimeout(resolve, 200)); + await expect(page).toUploadFile( + "#webamp-file-input", + "./skins/AmigaPPC-dark.wsz" + ); + await page.evaluate(() => window.__webamp.skinIsLoaded()); expect(await page.screenshot()).toMatchImageSnapshot(); }); test("pads empty space in the marquee with the space character", async () => { await page.goto(`http://localhost:8080/#{"disableMarquee":true}`); // This skin has noticeable light blue where it expects the marquee to always cover. - expect(page).toUploadFile("#webamp-file-input", "./skins/Sonic_Attitude.wsz"); - await new Promise(resolve => setTimeout(resolve, 200)); + await expect(page).toUploadFile( + "#webamp-file-input", + "./skins/Sonic_Attitude.wsz" + ); + await page.evaluate(() => window.__webamp.skinIsLoaded()); await page.evaluate(() => window.__webamp.store.dispatch({ type: "SET_FOCUS", input: "balance" }) );