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