Skip to content

Commit 5d9b3ad

Browse files
committed
chore: add-e2e-app
1 parent 7742dd2 commit 5d9b3ad

24 files changed

Lines changed: 296 additions & 5 deletions

.github/instructions/nx.instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ If the user wants to generate something, use the following flow:
2929
- wait for the user to finish the generator
3030
- read the generator log file using the 'nx_read_generator_log' tool
3131
- use the information provided in the log file to answer the user's question or continue with what they were doing
32+
undefined
3233

3334
# CI Error Guidelines
3435

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,5 @@ packages/davinci-client/src/lib/mock-data/*.d.ts
7474
packages/davinci-client/src/lib/mock-data/*.d.ts.map
7575
**/**/tsconfig.tsbuildinfo
7676
**/**/tsconfig.spec.vitest-temp.json
77+
78+
test-output

e2e/oidc-app-e2e/eslint.config.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import playwright from 'eslint-plugin-playwright';
2+
import baseConfig from '../../eslint.config.mjs';
3+
4+
export default [
5+
playwright.configs['flat/recommended'],
6+
...baseConfig,
7+
{
8+
files: ['**/*.ts', '**/*.js'],
9+
// Override or add rules here
10+
rules: {},
11+
},
12+
];

e2e/oidc-app-e2e/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "@forgerock/oidc-e2e",
3+
"version": "0.0.1",
4+
"private": true,
5+
"nx": {
6+
"implicitDependencies": ["oidc-app"]
7+
}
8+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { defineConfig, devices } from '@playwright/test';
2+
import { nxE2EPreset } from '@nx/playwright/preset';
3+
import { workspaceRoot } from '@nx/devkit';
4+
5+
// For CI, you may want to set BASE_URL to the deployed application.
6+
const baseURL = process.env['BASE_URL'] || 'http://localhost:8443';
7+
8+
/**
9+
* Read environment variables from file.
10+
* https://github.com/motdotla/dotenv
11+
*/
12+
// require('dotenv').config();
13+
14+
/**
15+
* See https://playwright.dev/docs/test-configuration.
16+
*/
17+
export default defineConfig({
18+
...nxE2EPreset(__filename, { testDir: './src' }),
19+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
20+
use: {
21+
baseURL,
22+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
23+
trace: 'on-first-retry',
24+
},
25+
/* Run your local dev server before starting the tests */
26+
webServer: {
27+
command: 'pnpm exec nx run oidc-app:serve',
28+
url: 'http://localhost:8443',
29+
reuseExistingServer: true,
30+
cwd: workspaceRoot,
31+
},
32+
projects: [
33+
{
34+
name: 'chromium',
35+
use: { ...devices['Desktop Chrome'] },
36+
},
37+
38+
{
39+
name: 'firefox',
40+
use: { ...devices['Desktop Firefox'] },
41+
},
42+
43+
{
44+
name: 'webkit',
45+
use: { ...devices['Desktop Safari'] },
46+
},
47+
48+
// Uncomment for mobile browsers support
49+
/* {
50+
name: 'Mobile Chrome',
51+
use: { ...devices['Pixel 5'] },
52+
},
53+
{
54+
name: 'Mobile Safari',
55+
use: { ...devices['iPhone 12'] },
56+
}, */
57+
58+
// Uncomment for branded browsers
59+
/* {
60+
name: 'Microsoft Edge',
61+
use: { ...devices['Desktop Edge'], channel: 'msedge' },
62+
},
63+
{
64+
name: 'Google Chrome',
65+
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
66+
} */
67+
],
68+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test('has title', async ({ page }) => {
4+
await page.goto('/');
5+
6+
// Expect h1 to contain a substring.
7+
expect(await page.locator('h1').innerText()).toContain('Welcome');
8+
});

e2e/oidc-app-e2e/tsconfig.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"outDir": "out-tsc/playwright",
6+
"sourceMap": false
7+
},
8+
"include": [
9+
"**/*.ts",
10+
"**/*.js",
11+
"playwright.config.ts",
12+
"src/**/*.spec.ts",
13+
"src/**/*.spec.js",
14+
"src/**/*.test.ts",
15+
"src/**/*.test.js",
16+
"src/**/*.d.ts"
17+
],
18+
"exclude": [
19+
"out-tsc",
20+
"test-output",
21+
"eslint.config.js",
22+
"eslint.config.mjs",
23+
"eslint.config.cjs"
24+
]
25+
}

e2e/oidc-app/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["@nx/js/babel"]
3+
}

e2e/oidc-app/.swcrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"jsc": {
3+
"parser": {
4+
"syntax": "typescript"
5+
},
6+
"target": "es2016"
7+
}
8+
}

e2e/oidc-app/eslint.config.mjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import baseConfig from '../../eslint.config.mjs';
2+
3+
export default [
4+
{
5+
ignores: [
6+
'node_modules',
7+
'*.md',
8+
'LICENSE',
9+
'.swcrc',
10+
'.babelrc',
11+
'.env*',
12+
'.bin',
13+
'dist',
14+
'.eslintignore',
15+
'*.html',
16+
'*.svg',
17+
'*.css',
18+
'public',
19+
'*.json',
20+
'*.d.ts',
21+
],
22+
},
23+
...baseConfig,
24+
];

0 commit comments

Comments
 (0)