Skip to content

Commit 02989b6

Browse files
amannncursoragent
andauthored
test: Refactor extractor tests to e2e (#2312)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent e68a591 commit 02989b6

44 files changed

Lines changed: 2150 additions & 1927 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
with:
4343
path: ~/.cache/ms-playwright
4444
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}
45-
- run: pnpm --filter example-app-router exec playwright install --with-deps
45+
- run: pnpm --filter example-app-router --filter "./e2e/extracted-json" --filter "./e2e/extracted-po" exec playwright install --with-deps
4646
if: steps.playwright-cache.outputs.cache-hit != 'true'
4747

4848
# Main tasks

e2e/extracted-json/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
.next/
3+
playwright-report/
4+
test-results/

e2e/extracted-json/.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.next
2+
test-results
3+
next-env.d.ts
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {defineConfig} from 'eslint/config';
2+
import nextVitals from 'eslint-config-next/core-web-vitals';
3+
import nextTs from 'eslint-config-next/typescript';
4+
5+
export default defineConfig([
6+
...nextVitals,
7+
...nextTs,
8+
{
9+
rules: {
10+
'@typescript-eslint/no-unused-vars': [
11+
'error',
12+
{
13+
argsIgnorePattern: '^_',
14+
caughtErrorsIgnorePattern: '^_',
15+
varsIgnorePattern: '^_'
16+
}
17+
]
18+
}
19+
}
20+
]);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"NhX4DJ": "Hallo",
3+
"+YJVTi": ""
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"NhX4DJ": "Hello",
3+
"+YJVTi": "Hey!"
4+
}

e2e/extracted-json/next-env.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
import "./.next/dev/types/routes.d.ts";
4+
5+
// NOTE: This file should not be edited
6+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

e2e/extracted-json/next.config.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {NextConfig} from 'next';
2+
import createNextIntlPlugin from 'next-intl/plugin';
3+
4+
const withNextIntl = createNextIntlPlugin({
5+
experimental: {
6+
srcPath: './src',
7+
extract: {sourceLocale: 'en'},
8+
messages: {
9+
path: './messages',
10+
format: 'json',
11+
locales: 'infer'
12+
}
13+
}
14+
});
15+
16+
const config: NextConfig = {};
17+
export default withNextIntl(config);

e2e/extracted-json/package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "e2e-extracted-json",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"dev": "next dev",
7+
"lint": "eslint src tests && prettier . --check",
8+
"build": "next build",
9+
"start": "next start",
10+
"test": "playwright test"
11+
},
12+
"dependencies": {
13+
"e2e-utils": "workspace:*",
14+
"next": "^16.0.10",
15+
"next-intl": "workspace:*",
16+
"react": "^19.2.3",
17+
"react-dom": "^19.2.3",
18+
"use-intl": "workspace:*"
19+
},
20+
"devDependencies": {
21+
"@eslint/eslintrc": "^3.1.0",
22+
"@playwright/test": "^1.51.1",
23+
"@types/react": "^19.2.3",
24+
"@types/react-dom": "^19.2.3",
25+
"eslint": "^9.38.0",
26+
"eslint-config-next": "^16.0.10",
27+
"prettier": "^3.3.3",
28+
"typescript": "^5.5.3"
29+
},
30+
"prettier": {
31+
"singleQuote": true,
32+
"bracketSpacing": false,
33+
"trailingComma": "none"
34+
},
35+
"engines": {
36+
"node": ">=20.0.0"
37+
}
38+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import {defineConfig, devices} from '@playwright/test';
2+
import {reserveSharedPlaywrightDevPort} from 'e2e-utils/playwright-dev-port';
3+
4+
const port = await reserveSharedPlaywrightDevPort(
5+
'PW_E2E_EXTRACTED_JSON_DEV_PORT'
6+
);
7+
8+
export default defineConfig({
9+
workers: 1,
10+
fullyParallel: false,
11+
testDir: './tests',
12+
timeout: 120_000,
13+
use: {
14+
...devices['Desktop Chrome'],
15+
baseURL: `http://localhost:${port}`
16+
},
17+
webServer: {
18+
command: `PORT=${port} pnpm dev`,
19+
port,
20+
reuseExistingServer: !process.env.CI
21+
}
22+
});

0 commit comments

Comments
 (0)