@zohodesk/testinglibrary 0.1.8-exp.4 → 0.1.8-stb-bdd-v1
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 +18 -18
- package/.eslintrc.js +31 -31
- package/.prettierrc +5 -5
- package/README.md +17 -17
- package/bin/cli.js +2 -2
- package/build/bdd-framework/cli/commands/env.js +3 -3
- package/build/bdd-framework/cli/options.js +4 -4
- package/build/bdd-framework/cli/worker.js +3 -3
- package/build/bdd-framework/config/dir.js +6 -6
- package/build/bdd-framework/config/env.js +3 -3
- package/build/bdd-framework/config/index.js +2 -2
- package/build/bdd-framework/config/lang.js +2 -2
- package/build/bdd-framework/cucumber/buildStepDefinition.js +3 -3
- package/build/bdd-framework/cucumber/loadSnippetBuilder.js +3 -3
- package/build/bdd-framework/cucumber/loadSources.js +9 -9
- package/build/bdd-framework/gen/fixtures.js +8 -8
- package/build/bdd-framework/gen/formatter.js +7 -7
- package/build/bdd-framework/gen/i18n.js +3 -3
- package/build/bdd-framework/gen/index.js +2 -2
- package/build/bdd-framework/gen/testFile.js +16 -16
- package/build/bdd-framework/gen/testNode.js +3 -3
- package/build/bdd-framework/gen/testPoms.js +31 -31
- package/build/bdd-framework/hooks/scenario.js +6 -6
- package/build/bdd-framework/hooks/worker.js +4 -4
- package/build/bdd-framework/playwright/fixtureParameterNames.js +3 -3
- package/build/bdd-framework/playwright/getLocationInFile.js +4 -4
- package/build/bdd-framework/playwright/loadConfig.js +3 -3
- package/build/bdd-framework/playwright/testTypeImpl.js +11 -11
- package/build/bdd-framework/playwright/transform.js +4 -4
- package/build/bdd-framework/playwright/utils.js +2 -2
- package/build/bdd-framework/run/StepInvoker.js +2 -2
- package/build/bdd-framework/run/bddWorld.js +15 -15
- package/build/bdd-framework/snippets/index.js +2 -2
- package/build/bdd-framework/snippets/snippetSyntaxTs.js +4 -4
- package/build/bdd-framework/stepDefinitions/createBdd.js +2 -2
- package/build/bdd-framework/stepDefinitions/decorators/class.js +7 -7
- package/build/bdd-framework/stepDefinitions/decorators/steps.js +6 -6
- package/build/bdd-framework/stepDefinitions/defineStep.js +3 -3
- package/build/bdd-framework/stepDefinitions/stepConfig.js +5 -5
- package/build/bdd-framework/utils/exit.js +18 -22
- package/build/bdd-framework/utils/index.js +9 -9
- package/build/bdd-framework/utils/jsStringWrap.js +9 -9
- package/build/bdd-framework/utils/logger.js +2 -2
- package/build/bdd-poc/config/pathConfig.js +20 -0
- package/build/bdd-poc/core-runner/exportMethods.js +20 -0
- package/build/bdd-poc/core-runner/main.js +10 -0
- package/build/bdd-poc/core-runner/runner.js +20 -0
- package/build/bdd-poc/core-runner/stepDefinitions.js +52 -0
- package/build/bdd-poc/index.js +26 -0
- package/build/bdd-poc/test/cucumber/featureFileParer.js +84 -0
- package/build/bdd-poc/test/cucumber/parserCucumber.js +15 -0
- package/build/bdd-poc/test/stepGenerate/extractTestInputs.js +36 -0
- package/build/bdd-poc/test/stepGenerate/stepFileGenerate.js +38 -0
- package/build/bdd-poc/test/stepGenerate/stepsnippets.js +58 -0
- package/build/bdd-poc/test/tagsHandle.js +69 -0
- package/build/bdd-poc/test/testDataMap.js +97 -0
- package/build/bdd-poc/test/testStructure.js +98 -0
- package/build/bdd-poc/utils/stringManipulation.js +26 -0
- package/build/core/playwright/builtInFixtures/addTags.js +1 -1
- package/build/core/playwright/builtInFixtures/index.js +4 -3
- package/build/core/playwright/custom-commands.js +1 -1
- package/build/core/playwright/index.js +6 -17
- package/build/core/playwright/readConfigFile.js +30 -30
- package/build/core/playwright/setup/config-creator.js +14 -13
- package/build/core/playwright/setup/config-utils.js +22 -32
- package/build/core/playwright/tag-processor.js +4 -2
- package/build/core/playwright/test-runner.js +42 -36
- package/build/decorators.d.ts +1 -1
- package/build/decorators.js +2 -16
- package/build/index.d.ts +60 -60
- package/build/index.js +12 -17
- package/build/parser/sample.feature +34 -34
- package/build/parser/sample.spec.js +18 -18
- package/build/setup-folder-structure/helper.js +0 -1
- package/build/setup-folder-structure/reportEnhancement/addonScript.html +24 -24
- package/build/setup-folder-structure/samples/auth-setup-sample.js +72 -72
- package/build/setup-folder-structure/samples/authUsers-sample.json +8 -8
- package/build/setup-folder-structure/samples/env-config-sample.json +20 -20
- package/build/setup-folder-structure/samples/git-ignore.sample.js +36 -36
- package/build/setup-folder-structure/samples/uat-config-sample.js +44 -44
- package/build/utils/cliArgsToObject.js +25 -25
- package/build/utils/fileUtils.js +19 -1
- package/build/utils/getFilePath.js +2 -1
- package/changelog.md +131 -137
- package/jest.config.js +63 -63
- package/npm-shrinkwrap.json +5980 -6469
- package/package.json +54 -55
- package/playwright.config.js +112 -112
package/package.json
CHANGED
|
@@ -1,55 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "0.1.8-
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "./build/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"postinstall": "node bin/postinstall.js",
|
|
8
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
-
"clean": "
|
|
10
|
-
"build-babel": "babel -d ./build ./src --copy-files",
|
|
11
|
-
"build": "npm run clean && npm run build-babel",
|
|
12
|
-
"prepare": "npm run build",
|
|
13
|
-
"lint": "eslint src/* --fix"
|
|
14
|
-
},
|
|
15
|
-
"exports": {
|
|
16
|
-
".": "./build/index.js",
|
|
17
|
-
"./decorators": "./build/decorators.js"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [],
|
|
20
|
-
"author": "",
|
|
21
|
-
"license": "ISC",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@babel/preset-react": "7.22.5",
|
|
24
|
-
"@cucumber/
|
|
25
|
-
"@playwright/test": "1.
|
|
26
|
-
"@testing-library/jest-dom": "5.11.9",
|
|
27
|
-
"@testing-library/react": "11.2.7",
|
|
28
|
-
"@testing-library/react-hooks": "7.0.2",
|
|
29
|
-
"babel-jest": "29.6.2",
|
|
30
|
-
"babel-plugin-transform-dynamic-import": "2.1.0",
|
|
31
|
-
"fast-glob": "3.3.1",
|
|
32
|
-
"jest": "29.6.2",
|
|
33
|
-
"jest-environment-jsdom": "29.6.2",
|
|
34
|
-
"msw": "1.2.3"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"react": "*",
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"@babel/
|
|
47
|
-
"@babel/
|
|
48
|
-
"@babel/
|
|
49
|
-
"@babel/
|
|
50
|
-
"@babel/
|
|
51
|
-
"@babel/
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@zohodesk/testinglibrary",
|
|
3
|
+
"version": "0.1.8-stb-bdd-v1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./build/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"postinstall": "node bin/postinstall.js",
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"clean": "rmdir /s /q build && mkdir build",
|
|
10
|
+
"build-babel": "babel -d ./build ./src --copy-files",
|
|
11
|
+
"build": "npm run clean && npm run build-babel",
|
|
12
|
+
"prepare": "npm run build",
|
|
13
|
+
"lint": "eslint src/* --fix"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./build/index.js",
|
|
17
|
+
"./decorators": "./build/decorators.js"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [],
|
|
20
|
+
"author": "",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@babel/preset-react": "7.22.5",
|
|
24
|
+
"@cucumber/gherkin": "^27.0.0",
|
|
25
|
+
"@playwright/test": "1.39.0",
|
|
26
|
+
"@testing-library/jest-dom": "5.11.9",
|
|
27
|
+
"@testing-library/react": "11.2.7",
|
|
28
|
+
"@testing-library/react-hooks": "7.0.2",
|
|
29
|
+
"babel-jest": "29.6.2",
|
|
30
|
+
"babel-plugin-transform-dynamic-import": "2.1.0",
|
|
31
|
+
"fast-glob": "3.3.1",
|
|
32
|
+
"jest": "29.6.2",
|
|
33
|
+
"jest-environment-jsdom": "29.6.2",
|
|
34
|
+
"msw": "1.2.3"
|
|
35
|
+
},
|
|
36
|
+
"bin": {
|
|
37
|
+
"ZDTestingFramework": "./bin/cli.js"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": "*",
|
|
41
|
+
"react-dom": "*",
|
|
42
|
+
"eslint": "*"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@babel/cli": "7.22.15",
|
|
46
|
+
"@babel/core": "7.22.17",
|
|
47
|
+
"@babel/node": "7.22.15",
|
|
48
|
+
"@babel/plugin-transform-runtime": "7.22.15",
|
|
49
|
+
"@babel/polyfill": "7.12.1",
|
|
50
|
+
"@babel/preset-env": "7.22.15",
|
|
51
|
+
"@babel/runtime": "7.22.15",
|
|
52
|
+
"commander": "^11.0.0"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/playwright.config.js
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
const { defineConfig, devices } = require('@playwright/test');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const numCPUs = require('os').cpus().length;
|
|
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
|
-
export default defineConfig({
|
|
16
|
-
testDir: path.join(path.resolve(process.cwd()), 'uat'),
|
|
17
|
-
outputDir: path.join(process.cwd(), 'uat', 'test-results'),
|
|
18
|
-
/* Run tests in files in parallel */
|
|
19
|
-
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
|
-
retries: process.env.CI ? 2 : 0,
|
|
24
|
-
/* Opt out of parallel tests on CI. */
|
|
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(), 'uat', 'playwright-report'), open: "always" }]],
|
|
28
|
-
timeout: 60 * 1000,
|
|
29
|
-
expect: {
|
|
30
|
-
timeout: 5 * 1000,
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
34
|
-
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
|
-
trace: 'on',
|
|
40
|
-
video: {
|
|
41
|
-
mode: 'on',
|
|
42
|
-
size: { width: 640, height: 480 }
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
/* Configure projects for major browsers */
|
|
47
|
-
projects: [
|
|
48
|
-
{ name: 'setup', testMatch: /.*\.setup\.js/ },
|
|
49
|
-
{
|
|
50
|
-
name: 'chromium',
|
|
51
|
-
use: {
|
|
52
|
-
...devices['Desktop Chrome'],
|
|
53
|
-
storageState: path.resolve(process.cwd(), 'uat', 'playwright/.auth/user.json')
|
|
54
|
-
},
|
|
55
|
-
dependencies: ['setup'],
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
name: 'firefox',
|
|
60
|
-
timeout: 4 * 60 * 1000,
|
|
61
|
-
expect: {
|
|
62
|
-
timeout: 80 * 1000,
|
|
63
|
-
},
|
|
64
|
-
use: {
|
|
65
|
-
...devices['Desktop Firefox'],
|
|
66
|
-
storageState: path.resolve(process.cwd(), 'uat', 'playwright/.auth/user.json')
|
|
67
|
-
},
|
|
68
|
-
dependencies: ['setup'],
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
{
|
|
72
|
-
name: 'webkit',
|
|
73
|
-
timeout: 2 * 60 * 1000,
|
|
74
|
-
expect: {
|
|
75
|
-
timeout: 80 * 1000,
|
|
76
|
-
},
|
|
77
|
-
use: {
|
|
78
|
-
...devices['Desktop Safari'],
|
|
79
|
-
storageState: path.resolve(process.cwd(), 'uat', 'playwright/.auth/user.json')
|
|
80
|
-
},
|
|
81
|
-
dependencies: ['setup'],
|
|
82
|
-
},
|
|
83
|
-
|
|
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
|
-
],
|
|
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
|
-
});
|
|
112
|
-
|
|
1
|
+
// @ts-check
|
|
2
|
+
const { defineConfig, devices } = require('@playwright/test');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const numCPUs = require('os').cpus().length;
|
|
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
|
+
export default defineConfig({
|
|
16
|
+
testDir: path.join(path.resolve(process.cwd()), 'uat'),
|
|
17
|
+
outputDir: path.join(process.cwd(), 'uat', 'test-results'),
|
|
18
|
+
/* Run tests in files in parallel */
|
|
19
|
+
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
|
+
retries: process.env.CI ? 2 : 0,
|
|
24
|
+
/* Opt out of parallel tests on CI. */
|
|
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(), 'uat', 'playwright-report'), open: "always" }]],
|
|
28
|
+
timeout: 60 * 1000,
|
|
29
|
+
expect: {
|
|
30
|
+
timeout: 5 * 1000,
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
34
|
+
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
|
+
trace: 'on',
|
|
40
|
+
video: {
|
|
41
|
+
mode: 'on',
|
|
42
|
+
size: { width: 640, height: 480 }
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
/* Configure projects for major browsers */
|
|
47
|
+
projects: [
|
|
48
|
+
{ name: 'setup', testMatch: /.*\.setup\.js/ },
|
|
49
|
+
{
|
|
50
|
+
name: 'chromium',
|
|
51
|
+
use: {
|
|
52
|
+
...devices['Desktop Chrome'],
|
|
53
|
+
storageState: path.resolve(process.cwd(), 'uat', 'playwright/.auth/user.json')
|
|
54
|
+
},
|
|
55
|
+
dependencies: ['setup'],
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
{
|
|
59
|
+
name: 'firefox',
|
|
60
|
+
timeout: 4 * 60 * 1000,
|
|
61
|
+
expect: {
|
|
62
|
+
timeout: 80 * 1000,
|
|
63
|
+
},
|
|
64
|
+
use: {
|
|
65
|
+
...devices['Desktop Firefox'],
|
|
66
|
+
storageState: path.resolve(process.cwd(), 'uat', 'playwright/.auth/user.json')
|
|
67
|
+
},
|
|
68
|
+
dependencies: ['setup'],
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
{
|
|
72
|
+
name: 'webkit',
|
|
73
|
+
timeout: 2 * 60 * 1000,
|
|
74
|
+
expect: {
|
|
75
|
+
timeout: 80 * 1000,
|
|
76
|
+
},
|
|
77
|
+
use: {
|
|
78
|
+
...devices['Desktop Safari'],
|
|
79
|
+
storageState: path.resolve(process.cwd(), 'uat', 'playwright/.auth/user.json')
|
|
80
|
+
},
|
|
81
|
+
dependencies: ['setup'],
|
|
82
|
+
},
|
|
83
|
+
|
|
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
|
+
],
|
|
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
|
+
});
|
|
112
|
+
|