@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
|
@@ -29,7 +29,6 @@ function helpercmd() {
|
|
|
29
29
|
_commander.program.option('--debug', 'This command is used to initiate a debugging session');
|
|
30
30
|
_commander.program.option('--tags', 'Run specific test case with mentioned tags (Usage: -- --tags="@live")');
|
|
31
31
|
_commander.program.option('--workers', 'Specify number of workers to run the test case parallely (Usage: -- --workers=2)');
|
|
32
|
-
_commander.program.option('--browsers', 'Specify the browsers on which the test case should run (Usage: -- --browsers="chrome,firefox,safari")');
|
|
33
32
|
_commander.program.parse(process.argv);
|
|
34
33
|
}
|
|
35
34
|
var _default = exports.default = helpercmd;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
function sortEdition(event) {
|
|
3
|
-
var currentURL = window.location.href;
|
|
4
|
-
const endPointCount = window.location.href.indexOf('#');
|
|
5
|
-
if (!(endPointCount == -1)) {
|
|
6
|
-
window.history.pushState({}, '', currentURL.slice(0, endPointCount));
|
|
7
|
-
currentURL = currentURL.slice(0, endPointCount);
|
|
8
|
-
}
|
|
9
|
-
console.log(currentURL);
|
|
10
|
-
window.open(`${currentURL}#?q=@edition_${event.target.value}`, '_self');
|
|
11
|
-
}
|
|
12
|
-
</script>
|
|
13
|
-
<div class="mainContainer" style="margin-left: 20px; display: flex;">
|
|
14
|
-
<div class="selectEditionContainer" style="padding: 20px;">
|
|
15
|
-
<select class="selectEdition" style="padding: 5px; width: 100px; border-radius: 6px; border: 1px solid var(--color-border-default);" onchange="sortEdition(event)">
|
|
16
|
-
<option value="EnterPrise">EnterPrise</option>
|
|
17
|
-
<option value="Professional">Professional</option>
|
|
18
|
-
<option value="Express">Express</option>
|
|
19
|
-
<option value="Standard">Standard</option>
|
|
20
|
-
<option value="Free">Free</option>
|
|
21
|
-
</select>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
1
|
+
<script>
|
|
2
|
+
function sortEdition(event) {
|
|
3
|
+
var currentURL = window.location.href;
|
|
4
|
+
const endPointCount = window.location.href.indexOf('#');
|
|
5
|
+
if (!(endPointCount == -1)) {
|
|
6
|
+
window.history.pushState({}, '', currentURL.slice(0, endPointCount));
|
|
7
|
+
currentURL = currentURL.slice(0, endPointCount);
|
|
8
|
+
}
|
|
9
|
+
console.log(currentURL);
|
|
10
|
+
window.open(`${currentURL}#?q=@edition_${event.target.value}`, '_self');
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
<div class="mainContainer" style="margin-left: 20px; display: flex;">
|
|
14
|
+
<div class="selectEditionContainer" style="padding: 20px;">
|
|
15
|
+
<select class="selectEdition" style="padding: 5px; width: 100px; border-radius: 6px; border: 1px solid var(--color-border-default);" onchange="sortEdition(event)">
|
|
16
|
+
<option value="EnterPrise">EnterPrise</option>
|
|
17
|
+
<option value="Professional">Professional</option>
|
|
18
|
+
<option value="Express">Express</option>
|
|
19
|
+
<option value="Standard">Standard</option>
|
|
20
|
+
<option value="Free">Free</option>
|
|
21
|
+
</select>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
25
|
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import { test as setup, expect } from '@zohodesk/testinglibrary';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
5
|
-
|
|
6
|
-
const userdata = require('./authUsers.json');
|
|
7
|
-
|
|
8
|
-
const authDirectory = path.resolve(process.cwd(), 'uat', 'playwright', '.auth');
|
|
9
|
-
|
|
10
|
-
const authContent = { "cookies": [] };
|
|
11
|
-
|
|
12
|
-
const LOGIN_ERR_MESSAGE = 'Need go be logged in';
|
|
13
|
-
// const AUTH_ERR_MESSAGE = `Founded Path - ${path.resolve(process.cwd(),'uat','playwright','.auth')} \n Find if file is Properly Created. Cookies Cannot Be Read .. `
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function convertCookiesToParse(cookies, authFilePath) {
|
|
17
|
-
try {
|
|
18
|
-
return JSON.parse(cookies)
|
|
19
|
-
} catch (err) {
|
|
20
|
-
throw new Error(` Error while parsing cookies ${err} \n${path.resolve(process.cwd(), authFilePath)} File is Empty`)
|
|
21
|
-
// process.exit()
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (!existsSync(authDirectory)) {
|
|
26
|
-
console.log('Creating auth directory for the first time setup...');
|
|
27
|
-
mkdirSync(authDirectory, { recursive: true });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
userdata.forEach((data) => {
|
|
31
|
-
const authFile = path.resolve(path.join(authDirectory, `${data.filename}`));
|
|
32
|
-
if (!existsSync(authFile)) {
|
|
33
|
-
console.log('creating auth file..');
|
|
34
|
-
writeFileSync(authFile, JSON.stringify(authContent, null, 2))
|
|
35
|
-
}
|
|
36
|
-
setup(data.description, async ({ page }) => {
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
const cookies = readFileSync(authFile);
|
|
40
|
-
const parsedCookies = convertCookiesToParse(cookies, authFile);
|
|
41
|
-
await page.context().addCookies(parsedCookies.cookies === undefined ? [] : parsedCookies.cookies)
|
|
42
|
-
await page.goto(page.getBaseUrl());
|
|
43
|
-
await page.waitForLoadState();
|
|
44
|
-
if (await page.url().includes(process.env.domain)) {
|
|
45
|
-
await page.waitForSelector(data.locator);
|
|
46
|
-
} else {
|
|
47
|
-
throw new Error(LOGIN_ERR_MESSAGE);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} catch (err) {
|
|
52
|
-
if (err.message === LOGIN_ERR_MESSAGE) {
|
|
53
|
-
|
|
54
|
-
await expect(page.locator('.load-bg')).toBeHidden();
|
|
55
|
-
await page.locator('#login_id').type(data.useremail);
|
|
56
|
-
await page.locator('#nextbtn').click();
|
|
57
|
-
await page.locator('#password').type(data.password);
|
|
58
|
-
await page.locator('#nextbtn').click();
|
|
59
|
-
|
|
60
|
-
await page.waitForLoadState("networkidle");
|
|
61
|
-
|
|
62
|
-
await page.waitForSelector(data.locator)
|
|
63
|
-
|
|
64
|
-
await page.context().storageState({ path: authFile });
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
})
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { test as setup, expect } from '@zohodesk/testinglibrary';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
5
|
+
|
|
6
|
+
const userdata = require('./authUsers.json');
|
|
7
|
+
|
|
8
|
+
const authDirectory = path.resolve(process.cwd(), 'uat', 'playwright', '.auth');
|
|
9
|
+
|
|
10
|
+
const authContent = { "cookies": [] };
|
|
11
|
+
|
|
12
|
+
const LOGIN_ERR_MESSAGE = 'Need go be logged in';
|
|
13
|
+
// const AUTH_ERR_MESSAGE = `Founded Path - ${path.resolve(process.cwd(),'uat','playwright','.auth')} \n Find if file is Properly Created. Cookies Cannot Be Read .. `
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function convertCookiesToParse(cookies, authFilePath) {
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(cookies)
|
|
19
|
+
} catch (err) {
|
|
20
|
+
throw new Error(` Error while parsing cookies ${err} \n${path.resolve(process.cwd(), authFilePath)} File is Empty`)
|
|
21
|
+
// process.exit()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!existsSync(authDirectory)) {
|
|
26
|
+
console.log('Creating auth directory for the first time setup...');
|
|
27
|
+
mkdirSync(authDirectory, { recursive: true });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
userdata.forEach((data) => {
|
|
31
|
+
const authFile = path.resolve(path.join(authDirectory, `${data.filename}`));
|
|
32
|
+
if (!existsSync(authFile)) {
|
|
33
|
+
console.log('creating auth file..');
|
|
34
|
+
writeFileSync(authFile, JSON.stringify(authContent, null, 2))
|
|
35
|
+
}
|
|
36
|
+
setup(data.description, async ({ page }) => {
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const cookies = readFileSync(authFile);
|
|
40
|
+
const parsedCookies = convertCookiesToParse(cookies, authFile);
|
|
41
|
+
await page.context().addCookies(parsedCookies.cookies === undefined ? [] : parsedCookies.cookies)
|
|
42
|
+
await page.goto(page.getBaseUrl());
|
|
43
|
+
await page.waitForLoadState();
|
|
44
|
+
if (await page.url().includes(process.env.domain)) {
|
|
45
|
+
await page.waitForSelector(data.locator);
|
|
46
|
+
} else {
|
|
47
|
+
throw new Error(LOGIN_ERR_MESSAGE);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
} catch (err) {
|
|
52
|
+
if (err.message === LOGIN_ERR_MESSAGE) {
|
|
53
|
+
|
|
54
|
+
await expect(page.locator('.load-bg')).toBeHidden();
|
|
55
|
+
await page.locator('#login_id').type(data.useremail);
|
|
56
|
+
await page.locator('#nextbtn').click();
|
|
57
|
+
await page.locator('#password').type(data.password);
|
|
58
|
+
await page.locator('#nextbtn').click();
|
|
59
|
+
|
|
60
|
+
await page.waitForLoadState("networkidle");
|
|
61
|
+
|
|
62
|
+
await page.waitForSelector(data.locator)
|
|
63
|
+
|
|
64
|
+
await page.context().storageState({ path: authFile });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"useremail": "/ user name /",
|
|
4
|
-
"password": "/ password /",
|
|
5
|
-
"description": "/ description/",
|
|
6
|
-
"filename": "user.json",
|
|
7
|
-
"locator": "/ selector to identify page has been loaded completely /"
|
|
8
|
-
}
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"useremail": "/ user name /",
|
|
4
|
+
"password": "/ password /",
|
|
5
|
+
"description": "/ description/",
|
|
6
|
+
"filename": "user.json",
|
|
7
|
+
"locator": "/ selector to identify page has been loaded completely /"
|
|
8
|
+
}
|
|
9
9
|
]
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
"dev": {
|
|
3
|
-
"domain": "https://desk.localzoho.com/agent",
|
|
4
|
-
"orgName": "org-name",
|
|
5
|
-
"deptName": "dept-name",
|
|
6
|
-
"moduleName": "module-name",
|
|
7
|
-
"devURL": "Provide your devURL here"
|
|
8
|
-
},
|
|
9
|
-
"prod": {
|
|
10
|
-
"domain": "https://desk.localzoho.com/agent",
|
|
11
|
-
"orgName": "org-name",
|
|
12
|
-
"deptName": "dept-name",
|
|
13
|
-
"moduleName": "module-name"
|
|
14
|
-
},
|
|
15
|
-
"k8test": {
|
|
16
|
-
"domain": "https://desk.localzoho.com/agent",
|
|
17
|
-
"orgName": "org-name",
|
|
18
|
-
"deptName": "dept-name",
|
|
19
|
-
"moduleName": "module-name"
|
|
20
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"dev": {
|
|
3
|
+
"domain": "https://desk.localzoho.com/agent",
|
|
4
|
+
"orgName": "org-name",
|
|
5
|
+
"deptName": "dept-name",
|
|
6
|
+
"moduleName": "module-name",
|
|
7
|
+
"devURL": "Provide your devURL here"
|
|
8
|
+
},
|
|
9
|
+
"prod": {
|
|
10
|
+
"domain": "https://desk.localzoho.com/agent",
|
|
11
|
+
"orgName": "org-name",
|
|
12
|
+
"deptName": "dept-name",
|
|
13
|
+
"moduleName": "module-name"
|
|
14
|
+
},
|
|
15
|
+
"k8test": {
|
|
16
|
+
"domain": "https://desk.localzoho.com/agent",
|
|
17
|
+
"orgName": "org-name",
|
|
18
|
+
"deptName": "dept-name",
|
|
19
|
+
"moduleName": "module-name"
|
|
20
|
+
}
|
|
21
21
|
}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { Logger } from '../utils/logger';
|
|
4
|
-
import { generateConfigFromFile } from '../core/playwright/readConfigFile';
|
|
5
|
-
const gitIgnoreAbsolutePath = path.resolve(process.cwd(), '../', '../')
|
|
6
|
-
|
|
7
|
-
const { reportPath = path.resolve(process.cwd(), 'uat', 'playwright-reports') } = generateConfigFromFile();
|
|
8
|
-
const testResultsPath = path.resolve(process.cwd(), 'uat', 'test-results');
|
|
9
|
-
|
|
10
|
-
const testResultsRelativepath = path.relative(gitIgnoreAbsolutePath, testResultsPath)
|
|
11
|
-
const reportRelativepath = path.relative(gitIgnoreAbsolutePath, reportPath)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const absolutePathfeaturegen = path.resolve(process.cwd(), 'uat', '.features-gen');
|
|
15
|
-
const featuregenRelativePath = path.relative(gitIgnoreAbsolutePath,absolutePathfeaturegen)
|
|
16
|
-
|
|
17
|
-
const dirpathtoIgnore = `${testResultsRelativepath}\n${reportRelativepath}\n${featuregenRelativePath}`
|
|
18
|
-
|
|
19
|
-
function updateGitIgnore() {
|
|
20
|
-
if (existsSync(path.resolve(process.cwd(), '../', '../', '.gitignore'))) {
|
|
21
|
-
let gitIgnoreData = readFileSync(path.resolve(process.cwd(), '../', '../', '.gitignore'), 'utf-8', (err) => {
|
|
22
|
-
if (err) {
|
|
23
|
-
Logger.log(Logger.FAILURE_TYPE, 'cannot able to read git ignore ')
|
|
24
|
-
// process.exit()
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
if (gitIgnoreData.includes(dirpathtoIgnore)) {
|
|
28
|
-
return
|
|
29
|
-
} else {
|
|
30
|
-
writeFileSync(path.resolve(process.cwd(), '../', '../', '.gitignore', dirpathtoIgnore, null, 2))
|
|
31
|
-
}
|
|
32
|
-
} else {
|
|
33
|
-
Logger.log(Logger.INFO_TYPE, 'GitIgnore file is No Found ....')
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { Logger } from '../utils/logger';
|
|
4
|
+
import { generateConfigFromFile } from '../core/playwright/readConfigFile';
|
|
5
|
+
const gitIgnoreAbsolutePath = path.resolve(process.cwd(), '../', '../')
|
|
6
|
+
|
|
7
|
+
const { reportPath = path.resolve(process.cwd(), 'uat', 'playwright-reports') } = generateConfigFromFile();
|
|
8
|
+
const testResultsPath = path.resolve(process.cwd(), 'uat', 'test-results');
|
|
9
|
+
|
|
10
|
+
const testResultsRelativepath = path.relative(gitIgnoreAbsolutePath, testResultsPath)
|
|
11
|
+
const reportRelativepath = path.relative(gitIgnoreAbsolutePath, reportPath)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const absolutePathfeaturegen = path.resolve(process.cwd(), 'uat', '.features-gen');
|
|
15
|
+
const featuregenRelativePath = path.relative(gitIgnoreAbsolutePath,absolutePathfeaturegen)
|
|
16
|
+
|
|
17
|
+
const dirpathtoIgnore = `${testResultsRelativepath}\n${reportRelativepath}\n${featuregenRelativePath}`
|
|
18
|
+
|
|
19
|
+
function updateGitIgnore() {
|
|
20
|
+
if (existsSync(path.resolve(process.cwd(), '../', '../', '.gitignore'))) {
|
|
21
|
+
let gitIgnoreData = readFileSync(path.resolve(process.cwd(), '../', '../', '.gitignore'), 'utf-8', (err) => {
|
|
22
|
+
if (err) {
|
|
23
|
+
Logger.log(Logger.FAILURE_TYPE, 'cannot able to read git ignore ')
|
|
24
|
+
// process.exit()
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
if (gitIgnoreData.includes(dirpathtoIgnore)) {
|
|
28
|
+
return
|
|
29
|
+
} else {
|
|
30
|
+
writeFileSync(path.resolve(process.cwd(), '../', '../', '.gitignore', dirpathtoIgnore, null, 2))
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
Logger.log(Logger.INFO_TYPE, 'GitIgnore file is No Found ....')
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
37
|
export default updateGitIgnore;
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object|null} viewportConfig
|
|
3
|
-
* @property {number} width - width of the viewport
|
|
4
|
-
* @property {number} height - height of the viewport
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Represents the user configuration object.
|
|
8
|
-
* @typedef {Object} UserConfig
|
|
9
|
-
* @property {string} headless - Headless Browsers mode.
|
|
10
|
-
* @property {number} trace - trace for test cases.
|
|
11
|
-
* @property {boolean} video - video for test cases,
|
|
12
|
-
* @property {boolean} debug - debug mode
|
|
13
|
-
* @property {string} mode: mode in which the test cases needs to run
|
|
14
|
-
* @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
|
|
15
|
-
* @property {string} authFilePath - File Path where the cookies stored
|
|
16
|
-
* @property {any} browsers: List of browsers
|
|
17
|
-
* @property {string} openReportOn: default Option value (never, on-failure and always)
|
|
18
|
-
* @property {any} reportPath : directory where report is generate
|
|
19
|
-
* @property {boolean} bddMode: Feature files needs to be processed
|
|
20
|
-
* @property {number} expectTimeout: time in milliseconds which the expect condition should fail
|
|
21
|
-
* @property {number} testTimeout: time in milliseconds which the test should fail
|
|
22
|
-
* @property {Object} additionalPages: custom pages configuration
|
|
23
|
-
* @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
|
|
24
|
-
* @property {string} stepDefinitionsFolder: folder name under which step implementations will be placed. Default is steps
|
|
25
|
-
* @property {viewportConfig} viewport: viewport configuration for the browser. Default is { width: 1280, height: 720 }
|
|
26
|
-
* @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @type {UserConfig}
|
|
31
|
-
*/
|
|
32
|
-
module.exports = {
|
|
33
|
-
headless: false,
|
|
34
|
-
browsers: ['Chrome', 'Firefox', 'Safari', 'Edge'],
|
|
35
|
-
mode: 'dev',
|
|
36
|
-
isAuthMode: true,
|
|
37
|
-
authFilePath: 'uat/playwright/.auth/user.json',
|
|
38
|
-
trace: true,
|
|
39
|
-
video: true,
|
|
40
|
-
bddMode: true,
|
|
41
|
-
featureFilesFolder: 'feature-files',
|
|
42
|
-
stepDefinitionsFolder: 'steps',
|
|
43
|
-
viewport: { width: 1280, height: 720 }
|
|
44
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object|null} viewportConfig
|
|
3
|
+
* @property {number} width - width of the viewport
|
|
4
|
+
* @property {number} height - height of the viewport
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Represents the user configuration object.
|
|
8
|
+
* @typedef {Object} UserConfig
|
|
9
|
+
* @property {string} headless - Headless Browsers mode.
|
|
10
|
+
* @property {number} trace - trace for test cases.
|
|
11
|
+
* @property {boolean} video - video for test cases,
|
|
12
|
+
* @property {boolean} debug - debug mode
|
|
13
|
+
* @property {string} mode: mode in which the test cases needs to run
|
|
14
|
+
* @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
|
|
15
|
+
* @property {string} authFilePath - File Path where the cookies stored
|
|
16
|
+
* @property {any} browsers: List of browsers
|
|
17
|
+
* @property {string} openReportOn: default Option value (never, on-failure and always)
|
|
18
|
+
* @property {any} reportPath : directory where report is generate
|
|
19
|
+
* @property {boolean} bddMode: Feature files needs to be processed
|
|
20
|
+
* @property {number} expectTimeout: time in milliseconds which the expect condition should fail
|
|
21
|
+
* @property {number} testTimeout: time in milliseconds which the test should fail
|
|
22
|
+
* @property {Object} additionalPages: custom pages configuration
|
|
23
|
+
* @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
|
|
24
|
+
* @property {string} stepDefinitionsFolder: folder name under which step implementations will be placed. Default is steps
|
|
25
|
+
* @property {viewportConfig} viewport: viewport configuration for the browser. Default is { width: 1280, height: 720 }
|
|
26
|
+
* @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @type {UserConfig}
|
|
31
|
+
*/
|
|
32
|
+
module.exports = {
|
|
33
|
+
headless: false,
|
|
34
|
+
browsers: ['Chrome', 'Firefox', 'Safari', 'Edge'],
|
|
35
|
+
mode: 'dev',
|
|
36
|
+
isAuthMode: true,
|
|
37
|
+
authFilePath: 'uat/playwright/.auth/user.json',
|
|
38
|
+
trace: true,
|
|
39
|
+
video: true,
|
|
40
|
+
bddMode: true,
|
|
41
|
+
featureFilesFolder: 'feature-files',
|
|
42
|
+
stepDefinitionsFolder: 'steps',
|
|
43
|
+
viewport: { width: 1280, height: 720 }
|
|
44
|
+
}
|
|
@@ -5,19 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.cliArgsToObject = cliArgsToObject;
|
|
7
7
|
exports.objectToCliArgs = objectToCliArgs;
|
|
8
|
-
/**
|
|
9
|
-
* Converts an array of command-line arguments into an object.
|
|
10
|
-
*
|
|
11
|
-
* @param {string[]} cliArgs - An array of command-line arguments.
|
|
12
|
-
* @param {boolean} [isKeyNeedToBeAdded=true] - Indicates whether the keys should be added to the resulting object.
|
|
13
|
-
* @returns {Object} An object representing the command-line arguments, where keys are argument names (without '--') and values are argument values.
|
|
14
|
-
* If `isKeyNeedToBeAdded` is set to `false`, only values are included in the object with numeric indexes as keys.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* // Example usage:
|
|
18
|
-
* const args = ['--port=8080', '--verbose', 'input.txt'];
|
|
19
|
-
* const result = cliArgsToObject(args);
|
|
20
|
-
* // result will be: { port: '8080', verbose: true }
|
|
8
|
+
/**
|
|
9
|
+
* Converts an array of command-line arguments into an object.
|
|
10
|
+
*
|
|
11
|
+
* @param {string[]} cliArgs - An array of command-line arguments.
|
|
12
|
+
* @param {boolean} [isKeyNeedToBeAdded=true] - Indicates whether the keys should be added to the resulting object.
|
|
13
|
+
* @returns {Object} An object representing the command-line arguments, where keys are argument names (without '--') and values are argument values.
|
|
14
|
+
* If `isKeyNeedToBeAdded` is set to `false`, only values are included in the object with numeric indexes as keys.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Example usage:
|
|
18
|
+
* const args = ['--port=8080', '--verbose', 'input.txt'];
|
|
19
|
+
* const result = cliArgsToObject(args);
|
|
20
|
+
* // result will be: { port: '8080', verbose: true }
|
|
21
21
|
*/
|
|
22
22
|
// eslint-disable-next-line no-unused-vars
|
|
23
23
|
function cliArgsToObject(cliArgs, isKeyNeedToBeAdded) {
|
|
@@ -37,18 +37,18 @@ function cliArgsToObject(cliArgs, isKeyNeedToBeAdded) {
|
|
|
37
37
|
return processEnv;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
* Converts an object to an array of command-line arguments.
|
|
42
|
-
*
|
|
43
|
-
* @param {Object} objectToBeConverted - The object to be converted to command-line arguments.
|
|
44
|
-
* @param {(string|function(string): boolean)} [isKeyNeedToBeAdded=true] - A string representing a key, or a function that determines whether a key should be added to the resulting array.
|
|
45
|
-
* @returns {string[]} An array of command-line arguments generated from the object's key-value pairs. Keys are transformed into argument names (with '--') and values are added as argument values.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* // Example usage:
|
|
49
|
-
* const options = { port: 8080, verbose: true, input: 'input.txt' };
|
|
50
|
-
* const args = objectToCliArgs(options);
|
|
51
|
-
* // args will be: ['--port=8080', '--verbose', '--input=input.txt']
|
|
40
|
+
/**
|
|
41
|
+
* Converts an object to an array of command-line arguments.
|
|
42
|
+
*
|
|
43
|
+
* @param {Object} objectToBeConverted - The object to be converted to command-line arguments.
|
|
44
|
+
* @param {(string|function(string): boolean)} [isKeyNeedToBeAdded=true] - A string representing a key, or a function that determines whether a key should be added to the resulting array.
|
|
45
|
+
* @returns {string[]} An array of command-line arguments generated from the object's key-value pairs. Keys are transformed into argument names (with '--') and values are added as argument values.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // Example usage:
|
|
49
|
+
* const options = { port: 8080, verbose: true, input: 'input.txt' };
|
|
50
|
+
* const args = objectToCliArgs(options);
|
|
51
|
+
* // args will be: ['--port=8080', '--verbose', '--input=input.txt']
|
|
52
52
|
*/
|
|
53
53
|
function objectToCliArgs(objectToBeConverted, isKeyNeedToBeAdded) {
|
|
54
54
|
const argsArray = [];
|
package/build/utils/fileUtils.js
CHANGED
|
@@ -5,12 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.checkIfFileExists = checkIfFileExists;
|
|
8
|
+
exports.createFolderSync = createFolderSync;
|
|
8
9
|
exports.deleteFile = deleteFile;
|
|
9
10
|
exports.deleteFolder = deleteFolder;
|
|
10
11
|
exports.readFileContents = readFileContents;
|
|
11
12
|
exports.writeFileContents = writeFileContents;
|
|
12
|
-
var _fs =
|
|
13
|
+
var _fs = _interopRequireWildcard(require("fs"));
|
|
13
14
|
var _path = _interopRequireDefault(require("path"));
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
17
|
function checkIfFileExists(file) {
|
|
15
18
|
try {
|
|
16
19
|
_fs.default.accessSync(file, _fs.default.constants.F_OK);
|
|
@@ -61,4 +64,19 @@ function deleteFolder(folderPath) {
|
|
|
61
64
|
throw new Error(`Error while deleting the test data file: ${folderPath}`);
|
|
62
65
|
}
|
|
63
66
|
}
|
|
67
|
+
}
|
|
68
|
+
function resolveFilePath(...filePath) {
|
|
69
|
+
var resolvedPath;
|
|
70
|
+
for (let i = 0; i < filePath.length; i++) {
|
|
71
|
+
resolvedPath = _path.default.resolve(resolvedPath, filePath[i]);
|
|
72
|
+
}
|
|
73
|
+
return resolvedPath;
|
|
74
|
+
}
|
|
75
|
+
function createFolderSync(folderPath, options = {}) {
|
|
76
|
+
if ((0, _fs.existsSync)(folderPath)) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
return (0, _fs.mkdirSync)(folderPath, {
|
|
80
|
+
recursive: true
|
|
81
|
+
});
|
|
64
82
|
}
|
|
@@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = getFilePathWithExtension;
|
|
7
|
+
exports.isWindows = void 0;
|
|
7
8
|
var _os = require("os");
|
|
8
|
-
const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
|
|
9
|
+
const isWindows = exports.isWindows = (0, _os.platform)().toLowerCase() === 'win32';
|
|
9
10
|
function getFilePathWithExtension(binName) {
|
|
10
11
|
return isWindows ? `${binName}.cmd` : binName;
|
|
11
12
|
}
|