Skip to content

Commit

Permalink
#42398 test(production): check link to iso route
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus-Rise committed Nov 8, 2022
1 parent ad03327 commit 592f8c7
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions test/production/app-dir-prefetch-non-iso-url/index.test.ts
Expand Up @@ -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
Expand All @@ -18,16 +17,31 @@ 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

try {
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()
Expand Down

0 comments on commit 592f8c7

Please sign in to comment.