@zohodesk/testinglibrary 0.0.5-exp.9 → 0.0.5-n20-experimental
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/.babelrc +9 -1
- package/.eslintrc.js +31 -0
- package/.gitlab-ci.yml +191 -0
- package/.prettierrc +6 -0
- package/README.md +151 -1
- package/build/common/data-generator/steps/DataGenerator.spec.js +19 -0
- package/build/common/data-generator/steps/DataGeneratorStepsHelper.js +19 -0
- package/build/common/multi-actor/steps/multiActorHandling.spec.js +26 -0
- package/build/common/searchFake/helpers/rpcRequestHelper.js +41 -0
- package/build/common/searchFake/steps/searchFake.spec.js +26 -0
- package/build/core/dataGenerator/DataGenerator.js +108 -0
- package/build/core/dataGenerator/DataGeneratorError.js +50 -0
- package/build/core/dataGenerator/DataGeneratorHelper.js +49 -0
- package/build/core/jest/preprocessor/jsPreprocessor.js +3 -9
- package/build/core/jest/runner/jest-runner.js +1 -0
- package/build/core/jest/setup/index.js +1 -7
- package/build/core/playwright/builtInFixtures/actorContext.js +75 -0
- package/build/core/playwright/builtInFixtures/addTags.js +19 -0
- package/build/core/playwright/builtInFixtures/cacheLayer.js +13 -0
- package/build/core/playwright/builtInFixtures/context.js +32 -0
- package/build/core/playwright/builtInFixtures/executionContext.js +17 -0
- package/build/core/playwright/builtInFixtures/i18N.js +41 -0
- package/build/core/playwright/builtInFixtures/index.js +46 -0
- package/build/core/playwright/builtInFixtures/page.js +38 -0
- package/build/core/playwright/builtInFixtures/unauthenticatedPage.js +18 -0
- package/build/core/playwright/clear-caches.js +49 -0
- package/build/core/playwright/codegen.js +5 -6
- package/build/core/playwright/configuration/Configuration.js +25 -0
- package/build/core/playwright/configuration/ConfigurationHelper.js +43 -0
- package/build/core/playwright/configuration/UserArgs.js +12 -0
- package/build/core/playwright/constants/browserTypes.js +12 -0
- package/build/core/playwright/constants/fileMutexConfig.js +9 -0
- package/build/core/playwright/custom-commands.js +1 -2
- package/build/core/playwright/env-initializer.js +28 -6
- package/build/core/playwright/fixtures.js +24 -0
- package/build/core/playwright/helpers/additionalProfiles.js +25 -0
- package/build/core/playwright/helpers/auth/accountLogin.js +21 -0
- package/build/core/playwright/helpers/auth/checkAuthCookies.js +41 -0
- package/build/core/playwright/helpers/auth/getUrlOrigin.js +13 -0
- package/build/core/playwright/helpers/auth/getUsers.js +118 -0
- package/build/core/playwright/helpers/auth/index.js +76 -0
- package/build/core/playwright/helpers/auth/loginDefaultStepsHelper.js +54 -0
- package/build/core/playwright/helpers/auth/loginSteps.js +50 -0
- package/build/core/playwright/helpers/checkAuthDirectory.js +27 -0
- package/build/core/playwright/helpers/configFileNameProvider.js +31 -0
- package/build/core/playwright/helpers/customFixturesHelper.js +58 -0
- package/build/core/playwright/helpers/fileMutex.js +71 -0
- package/build/core/playwright/helpers/getUserFixtures.js +23 -0
- package/build/core/playwright/helpers/mergeObjects.js +13 -0
- package/build/core/playwright/helpers/parseUserArgs.js +10 -0
- package/build/core/playwright/index.js +10 -89
- package/build/core/playwright/readConfigFile.js +97 -14
- package/build/core/playwright/report-generator.js +9 -10
- package/build/core/playwright/runner/Runner.js +22 -0
- package/build/core/playwright/runner/RunnerHelper.js +43 -0
- package/build/core/playwright/runner/RunnerTypes.js +17 -0
- package/build/core/playwright/runner/SpawnRunner.js +113 -0
- package/build/core/playwright/setup/config-creator.js +101 -90
- package/build/core/playwright/setup/config-utils.js +188 -0
- package/build/core/playwright/setup/custom-reporter.js +136 -0
- package/build/core/playwright/setup/qc-custom-reporter.js +291 -0
- package/build/core/playwright/tagProcessor.js +69 -0
- package/build/core/playwright/test-runner.js +84 -67
- package/build/core/playwright/types.js +44 -0
- package/build/core/playwright/validateFeature.js +28 -0
- package/build/decorators.d.ts +1 -0
- package/build/decorators.js +16 -0
- package/build/index.d.ts +78 -0
- package/build/index.js +73 -5
- package/build/lib/cli.js +38 -5
- package/build/lib/post-install.js +19 -11
- package/build/lint/index.js +3 -6
- package/build/parser/parser.js +205 -0
- package/build/parser/sample.feature +34 -0
- package/build/parser/sample.spec.js +37 -0
- package/build/parser/verifier.js +130 -0
- package/build/setup-folder-structure/helper.js +37 -0
- package/build/setup-folder-structure/reportEnhancement/addonScript.html +25 -0
- package/build/setup-folder-structure/reportEnhancement/reportAlteration.js +25 -0
- package/build/setup-folder-structure/samples/accountLogin-sample.js +19 -0
- package/build/setup-folder-structure/samples/actors-index.js +2 -0
- package/build/setup-folder-structure/samples/auth-setup-sample.js +15 -0
- package/build/setup-folder-structure/samples/editions-index.js +3 -0
- package/build/setup-folder-structure/samples/free-sample.json +25 -0
- package/build/setup-folder-structure/samples/git-ignore.sample.js +37 -0
- package/build/setup-folder-structure/samples/settings.json +7 -0
- package/build/setup-folder-structure/samples/testSetup-sample.js +14 -0
- package/build/setup-folder-structure/samples/uat-config-sample.js +46 -0
- package/build/setup-folder-structure/setupProject.js +36 -18
- package/build/test/core/playwright/__tests__/tagProcessor.test.js +94 -0
- package/build/test/core/playwright/__tests__/validateFeature.test.js +69 -0
- package/build/test/core/playwright/buildInFixtures/__tests__/executionContext.test.js +27 -0
- package/build/test/core/playwright/configuration/__tests__/Configuration.test.js +53 -0
- package/build/test/core/playwright/helpers/__tests__/additionalProfiles.test.js +45 -0
- package/build/test/core/playwright/helpers/__tests__/configFileNameProvider.test.js +34 -0
- package/build/test/core/playwright/helpers/__tests__/customFixturesHelper.test.js +51 -0
- package/build/test/core/playwright/helpers/__tests__/fileMutex.test.js +79 -0
- package/build/test/core/playwright/helpers/__tests__/getUsers_ListOfActors.test.js +80 -0
- package/build/test/core/playwright/runner/__tests__/RunnerHelper.test.js +16 -0
- package/build/test/core/playwright/runner/__tests__/SpawnRunner.test.js +27 -0
- package/build/utils/cliArgsToObject.js +9 -1
- package/build/utils/commonUtils.js +17 -0
- package/build/utils/fileUtils.js +109 -0
- package/build/utils/logger.js +7 -35
- package/build/utils/rootPath.js +16 -9
- package/build/utils/stepDefinitionsFormatter.js +11 -0
- package/changelog.md +136 -10
- package/jest.config.js +29 -11
- package/npm-shrinkwrap.json +10241 -6175
- package/package.json +40 -26
- package/playwright.config.js +5 -55
- package/test-results/.last-run.json +4 -0
- package/unit_reports/unit-report.html +277 -0
- package/build/bdd-framework/cli/commands/env.js +0 -44
- package/build/bdd-framework/cli/commands/export.js +0 -47
- package/build/bdd-framework/cli/commands/test.js +0 -60
- package/build/bdd-framework/cli/index.js +0 -11
- package/build/bdd-framework/cli/options.js +0 -21
- package/build/bdd-framework/cli/worker.js +0 -13
- package/build/bdd-framework/config/dir.js +0 -27
- package/build/bdd-framework/config/env.js +0 -49
- package/build/bdd-framework/config/index.js +0 -92
- package/build/bdd-framework/cucumber/buildStepDefinition.js +0 -45
- package/build/bdd-framework/cucumber/gherkin.d.ts +0 -45
- package/build/bdd-framework/cucumber/loadConfig.js +0 -17
- package/build/bdd-framework/cucumber/loadFeatures.js +0 -39
- package/build/bdd-framework/cucumber/loadSnippetBuilder.js +0 -20
- package/build/bdd-framework/cucumber/loadSources.js +0 -58
- package/build/bdd-framework/cucumber/loadSteps.js +0 -41
- package/build/bdd-framework/decorators.js +0 -21
- package/build/bdd-framework/gen/formatter.js +0 -92
- package/build/bdd-framework/gen/i18n.js +0 -44
- package/build/bdd-framework/gen/index.js +0 -150
- package/build/bdd-framework/gen/poms.js +0 -47
- package/build/bdd-framework/gen/testFile.js +0 -356
- package/build/bdd-framework/gen/testNode.js +0 -50
- package/build/bdd-framework/index.js +0 -33
- package/build/bdd-framework/playwright/fixtureParameterNames.js +0 -103
- package/build/bdd-framework/playwright/getLocationInFile.js +0 -50
- package/build/bdd-framework/playwright/loadConfig.js +0 -42
- package/build/bdd-framework/playwright/testTypeImpl.js +0 -47
- package/build/bdd-framework/playwright/transform.js +0 -85
- package/build/bdd-framework/playwright/utils.js +0 -24
- package/build/bdd-framework/run/bddFixtures.js +0 -109
- package/build/bdd-framework/run/bddWorld.js +0 -91
- package/build/bdd-framework/snippets/index.js +0 -132
- package/build/bdd-framework/snippets/snippetSyntax.js +0 -50
- package/build/bdd-framework/snippets/snippetSyntaxDecorators.js +0 -32
- package/build/bdd-framework/snippets/snippetSyntaxTs.js +0 -18
- package/build/bdd-framework/stepDefinitions/createBdd.js +0 -52
- package/build/bdd-framework/stepDefinitions/createDecorators.js +0 -110
- package/build/bdd-framework/stepDefinitions/defineStep.js +0 -62
- package/build/bdd-framework/utils/index.js +0 -52
- package/build/bdd-framework/utils/jsStringWrap.js +0 -44
- package/build/bdd-framework/utils/logger.js +0 -21
- package/build/setup-folder-structure/env-config-sample.json +0 -17
- package/build/setup-folder-structure/uat-config-sample.js +0 -31
- package/build/setup-folder-structure/user-example.json +0 -3
package/package.json
CHANGED
|
@@ -1,46 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "0.0.5-
|
|
3
|
+
"version": "0.0.5-n20-experimental",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"postinstall": "node bin/postinstall.js",
|
|
8
|
-
"test": "
|
|
8
|
+
"test": "jest",
|
|
9
9
|
"clean": "rm -rf build && mkdir build",
|
|
10
10
|
"build-babel": "babel -d ./build ./src --copy-files",
|
|
11
11
|
"build": "npm run clean && npm run build-babel",
|
|
12
|
-
"prepare": "npm run build"
|
|
12
|
+
"prepare": "npm run build",
|
|
13
|
+
"lint": "eslint src/* --fix"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./build/index.js",
|
|
17
|
+
"./decorators": "./build/decorators.js",
|
|
18
|
+
"./helpers": "./build/core/playwright/helpers/auth/index.js",
|
|
19
|
+
"./DataGenerator": "./build/core/dataGenerator/DataGenerator.js"
|
|
13
20
|
},
|
|
14
21
|
"keywords": [],
|
|
15
22
|
"author": "",
|
|
16
23
|
"license": "ISC",
|
|
17
24
|
"dependencies": {
|
|
18
|
-
"@babel/
|
|
19
|
-
"@
|
|
20
|
-
"@
|
|
21
|
-
"@
|
|
22
|
-
"@
|
|
23
|
-
"@testing-library/
|
|
24
|
-
"
|
|
25
|
-
"babel-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
25
|
+
"@babel/code-frame": "7.27.1",
|
|
26
|
+
"@babel/preset-react": "7.27.1",
|
|
27
|
+
"@cucumber/cucumber": "12.2.0",
|
|
28
|
+
"@playwright/test": "1.56.0",
|
|
29
|
+
"@reportportal/agent-js-playwright": "5.2.2",
|
|
30
|
+
"@testing-library/jest-dom": "6.8.0",
|
|
31
|
+
"@testing-library/react": "16.3.0",
|
|
32
|
+
"babel-jest": "30.1.2",
|
|
33
|
+
"babel-plugin-transform-dynamic-import": "2.1.0",
|
|
34
|
+
"fast-glob": "3.3.3",
|
|
35
|
+
"jest": "30.1.2",
|
|
36
|
+
"jest-environment-jsdom": "30.1.2",
|
|
37
|
+
"msw": "2.11.2",
|
|
38
|
+
"playwright": "1.56.0",
|
|
39
|
+
"supports-color": "10.2.2",
|
|
40
|
+
"playwright-bdd": "8.4.1"
|
|
33
41
|
},
|
|
34
42
|
"bin": {
|
|
35
43
|
"ZDTestingFramework": "./bin/cli.js"
|
|
36
44
|
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"eslint": "*",
|
|
47
|
+
"react": "*",
|
|
48
|
+
"react-dom": "*"
|
|
49
|
+
},
|
|
37
50
|
"devDependencies": {
|
|
38
|
-
"@babel/cli": "
|
|
39
|
-
"@babel/core": "
|
|
40
|
-
"@babel/node": "
|
|
41
|
-
"@babel/plugin-transform-runtime": "
|
|
42
|
-
"@babel/
|
|
43
|
-
"@babel/
|
|
44
|
-
"
|
|
51
|
+
"@babel/cli": "7.28.3",
|
|
52
|
+
"@babel/core": "7.28.4",
|
|
53
|
+
"@babel/node": "7.28.0",
|
|
54
|
+
"@babel/plugin-transform-runtime": "7.28.3",
|
|
55
|
+
"@babel/preset-env": "7.28.3",
|
|
56
|
+
"@babel/runtime": "7.28.4",
|
|
57
|
+
"commander": "14.0.1",
|
|
58
|
+
"jest-html-reporter": "4.3.0"
|
|
45
59
|
}
|
|
46
|
-
}
|
|
60
|
+
}
|
package/playwright.config.js
CHANGED
|
@@ -3,54 +3,30 @@ const { defineConfig, devices } = require('@playwright/test');
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const numCPUs = require('os').cpus().length;
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Read environment variables from file.
|
|
8
|
-
* https://github.com/motdotla/dotenv
|
|
9
|
-
*/
|
|
10
|
-
// require('dotenv').config();
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @see https://playwright.dev/docs/test-configuration
|
|
14
|
-
*/
|
|
15
6
|
export default defineConfig({
|
|
16
7
|
testDir: path.join(path.resolve(process.cwd()), 'uat'),
|
|
17
|
-
outputDir: path.join(process.cwd(), 'test-results'),
|
|
18
|
-
/* Run tests in files in parallel */
|
|
8
|
+
outputDir: path.join(process.cwd(), 'uat', 'test-results'),
|
|
19
9
|
fullyParallel: true,
|
|
20
|
-
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
21
|
-
forbidOnly: !!process.env.CI,
|
|
22
|
-
/* Retry on CI only */
|
|
23
10
|
retries: process.env.CI ? 2 : 0,
|
|
24
|
-
|
|
25
|
-
workers: process.env.CI ? 1 : 1,
|
|
26
|
-
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
27
|
-
reporter: [['html', { outputFolder: path.join(process.cwd(), 'playwright-report'), open: "always" }]],
|
|
11
|
+
reporter: [['html', { outputFolder: path.join(process.cwd(), 'uat', 'playwright-report'), open: "always" }]],
|
|
28
12
|
timeout: 60 * 1000,
|
|
29
13
|
expect: {
|
|
30
14
|
timeout: 5 * 1000,
|
|
31
15
|
},
|
|
32
|
-
|
|
33
|
-
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
34
16
|
use: {
|
|
35
|
-
/* Base URL to use in actions like `await page.goto('/')`. */
|
|
36
|
-
//baseURL: process.env.domain,
|
|
37
|
-
|
|
38
|
-
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
39
17
|
trace: 'on',
|
|
40
18
|
video: {
|
|
41
19
|
mode: 'on',
|
|
42
20
|
size: { width: 640, height: 480 }
|
|
43
21
|
}
|
|
44
22
|
},
|
|
45
|
-
|
|
46
|
-
/* Configure projects for major browsers */
|
|
47
23
|
projects: [
|
|
48
24
|
{ name: 'setup', testMatch: /.*\.setup\.js/ },
|
|
49
25
|
{
|
|
50
26
|
name: 'chromium',
|
|
51
27
|
use: {
|
|
52
28
|
...devices['Desktop Chrome'],
|
|
53
|
-
storageState: path.resolve(process.cwd(), 'playwright/.auth/user.json')
|
|
29
|
+
storageState: path.resolve(process.cwd(), 'uat', 'playwright/.auth/user.json')
|
|
54
30
|
},
|
|
55
31
|
dependencies: ['setup'],
|
|
56
32
|
},
|
|
@@ -63,7 +39,7 @@ export default defineConfig({
|
|
|
63
39
|
},
|
|
64
40
|
use: {
|
|
65
41
|
...devices['Desktop Firefox'],
|
|
66
|
-
storageState: path.resolve(process.cwd(), 'playwright/.auth/user.json')
|
|
42
|
+
storageState: path.resolve(process.cwd(), 'uat', 'playwright/.auth/user.json')
|
|
67
43
|
},
|
|
68
44
|
dependencies: ['setup'],
|
|
69
45
|
},
|
|
@@ -76,37 +52,11 @@ export default defineConfig({
|
|
|
76
52
|
},
|
|
77
53
|
use: {
|
|
78
54
|
...devices['Desktop Safari'],
|
|
79
|
-
storageState: path.resolve(process.cwd(), 'playwright/.auth/user.json')
|
|
55
|
+
storageState: path.resolve(process.cwd(), 'uat', 'playwright/.auth/user.json')
|
|
80
56
|
},
|
|
81
57
|
dependencies: ['setup'],
|
|
82
58
|
},
|
|
83
59
|
|
|
84
|
-
/* Test against mobile viewports. */
|
|
85
|
-
// {
|
|
86
|
-
// name: 'Mobile Chrome',
|
|
87
|
-
// use: { ...devices['Pixel 5'] },
|
|
88
|
-
// },
|
|
89
|
-
// {
|
|
90
|
-
// name: 'Mobile Safari',
|
|
91
|
-
// use: { ...devices['iPhone 12'] },
|
|
92
|
-
// },
|
|
93
|
-
|
|
94
|
-
/* Test against branded browsers. */
|
|
95
|
-
// {
|
|
96
|
-
// name: 'Microsoft Edge',
|
|
97
|
-
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
|
98
|
-
// },
|
|
99
|
-
// {
|
|
100
|
-
// name: 'Google Chrome',
|
|
101
|
-
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
|
|
102
|
-
// },
|
|
103
60
|
],
|
|
104
|
-
|
|
105
|
-
/* Run your local dev server before starting the tests */
|
|
106
|
-
// webServer: {
|
|
107
|
-
// command: 'npm run start',
|
|
108
|
-
// url: 'http://127.0.0.1:3000',
|
|
109
|
-
// reuseExistingServer: !process.env.CI,
|
|
110
|
-
// },
|
|
111
61
|
});
|
|
112
62
|
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
<html><head><meta charset="utf-8"/><title>Unit Report</title><style type="text/css">:root {
|
|
2
|
+
--text-primary: #111;
|
|
3
|
+
--text-secondary: #4f4f4f;
|
|
4
|
+
--success: #006633;
|
|
5
|
+
--success-bright: #80ffbf;
|
|
6
|
+
--danger: #cc071e;
|
|
7
|
+
--danger-bright: #fbdfe0;
|
|
8
|
+
--warning: #995c00;
|
|
9
|
+
--warning-bright: #ffeea8;
|
|
10
|
+
--panel: #eee;
|
|
11
|
+
--border: #949494;
|
|
12
|
+
--disabled: #6b6b6b;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
html,
|
|
16
|
+
body {
|
|
17
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
18
|
+
font-size: 16px;
|
|
19
|
+
margin: 0;
|
|
20
|
+
padding: 0;
|
|
21
|
+
color: var(--text-primary);
|
|
22
|
+
}
|
|
23
|
+
body {
|
|
24
|
+
padding: 2rem 1rem;
|
|
25
|
+
}
|
|
26
|
+
.jesthtml-content {
|
|
27
|
+
margin: 0 auto;
|
|
28
|
+
max-width: 70rem;
|
|
29
|
+
}
|
|
30
|
+
header {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
}
|
|
34
|
+
#title {
|
|
35
|
+
margin: 0;
|
|
36
|
+
flex-grow: 1;
|
|
37
|
+
}
|
|
38
|
+
#logo {
|
|
39
|
+
height: 4rem;
|
|
40
|
+
}
|
|
41
|
+
#timestamp {
|
|
42
|
+
color: var(--text-secondary);
|
|
43
|
+
margin-top: 0.5rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#metadata-container {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
gap: 2rem;
|
|
50
|
+
margin-bottom: 2rem;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.additional-information-container {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
gap: 0.5rem;
|
|
57
|
+
color: var(--text-secondary);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** SUMMARY */
|
|
61
|
+
#summary {
|
|
62
|
+
color: var(--text-primary);
|
|
63
|
+
display: flex;
|
|
64
|
+
font-family: monospace;
|
|
65
|
+
font-size: 1rem;
|
|
66
|
+
}
|
|
67
|
+
#summary > div {
|
|
68
|
+
margin-right: 0.5rem;
|
|
69
|
+
background: var(--panel);
|
|
70
|
+
padding: 1rem;
|
|
71
|
+
min-width: 15rem;
|
|
72
|
+
}
|
|
73
|
+
#summary > div:last-child {
|
|
74
|
+
margin-right: 0;
|
|
75
|
+
}
|
|
76
|
+
@media only screen and (max-width: 720px) {
|
|
77
|
+
#summary {
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
}
|
|
80
|
+
#summary > div {
|
|
81
|
+
margin-right: 0;
|
|
82
|
+
margin-top: 1rem;
|
|
83
|
+
}
|
|
84
|
+
#summary > div:first-child {
|
|
85
|
+
margin-top: 0;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.summary-total {
|
|
90
|
+
font-weight: bold;
|
|
91
|
+
margin-bottom: 0.5rem;
|
|
92
|
+
}
|
|
93
|
+
.summary-passed {
|
|
94
|
+
color: var(--success);
|
|
95
|
+
border-left: 0.4rem solid var(--success);
|
|
96
|
+
padding-left: 0.5rem;
|
|
97
|
+
margin-bottom: 0.15rem;
|
|
98
|
+
}
|
|
99
|
+
.summary-failed,
|
|
100
|
+
.summary-obsolete-snapshots {
|
|
101
|
+
color: var(--danger);
|
|
102
|
+
border-left: 0.4rem solid var(--danger);
|
|
103
|
+
padding-left: 0.5rem;
|
|
104
|
+
margin-bottom: 0.15rem;
|
|
105
|
+
}
|
|
106
|
+
.summary-pending {
|
|
107
|
+
color: var(--warning);
|
|
108
|
+
border-left: 0.4rem solid var(--warning);
|
|
109
|
+
padding-left: 0.5rem;
|
|
110
|
+
margin-bottom: 0.15rem;
|
|
111
|
+
}
|
|
112
|
+
.summary-empty {
|
|
113
|
+
color: var(--disabled);
|
|
114
|
+
border-left: 0.4rem solid var(--disabled);
|
|
115
|
+
margin-bottom: 0.15rem;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.test-result {
|
|
119
|
+
padding: 1rem;
|
|
120
|
+
margin-bottom: 0.25rem;
|
|
121
|
+
}
|
|
122
|
+
.test-result:last-child {
|
|
123
|
+
border: 0;
|
|
124
|
+
}
|
|
125
|
+
.test-result.passed {
|
|
126
|
+
background-color: var(--success-bright);
|
|
127
|
+
color: var(--success);
|
|
128
|
+
}
|
|
129
|
+
.test-result.failed {
|
|
130
|
+
background-color: var(--danger-bright);
|
|
131
|
+
color: var(--danger);
|
|
132
|
+
}
|
|
133
|
+
.test-result.pending {
|
|
134
|
+
background-color: var(--warning-bright);
|
|
135
|
+
color: var(--warning);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.test-info {
|
|
139
|
+
display: flex;
|
|
140
|
+
justify-content: space-between;
|
|
141
|
+
}
|
|
142
|
+
.test-suitename {
|
|
143
|
+
width: 20%;
|
|
144
|
+
text-align: left;
|
|
145
|
+
font-weight: bold;
|
|
146
|
+
word-break: break-word;
|
|
147
|
+
}
|
|
148
|
+
.test-title {
|
|
149
|
+
width: 40%;
|
|
150
|
+
text-align: left;
|
|
151
|
+
font-style: italic;
|
|
152
|
+
}
|
|
153
|
+
.test-status {
|
|
154
|
+
width: 20%;
|
|
155
|
+
text-align: right;
|
|
156
|
+
}
|
|
157
|
+
.test-duration {
|
|
158
|
+
width: 10%;
|
|
159
|
+
text-align: right;
|
|
160
|
+
font-size: 0.85rem;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.failureMessages {
|
|
164
|
+
padding: 0 1rem;
|
|
165
|
+
margin-top: 1rem;
|
|
166
|
+
border-top: 1px dashed var(--danger);
|
|
167
|
+
}
|
|
168
|
+
.failureMessages.suiteFailure {
|
|
169
|
+
border-top: none;
|
|
170
|
+
}
|
|
171
|
+
.failureMsg {
|
|
172
|
+
white-space: pre-wrap;
|
|
173
|
+
white-space: -moz-pre-wrap;
|
|
174
|
+
white-space: -pre-wrap;
|
|
175
|
+
white-space: -o-pre-wrap;
|
|
176
|
+
word-wrap: break-word;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.suite-container {
|
|
180
|
+
margin-bottom: 1rem;
|
|
181
|
+
}
|
|
182
|
+
.suite-info {
|
|
183
|
+
padding: 1rem;
|
|
184
|
+
background-color: var(--panel);
|
|
185
|
+
color: var(--text-secondary);
|
|
186
|
+
border: 0.15rem solid;
|
|
187
|
+
border-color: var(--panel);
|
|
188
|
+
display: flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
margin-bottom: 0.25rem;
|
|
191
|
+
}
|
|
192
|
+
.suite-info:hover {
|
|
193
|
+
border-color: var(--border);
|
|
194
|
+
cursor: pointer;
|
|
195
|
+
}
|
|
196
|
+
.suite-info .suite-path {
|
|
197
|
+
word-break: break-all;
|
|
198
|
+
flex-grow: 1;
|
|
199
|
+
font-family: monospace;
|
|
200
|
+
font-size: 1rem;
|
|
201
|
+
}
|
|
202
|
+
.suite-info .suite-time {
|
|
203
|
+
margin-left: 1rem;
|
|
204
|
+
padding: 0.2rem 0.3rem;
|
|
205
|
+
font-size: 0.85rem;
|
|
206
|
+
}
|
|
207
|
+
.suite-info .suite-time.warn {
|
|
208
|
+
background-color: var(--danger);
|
|
209
|
+
color: #fff;
|
|
210
|
+
}
|
|
211
|
+
.suite-info:before {
|
|
212
|
+
content: "\2303";
|
|
213
|
+
display: inline-block;
|
|
214
|
+
margin-right: 1rem;
|
|
215
|
+
transform: rotate(180deg) translateY(0.15rem);
|
|
216
|
+
}
|
|
217
|
+
.suite-container[open] .suite-info:before {
|
|
218
|
+
transform: rotate(0deg) translateY(0.15rem);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* CONSOLE LOGS */
|
|
222
|
+
.suite-consolelog {
|
|
223
|
+
margin-bottom: 0.25rem;
|
|
224
|
+
padding: 1rem;
|
|
225
|
+
background-color: var(--panel);
|
|
226
|
+
}
|
|
227
|
+
.suite-consolelog-header {
|
|
228
|
+
font-weight: bold;
|
|
229
|
+
}
|
|
230
|
+
.suite-consolelog-item {
|
|
231
|
+
padding: 0.5rem;
|
|
232
|
+
}
|
|
233
|
+
.suite-consolelog-item pre {
|
|
234
|
+
margin: 0.5rem 0;
|
|
235
|
+
white-space: pre-wrap;
|
|
236
|
+
white-space: -moz-pre-wrap;
|
|
237
|
+
white-space: -pre-wrap;
|
|
238
|
+
white-space: -o-pre-wrap;
|
|
239
|
+
word-wrap: break-word;
|
|
240
|
+
}
|
|
241
|
+
.suite-consolelog-item-origin {
|
|
242
|
+
color: var(--text-secondary);
|
|
243
|
+
font-weight: bold;
|
|
244
|
+
}
|
|
245
|
+
.suite-consolelog-item-message {
|
|
246
|
+
color: var(--text-primary);
|
|
247
|
+
font-size: 1rem;
|
|
248
|
+
padding: 0 0.5rem;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/* OBSOLETE SNAPSHOTS */
|
|
252
|
+
.suite-obsolete-snapshots {
|
|
253
|
+
margin-bottom: 0.25rem;
|
|
254
|
+
padding: 1rem;
|
|
255
|
+
background-color: var(--danger-bright);
|
|
256
|
+
color: var(--danger);
|
|
257
|
+
}
|
|
258
|
+
.suite-obsolete-snapshots-header {
|
|
259
|
+
font-weight: bold;
|
|
260
|
+
}
|
|
261
|
+
.suite-obsolete-snapshots-item {
|
|
262
|
+
padding: 0.5rem;
|
|
263
|
+
}
|
|
264
|
+
.suite-obsolete-snapshots-item pre {
|
|
265
|
+
margin: 0.5rem 0;
|
|
266
|
+
white-space: pre-wrap;
|
|
267
|
+
white-space: -moz-pre-wrap;
|
|
268
|
+
white-space: -pre-wrap;
|
|
269
|
+
white-space: -o-pre-wrap;
|
|
270
|
+
word-wrap: break-word;
|
|
271
|
+
}
|
|
272
|
+
.suite-obsolete-snapshots-item-message {
|
|
273
|
+
color: var(--text-primary);
|
|
274
|
+
font-size: 1rem;
|
|
275
|
+
padding: 0 0.5rem;
|
|
276
|
+
}
|
|
277
|
+
</style></head><body><main class="jesthtml-content"><header><h1 id="title">Unit Report</h1></header><section id="metadata-container"><div id="timestamp">Started: 2025-10-07 10:42:24</div><div id="summary"><div id="suite-summary"><div class="summary-total">Suites (12)</div><div class="summary-passed ">12 passed</div><div class="summary-failed summary-empty">0 failed</div><div class="summary-pending summary-empty">0 pending</div></div><div id="test-summary"><div class="summary-total">Tests (41)</div><div class="summary-passed ">41 passed</div><div class="summary-failed summary-empty">0 failed</div><div class="summary-pending summary-empty">0 pending</div></div></div></section><details id="suite-1" class="suite-container" open=""><summary class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/src/test/core/playwright/configuration/__tests__/Configuration.test.js</div><div class="suite-time">1.139s</div></summary><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">Configuration Class</div><div class="test-title">should add new key-value pair to the configuration</div><div class="test-status">passed</div><div class="test-duration">0.003s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">Configuration Class</div><div class="test-title">should combine configurations correctly using addAll</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">Configuration Class</div><div class="test-title">should return correct value for a given key</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div></div></details><details id="suite-2" class="suite-container" open=""><summary class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/src/test/core/playwright/helpers/__tests__/getUsers_ListOfActors.test.js</div><div class="suite-time">1.251s</div></summary><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">getListOfActors</div><div class="test-title">throws an error when config file cannot be loaded</div><div class="test-status">passed</div><div class="test-duration">0.027s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">getListOfActors</div><div class="test-title">throws an error when beta feature config does not exist</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">getListOfActors</div><div class="test-title">loads main configuration when betaFeature is not provided and main config file exists</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">getListOfActors</div><div class="test-title">falls back to default configuration if main config file does not exist</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">getListOfActors</div><div class="test-title">loads beta feature configuration when betaFeature is provided</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div></div></details><details id="suite-3" class="suite-container" open=""><summary class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/src/test/core/playwright/__tests__/tagProcessor.test.js</div><div class="suite-time">1.315s</div></summary><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">TagProcessor</div><div class="test-title">should return tagArgs if no edition is provided</div><div class="test-status">passed</div><div class="test-duration">0.018s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">TagProcessor</div><div class="test-title">should handle a single edition with <= operator</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">TagProcessor</div><div class="test-title">should handle a single edition with >= operator</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">TagProcessor</div><div class="test-title">should handle a single edition with < operator</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">TagProcessor</div><div class="test-title">should handle a single edition with > operator</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">TagProcessor</div><div class="test-title">should handle a single edition with no operator</div><div class="test-status">passed</div><div class="test-duration">0.005s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">TagProcessor</div><div class="test-title">should log a message if edition is not found</div><div class="test-status">passed</div><div class="test-duration">0.003s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">TagProcessor</div><div class="test-title">should handle multiple editions</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">TagProcessor</div><div class="test-title">should build tags correctly when tags are empty</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div></div></details><details id="suite-4" class="suite-container" open=""><summary class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/src/test/core/playwright/helpers/__tests__/additionalProfiles.test.js</div><div class="suite-time">1.521s</div></summary><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">additionalProfiles</div><div class="test-title">should return empty object when no additional profile tags are present</div><div class="test-status">passed</div><div class="test-duration">0.007s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">additionalProfiles</div><div class="test-title">should return additional profile actors when additional profile tags and editionInfo are present</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">additionalProfiles</div><div class="test-title">should return additional profile actors when all actor details are present</div><div class="test-status">passed</div><div class="test-duration">0.004s</div></div></div></div></details><details id="suite-5" class="suite-container" open=""><summary class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/src/test/core/playwright/helpers/__tests__/configFileNameProvider.test.js</div><div class="suite-time">0.436s</div></summary><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">getUATFileName</div><div class="test-title">return the pipeline matched config files for pipeline matched files exists</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">getUATFileName</div><div class="test-title">return the default config files for pipeline matched files not exists</div><div class="test-status">passed</div><div class="test-duration">0.019s</div></div></div></div></details><details id="suite-6" class="suite-container" open=""><summary class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/src/test/core/playwright/helpers/__tests__/customFixturesHelper.test.js</div><div class="suite-time">1.587s</div></summary><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">getCustomAccountDetails</div><div class="test-title">returns selected user when any tag info is present</div><div class="test-status">passed</div><div class="test-duration">0.004s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">getCustomAccountDetails</div><div class="test-title">logs and returns undefined if getCustomAccountDetails function throws</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">getCustomAccountDetails</div><div class="test-title">returns default actor when no tag info is not provided</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div></div></details><details id="suite-7" class="suite-container" open=""><summary class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/src/test/core/playwright/buildInFixtures/__tests__/executionContext.test.js</div><div class="suite-time">0.339s</div></summary><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">executionContext</div><div class="test-title">should pass actorInfo with details from getCustomAccountDetails to use</div><div class="test-status">passed</div><div class="test-duration">0.002s</div></div></div></div></details><details id="suite-8" class="suite-container" open=""><summary class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/examples/src/__tests__/App.test.js</div><div class="suite-time">0.142s</div></summary><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">example functions</div><div class="test-title">add function adds two numbers correctly</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">example functions</div><div class="test-title">greet function greets a person with their name</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div></div></details><details id="suite-9" class="suite-container" open=""><summary class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/src/test/core/playwright/runner/__tests__/SpawnRunner.test.js</div><div class="suite-time">0.981s</div></summary><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">SpawnRunner > run</div><div class="test-title">should call runPreprocessing when bddMode is true</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div></div></details><details id="suite-10" class="suite-container" open=""><summary class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/src/test/core/playwright/runner/__tests__/RunnerHelper.test.js</div><div class="suite-time">0.694s</div></summary><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">RunnerHelper > createRunner</div><div class="test-title">should throw error on invalid runner type</div><div class="test-status">passed</div><div class="test-duration">0.004s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">RunnerHelper > createRunner</div><div class="test-title">should create a valid runner class</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div></div></details><details id="suite-11" class="suite-container" open=""><summary class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/src/test/core/playwright/__tests__/validateFeature.test.js</div><div class="suite-time">2.3s</div></summary><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">validateFeatureFiles</div><div class="test-title">runPreprocessing with correct arguments and log success</div><div class="test-status">passed</div><div class="test-duration">0.004s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">validateFeatureFiles</div><div class="test-title">runPreprocessing with playwright conf</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">validateFeatureFiles</div><div class="test-title">error when runPreprocessing fails</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div></div></details><details id="suite-12" class="suite-container" open=""><summary class="suite-info"><div class="suite-path">/Users/muthu-19817/git/testing-framework/src/test/core/playwright/helpers/__tests__/fileMutex.test.js</div><div class="suite-time">2.359s</div></summary><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">FileMutex > acquire</div><div class="test-title">should create the lock file if it does not exist</div><div class="test-status">passed</div><div class="test-duration">0.008s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">FileMutex > acquire</div><div class="test-title">should wait for lock file deletion if it exists</div><div class="test-status">passed</div><div class="test-duration">0.025s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">FileMutex > acquire</div><div class="test-title">should reject if watch timeout exceeds</div><div class="test-status">passed</div><div class="test-duration">1.009s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">FileMutex > release</div><div class="test-title">should delete the lock file if it exists</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">FileMutex > release</div><div class="test-title">should release lock by deleting lock file</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">FileMutex > release</div><div class="test-title">should not attempt to delete the lock file if it does not exist</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">FileMutex > release</div><div class="test-title">should log an error if deleting the lock file fails</div><div class="test-status">passed</div><div class="test-duration">0.003s</div></div></div></div></details></main></body></html>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.envCommand = void 0;
|
|
8
|
-
exports.getOwnVersion = getOwnVersion;
|
|
9
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
10
|
-
var _commander = require("commander");
|
|
11
|
-
var _options = require("../options");
|
|
12
|
-
var _path = _interopRequireDefault(require("path"));
|
|
13
|
-
var _logger = require("../../utils/logger");
|
|
14
|
-
var _utils = require("../../utils");
|
|
15
|
-
var _loadConfig = require("../../playwright/loadConfig");
|
|
16
|
-
const envCommand = new _commander.Command('env').description('Prints environment info').addOption(_options.configOption).action(opts => {
|
|
17
|
-
_logger.logger.log(`Playwright-bdd environment info:\n`);
|
|
18
|
-
_logger.logger.log(`platform: ${process.platform}`);
|
|
19
|
-
_logger.logger.log(`node: ${process.version}`);
|
|
20
|
-
showPackageVersion('playwright-bdd');
|
|
21
|
-
showPackageVersion('@playwright/test');
|
|
22
|
-
showPackageVersion('@cucumber/cucumber');
|
|
23
|
-
showPlaywrightConfigPath(opts.config);
|
|
24
|
-
});
|
|
25
|
-
exports.envCommand = envCommand;
|
|
26
|
-
function showPackageVersion(packageName) {
|
|
27
|
-
const version = packageName === 'playwright-bdd' ? getOwnVersion() : (0, _utils.getPackageVersion)(packageName);
|
|
28
|
-
_logger.logger.log(`${packageName}: v${version}`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Getting own version by relative path instead of using getPackageVersion(),
|
|
33
|
-
* to aneble using directly from /dist in tests.
|
|
34
|
-
*/
|
|
35
|
-
function getOwnVersion() {
|
|
36
|
-
// const packageJsonPath = path.resolve(__dirname, '..', '..', '..', `package.json`);
|
|
37
|
-
// const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
38
|
-
return '5.2.0';
|
|
39
|
-
}
|
|
40
|
-
function showPlaywrightConfigPath(cliConfigPath) {
|
|
41
|
-
const resolvedConfigFile = (0, _loadConfig.resolveConfigFile)(cliConfigPath);
|
|
42
|
-
const relPath = _path.default.relative(process.cwd(), resolvedConfigFile);
|
|
43
|
-
_logger.logger.log(`Playwright config file: ${relPath}`);
|
|
44
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.exportCommand = void 0;
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
var _commander = require("commander");
|
|
10
|
-
var _options = require("../options");
|
|
11
|
-
var _loadConfig = require("../../playwright/loadConfig");
|
|
12
|
-
var _logger = require("../../utils/logger");
|
|
13
|
-
var _env = require("../../config/env");
|
|
14
|
-
var _test = require("./test");
|
|
15
|
-
var _gen = require("../../gen");
|
|
16
|
-
// filter by project?
|
|
17
|
-
|
|
18
|
-
const exportCommand = new _commander.Command('export').description('Prints all step definitions').addOption(_options.configOption).action(async opts => {
|
|
19
|
-
const {
|
|
20
|
-
resolvedConfigFile
|
|
21
|
-
} = await (0, _loadConfig.loadConfig)(opts.config);
|
|
22
|
-
_logger.logger.log(`List of all steps found by config: ${_path.default.relative(process.cwd(), resolvedConfigFile)}\n`);
|
|
23
|
-
const configs = Object.values((0, _env.getEnvConfigs)());
|
|
24
|
-
(0, _test.assertConfigsCount)(configs);
|
|
25
|
-
await showStepsForConfigs(configs);
|
|
26
|
-
});
|
|
27
|
-
exports.exportCommand = exportCommand;
|
|
28
|
-
async function showStepsForConfigs(configs) {
|
|
29
|
-
// here we don't need workers (as in test command) because if some step files
|
|
30
|
-
// are already in node cache, we collected them.
|
|
31
|
-
const steps = new Set();
|
|
32
|
-
const tasks = configs.map(async config => {
|
|
33
|
-
const stepDefinitions = await new _gen.TestFilesGenerator(config).extractSteps();
|
|
34
|
-
stepDefinitions.forEach(s => steps.add(`* ${getStepText(s)}`));
|
|
35
|
-
});
|
|
36
|
-
await Promise.all(tasks);
|
|
37
|
-
steps.forEach(stepText => _logger.logger.log(stepText));
|
|
38
|
-
}
|
|
39
|
-
function getStepText({
|
|
40
|
-
pattern,
|
|
41
|
-
keyword
|
|
42
|
-
}) {
|
|
43
|
-
// for Unknown return When as it looks the most suitable
|
|
44
|
-
const keywordText = keyword === 'Unknown' ? 'When' : keyword;
|
|
45
|
-
const patternText = typeof pattern === 'string' ? pattern : pattern.source;
|
|
46
|
-
return `${keywordText} ${patternText}`;
|
|
47
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.assertConfigsCount = assertConfigsCount;
|
|
8
|
-
exports.testCommand = void 0;
|
|
9
|
-
var _worker_threads = require("worker_threads");
|
|
10
|
-
var _events = require("events");
|
|
11
|
-
var _path = _interopRequireDefault(require("path"));
|
|
12
|
-
var _commander = require("commander");
|
|
13
|
-
var _gen = require("../../gen");
|
|
14
|
-
var _utils = require("../../utils");
|
|
15
|
-
var _loadConfig = require("../../playwright/loadConfig");
|
|
16
|
-
var _env = require("../../config/env");
|
|
17
|
-
var _config = require("../../config");
|
|
18
|
-
var _options = require("../options");
|
|
19
|
-
const GEN_WORKER_PATH = _path.default.resolve(__dirname, '..', 'worker.js');
|
|
20
|
-
const testCommand = new _commander.Command('test').description('Generate Playwright test files from Gherkin documents').addOption(_options.configOption).option('--tags <expression>', `Tags expression to filter scenarios for generation`).option('--verbose', `Verbose mode (default: ${Boolean(_config.defaults.verbose)})`).action(async opts => {
|
|
21
|
-
await (0, _loadConfig.loadConfig)(opts.config);
|
|
22
|
-
const configs = Object.values((0, _env.getEnvConfigs)());
|
|
23
|
-
assertConfigsCount(configs);
|
|
24
|
-
const cliOptions = buildCliOptions(opts);
|
|
25
|
-
await generateFilesForConfigs(configs, cliOptions);
|
|
26
|
-
});
|
|
27
|
-
exports.testCommand = testCommand;
|
|
28
|
-
function buildCliOptions(opts) {
|
|
29
|
-
const config = {};
|
|
30
|
-
if ('tags' in opts) config.tags = opts.tags;
|
|
31
|
-
if ('verbose' in opts) config.verbose = Boolean(opts.verbose);
|
|
32
|
-
return config;
|
|
33
|
-
}
|
|
34
|
-
function assertConfigsCount(configs) {
|
|
35
|
-
if (configs.length === 0) {
|
|
36
|
-
(0, _utils.exitWithMessage)(`No BDD configs found. Did you use defineBddConfig() in playwright.config.ts?`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
async function runInWorker(config) {
|
|
40
|
-
const worker = new _worker_threads.Worker(GEN_WORKER_PATH, {
|
|
41
|
-
workerData: {
|
|
42
|
-
config
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// todo: check if worker exited with error?
|
|
47
|
-
await (0, _events.once)(worker, 'exit');
|
|
48
|
-
}
|
|
49
|
-
async function generateFilesForConfigs(configs, cliConfig) {
|
|
50
|
-
// run first config in main thread and other in workers (to have fresh require cache)
|
|
51
|
-
// See: https://github.com/vitalets/playwright-bdd/issues/32
|
|
52
|
-
const tasks = configs.map((config, index) => {
|
|
53
|
-
const finalConfig = {
|
|
54
|
-
...config,
|
|
55
|
-
...cliConfig
|
|
56
|
-
};
|
|
57
|
-
return index === 0 ? new _gen.TestFilesGenerator(finalConfig).generate() : runInWorker(finalConfig);
|
|
58
|
-
});
|
|
59
|
-
return Promise.all(tasks);
|
|
60
|
-
}
|