@zohodesk/testinglibrary 0.1.8-bdd-30.1 → 0.1.8-bdd-30.2

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.
Files changed (40) hide show
  1. package/.babelrc +18 -18
  2. package/.eslintrc.js +31 -31
  3. package/.prettierrc +5 -5
  4. package/README.md +17 -17
  5. package/bin/cli.js +2 -2
  6. package/build/bdd-poc/core-runner/createCallbacksMap.js +11 -8
  7. package/build/bdd-poc/core-runner/{intialize.js → initializeMaps.js} +1 -1
  8. package/build/bdd-poc/core-runner/main.js +7 -7
  9. package/build/bdd-poc/core-runner/stepRunner.js +8 -2
  10. package/build/bdd-poc/errors/throwError.js +6 -1
  11. package/build/bdd-poc/gherkin-parser/createTestTemplate.js +8 -8
  12. package/build/bdd-poc/gherkin-parser/cucumber/{cucumberSynatxParser.js → cucumberSyntaxParser.js} +4 -4
  13. package/build/bdd-poc/gherkin-parser/cucumber/data-driven/dataSourceMap.js +16 -16
  14. package/build/bdd-poc/gherkin-parser/stepsDefinition/extractTestInputs.js +18 -17
  15. package/build/bdd-poc/gherkin-parser/stepsDefinition/parserStepsArguments.js +5 -6
  16. package/build/bdd-poc/snippets/stepsnippets.js +2 -2
  17. package/build/bdd-poc/utils/stringManipulation.js +11 -8
  18. package/build/core/playwright/readConfigFile.js +30 -30
  19. package/build/core/playwright/setup/config-creator.js +9 -9
  20. package/build/core/playwright/setup/config-utils.js +7 -7
  21. package/build/index.d.ts +13 -13
  22. package/build/parser/sample.feature +34 -34
  23. package/build/parser/sample.spec.js +18 -18
  24. package/build/parser/verifier.js +2 -3
  25. package/build/setup-folder-structure/reportEnhancement/addonScript.html +23 -24
  26. package/build/setup-folder-structure/samples/auth-setup-sample.js +72 -72
  27. package/build/setup-folder-structure/samples/authUsers-sample.json +8 -8
  28. package/build/setup-folder-structure/samples/env-config-sample.json +20 -20
  29. package/build/setup-folder-structure/samples/git-ignore.sample.js +36 -36
  30. package/build/setup-folder-structure/samples/uat-config-sample.js +44 -44
  31. package/build/utils/PathProviderOfConfig.js +25 -0
  32. package/build/utils/cliArgsToObject.js +25 -25
  33. package/build/utils/fileUtils.js +10 -0
  34. package/changelog.md +131 -131
  35. package/jest.config.js +63 -63
  36. package/npm-shrinkwrap.json +5994 -5994
  37. package/package.json +56 -56
  38. package/playwright.config.js +112 -112
  39. package/build/bdd-poc/config/pathConfig.js +0 -26
  40. /package/build/bdd-poc/gherkin-parser/cucumber/{cucumber.js → invokerOfCucumberParser.js} +0 -0
@@ -9,7 +9,7 @@ var _test = require("@playwright/test");
9
9
  var _path = _interopRequireDefault(require("path"));
10
10
  var _readConfigFile = require("../readConfigFile");
11
11
  var _configUtils = require("./config-utils");
12
- var _intialize = require("../../../bdd-poc/core-runner/intialize");
12
+ var _initializeMaps = require("../../../bdd-poc/core-runner/initializeMaps");
13
13
  // import { createTestDataMap } from '../../../bdd-poc/test/cucumber/data-driven/dataSourceMap';
14
14
  // import { createStepsCallBack } from '../../../bdd-poc/core-runner/createCallbacksMap';
15
15
 
@@ -47,16 +47,16 @@ const testOptions = (0, _configUtils.getTestUseOptions)({
47
47
  testIdAttribute
48
48
  });
49
49
 
50
- /**
51
- * Playwright configuration object
52
- *
53
- * @returns {import('@playwright/test').PlaywrightTestConfig}
50
+ /**
51
+ * Playwright configuration object
52
+ *
53
+ * @returns {import('@playwright/test').PlaywrightTestConfig}
54
54
  */
55
55
  async function getPlaywrightConfig() {
56
- (0, _intialize.createGlobalMaps)();
57
- /**
58
- * createglobal Map = make it loose coupled
59
- * expose from bdd parser (From module to core module)
56
+ (0, _initializeMaps.createGlobalMaps)();
57
+ /**
58
+ * createglobal Map = make it loose coupled
59
+ * expose from bdd parser (From module to core module)
60
60
  */
61
61
  // globalThis.globalStepMap = new Map();
62
62
  // createStepsCallBack();
@@ -11,9 +11,9 @@ var _path = _interopRequireDefault(require("path"));
11
11
  var _readConfigFile = require("../readConfigFile");
12
12
  // import { defineBddConfig } from '../../../bdd-framework';
13
13
 
14
- /**
15
- ** Playwright project configuration
16
- * @returns {import('@playwright/test').Project}
14
+ /**
15
+ ** Playwright project configuration
16
+ * @returns {import('@playwright/test').Project}
17
17
  */
18
18
  function getBrowserConfig({
19
19
  browserName,
@@ -87,10 +87,10 @@ function getBrowserConfig({
87
87
  }
88
88
  }
89
89
 
90
- /**
91
- *
92
- * @param {*} param0
93
- * @returns {import('@playwright/test').Project[]}
90
+ /**
91
+ *
92
+ * @param {*} param0
93
+ * @returns {import('@playwright/test').Project[]}
94
94
  */
95
95
  function getProjects({
96
96
  browsers,
package/build/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { expect, test } from './core/playwright/index';
2
- // import { fireEvent, render } from '@testing-library/react';
3
- import {
4
- PlaywrightTestArgs,
5
- PlaywrightTestOptions,
6
- PlaywrightWorkerArgs,
7
- PlaywrightWorkerOptions,
8
- TestType,
9
- Page
10
- } from '@playwright/test';
11
-
12
-
13
- export * from '@playwright/test/types/test';
1
+ import { expect, test } from './core/playwright/index';
2
+ // import { fireEvent, render } from '@testing-library/react';
3
+ import {
4
+ PlaywrightTestArgs,
5
+ PlaywrightTestOptions,
6
+ PlaywrightWorkerArgs,
7
+ PlaywrightWorkerOptions,
8
+ TestType,
9
+ Page
10
+ } from '@playwright/test';
11
+
12
+
13
+ export * from '@playwright/test/types/test';
@@ -1,34 +1,34 @@
1
- Feature: Home Page
2
-
3
- Scenario: Home Page Default content
4
- Given user is on "<App>" home page
5
- Then user gets a "<App>" bootcamp section
6
- And username is also displayed on right corner
7
-
8
- Examples:
9
- | App |
10
- | GitHub |
11
-
12
- Scenario: GitHub Bootcamp Section
13
- Given user is on "<Site>" home page
14
- When user focuses on "<Site>" Bootcamp Section
15
- Then user gets an option to setup git
16
- And user gets an option to create repository
17
- And user gets an option to Fork Repository
18
- And user gets an option to work together
19
-
20
- Examples:
21
- | Site |
22
- | GitHub |
23
-
24
- Scenario: Top Banner content
25
- Given user is on "<Product>" home page
26
- When user focuses on Top Banner
27
- Then user gets an option of home page
28
- And user gets an option to search
29
- And user gets settings options
30
- And user gets an option to logout
31
-
32
- Examples:
33
- | Product |
34
- | GitHub |
1
+ Feature: Home Page
2
+
3
+ Scenario: Home Page Default content
4
+ Given user is on "<App>" home page
5
+ Then user gets a "<App>" bootcamp section
6
+ And username is also displayed on right corner
7
+
8
+ Examples:
9
+ | App |
10
+ | GitHub |
11
+
12
+ Scenario: GitHub Bootcamp Section
13
+ Given user is on "<Site>" home page
14
+ When user focuses on "<Site>" Bootcamp Section
15
+ Then user gets an option to setup git
16
+ And user gets an option to create repository
17
+ And user gets an option to Fork Repository
18
+ And user gets an option to work together
19
+
20
+ Examples:
21
+ | Site |
22
+ | GitHub |
23
+
24
+ Scenario: Top Banner content
25
+ Given user is on "<Product>" home page
26
+ When user focuses on Top Banner
27
+ Then user gets an option of home page
28
+ And user gets an option to search
29
+ And user gets settings options
30
+ And user gets an option to logout
31
+
32
+ Examples:
33
+ | Product |
34
+ | GitHub |
@@ -2,34 +2,34 @@
2
2
 
3
3
  var _testinglibrary = require("@zohodesk/testinglibrary");
4
4
  _testinglibrary.test.describe('Home Page', () => {
5
- /*
6
- ** Given user is on "<App>" home page
7
- ** Then user gets a "<App>" bootcamp section
8
- ** And username is also displayed on right corner
5
+ /*
6
+ ** Given user is on "<App>" home page
7
+ ** Then user gets a "<App>" bootcamp section
8
+ ** And username is also displayed on right corner
9
9
  */
10
10
  (0, _testinglibrary.test)('Home Page Default content', () => {
11
11
  // Your implementation here
12
12
  });
13
13
 
14
- /*
15
- ** Given user is on "<Site>" home page
16
- ** When user focuses on "<Site>" Bootcamp Section
17
- ** Then user gets an option to setup git
18
- ** And user gets an option to create repository
19
- ** And user gets an option to Fork Repository
20
- ** And user gets an option to work together
14
+ /*
15
+ ** Given user is on "<Site>" home page
16
+ ** When user focuses on "<Site>" Bootcamp Section
17
+ ** Then user gets an option to setup git
18
+ ** And user gets an option to create repository
19
+ ** And user gets an option to Fork Repository
20
+ ** And user gets an option to work together
21
21
  */
22
22
  (0, _testinglibrary.test)('GitHub Bootcamp Section', () => {
23
23
  // Your implementation here
24
24
  });
25
25
 
26
- /*
27
- ** Given user is on "<Product>" home page
28
- ** When user focuses on Top Banner
29
- ** Then user gets an option of home page
30
- ** And user gets an option to search
31
- ** And user gets settings options
32
- ** And user gets an option to logout
26
+ /*
27
+ ** Given user is on "<Product>" home page
28
+ ** When user focuses on Top Banner
29
+ ** Then user gets an option of home page
30
+ ** And user gets an option to search
31
+ ** And user gets settings options
32
+ ** And user gets an option to logout
33
33
  */
34
34
  (0, _testinglibrary.test)('Top Banner content', () => {
35
35
  // Your implementation here
@@ -2,7 +2,6 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  var _path = _interopRequireDefault(require("path"));
5
- var _fastGlob = _interopRequireDefault(require("fast-glob"));
6
5
  var _parser = require("./parser");
7
6
  var _logger = require("../utils/logger");
8
7
  var _fileUtils = require("../utils/fileUtils");
@@ -42,7 +41,7 @@ function extractExamplesToSeperateFile(examples, scenarioIndex, filePath, featur
42
41
  throw new Error(`Error appending or creating the test data file: ${filePath}`);
43
42
  }
44
43
  }
45
- function verifyFeatureFileWithSpecFile() {
44
+ async function verifyFeatureFileWithSpecFile() {
46
45
  try {
47
46
  let errorCount = 0;
48
47
  let allStepsFound = {};
@@ -50,7 +49,7 @@ function verifyFeatureFileWithSpecFile() {
50
49
  featureFilesFolder = 'feature-files',
51
50
  stepDefinitionsFolder = 'steps'
52
51
  } = (0, _readConfigFile.generateConfigFromFile)();
53
- const featureFiles = _fastGlob.default.globSync([featurePattern], {
52
+ const featureFiles = await (0, _fileUtils.getFilesFromGivenPattern)([featurePattern], {
54
53
  dot: true
55
54
  });
56
55
  featureFiles.forEach(featureFile => {
@@ -1,25 +1,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
-
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
+ window.open(`${currentURL}#?q=@edition_${event.target.value}`, '_self');
10
+ }
11
+ </script>
12
+ <div class="mainContainer" style="margin-left: 20px; display: flex;">
13
+ <div class="selectEditionContainer" style="padding: 20px;">
14
+ <select class="selectEdition" style="padding: 5px; width: 100px; border-radius: 6px; border: 1px solid var(--color-border-default);" onchange="sortEdition(event)">
15
+ <option value="EnterPrise">EnterPrise</option>
16
+ <option value="Professional">Professional</option>
17
+ <option value="Express">Express</option>
18
+ <option value="Standard">Standard</option>
19
+ <option value="Free">Free</option>
20
+ </select>
21
+ </div>
22
+ </div>
23
+
25
24
 
@@ -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;