From 6e3d969766c0cb2c539c3606a83d33e32deaf112 Mon Sep 17 00:00:00 2001 From: Marcus-Rise Date: Tue, 8 Nov 2022 13:56:30 +0400 Subject: [PATCH] #42398 test(production): check link to iso route --- .../index.test.ts | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/test/production/app-dir-prefetch-non-iso-url/index.test.ts b/test/production/app-dir-prefetch-non-iso-url/index.test.ts index dfb4c62197989..28625dbe8164a 100644 --- a/test/production/app-dir-prefetch-non-iso-url/index.test.ts +++ b/test/production/app-dir-prefetch-non-iso-url/index.test.ts @@ -3,7 +3,6 @@ import { NextInstance } from 'test/lib/next-modes/base' import { join } from 'path' import { BrowserInterface } from '../../lib/browsers/base' import webdriver from 'next-webdriver' -import { waitFor } from 'next-test-utils' describe('app-dir-prefetch-non-iso-url', () => { let next: NextInstance @@ -18,6 +17,22 @@ describe('app-dir-prefetch-non-iso-url', () => { }) afterAll(() => next.destroy()) + it('should go to iso url', async () => { + let browser: BrowserInterface + + try { + browser = await webdriver(next.appPort, '/') + await browser.elementByCss('#to-iso').click() + + const text = await browser.elementByCss('#page').text() + expect(text).toBe('/[slug]') + } finally { + if (browser) { + await browser.close() + } + } + }) + it('should go to non-iso url', async () => { let browser: BrowserInterface @@ -25,9 +40,8 @@ describe('app-dir-prefetch-non-iso-url', () => { browser = await webdriver(next.appPort, '/') await browser.elementByCss('#to-non-iso').click() - await waitFor(3000) - - expect(browser.elementByCss('#page')).toBe('/[slug]') + const text = await browser.elementByCss('#page').text() + expect(text).toBe('/[slug]') } finally { if (browser) { await browser.close()