MCPcopy
hub / github.com/vercel/next.js / runTests

Function runTests

test/integration/rewrites-client-resolving/test/index.test.ts:17–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15let app
16
17const runTests = () => {
18 it('should break rewrites chain when dynamic route matches', async () => {
19 const browser = await webdriver(appPort, '/')
20 await browser.elementByCss('#product-link').click()
21 await browser.waitForElementByCss('#product')
22
23 expect(await browser.elementByCss('#product').text()).toBe('product: first')
24 })
25
26 it('should break rewrites chain when normal page matches', async () => {
27 const browser = await webdriver(appPort, '/')
28 await browser.elementByCss('#products-link').click()
29 await browser.waitForElementByCss('#products')
30
31 expect(await browser.elementByCss('#products').text()).toBe('products')
32 })
33
34 it('should break rewrites chain when dynamic catch-all route matches', async () => {
35 const browser = await webdriver(appPort, '/')
36 await browser.elementByCss('#category-link').click()
37 await browser.waitForElementByCss('#category')
38
39 expect(await browser.elementByCss('#category').text()).toBe(
40 'category: first'
41 )
42 })
43
44 it('should break rewrites chain when dynamic catch-all route multi-level matches', async () => {
45 const browser = await webdriver(appPort, '/')
46 await browser.elementByCss('#category-link-again').click()
47 await browser.waitForElementByCss('#category')
48
49 expect(await browser.elementByCss('#category').text()).toBe(
50 'category: hello/world'
51 )
52 })
53
54 it('should break rewrites chain after matching /category', async () => {
55 const browser = await webdriver(appPort, '/')
56 await browser.elementByCss('#categories-link').click()
57 await browser.waitForElementByCss('#categories')
58
59 expect(await browser.elementByCss('#categories').text()).toBe('categories')
60 })
61}
62
63describe('Client-side rewrites resolving', () => {
64 ;(process.env.TURBOPACK_BUILD ? describe.skip : describe)(

Callers 1

index.test.tsFile · 0.70

Calls 7

webdriverFunction · 0.85
clickMethod · 0.80
elementByCssMethod · 0.80
waitForElementByCssMethod · 0.80
textMethod · 0.65
itFunction · 0.50
expectFunction · 0.50

Tested by

no test coverage detected