@nx/playwright 17.3.0-beta.5 → 17.3.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/src/generators/configuration/files/playwright.config.ts.template +37 -1
- package/src/generators/init/init.js +6 -1
- package/src/generators/init/schema.d.ts +4 -2
- package/src/generators/init/schema.json +12 -0
- package/src/plugins/plugin.js +2 -2
- package/src/utils/preset.d.ts +1 -10
- package/src/utils/preset.js +1 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/playwright",
|
|
3
|
-
"version": "17.3.0-beta.
|
|
3
|
+
"version": "17.3.0-beta.8",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"homepage": "https://nx.dev",
|
|
6
6
|
"private": false,
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"directory": "packages/playwright"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@nx/devkit": "17.3.0-beta.
|
|
36
|
-
"@nx/eslint": "17.3.0-beta.
|
|
37
|
-
"@nx/js": "17.3.0-beta.
|
|
35
|
+
"@nx/devkit": "17.3.0-beta.8",
|
|
36
|
+
"@nx/eslint": "17.3.0-beta.8",
|
|
37
|
+
"@nx/js": "17.3.0-beta.8",
|
|
38
38
|
"tslib": "^2.3.0",
|
|
39
|
-
"minimatch": "
|
|
39
|
+
"minimatch": "9.0.3"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@playwright/test": "^1.36.0"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineConfig } from '@playwright/test';
|
|
1
|
+
import { defineConfig, devices } from '@playwright/test';
|
|
2
2
|
import { nxE2EPreset } from '@nx/playwright/preset';
|
|
3
3
|
<% if(!webServerCommand || !webServerAddress) { %>// eslint-disable-next-line @typescript-eslint/no-unused-vars <% } %>
|
|
4
4
|
import { workspaceRoot } from '@nx/devkit';
|
|
@@ -35,4 +35,40 @@ export default defineConfig({
|
|
|
35
35
|
// reuseExistingServer: !process.env.CI,
|
|
36
36
|
// cwd: workspaceRoot,
|
|
37
37
|
// },<% } %>
|
|
38
|
+
projects: [
|
|
39
|
+
{
|
|
40
|
+
name: "chromium",
|
|
41
|
+
use: { ...devices["Desktop Chrome"] },
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
{
|
|
45
|
+
name: "firefox",
|
|
46
|
+
use: { ...devices["Desktop Firefox"] },
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
{
|
|
50
|
+
name: "webkit",
|
|
51
|
+
use: { ...devices["Desktop Safari"] },
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
// Uncomment for mobile browsers support
|
|
55
|
+
/* {
|
|
56
|
+
name: 'Mobile Chrome',
|
|
57
|
+
use: { ...devices['Pixel 5'] },
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'Mobile Safari',
|
|
61
|
+
use: { ...devices['iPhone 12'] },
|
|
62
|
+
}, */
|
|
63
|
+
|
|
64
|
+
// Uncomment for branded browsers
|
|
65
|
+
/* {
|
|
66
|
+
name: 'Microsoft Edge',
|
|
67
|
+
use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'Google Chrome',
|
|
71
|
+
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
|
|
72
|
+
} */
|
|
73
|
+
],
|
|
38
74
|
});
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const update_package_scripts_1 = require("@nx/devkit/src/utils/update-package-scripts");
|
|
6
|
+
const plugin_1 = require("../../plugins/plugin");
|
|
5
7
|
const versions_1 = require("../../utils/versions");
|
|
6
8
|
async function initGenerator(tree, options) {
|
|
7
9
|
const tasks = [];
|
|
@@ -9,11 +11,14 @@ async function initGenerator(tree, options) {
|
|
|
9
11
|
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
10
12
|
'@nx/playwright': versions_1.nxVersion,
|
|
11
13
|
'@playwright/test': versions_1.playwrightVersion,
|
|
12
|
-
}));
|
|
14
|
+
}, undefined, options.keepExistingVersions));
|
|
13
15
|
}
|
|
14
16
|
if (process.env.NX_PCV3 === 'true') {
|
|
15
17
|
addPlugin(tree);
|
|
16
18
|
}
|
|
19
|
+
if (options.updatePackageScripts) {
|
|
20
|
+
await (0, update_package_scripts_1.updatePackageScripts)(tree, plugin_1.createNodes);
|
|
21
|
+
}
|
|
17
22
|
if (!options.skipFormat) {
|
|
18
23
|
await (0, devkit_1.formatFiles)(tree);
|
|
19
24
|
}
|
|
@@ -16,6 +16,18 @@
|
|
|
16
16
|
"default": false,
|
|
17
17
|
"description": "Do not add dependencies to `package.json`.",
|
|
18
18
|
"x-priority": "internal"
|
|
19
|
+
},
|
|
20
|
+
"keepExistingVersions": {
|
|
21
|
+
"type": "boolean",
|
|
22
|
+
"x-priority": "internal",
|
|
23
|
+
"description": "Keep existing dependencies versions",
|
|
24
|
+
"default": false
|
|
25
|
+
},
|
|
26
|
+
"updatePackageScripts": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"x-priority": "internal",
|
|
29
|
+
"description": "Update `package.json` scripts with inferred targets",
|
|
30
|
+
"default": false
|
|
19
31
|
}
|
|
20
32
|
},
|
|
21
33
|
"required": []
|
package/src/plugins/plugin.js
CHANGED
|
@@ -7,7 +7,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
7
7
|
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
8
8
|
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
9
9
|
const workspace_context_1 = require("nx/src/utils/workspace-context");
|
|
10
|
-
const
|
|
10
|
+
const minimatch_1 = require("minimatch");
|
|
11
11
|
const load_config_file_1 = require("../utils/load-config-file");
|
|
12
12
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
13
13
|
const js_1 = require("@nx/js");
|
|
@@ -136,7 +136,7 @@ function createMatcher(pattern) {
|
|
|
136
136
|
else {
|
|
137
137
|
return (path) => {
|
|
138
138
|
try {
|
|
139
|
-
return minimatch(path, pattern);
|
|
139
|
+
return (0, minimatch_1.minimatch)(path, pattern);
|
|
140
140
|
}
|
|
141
141
|
catch (e) {
|
|
142
142
|
throw new Error(`Error matching ${path} with ${pattern}: ${e.message}`);
|
package/src/utils/preset.d.ts
CHANGED
|
@@ -4,16 +4,6 @@ export interface NxPlaywrightOptions {
|
|
|
4
4
|
* @default './src'
|
|
5
5
|
**/
|
|
6
6
|
testDir?: string;
|
|
7
|
-
/**
|
|
8
|
-
* Include Mobile Chome and Mobile Safari browsers in test projects
|
|
9
|
-
* @default false
|
|
10
|
-
**/
|
|
11
|
-
includeMobileBrowsers?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Include Microsoft Edge and Google Chrome browsers in test projects
|
|
14
|
-
* @default false
|
|
15
|
-
**/
|
|
16
|
-
includeBrandedBrowsers?: boolean;
|
|
17
7
|
}
|
|
18
8
|
/**
|
|
19
9
|
* nx E2E Preset for Playwright
|
|
@@ -25,6 +15,7 @@ export interface NxPlaywrightOptions {
|
|
|
25
15
|
* - chromium
|
|
26
16
|
* - firefox
|
|
27
17
|
* - webkit
|
|
18
|
+
* These are generated by default.
|
|
28
19
|
*
|
|
29
20
|
* you can easily extend this within your playwright config via spreading the preset
|
|
30
21
|
* @example
|
package/src/utils/preset.js
CHANGED
|
@@ -15,6 +15,7 @@ const test_1 = require("@playwright/test");
|
|
|
15
15
|
* - chromium
|
|
16
16
|
* - firefox
|
|
17
17
|
* - webkit
|
|
18
|
+
* These are generated by default.
|
|
18
19
|
*
|
|
19
20
|
* you can easily extend this within your playwright config via spreading the preset
|
|
20
21
|
* @example
|
|
@@ -34,44 +35,6 @@ function nxE2EPreset(pathToConfig, options) {
|
|
|
34
35
|
const offset = (0, node_path_1.relative)(normalizedPath, devkit_1.workspaceRoot);
|
|
35
36
|
const testResultOuputDir = (0, node_path_1.join)(offset, 'dist', '.playwright', projectPath, 'test-output');
|
|
36
37
|
const reporterOutputDir = (0, node_path_1.join)(offset, 'dist', '.playwright', projectPath, 'playwright-report');
|
|
37
|
-
const projects = [
|
|
38
|
-
{
|
|
39
|
-
name: 'chromium',
|
|
40
|
-
use: { ...test_1.devices['Desktop Chrome'] },
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: 'firefox',
|
|
44
|
-
use: { ...test_1.devices['Desktop Firefox'] },
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: 'webkit',
|
|
48
|
-
use: { ...test_1.devices['Desktop Safari'] },
|
|
49
|
-
},
|
|
50
|
-
];
|
|
51
|
-
if (options?.includeMobileBrowsers) {
|
|
52
|
-
projects.push(...[
|
|
53
|
-
{
|
|
54
|
-
name: 'Mobile Chrome',
|
|
55
|
-
use: { ...test_1.devices['Pixel 5'] },
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: 'Mobile Safari',
|
|
59
|
-
use: { ...test_1.devices['iPhone 12'] },
|
|
60
|
-
},
|
|
61
|
-
]);
|
|
62
|
-
}
|
|
63
|
-
if (options?.includeBrandedBrowsers) {
|
|
64
|
-
projects.push(...[
|
|
65
|
-
{
|
|
66
|
-
name: 'Microsoft Edge',
|
|
67
|
-
use: { ...test_1.devices['Desktop Edge'], channel: 'msedge' },
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: 'Google Chrome',
|
|
71
|
-
use: { ...test_1.devices['Desktop Chrome'], channel: 'chrome' },
|
|
72
|
-
},
|
|
73
|
-
]);
|
|
74
|
-
}
|
|
75
38
|
return (0, test_1.defineConfig)({
|
|
76
39
|
testDir: options?.testDir ?? './src',
|
|
77
40
|
outputDir: testResultOuputDir,
|
|
@@ -92,7 +55,6 @@ function nxE2EPreset(pathToConfig, options) {
|
|
|
92
55
|
},
|
|
93
56
|
],
|
|
94
57
|
],
|
|
95
|
-
projects,
|
|
96
58
|
});
|
|
97
59
|
}
|
|
98
60
|
exports.nxE2EPreset = nxE2EPreset;
|