Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
dfd3fae
apply patch correctly for last segment
feedthejim Mar 22, 2023
739a584
re-render layout on parallel key change
feedthejim Mar 22, 2023
a51b1db
refactor for readability
feedthejim Mar 22, 2023
b120b12
implement parallel routes default
feedthejim Mar 23, 2023
a79fe3f
remove useless check
feedthejim Mar 23, 2023
452770a
remove leftover fn
feedthejim Mar 23, 2023
98f6eb2
enable tests in dev
feedthejim Mar 23, 2023
8829681
fix test + small refactor
feedthejim Mar 23, 2023
c6326ca
fix test
feedthejim Mar 23, 2023
59b3634
support @children
feedthejim Mar 24, 2023
6abf5fa
re-enable test for build
feedthejim Mar 24, 2023
3084422
fix adjacent child check for directory only
feedthejim Mar 24, 2023
47a6f00
Merge branch 'canary' into feedthejim/next-748-verify-partial-renderi…
feedthejim Mar 24, 2023
1192d34
fix lint
feedthejim Mar 24, 2023
9ade248
initial implementation
feedthejim Mar 25, 2023
64284d8
refactors
feedthejim Mar 26, 2023
4900fa2
fix hmr
feedthejim Mar 27, 2023
9b83aef
change referrer computation method
feedthejim Mar 27, 2023
92cbf42
add segment tree override
feedthejim Mar 27, 2023
999b516
Merge branch 'canary' into feedthejim/next-749-implement-route-interc…
feedthejim Mar 27, 2023
b8bde07
fix types
feedthejim Mar 27, 2023
0fde8ff
fix test
feedthejim Mar 27, 2023
02d037b
update tests
feedthejim Mar 27, 2023
be9e620
rewrite tests
feedthejim Mar 27, 2023
8fdb943
remove logs
feedthejim Mar 27, 2023
94d4a59
add unit test for referrer parsing
feedthejim Mar 27, 2023
9fc9bc9
Merge branch 'canary' into feedthejim/next-749-implement-route-interc…
feedthejim Mar 27, 2023
45b1a43
remove log
feedthejim Mar 27, 2023
acb3b29
update comments
feedthejim Mar 27, 2023
d097f9f
Merge branch 'canary' into feedthejim/next-749-implement-route-interc…
feedthejim Mar 27, 2023
92237b9
Merge branch 'canary' into feedthejim/next-749-implement-route-interc…
feedthejim Mar 27, 2023
09c6ce6
refactor: provide more consistent interface for matchers with pathnam…
wyattjoh Mar 27, 2023
ce365a9
refactor: formatting updates
wyattjoh Mar 27, 2023
be0c36c
fix: added key prop's to test files
wyattjoh Mar 28, 2023
b2ac7dc
fix: corrected invalid slot name
wyattjoh Mar 28, 2023
853f9fd
Merge branch 'canary' into feedthejim/next-749-implement-route-interc…
feedthejim Mar 28, 2023
eac2b2d
address comments
feedthejim Mar 28, 2023
6783565
fix windows test
feedthejim Mar 28, 2023
6001b80
Merge branch 'canary' into feedthejim/next-749-implement-route-interc…
feedthejim Mar 28, 2023
a1f00be
Merge branch 'canary' into feedthejim/next-749-implement-route-interc…
feedthejim Mar 28, 2023
d615593
use check for tests
feedthejim Mar 28, 2023
d66a842
Merge branch 'canary' into feedthejim/next-749-implement-route-interc…
feedthejim Mar 28, 2023
f6ab0f7
fix tests failures
feedthejim Mar 28, 2023
76c9726
Merge branch 'canary' into feedthejim/next-749-implement-route-interc…
feedthejim Mar 28, 2023
61cd219
Merge branch 'canary' into feedthejim/next-749-implement-route-interc…
feedthejim Mar 29, 2023
58d247d
restire test position
feedthejim Mar 28, 2023
ceaa38f
Merge branch 'canary' into feedthejim/next-749-implement-route-interc…
feedthejim Mar 31, 2023
1496087
update injection method
feedthejim Mar 31, 2023
9b168df
make sure we patch the tree if the previous page was a __DEFAULT__
feedthejim Mar 31, 2023
148f04f
pass the previous cache node when populating the cache tree
feedthejim Mar 31, 2023
08cdb07
add a fast refresh reducer
feedthejim Mar 31, 2023
ab4533f
Merge branch 'canary' into feedthejim/next-749-implement-route-interc…
feedthejim Mar 31, 2023
f7041fe
remove misc change
feedthejim Mar 31, 2023
1512bc8
Merge branch 'canary' into feedthejim/next-749-implement-route-interc…
feedthejim Apr 3, 2023
266c003
pass the existing cache node nonethelesss
feedthejim Apr 3, 2023
c4589bf
skip __DEFAULT__ item when applying fligth data to the cache
feedthejim Apr 3, 2023
5e4abc0
don't overwrite cache node if already ready
feedthejim Apr 3, 2023
6ce7349
add 404 by default for parallel routes
feedthejim Apr 3, 2023
b59a53d
Merge branch 'canary' into feedthejim/next-918-make-default-pagets-404
feedthejim Apr 4, 2023
4a369f8
Merge branch 'canary' into feedthejim/next-918-make-default-pagets-404
feedthejim Apr 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use check for tests
  • Loading branch information
feedthejim committed Mar 28, 2023
commit d61559306203a46df652cdd7be2df0fa0f9f17e2
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createNextDescribe } from 'e2e-utils'
import { check } from 'next-test-utils'

createNextDescribe(
'parallel-routes-and-interception',
Expand All @@ -11,39 +12,50 @@ createNextDescribe(
const browser = await next.browser('/parallel-tab-bar')

const hasHome = async () => {
const text = await browser.waitForElementByCss('#home').text()
expect(text).toBe('Tab bar page (@children)')
await check(
() => browser.waitForElementByCss('#home').text(),
'Tab bar page (@children)'
)
}
const hasViewsHome = async () => {
const text = await browser.waitForElementByCss('#views-home').text()
expect(text).toBe('Views home')
await check(
() => browser.waitForElementByCss('#views-home').text(),
'Views home'
)
}
const hasViewDuration = async () => {
const text = await browser
.waitForElementByCss('#view-duration')
.text()
expect(text).toBe('View duration')
await check(
() => browser.waitForElementByCss('#view-duration').text(),
'View duration'
)
}
const hasImpressions = async () => {
const text = await browser.waitForElementByCss('#impressions').text()
expect(text).toBe('Impressions')
await check(
() => browser.waitForElementByCss('#impressions').text(),
'Impressions'
)
}
const hasAudienceHome = async () => {
const text = await browser
.waitForElementByCss('#audience-home')
.text()
expect(text).toBe('Audience home')
await check(
() => browser.waitForElementByCss('#audience-home').text(),
'Audience home'
)
}
const hasDemographics = async () => {
const text = await browser.waitForElementByCss('#demographics').text()
expect(text).toBe('Demographics')
await check(
() => browser.waitForElementByCss('#demographics').text(),
'Demographics'
)
}
const hasSubscribers = async () => {
const text = await browser.waitForElementByCss('#subscribers').text()
expect(text).toBe('Subscribers')
await check(
() => browser.waitForElementByCss('#subscribers').text(),
'Subscribers'
)
}
const checkUrlPath = async (path: string) => {
expect(await browser.url()).toBe(
await check(
() => browser.url(),
`${next.url}/parallel-tab-bar${path}`
)
}
Expand Down Expand Up @@ -119,36 +131,36 @@ createNextDescribe(

// TODO: fix back/forward navigation test
// Test that back navigation works as intended
// await browser.back()
// await step5()
// console.log('step5 back')
// await browser.back()
// await step4()
// console.log('step4 back')
// await browser.back()
// await step3()
// console.log('step3 back')

// await browser.back()
// await step2()
// console.log('step2 back')
// await browser.back()
// await step1()
// console.log('step1 back')
// console.log('step6')

// // Test that forward navigation works as intended
// await browser.forward()
// await step2()
// console.log('step2 forward')
// await browser.forward()
// await step3()
// console.log('step3 forward')
// await browser.forward()
// await step4()
// console.log('step4 forward')
// await browser.forward()
// await step5()
await browser.back()
await step5()
console.log('step5 back')
await browser.back()
await step4()
console.log('step4 back')
await browser.back()
await step3()
console.log('step3 back')

await browser.back()
await step2()
console.log('step2 back')
await browser.back()
await step1()
console.log('step1 back')
console.log('step6')

// Test that forward navigation works as intended
await browser.forward()
await step2()
console.log('step2 forward')
await browser.forward()
await step3()
console.log('step3 forward')
await browser.forward()
await step4()
console.log('step4 forward')
await browser.forward()
await step5()
})

it('should match parallel routes', async () => {
Expand Down Expand Up @@ -176,30 +188,35 @@ createNextDescribe(
const browser = await next.browser('/intercepting-routes/feed')

// Check if navigation to modal route works.
expect(
await browser
.elementByCss('[href="/intercepting-routes/photos/1"]')
.click()
.waitForElementByCss('#photo-intercepted-1')
.text()
).toBe('Photo INTERCEPTED 1')
await check(
() =>
browser
.elementByCss('[href="/intercepting-routes/photos/1"]')
.click()
.waitForElementByCss('#photo-intercepted-1')
.text(),
'Photo INTERCEPTED 1'
)

// Check if intercepted route was rendered while existing page content was removed.
// Content would only be preserved when combined with parallel routes.
// expect(await browser.elementByCss('#feed-page').text()).not.toBe('Feed')
// await check(() => browser.elementByCss('#feed-page').text()).not.toBe('Feed')

// Check if url matches even though it was intercepted.
expect(await browser.url()).toBe(
await check(
() => browser.url(),
next.url + '/intercepting-routes/photos/1'
)

// Trigger a refresh, this should load the normal page, not the modal.
expect(
await browser.refresh().waitForElementByCss('#photo-page-1').text()
).toBe('Photo PAGE 1')
await check(
() => browser.refresh().waitForElementByCss('#photo-page-1').text(),
'Photo PAGE 1'
)

// Check if the url matches still.
expect(await browser.url()).toBe(
await check(
() => browser.url(),
next.url + '/intercepting-routes/photos/1'
)
})
Expand All @@ -209,31 +226,37 @@ createNextDescribe(
'/intercepting-parallel-modal/vercel'
)
// Check if navigation to modal route works.
expect(
await browser
.elementByCss('[href="/intercepting-parallel-modal/photo/1"]')
.click()
.waitForElementByCss('#photo-modal-1')
.text()
).toBe('Photo MODAL 1')
await check(
() =>
browser
.elementByCss('[href="/intercepting-parallel-modal/photo/1"]')
.click()
.waitForElementByCss('#photo-modal-1')
.text(),
'Photo MODAL 1'
)

// Check if modal was rendered while existing page content is preserved.
expect(await browser.elementByCss('#user-page').text()).toBe(
await check(
() => browser.elementByCss('#user-page').text(),
'Feed for vercel'
)

// Check if url matches even though it was intercepted.
expect(await browser.url()).toBe(
await check(
() => browser.url(),
next.url + '/intercepting-parallel-modal/photo/1'
)

// Trigger a refresh, this should load the normal page, not the modal.
expect(
await browser.refresh().waitForElementByCss('#photo-page-1').text()
).toBe('Photo PAGE 1')
await check(
() => browser.refresh().waitForElementByCss('#photo-page-1').text(),
'Photo PAGE 1'
)

// Check if the url matches still.
expect(await browser.url()).toBe(
await check(
() => browser.url(),
next.url + '/intercepting-parallel-modal/photo/1'
)
})
Expand Down