Unverified Commit b3278b75 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

test: Use Turbopack for 'Test new and changed tests when deployed' (#95552)

parent 8cc2bd1e
......@@ -754,6 +754,7 @@ jobs:
export NEXT_E2E_TEST_TIMEOUT=240000
export __NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES=true
export __NEXT_EXPERIMENTAL_APP_NEW_SCROLL_HANDLER=false
export IS_TURBOPACK_TEST=1
node scripts/test-new-tests.mjs \
--mode deploy \
--group ${{ matrix.group }} \
......@@ -788,6 +789,7 @@ jobs:
export NEXT_ENABLE_ADAPTER=1
export NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json,test/cache-components-tests-manifest.json"
export NEXT_E2E_TEST_TIMEOUT=240000
export IS_TURBOPACK_TEST=1
node scripts/test-new-tests.mjs \
--mode deploy \
--group ${{ matrix.group }} \
......
......@@ -189,7 +189,15 @@ async function main() {
NEXT_TEST_MODE: testMode,
NEXT_TEST_VERSION: nextTestVersion,
NEXT_TEST_PREVIEW_BUILDS_BASE_URL: previewBuildsBaseUrl,
IS_WEBPACK_TEST: '1',
TURBOPACK_BUILD:
process.env.IS_TURBOPACK_TEST &&
(testMode === 'start' || testMode === 'deploy')
? '1'
: undefined,
TURBOPACK_DEV:
process.env.IS_TURBOPACK_TEST && testMode === 'dev'
? '1'
: undefined,
NEXT_TEST_SKIP_RESULT_CACHE: '1',
},
})
......
import { FileRef, nextTestSetup } from 'e2e-utils'
import { check } from 'next-test-utils'
import { retry } from 'next-test-utils'
import { join } from 'path'
describe('app-dir action useActionState', () => {
......@@ -20,9 +20,11 @@ describe('app-dir action useActionState', () => {
await browser.eval(`document.getElementById('name-input').value = 'test'`)
await browser.elementByCss('#submit-form').click()
await check(() => {
return browser.elementByCss('#form-state').text()
}, 'initial-state:test')
await retry(async () => {
expect(await browser.elementByCss('#form-state').text()).toBe(
'initial-state:test'
)
})
})
it('should support submitting form state without JS', async () => {
......@@ -34,9 +36,11 @@ describe('app-dir action useActionState', () => {
await browser.elementByCss('#submit-form').click()
// It should inline the form state into HTML so it can still be hydrated.
await check(() => {
return browser.elementByCss('#form-state').text()
}, 'initial-state:test')
await retry(async () => {
expect(await browser.elementByCss('#form-state').text()).toBe(
'initial-state:test'
)
})
})
it('should support hydrating the app from progressively enhanced form request', async () => {
......@@ -46,14 +50,16 @@ describe('app-dir action useActionState', () => {
await browser.eval(`document.getElementById('name-input').value = 'test'`)
await browser.eval(`document.getElementById('form-state-form').submit()`)
await check(() => {
return browser.elementByCss('#form-state').text()
}, 'initial-state:test')
await retry(async () => {
expect(await browser.elementByCss('#form-state').text()).toBe(
'initial-state:test'
)
})
// Should hydrate successfully
await check(() => {
return browser.elementByCss('#hydrated').text()
}, 'hydrated')
await retry(async () => {
expect(await browser.elementByCss('#hydrated').text()).toBe('hydrated')
})
})
it('should send the action to the provided permalink with form state when JS disabled', async () => {
......@@ -67,8 +73,10 @@ describe('app-dir action useActionState', () => {
)
await browser.eval(`document.getElementById('form-state-form').submit()`)
await check(() => {
return browser.elementByCss('#form-state').text()
}, 'initial-state:test-permalink')
await retry(async () => {
expect(await browser.elementByCss('#form-state').text()).toBe(
'initial-state:test-permalink'
)
})
})
})
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