Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
02de2079
Unverified
Commit
02de2079
authored
Jun 13, 2024
by
Zack Tanner
Committed by
GitHub
Jun 13, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix actions-navigation deploy test (#66850)
Switches to reading action result from state rather than runtime logs.
parent
4dd26753
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
8 deletions
+9
-8
deploy-tests-manifest.json
test/deploy-tests-manifest.json
+0
-1
actions.js
...ested-folder/(foo)/product-category/[...slugs]/actions.js
+1
-1
page.js
...p/nested-folder/(foo)/product-category/[...slugs]/page.js
+4
-2
index.test.ts
test/e2e/app-dir/actions-navigation/index.test.ts
+4
-4
No files found.
test/deploy-tests-manifest.json
View file @
02de2079
...
@@ -36,7 +36,6 @@
...
@@ -36,7 +36,6 @@
"test/e2e/app-dir/mdx/mdx.test.ts"
,
"test/e2e/app-dir/mdx/mdx.test.ts"
,
"test/e2e/app-dir/modularizeimports/modularizeimports.test.ts"
,
"test/e2e/app-dir/modularizeimports/modularizeimports.test.ts"
,
"test/e2e/app-dir/third-parties/basic.test.ts"
,
"test/e2e/app-dir/third-parties/basic.test.ts"
,
"test/e2e/app-dir/actions-navigation/index.test.ts"
,
"test/e2e/app-dir/app-static/app-static-custom-handler.test.ts"
,
"test/e2e/app-dir/app-static/app-static-custom-handler.test.ts"
,
"test/e2e/app-dir/options-request/options-request.test.ts"
,
"test/e2e/app-dir/options-request/options-request.test.ts"
,
"test/e2e/app-dir/revalidate-dynamic/revalidate-dynamic.test.ts"
,
"test/e2e/app-dir/revalidate-dynamic/revalidate-dynamic.test.ts"
,
...
...
test/e2e/app-dir/actions-navigation/app/nested-folder/(foo)/product-category/[...slugs]/actions.js
View file @
02de2079
'use server'
'use server'
export
async
function
addToCart
()
{
export
async
function
addToCart
()
{
console
.
log
(
'addToCart'
)
return
'Added to cart!'
}
}
test/e2e/app-dir/actions-navigation/app/nested-folder/(foo)/product-category/[...slugs]/page.js
View file @
02de2079
'use client'
'use client'
import
{
useFormStatus
}
from
'react-dom'
import
{
useFormStatus
,
useFormState
}
from
'react-dom'
import
{
addToCart
}
from
'./actions'
import
{
addToCart
}
from
'./actions'
function
SubmitButton
()
{
function
SubmitButton
()
{
...
@@ -13,10 +13,12 @@ function SubmitButton() {
...
@@ -13,10 +13,12 @@ function SubmitButton() {
}
}
export
default
function
Page
()
{
export
default
function
Page
()
{
const
[
state
,
formAction
]
=
useFormState
(
addToCart
)
return
(
return
(
<>
<>
<
h1
>
Add
to
cart
<
/h1
>
<
h1
>
Add
to
cart
<
/h1
>
<
form
action
=
{
addToCart
}
>
{
state
&&
<
div
id
=
"result"
>
{
state
}
<
/div>
}
<
form
action
=
{
formAction
}
>
<
SubmitButton
/>
<
SubmitButton
/>
<
/form
>
<
/form
>
<
/
>
<
/
>
...
...
test/e2e/app-dir/actions-navigation/index.test.ts
View file @
02de2079
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
check
,
waitFor
}
from
'next-test-utils'
import
{
check
,
waitFor
,
retry
}
from
'next-test-utils'
describe
(
'app-dir action handling'
,
()
=>
{
describe
(
'app-dir action handling'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
const
{
next
}
=
nextTestSetup
({
...
@@ -40,8 +40,8 @@ describe('app-dir action handling', () => {
...
@@ -40,8 +40,8 @@ describe('app-dir action handling', () => {
await
browser
.
elementByCss
(
'button'
).
click
()
await
browser
.
elementByCss
(
'button'
).
click
()
await
check
(
()
=>
{
await
retry
(
async
()
=>
{
return
(
next
.
cliOutput
.
match
(
/addToCart/g
)
||
[]).
length
expect
(
await
browser
.
elementById
(
'result'
).
text
()).
toBe
(
'Added to cart!'
)
}
,
1
)
})
})
})
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment