diff --git a/test/spa-loader/spa-preloader-outside-disabled.test.ts b/test/spa-loader/spa-preloader-outside-disabled.test.ts index 1a6e1efbf5..5c794b627e 100644 --- a/test/spa-loader/spa-preloader-outside-disabled.test.ts +++ b/test/spa-loader/spa-preloader-outside-disabled.test.ts @@ -25,19 +25,21 @@ await setup({ }) describe('spaLoadingTemplateLocation flag is set to `within`', () => { - it('shoul be render loader inside appTag', async () => { + it('should render loader inside appTag', async () => { const html = await $fetch('/spa') - expect(html.replace(/[\n\r]+/g, '')).toContain( + expect(html).toContain( `
loading...
`, ) }) - it.skipIf(isDev)('spa-loader does not appear while the app is mounting', async () => { + it('spa-loader does not appear while the app is mounting', async () => { const browser = await getBrowser() const page = await browser.newPage({}) - await page.goto(url('/spa'), { waitUntil: 'domcontentloaded' }) + await page.goto(url('/spa')) const loader = page.getByTestId('loader') + + await page.waitForFunction(() => window.useNuxtApp?.() && window.useNuxtApp?.().isHydrating) expect(await loader.isHidden()).toBeTruthy() await page.close() diff --git a/test/spa-loader/spa-preloader-outside-enabled.test.ts b/test/spa-loader/spa-preloader-outside-enabled.test.ts index ac894f2d13..f8313b1eec 100644 --- a/test/spa-loader/spa-preloader-outside-enabled.test.ts +++ b/test/spa-loader/spa-preloader-outside-enabled.test.ts @@ -24,7 +24,7 @@ describe('spaLoadingTemplateLocation flag is set to `body`', () => { it('should render spa-loader', async () => { const browser = await getBrowser() const page = await browser.newPage({}) - await page.goto(url('/spa'), { waitUntil: 'domcontentloaded' }) + await page.goto(url('/spa')) const loader = page.getByTestId('loader') expect(await loader.isVisible()).toBeTruthy() @@ -38,7 +38,7 @@ describe('spaLoadingTemplateLocation flag is set to `body`', () => { it('should render content without spa-loader', async () => { const browser = await getBrowser() const page = await browser.newPage({}) - await page.goto(url('/ssr'), { waitUntil: 'domcontentloaded' }) + await page.goto(url('/ssr')) const loader = page.getByTestId('loader') expect(await loader.isHidden()).toBeTruthy()