Unverified Commit bbb72bf2 authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

enable server action RDC deploy test (#90796)

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
parent 410c6580
...@@ -3,7 +3,7 @@ import { retry } from 'next-test-utils' ...@@ -3,7 +3,7 @@ import { retry } from 'next-test-utils'
import { computeCacheBustingSearchParam } from 'next/dist/shared/lib/router/utils/cache-busting-search-param' import { computeCacheBustingSearchParam } from 'next/dist/shared/lib/router/utils/cache-busting-search-param'
describe('resume-data-cache', () => { describe('resume-data-cache', () => {
const { next, isNextDev, isNextDeploy } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
}) })
...@@ -132,41 +132,38 @@ describe('resume-data-cache', () => { ...@@ -132,41 +132,38 @@ describe('resume-data-cache', () => {
} }
) )
// TODO: Re-enable this test once necessary upstream changes are merged to support this it('should use RDC for server action re-renders', async () => {
if (!isNextDeploy) { const browser = await next.browser('/server-action')
it('should use RDC for server action re-renders', async () => {
const browser = await next.browser('/server-action')
// Get the initial values // Get the initial values
const initialCachedValue = await browser const initialCachedValue = await browser
.elementByCss('#cached-random')
.text()
const initialUncachedValue = await browser
.elementByCss('#uncached-random')
.text()
await browser.elementByCss('#refresh-button').click()
// Wait for the action to complete and verify:
// 1. The uncached value should change
// 2. The cached value should remain the same (proving RDC is being used)
await retry(async () => {
const cachedValueAfterAction = await browser
.elementByCss('#cached-random') .elementByCss('#cached-random')
.text() .text()
const initialUncachedValue = await browser const uncachedValueAfterAction = await browser
.elementByCss('#uncached-random') .elementByCss('#uncached-random')
.text() .text()
await browser.elementByCss('#refresh-button').click() // Uncached value should have changed - this proves the action caused a re-render
expect(uncachedValueAfterAction).not.toBe(initialUncachedValue)
// Wait for the action to complete and verify: // Cached value should remain the same - this proves the RDC is being used
// 1. The uncached value should change // to maintain consistency during server action re-renders
// 2. The cached value should remain the same (proving RDC is being used) expect(cachedValueAfterAction).toBe(initialCachedValue)
await retry(async () => {
const cachedValueAfterAction = await browser
.elementByCss('#cached-random')
.text()
const uncachedValueAfterAction = await browser
.elementByCss('#uncached-random')
.text()
// Uncached value should have changed - this proves the action caused a re-render
expect(uncachedValueAfterAction).not.toBe(initialUncachedValue)
// Cached value should remain the same - this proves the RDC is being used
// to maintain consistency during server action re-renders
expect(cachedValueAfterAction).toBe(initialCachedValue)
})
}) })
} })
it('should see fresh data after updateTag in server action with use cache', async () => { it('should see fresh data after updateTag in server action with use cache', async () => {
// This test verifies that when a server action calls updateTag(), // This test verifies that when a server action calls updateTag(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment