rsnext/test/e2e
Tim Neutkens c0b1383c39
Migrate Sass tests to test/e2e (#62321)
## What?

Migrates the Sass support tests from `test/integration` (legacy test
suite) to `test/e2e`, this way all these tests run against both
development and production, whereas previously most of them would only
run against production.

This is helpful as it ensures the tests are running against Turbopack
too, which is highlighting some missing features in Sass support for
Turbopack.

I've had to rewrite most of the tests to check against the actual
rendered output in the browser instead of CSS output in the `.next`
folder, the majority of these now run regardless of implementation
details.

<details>
<summary>Tests that failed with Turbopack</summary>

```
 FAIL  e2e/app-dir/scss/url-global-partial/url-global-partial.test.ts (84.9 s)
  ● SCSS Support loader handling › CSS URL via file-loader sass partial › should render the page

    thrown: "Exceeded timeout of 60000 ms for a test.
    Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

      13 |     })
      14 |
    > 15 |     it('should render the page', async () => {
         |     ^
      16 |       const browser = await next.browser('/')
      17 |       expect(
      18 |         await browser.elementByCss('.red-text').getComputedCss('color')

      at it (e2e/app-dir/scss/url-global-partial/url-global-partial.test.ts:15:5)
      at describe (e2e/app-dir/scss/url-global-partial/url-global-partial.test.ts:7:3)
      at Object.describe (e2e/app-dir/scss/url-global-partial/url-global-partial.test.ts:6:1)

 FAIL  e2e/app-dir/scss/composes-external/composes-external.test.ts (84.765 s)
  ● CSS Module Composes Usage (External) › should render the module

    thrown: "Exceeded timeout of 60000 ms for a test.
    Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

      12 |   })
      13 |
    > 14 |   it('should render the module', async () => {
         |   ^
      15 |     const browser = await next.browser('/')
      16 |     expect(
      17 |       await browser.elementByCss('#verify-yellow').getComputedCss('color')

      at it (e2e/app-dir/scss/composes-external/composes-external.test.ts:14:3)
      at Object.describe (e2e/app-dir/scss/composes-external/composes-external.test.ts:6:1)

 FAIL  e2e/app-dir/scss/composes-basic/composes-basic.test.ts (35.629 s)
  ● CSS Module Composes Usage (Basic) › should render the module

    expect(received).toBe(expected) // Object.is equality

    Expected: "rgb(255, 255, 0)"
    Received: "rgb(0, 0, 0)"

      16 |     expect(
      17 |       await browser.elementByCss('#verify-yellow').getComputedCss('color')
    > 18 |     ).toBe(colorToRgb('yellow'))
         |       ^
      19 |     expect(
      20 |       await browser
      21 |         .elementByCss('#verify-yellow')

      at Object.toBe (e2e/app-dir/scss/composes-basic/composes-basic.test.ts:18:7)

 FAIL  e2e/app-dir/scss/npm-import-nested/npm-import-nested.test.ts (90.889 s)
  ● Good Nested CSS Import from node_modules › should render the page

    thrown: "Exceeded timeout of 60000 ms for a test.
    Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

      12 |   })
      13 |
    > 14 |   it('should render the page', async () => {
         |   ^
      15 |     const browser = await next.browser('/')
      16 |     expect(
      17 |       await browser.elementByCss('.red-text').getComputedCss('color')

      at it (e2e/app-dir/scss/npm-import-nested/npm-import-nested.test.ts:14:3)
      at Object.describe (e2e/app-dir/scss/npm-import-nested/npm-import-nested.test.ts:6:1)

 FAIL  e2e/app-dir/scss/nm-module-nested/nm-module-nested.test.ts (81.941 s)
  ● Valid Nested CSS Module Usage from within node_modules › should render the page

    thrown: "Exceeded timeout of 60000 ms for a test.
    Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

      12 |   })
      13 |
    > 14 |   it('should render the page', async () => {
         |   ^
      15 |     const browser = await next.browser('/')
      16 |     expect(await browser.elementByCss('#other2').getComputedCss('color')).toBe(
      17 |       colorToRgb('red')

      at it (e2e/app-dir/scss/nm-module-nested/nm-module-nested.test.ts:14:3)
      at Object.describe (e2e/app-dir/scss/nm-module-nested/nm-module-nested.test.ts:6:1)

```

</details>

<!-- 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

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### 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 #

-->


Closes NEXT-2550

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2024-03-01 09:43:21 +00:00
..
404-page-router fix(turbopack): e2e/404-page-router test (#58146) 2023-11-22 19:30:26 +01:00
app-dir Migrate Sass tests to test/e2e (#62321) 2024-03-01 09:43:21 +00:00
app-dir-legacy-edge-runtime-config fix(DX): More precise error messages for export const config deprecation (#54492) 2023-08-25 16:25:15 +00:00
basepath Add hasRedbox fix (#60522) 2024-01-15 09:36:44 +01:00
browserslist Skip browserslistrc tests (#61294) 2024-01-29 10:51:44 +01:00
browserslist-extends
cancel-request Try to fix flakey socket hang up failures in stream cancel tests (#53318) 2023-07-28 22:59:24 +00:00
children-page fix: pages not visible in dev when named children (#54007) 2023-08-15 03:50:37 +00:00
config-promise-export
config-schema-check Polish compiling and turbopack logging (#57270) 2023-10-23 19:28:36 +00:00
conflicting-app-page-error Add hasRedbox fix (#60522) 2024-01-15 09:36:44 +01:00
custom-app-render Redesign nextjs logging (#54713) 2023-09-05 11:40:00 +00:00
disable-js-preload Enable App Router for all applications (#49088) 2023-05-04 17:47:10 +02:00
dynamic-route-interpolation fix: support both decoded and encoded url requests of conventioned files (#56187) 2023-10-03 00:02:49 +02:00
edge-api-endpoints-can-receive-body
edge-async-local-storage
edge-can-read-request-body chore: drop form-data (#57141) 2023-10-20 19:25:42 +00:00
edge-can-use-wasm-files
edge-compiler-can-import-blob-assets feat: drop Node.js 16 (#56896) 2023-10-16 21:41:38 +00:00
edge-compiler-module-exports-preference test: rename node_modules_bak to node_modules (#62066) 2024-02-15 00:42:35 +01:00
edge-configurable-runtime Skip configurable runtime warnings tests in Turbopack (#61048) 2024-01-23 16:32:58 -08:00
edge-pages-support Revert "Ensure dynamic routes dont match _next/static unexpectedly" (#62691) 2024-02-29 08:34:11 -08:00
edge-runtime-pages-api-route Fix issue with outputFileTracingExcludes and pages/api edge runtime (#59157) 2023-12-15 16:27:03 +01:00
edge-runtime-uses-edge-light-import-specifier-for-packages test: rename node_modules_bak to node_modules (#62066) 2024-02-15 00:42:35 +01:00
esm-externals add support for esmExternals in pages (#61983) 2024-02-16 23:09:45 +00:00
favicon-short-circuit Short circut 404's for /favicon.ico in development (#54747) 2023-08-30 16:15:19 +00:00
fetch-failures-have-good-stack-traces-in-edge-runtime Add hasRedbox fix (#60522) 2024-01-15 09:36:44 +01:00
getserversideprops Revert "Ensure dynamic routes dont match _next/static unexpectedly" (#62691) 2024-02-29 08:34:11 -08:00
handle-non-hoisted-swc-helpers Update swc_core to v0.75.23 (#48098) 2023-04-18 08:59:52 +02:00
hello-world Bail out of 404 page when favicon.ico doesn't exist (#50795) 2023-06-06 10:58:40 +02:00
i18n-api-support
i18n-data-fetching-redirect
i18n-data-route Strip internal routing headers (#55114) 2023-09-07 22:08:53 +00:00
i18n-default-locale-redirect
i18n-disallow-multiple-locales Update failing i18n e2e deploy test (#47462) 2023-03-23 15:53:14 -07:00
i18n-ignore-redirect-source-locale
i18n-ignore-rewrite-source-locale Skip i18n-ignore-rewrite-basepath-source irrelevant tests with turbopack (#57295) 2023-10-23 15:01:24 -07:00
i18n-preferred-locale-detection Migrate locale redirect handling to router-server (#62606) 2024-02-27 16:37:11 -08:00
ignore-invalid-popstateevent refactor(tests): make chain more "correct" (#51728) 2024-02-14 20:14:24 +01:00
instrumentation-hook Fix instrument bundling as client components (#60984) 2024-01-24 20:02:53 +01:00
instrumentation-hook-src add support for instrumentation (#59070) 2023-11-29 20:01:38 +01:00
link-with-api-rewrite
manual-client-base-path Update manual basePath with trailingSlash (#51726) 2023-06-23 15:36:16 -07:00
middleware-base-path
middleware-custom-matchers Add initial separated route resolving (#47208) 2023-04-02 15:17:15 +02:00
middleware-custom-matchers-basepath Add initial separated route resolving (#47208) 2023-04-02 15:17:15 +02:00
middleware-custom-matchers-i18n Add initial separated route resolving (#47208) 2023-04-02 15:17:15 +02:00
middleware-dynamic-basepath-matcher chore: fix flaky middleware matcher test (#49555) 2023-05-09 22:37:03 +00:00
middleware-fetches-with-any-http-method
middleware-fetches-with-body Revert "Revert "Separate routing code from render servers (#52492)"" (#53029) 2023-07-21 14:02:52 -07:00
middleware-general refactor(tests): make chain more "correct" (#51728) 2024-02-14 20:14:24 +01:00
middleware-matcher
middleware-redirects
middleware-request-header-overrides type check tests (and convert next-test-utils.js to ts) (#51071) 2023-06-23 17:42:50 +00:00
middleware-responses
middleware-rewrites refactor(tests): make chain more "correct" (#51728) 2024-02-14 20:14:24 +01:00
middleware-shallow-link
middleware-trailing-slash Revert "Revert "Update split chunk handling for edge/node" (#62313)" (#62336) 2024-02-21 11:40:29 -08:00
module-layer Update module-layer test for Turbopack (#60707) 2024-01-16 18:36:35 +00:00
multi-zone Fix instrumentation with only pages (#62622) 2024-02-28 11:38:39 +01:00
new-link-behavior refactor(tests): make chain more "correct" (#51728) 2024-02-14 20:14:24 +01:00
next-font fix(next-font): update capsize css so fallbacks are updated with the … (#62309) 2024-02-20 22:04:56 -08:00
next-head Ensure tests suites have unique names (#56085) 2023-09-27 13:55:45 +02:00
next-image-forward-ref
next-phase Fix next phase for next build (#60969) 2024-01-22 15:37:04 +01:00
next-script Skip experimental.nextScriptWorkers test for Turbopack (#56086) 2023-09-27 13:58:11 +02:00
no-eslint-warn-with-no-eslint-config
nonce-head-manager Ensure tests suites have unique names (#56085) 2023-09-27 13:55:45 +02:00
og-api Remove experimental config from create-next-app (#49241) 2023-05-05 00:22:28 -07:00
opentelemetry Fix instrumentation with only pages (#62622) 2024-02-28 11:38:39 +01:00
optimized-loading Enable App Router for all applications (#49088) 2023-05-04 17:47:10 +02:00
pages-performance-mark Fix performance measures crashing the app (#54858) 2023-09-01 14:51:38 +00:00
postcss-config-cjs
prerender
prerender-native-module
proxy-request-with-middleware Add initial separated route resolving (#47208) 2023-04-02 15:17:15 +02:00
react-dnd-compile Failing test for 59195 (#59210) 2023-12-04 05:13:28 +01:00
reload-scroll-backforward-restoration
repeated-forward-slashes-error
skip-trailing-slash-redirect Use consistent name for App Router tests (#56352) 2023-10-06 11:06:06 +02:00
socket-io Fix unmatched WebSocket upgrade requests being closed (#57245) 2023-10-23 17:23:34 +00:00
ssr-react-context
streaming-ssr Revert "Ensure webpack build worker defaults on" (#62342) 2024-02-21 12:00:18 -08:00
styled-jsx test: rename node_modules_bak to node_modules (#62066) 2024-02-15 00:42:35 +01:00
swc-warnings Fix e2e/swc-warnings (#61265) 2024-01-27 19:51:57 +01:00
switchable-runtime Revert "Revert "Update split chunk handling for edge/node" (#62313)" (#62336) 2024-02-21 11:40:29 -08:00
test-template/{{ toFileName name }} chore: update test template to use nextTestSetup (#62154) 2024-02-16 17:30:54 +01:00
test-utils-tests/basic chore: update test template to use nextTestSetup (#62154) 2024-02-16 17:30:54 +01:00
testmode Testmode: support edge functions inside a sandbox (#59179) 2023-12-04 16:47:34 -08:00
third-parties Adding Google analytics to next/third-parties (#58418) 2023-12-11 18:21:32 +00:00
trailingslash-with-rewrite
transpile-packages test: rename node_modules_bak to node_modules (#62066) 2024-02-15 00:42:35 +01:00
type-module-interop Add hasRedbox fix (#60522) 2024-01-15 09:36:44 +01:00
typescript-version-no-warning Bump to typescript@5.1 (#50557) 2023-06-08 17:18:37 +00:00
typescript-version-warning Redesign nextjs logging (#54713) 2023-09-05 11:40:00 +00:00
undici-fetch feat: make enableUndici: true default and remove node-fetch (#49061) 2023-05-02 04:10:59 +00:00
useselectedlayoutsegment-s-in-pages-router fix(navigation): allow useSelectedLayoutSegment(s) in Pages Router (#62584) 2024-02-29 13:14:52 +00:00
yarn-pnp/test Disable Yarn PnP tests for Turbopack (#61040) 2024-01-23 21:25:20 +01:00
basepath-trailing-slash.test.ts Add hasRedbox fix (#60522) 2024-01-15 09:36:44 +01:00
basepath.test.ts Add hasRedbox fix (#60522) 2024-01-15 09:36:44 +01:00
example-file.txt
example.txt chore: update test template to use nextTestSetup (#62154) 2024-02-16 17:30:54 +01:00
prerender-crawler.test.ts
prerender-native-module.test.ts server: re-land bundled runtimes (#55139) 2023-09-08 16:05:29 +00:00
prerender.test.ts Revert "Ensure dynamic routes dont match _next/static unexpectedly" (#62691) 2024-02-29 08:34:11 -08:00