@zohodesk/testinglibrary 0.0.4 → 0.0.5-exp.1
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/README.md +17 -17
- package/bin/cli.js +1 -1
- package/bin/postinstall.js +15 -15
- package/changelog.md +25 -19
- package/jest.config.js +63 -63
- package/npm-shrinkwrap.json +5772 -5772
- package/package.json +30 -30
- package/playwright.config.js +112 -112
- package/src/core/jest/preprocessor/jsPreprocessor.js +9 -9
- package/src/core/jest/runner/jest-runner.js +44 -44
- package/src/core/jest/setup/index.js +165 -165
- package/src/core/playwright/codegen.js +60 -60
- package/src/core/playwright/custom-commands.js +2 -2
- package/src/core/playwright/env-initializer.js +23 -23
- package/src/core/playwright/index.js +81 -81
- package/src/core/playwright/readConfigFile.js +62 -29
- package/src/core/playwright/report-generator.js +44 -42
- package/src/core/playwright/setup/config-creator.js +77 -77
- package/src/core/playwright/test-runner.js +67 -64
- package/src/index.js +8 -8
- package/src/lib/cli.js +42 -34
- package/src/setup-folder-structure/env-config-sample.json +17 -0
- package/src/setup-folder-structure/git/gitignore.js +36 -0
- package/src/setup-folder-structure/setupProject.js +98 -0
- package/src/setup-folder-structure/uat-config-sample.js +27 -0
- package/src/setup-folder-structure/user-example.json +3 -0
- package/src/utils/cliArgsToObject.js +62 -34
- package/src/utils/getFilePath.js +8 -8
- package/src/utils/logger.js +56 -28
- package/src/utils/rootPath.js +50 -50
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# Testing Framework
|
|
2
|
-
|
|
3
|
-
## Framework that abstracts the configuration for playwright and Jest
|
|
4
|
-
|
|
5
|
-
- Playwright
|
|
6
|
-
- Jest
|
|
7
|
-
|
|
8
|
-
## Cli
|
|
9
|
-
|
|
10
|
-
## Feature Supported
|
|
11
|
-
|
|
12
|
-
### Run TestCase
|
|
13
|
-
|
|
14
|
-
- npm run test
|
|
15
|
-
### Generate Report
|
|
16
|
-
|
|
17
|
-
- npm run report
|
|
1
|
+
# Testing Framework
|
|
2
|
+
|
|
3
|
+
## Framework that abstracts the configuration for playwright and Jest
|
|
4
|
+
|
|
5
|
+
- Playwright
|
|
6
|
+
- Jest
|
|
7
|
+
|
|
8
|
+
## Cli
|
|
9
|
+
|
|
10
|
+
## Feature Supported
|
|
11
|
+
|
|
12
|
+
### Run TestCase
|
|
13
|
+
|
|
14
|
+
- npm run test
|
|
15
|
+
### Generate Report
|
|
16
|
+
|
|
17
|
+
- npm run report
|
|
18
18
|
|
package/bin/cli.js
CHANGED
package/bin/postinstall.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const { spawn } = require('child_process');
|
|
3
|
-
const { Logger } = require('../src/utils/logger');
|
|
4
|
-
const getFilePathWithExtension = require('../src/utils/getFilePath');
|
|
5
|
-
|
|
6
|
-
const playwrightPath = path.resolve('node_modules', '.bin', getFilePathWithExtension('playwright'));
|
|
7
|
-
const command = playwrightPath;
|
|
8
|
-
const args = ['install'];
|
|
9
|
-
|
|
10
|
-
Logger.log(Logger.INFO_TYPE, 'Downloading browsers for running tests');
|
|
11
|
-
|
|
12
|
-
const childProcess = spawn(command, args, { stdio: 'inherit' });
|
|
13
|
-
|
|
14
|
-
childProcess.on('error', (error) => {
|
|
15
|
-
Logger.log(Logger.FAILURE_TYPE, error);
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { spawn } = require('child_process');
|
|
3
|
+
const { Logger } = require('../src/utils/logger');
|
|
4
|
+
const getFilePathWithExtension = require('../src/utils/getFilePath');
|
|
5
|
+
|
|
6
|
+
const playwrightPath = path.resolve('node_modules', '.bin', getFilePathWithExtension('playwright'));
|
|
7
|
+
const command = playwrightPath;
|
|
8
|
+
const args = ['install'];
|
|
9
|
+
|
|
10
|
+
Logger.log(Logger.INFO_TYPE, 'Downloading browsers for running tests');
|
|
11
|
+
|
|
12
|
+
const childProcess = spawn(command, args, { stdio: 'inherit' });
|
|
13
|
+
|
|
14
|
+
childProcess.on('error', (error) => {
|
|
15
|
+
Logger.log(Logger.FAILURE_TYPE, error);
|
|
16
16
|
});
|
package/changelog.md
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
# Testing Framework
|
|
2
|
-
|
|
3
|
-
## Framework that abstracts the configuration for playwright and Jest
|
|
4
|
-
|
|
5
|
-
# 0.0.
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
# Testing Framework
|
|
2
|
+
|
|
3
|
+
## Framework that abstracts the configuration for playwright and Jest
|
|
4
|
+
|
|
5
|
+
# 0.0.5
|
|
6
|
+
|
|
7
|
+
- Added Init command to initialize the folder structure and configuration for testing
|
|
8
|
+
- Renamed config.json to env-config.json
|
|
9
|
+
- Configured report file path directory and Handled Edge case in Cookies Handling
|
|
10
|
+
|
|
11
|
+
# 0.0.4
|
|
12
|
+
|
|
13
|
+
- Issue Fixes while loading the storage state
|
|
14
|
+
|
|
15
|
+
# 0.0.3
|
|
16
|
+
|
|
17
|
+
- Added Support for custom config generator based on user preferences
|
|
18
|
+
|
|
19
|
+
# 0.0.2
|
|
20
|
+
|
|
21
|
+
- Fix for Finding directories inside node_modules folder
|
|
22
|
+
|
|
23
|
+
# 0.0.1
|
|
24
|
+
|
|
25
|
+
- test and report command support
|
package/jest.config.js
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const { existsSync } = require('fs');
|
|
3
|
-
const appPath = process.cwd();
|
|
4
|
-
|
|
5
|
-
const appGlobals = path.resolve(appPath, '__testUtils__', 'globals.js');
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
rootDir: process.cwd(),
|
|
9
|
-
testEnvironment: 'jsdom',
|
|
10
|
-
|
|
11
|
-
setupFilesAfterEnv: [
|
|
12
|
-
existsSync(appGlobals) && appGlobals,
|
|
13
|
-
path.resolve(__dirname, 'src', 'core', 'jest', 'setup', 'index.js')
|
|
14
|
-
].filter(Boolean),
|
|
15
|
-
|
|
16
|
-
transform: {
|
|
17
|
-
'^.+\\.(js|jsx)$': path.resolve(
|
|
18
|
-
__dirname,
|
|
19
|
-
'src',
|
|
20
|
-
'core',
|
|
21
|
-
'jest',
|
|
22
|
-
'preprocessor',
|
|
23
|
-
'jsPreprocessor.js'
|
|
24
|
-
)
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
modulePathIgnorePatterns: ['/build/'],
|
|
28
|
-
|
|
29
|
-
transformIgnorePatterns: [
|
|
30
|
-
'/node_modules/(?!(@zohodesk)/)'
|
|
31
|
-
],
|
|
32
|
-
|
|
33
|
-
testPathIgnorePatterns: [
|
|
34
|
-
'/node_modules/',
|
|
35
|
-
'/build/',
|
|
36
|
-
'/uat/'
|
|
37
|
-
],
|
|
38
|
-
|
|
39
|
-
watchPathIgnorePatterns: [
|
|
40
|
-
'/node_modules/',
|
|
41
|
-
'/build/'
|
|
42
|
-
],
|
|
43
|
-
|
|
44
|
-
clearMocks: true,
|
|
45
|
-
resetMocks: false,
|
|
46
|
-
|
|
47
|
-
collectCoverage: true,
|
|
48
|
-
collectCoverageFrom: ['src/**/*.js'],
|
|
49
|
-
coverageDirectory: './build/cov',
|
|
50
|
-
coverageReporters: ['lcov', 'json', 'html', 'json-summary', 'text'],
|
|
51
|
-
coverageThreshold: {
|
|
52
|
-
global: {
|
|
53
|
-
branches: 100,
|
|
54
|
-
functions: 100,
|
|
55
|
-
lines: 100,
|
|
56
|
-
statements: 100
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
globals: {
|
|
60
|
-
__DEVELOPMENT__: true,
|
|
61
|
-
__DOCS__: false,
|
|
62
|
-
__TEST__: true
|
|
63
|
-
}
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { existsSync } = require('fs');
|
|
3
|
+
const appPath = process.cwd();
|
|
4
|
+
|
|
5
|
+
const appGlobals = path.resolve(appPath, '__testUtils__', 'globals.js');
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
rootDir: process.cwd(),
|
|
9
|
+
testEnvironment: 'jsdom',
|
|
10
|
+
|
|
11
|
+
setupFilesAfterEnv: [
|
|
12
|
+
existsSync(appGlobals) && appGlobals,
|
|
13
|
+
path.resolve(__dirname, 'src', 'core', 'jest', 'setup', 'index.js')
|
|
14
|
+
].filter(Boolean),
|
|
15
|
+
|
|
16
|
+
transform: {
|
|
17
|
+
'^.+\\.(js|jsx)$': path.resolve(
|
|
18
|
+
__dirname,
|
|
19
|
+
'src',
|
|
20
|
+
'core',
|
|
21
|
+
'jest',
|
|
22
|
+
'preprocessor',
|
|
23
|
+
'jsPreprocessor.js'
|
|
24
|
+
)
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
modulePathIgnorePatterns: ['/build/'],
|
|
28
|
+
|
|
29
|
+
transformIgnorePatterns: [
|
|
30
|
+
'/node_modules/(?!(@zohodesk)/)'
|
|
31
|
+
],
|
|
32
|
+
|
|
33
|
+
testPathIgnorePatterns: [
|
|
34
|
+
'/node_modules/',
|
|
35
|
+
'/build/',
|
|
36
|
+
'/uat/'
|
|
37
|
+
],
|
|
38
|
+
|
|
39
|
+
watchPathIgnorePatterns: [
|
|
40
|
+
'/node_modules/',
|
|
41
|
+
'/build/'
|
|
42
|
+
],
|
|
43
|
+
|
|
44
|
+
clearMocks: true,
|
|
45
|
+
resetMocks: false,
|
|
46
|
+
|
|
47
|
+
collectCoverage: true,
|
|
48
|
+
collectCoverageFrom: ['src/**/*.js'],
|
|
49
|
+
coverageDirectory: './build/cov',
|
|
50
|
+
coverageReporters: ['lcov', 'json', 'html', 'json-summary', 'text'],
|
|
51
|
+
coverageThreshold: {
|
|
52
|
+
global: {
|
|
53
|
+
branches: 100,
|
|
54
|
+
functions: 100,
|
|
55
|
+
lines: 100,
|
|
56
|
+
statements: 100
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
globals: {
|
|
60
|
+
__DEVELOPMENT__: true,
|
|
61
|
+
__DOCS__: false,
|
|
62
|
+
__TEST__: true
|
|
63
|
+
}
|
|
64
64
|
};
|