transit-core-taf 1.0.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 (54) hide show
  1. package/README.md +0 -0
  2. package/dist/transit-core-taf/base/basepageactions.d.ts +178 -0
  3. package/dist/transit-core-taf/base/basepageactions.js +288 -0
  4. package/dist/transit-core-taf/base/basepagevalidations.d.ts +296 -0
  5. package/dist/transit-core-taf/base/basepagevalidations.js +459 -0
  6. package/dist/transit-core-taf/base/basepagewaits.d.ts +54 -0
  7. package/dist/transit-core-taf/base/basepagewaits.js +169 -0
  8. package/dist/transit-core-taf/base/commonpageactions.d.ts +40 -0
  9. package/dist/transit-core-taf/base/commonpageactions.js +118 -0
  10. package/dist/transit-core-taf/base/commonpagevalidations.d.ts +10 -0
  11. package/dist/transit-core-taf/base/commonpagevalidations.js +21 -0
  12. package/dist/transit-core-taf/base/commonpagewaits.d.ts +28 -0
  13. package/dist/transit-core-taf/base/commonpagewaits.js +57 -0
  14. package/dist/transit-core-taf/base/logger.d.ts +10 -0
  15. package/dist/transit-core-taf/base/logger.js +42 -0
  16. package/dist/transit-core-taf/baseapi/apiutils.d.ts +9 -0
  17. package/dist/transit-core-taf/baseapi/apiutils.js +23 -0
  18. package/dist/transit-core-taf/baseapi/baseapihelpers.d.ts +10 -0
  19. package/dist/transit-core-taf/baseapi/baseapihelpers.js +45 -0
  20. package/dist/transit-core-taf/constants/apiconstants.d.ts +29 -0
  21. package/dist/transit-core-taf/constants/apiconstants.js +38 -0
  22. package/dist/transit-core-taf/constants/test-tags.d.ts +14 -0
  23. package/dist/transit-core-taf/constants/test-tags.js +17 -0
  24. package/dist/transit-core-taf/fixtures.d.ts +23 -0
  25. package/dist/transit-core-taf/fixtures.js +81 -0
  26. package/dist/transit-core-taf/global-setup.d.ts +2 -0
  27. package/dist/transit-core-taf/global-setup.js +103 -0
  28. package/dist/transit-core-taf/index.d.ts +23 -0
  29. package/dist/transit-core-taf/index.js +39 -0
  30. package/dist/transit-core-taf/steps/basepageactions.steps.d.ts +1 -0
  31. package/dist/transit-core-taf/steps/basepageactions.steps.js +92 -0
  32. package/dist/transit-core-taf/steps/basepagevalidations.steps.d.ts +1 -0
  33. package/dist/transit-core-taf/steps/basepagevalidations.steps.js +59 -0
  34. package/dist/transit-core-taf/steps/basepagewaits.steps.d.ts +1 -0
  35. package/dist/transit-core-taf/steps/basepagewaits.steps.js +29 -0
  36. package/dist/transit-core-taf/steps/commonpageactions.steps.d.ts +1 -0
  37. package/dist/transit-core-taf/steps/commonpageactions.steps.js +18 -0
  38. package/dist/transit-core-taf/steps/commonpagevalidations.steps.d.ts +1 -0
  39. package/dist/transit-core-taf/steps/commonpagevalidations.steps.js +16 -0
  40. package/dist/transit-core-taf/steps/commonpagewaits.steps.d.ts +1 -0
  41. package/dist/transit-core-taf/steps/commonpagewaits.steps.js +24 -0
  42. package/dist/transit-core-taf/steps/hooks.d.ts +1 -0
  43. package/dist/transit-core-taf/steps/hooks.js +10 -0
  44. package/dist/transit-core-taf/steps/world.d.ts +12 -0
  45. package/dist/transit-core-taf/steps/world.js +37 -0
  46. package/dist/transit-core-taf/utils/Utils.d.ts +114 -0
  47. package/dist/transit-core-taf/utils/Utils.js +219 -0
  48. package/dist/transit-core-taf/utils/envutils.d.ts +2 -0
  49. package/dist/transit-core-taf/utils/envutils.js +55 -0
  50. package/dist/transit-core-taf/utils/excelUtils.d.ts +1 -0
  51. package/dist/transit-core-taf/utils/excelUtils.js +51 -0
  52. package/dist/transit-core-taf/utils/networkutils.d.ts +24 -0
  53. package/dist/transit-core-taf/utils/networkutils.js +53 -0
  54. package/package.json +32 -0
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const dotenv = __importStar(require("dotenv"));
40
+ const path_1 = __importDefault(require("path"));
41
+ const fs = __importStar(require("fs"));
42
+ // Function to find the project root
43
+ const findProjectRoot = (startPath) => {
44
+ let currentPath = startPath;
45
+ while (currentPath !== path_1.default.parse(currentPath).root) {
46
+ if (fs.existsSync(path_1.default.join(currentPath, 'package.json'))) {
47
+ return currentPath;
48
+ }
49
+ currentPath = path_1.default.dirname(currentPath);
50
+ }
51
+ return startPath; // Fallback to the original directory if not found
52
+ };
53
+ async function globalSetup() {
54
+ const env = process.env.ENV || 'stage';
55
+ const projectRoot = path_1.default.resolve(__dirname, '..');
56
+ const envPath = path_1.default.join(projectRoot, `.env.${env}`);
57
+ // Load env file
58
+ if (fs.existsSync(envPath)) {
59
+ dotenv.config({ path: envPath, override: true });
60
+ console.log(`✅ Loaded ${envPath} from project root ${projectRoot} ✅`);
61
+ }
62
+ else {
63
+ throw new Error(`❌ Environment file .env.${env} not found in project root ${projectRoot} ❌`);
64
+ }
65
+ const argv = process.argv;
66
+ // Find all arguments related to project selection
67
+ const projectArgs = argv.map((arg, i) => {
68
+ if (arg === '--project' && i + 1 < argv.length) {
69
+ return argv[i + 1];
70
+ }
71
+ if (arg.startsWith('--project=')) {
72
+ return arg.split('=')[1];
73
+ }
74
+ return null;
75
+ }).filter(p => p !== null);
76
+ let runAuth = false;
77
+ if (projectArgs.length > 0) {
78
+ // --project flag is used. Only run if 'api-tests' is specified.
79
+ if (projectArgs.includes('api-tests')) {
80
+ runAuth = true;
81
+ }
82
+ }
83
+ else {
84
+ // No --project flag. Check for test path arguments.
85
+ const testCommandIndex = argv.indexOf('test');
86
+ const argsAfterTest = testCommandIndex !== -1 ? argv.slice(testCommandIndex + 1) : [];
87
+ const pathArgs = argsAfterTest.filter(arg => !arg.startsWith('-'));
88
+ if (pathArgs.length === 0) {
89
+ // No path arguments, so it's a full run.
90
+ runAuth = true;
91
+ }
92
+ else {
93
+ // Path arguments are present. Check if any are in the api-tests directory.
94
+ if (pathArgs.some(p => p.startsWith('tests/api-tests'))) {
95
+ runAuth = true;
96
+ }
97
+ }
98
+ }
99
+ if (runAuth) {
100
+ console.log('Global setup for api-tests is running...');
101
+ }
102
+ }
103
+ exports.default = globalSetup;
@@ -0,0 +1,23 @@
1
+ export * from './base/basepagevalidations';
2
+ export * from './base/basepageactions';
3
+ export * from './base/basepagewaits';
4
+ export * from './base/commonpageactions';
5
+ export * from './base/commonpagevalidations';
6
+ export * from './base/commonpagewaits';
7
+ export * from './base/logger';
8
+ export * from './utils/envutils';
9
+ export * from './utils/excelUtils';
10
+ export * from './utils/networkutils';
11
+ export * from './utils/Utils';
12
+ export * from './baseapi/baseapihelpers';
13
+ export * from './baseapi/apiutils';
14
+ export * from './constants/apiconstants';
15
+ export * from './constants/test-tags';
16
+ export * from './steps/basepageactions.steps';
17
+ export * from './steps/basepagevalidations.steps';
18
+ export * from './steps/basepagewaits.steps';
19
+ export * from './steps/commonpageactions.steps';
20
+ export * from './steps/commonpagevalidations.steps';
21
+ export * from './steps/commonpagewaits.steps';
22
+ export * from './steps/hooks';
23
+ export * from './steps/world';
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./base/basepagevalidations"), exports);
18
+ __exportStar(require("./base/basepageactions"), exports);
19
+ __exportStar(require("./base/basepagewaits"), exports);
20
+ __exportStar(require("./base/commonpageactions"), exports);
21
+ __exportStar(require("./base/commonpagevalidations"), exports);
22
+ __exportStar(require("./base/commonpagewaits"), exports);
23
+ __exportStar(require("./base/logger"), exports);
24
+ __exportStar(require("./utils/envutils"), exports);
25
+ __exportStar(require("./utils/excelUtils"), exports);
26
+ __exportStar(require("./utils/networkutils"), exports);
27
+ __exportStar(require("./utils/Utils"), exports);
28
+ __exportStar(require("./baseapi/baseapihelpers"), exports);
29
+ __exportStar(require("./baseapi/apiutils"), exports);
30
+ __exportStar(require("./constants/apiconstants"), exports);
31
+ __exportStar(require("./constants/test-tags"), exports);
32
+ __exportStar(require("./steps/basepageactions.steps"), exports);
33
+ __exportStar(require("./steps/basepagevalidations.steps"), exports);
34
+ __exportStar(require("./steps/basepagewaits.steps"), exports);
35
+ __exportStar(require("./steps/commonpageactions.steps"), exports);
36
+ __exportStar(require("./steps/commonpagevalidations.steps"), exports);
37
+ __exportStar(require("./steps/commonpagewaits.steps"), exports);
38
+ __exportStar(require("./steps/hooks"), exports);
39
+ __exportStar(require("./steps/world"), exports);
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cucumber_1 = require("@cucumber/cucumber");
4
+ const basepageactions_1 = require("../base/basepageactions");
5
+ (0, cucumber_1.When)('I click the element {string}', async function (selector) {
6
+ if (!this.page)
7
+ throw new Error('Page not found');
8
+ const basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
9
+ const element = this.page.locator(selector);
10
+ await basePageActions.clickElement(element);
11
+ });
12
+ (0, cucumber_1.When)('I click the locator {string}', async function (selector) {
13
+ if (!this.page)
14
+ throw new Error('Page not found');
15
+ const basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
16
+ const element = this.page.locator(selector);
17
+ await basePageActions.clickByLocator(element);
18
+ });
19
+ (0, cucumber_1.When)('I click the button with text {string}', async function (buttonText) {
20
+ if (!this.page)
21
+ throw new Error('Page not found');
22
+ const basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
23
+ await basePageActions.clickButtonByText(buttonText);
24
+ });
25
+ (0, cucumber_1.When)('I click the element with ID {string}', async function (id) {
26
+ if (!this.page)
27
+ throw new Error('Page not found');
28
+ const basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
29
+ await basePageActions.clickById(id);
30
+ });
31
+ (0, cucumber_1.When)('I fill the input {string} with {string}', async function (selector, value) {
32
+ if (!this.page)
33
+ throw new Error('Page not found');
34
+ const basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
35
+ const element = this.page.locator(selector);
36
+ await basePageActions.fillInput(element, value);
37
+ });
38
+ (0, cucumber_1.When)('I clear the input {string}', async function (selector) {
39
+ if (!this.page)
40
+ throw new Error('Page not found');
41
+ const basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
42
+ const element = this.page.locator(selector);
43
+ await basePageActions.clearInput(element);
44
+ });
45
+ (0, cucumber_1.When)('I type {string} into {string} slowly', async function (text, selector) {
46
+ if (!this.page)
47
+ throw new Error('Page not found');
48
+ const basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
49
+ const element = this.page.locator(selector);
50
+ await basePageActions.typeSlowly(element, text);
51
+ });
52
+ (0, cucumber_1.When)('I hover over the element {string}', async function (selector) {
53
+ if (!this.page)
54
+ throw new Error('Page not found');
55
+ const basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
56
+ const element = this.page.locator(selector);
57
+ await basePageActions.hoverOverElement(element);
58
+ });
59
+ (0, cucumber_1.When)('I press the {string} key on {string}', async function (key, selector) {
60
+ if (!this.page)
61
+ throw new Error('Page not found');
62
+ const basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
63
+ const element = this.page.locator(selector);
64
+ await basePageActions.pressKey(element, key);
65
+ });
66
+ (0, cucumber_1.When)('I check the checkbox {string}', async function (selector) {
67
+ if (!this.page)
68
+ throw new Error('Page not found');
69
+ const basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
70
+ const element = this.page.locator(selector);
71
+ await basePageActions.checkCheckbox(element);
72
+ });
73
+ (0, cucumber_1.When)('I uncheck the checkbox {string}', async function (selector) {
74
+ if (!this.page)
75
+ throw new Error('Page not found');
76
+ const basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
77
+ const element = this.page.locator(selector);
78
+ await basePageActions.uncheckCheckbox(element);
79
+ });
80
+ (0, cucumber_1.When)('I select the option {string} from {string}', async function (value, selector) {
81
+ if (!this.page)
82
+ throw new Error('Page not found');
83
+ const basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
84
+ const element = this.page.locator(selector);
85
+ await basePageActions.selectOption(element, value);
86
+ });
87
+ (0, cucumber_1.When)('I reload the page', async function () {
88
+ if (!this.page)
89
+ throw new Error('Page not found');
90
+ const basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
91
+ await basePageActions.reloadPage();
92
+ });
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cucumber_1 = require("@cucumber/cucumber");
4
+ const basepagevalidations_1 = require("../base/basepagevalidations");
5
+ (0, cucumber_1.Then)('the element {string} should be visible', async function (selector) {
6
+ if (!this.page)
7
+ throw new Error('Page not found');
8
+ const basePageValidations = new basepagevalidations_1.BasePageValidations(this.page, this.logger);
9
+ const element = this.page.locator(selector);
10
+ await basePageValidations.validateElementToBeVisible(element);
11
+ });
12
+ (0, cucumber_1.Then)('the element {string} should not be visible', async function (selector) {
13
+ if (!this.page)
14
+ throw new Error('Page not found');
15
+ const basePageValidations = new basepagevalidations_1.BasePageValidations(this.page, this.logger);
16
+ const element = this.page.locator(selector);
17
+ await basePageValidations.validateElementNotToBeVisible(element);
18
+ });
19
+ (0, cucumber_1.Then)('the element {string} should have text {string}', async function (selector, expectedText) {
20
+ if (!this.page)
21
+ throw new Error('Page not found');
22
+ const basePageValidations = new basepagevalidations_1.BasePageValidations(this.page, this.logger);
23
+ const element = this.page.locator(selector);
24
+ await basePageValidations.validateElementToHaveText(element, expectedText);
25
+ });
26
+ (0, cucumber_1.Then)('the element {string} should be enabled', async function (selector) {
27
+ if (!this.page)
28
+ throw new Error('Page not found');
29
+ const basePageValidations = new basepagevalidations_1.BasePageValidations(this.page, this.logger);
30
+ const element = this.page.locator(selector);
31
+ await basePageValidations.validateElementToBeEnabled(element);
32
+ });
33
+ (0, cucumber_1.Then)('the element {string} should be hidden', async function (selector) {
34
+ if (!this.page)
35
+ throw new Error('Page not found');
36
+ const basePageValidations = new basepagevalidations_1.BasePageValidations(this.page, this.logger);
37
+ const element = this.page.locator(selector);
38
+ await basePageValidations.validateElementToBeHidden(element);
39
+ });
40
+ (0, cucumber_1.Then)('the element {string} should have attribute {string} with value {string}', async function (selector, attribute, value) {
41
+ if (!this.page)
42
+ throw new Error('Page not found');
43
+ const basePageValidations = new basepagevalidations_1.BasePageValidations(this.page, this.logger);
44
+ const element = this.page.locator(selector);
45
+ await basePageValidations.validateElementToHaveAttribute(element, attribute, value);
46
+ });
47
+ (0, cucumber_1.Then)('the element {string} should contain text {string}', async function (selector, expectedText) {
48
+ if (!this.page)
49
+ throw new Error('Page not found');
50
+ const basePageValidations = new basepagevalidations_1.BasePageValidations(this.page, this.logger);
51
+ const element = this.page.locator(selector);
52
+ await basePageValidations.validateElementToContainText(element, expectedText);
53
+ });
54
+ (0, cucumber_1.Then)('the URL should match {string}', async function (expectedUrl) {
55
+ if (!this.page)
56
+ throw new Error('Page not found');
57
+ const basePageValidations = new basepagevalidations_1.BasePageValidations(this.page, this.logger);
58
+ await basePageValidations.validateUrlToContain(expectedUrl);
59
+ });
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cucumber_1 = require("@cucumber/cucumber");
4
+ const basepagewaits_1 = require("../base/basepagewaits");
5
+ (0, cucumber_1.When)('I wait for the page to load', async function () {
6
+ if (!this.page)
7
+ throw new Error('Page not found');
8
+ const basePageWaits = new basepagewaits_1.BasePageWaits(this.page, this.logger);
9
+ await basePageWaits.waitForPageLoad();
10
+ });
11
+ (0, cucumber_1.When)('I wait for {int} seconds', async function (seconds) {
12
+ if (!this.page)
13
+ throw new Error('Page not found');
14
+ const basePageWaits = new basepagewaits_1.BasePageWaits(this.page, this.logger);
15
+ await basePageWaits.waitForSeconds(seconds);
16
+ });
17
+ (0, cucumber_1.When)('I wait for the element {string} to be visible', async function (selector) {
18
+ if (!this.page)
19
+ throw new Error('Page not found');
20
+ const basePageWaits = new basepagewaits_1.BasePageWaits(this.page, this.logger);
21
+ const element = this.page.locator(selector);
22
+ await basePageWaits.waitForElementToBeVisible(element);
23
+ });
24
+ (0, cucumber_1.When)('I navigate to {string}', async function (url) {
25
+ if (!this.page)
26
+ throw new Error('Page not found');
27
+ const basePageWaits = new basepagewaits_1.BasePageWaits(this.page, this.logger);
28
+ await basePageWaits.goto(url);
29
+ });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cucumber_1 = require("@cucumber/cucumber");
4
+ const commonpageactions_1 = require("../base/commonpageactions");
5
+ (0, cucumber_1.When)('I accept the cookie popup', async function () {
6
+ if (!this.page)
7
+ throw new Error('Page not found');
8
+ const commonPageActions = new commonpageactions_1.CommonPageActions(this.page, this.logger);
9
+ await commonPageActions.acceptCookiePopup();
10
+ });
11
+ (0, cucumber_1.When)('I drag {string} to {string}', async function (sourceSelector, targetSelector) {
12
+ if (!this.page)
13
+ throw new Error('Page not found');
14
+ const commonPageActions = new commonpageactions_1.CommonPageActions(this.page, this.logger);
15
+ const source = this.page.locator(sourceSelector);
16
+ const target = this.page.locator(targetSelector);
17
+ await commonPageActions.dragAndDrop(source, target);
18
+ });
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cucumber_1 = require("@cucumber/cucumber");
4
+ const commonpagevalidations_1 = require("../base/commonpagevalidations");
5
+ (0, cucumber_1.Then)('the page should be in fullscreen mode', async function () {
6
+ if (!this.page)
7
+ throw new Error('Page not found');
8
+ const commonPageValidations = new commonpagevalidations_1.CommonPageValidations(this.page);
9
+ await commonPageValidations.validateFullScreen(true);
10
+ });
11
+ (0, cucumber_1.Then)('the page should not be in fullscreen mode', async function () {
12
+ if (!this.page)
13
+ throw new Error('Page not found');
14
+ const commonPageValidations = new commonpagevalidations_1.CommonPageValidations(this.page);
15
+ await commonPageValidations.validateFullScreen(false);
16
+ });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cucumber_1 = require("@cucumber/cucumber");
4
+ const commonpagewaits_1 = require("../base/commonpagewaits");
5
+ (0, cucumber_1.When)('I wait for the attribute {string} of element {string} to be {string}', async function (attribute, selector, value) {
6
+ if (!this.page)
7
+ throw new Error('Page not found');
8
+ const commonPageWaits = new commonpagewaits_1.CommonPageWaits(this.page);
9
+ const element = this.page.locator(selector);
10
+ await commonPageWaits.waitForAttributeToBePresent(element, attribute, value);
11
+ });
12
+ (0, cucumber_1.When)('I wait for the URL to be {string}', async function (url) {
13
+ if (!this.page)
14
+ throw new Error('Page not found');
15
+ const commonPageWaits = new commonpagewaits_1.CommonPageWaits(this.page);
16
+ await commonPageWaits.waitForURL(url);
17
+ });
18
+ (0, cucumber_1.When)('I wait for the element {string} to be hidden', async function (selector) {
19
+ if (!this.page)
20
+ throw new Error('Page not found');
21
+ const commonPageWaits = new commonpagewaits_1.CommonPageWaits(this.page);
22
+ const element = this.page.locator(selector);
23
+ await commonPageWaits.waitForElementToBeHidden(element);
24
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cucumber_1 = require("@cucumber/cucumber");
4
+ (0, cucumber_1.Before)(async function ({ pickle }) {
5
+ this.logger.testDescription = pickle.name;
6
+ await this.openBrowser();
7
+ });
8
+ (0, cucumber_1.After)(async function () {
9
+ await this.closeBrowser();
10
+ });
@@ -0,0 +1,12 @@
1
+ import { IWorldOptions, World } from '@cucumber/cucumber';
2
+ import { Page, Browser, BrowserContext } from '@playwright/test';
3
+ import { Logger } from '../base/logger';
4
+ export declare class CustomWorld extends World {
5
+ browser: Browser | null;
6
+ context: BrowserContext | null;
7
+ page: Page | null;
8
+ logger: Logger;
9
+ constructor(options: IWorldOptions);
10
+ openBrowser(): Promise<void>;
11
+ closeBrowser(): Promise<void>;
12
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomWorld = void 0;
4
+ const cucumber_1 = require("@cucumber/cucumber");
5
+ const test_1 = require("@playwright/test");
6
+ const logger_1 = require("../base/logger");
7
+ class CustomWorld extends cucumber_1.World {
8
+ browser;
9
+ context;
10
+ page;
11
+ logger;
12
+ constructor(options) {
13
+ super(options);
14
+ this.browser = null;
15
+ this.context = null;
16
+ this.page = null;
17
+ this.logger = new logger_1.Logger('Default Test');
18
+ }
19
+ async openBrowser() {
20
+ this.browser = await test_1.chromium.launch({ headless: false });
21
+ this.context = await this.browser.newContext();
22
+ this.page = await this.context.newPage();
23
+ }
24
+ async closeBrowser() {
25
+ if (this.page) {
26
+ await this.page.close();
27
+ }
28
+ if (this.context) {
29
+ await this.context.close();
30
+ }
31
+ if (this.browser) {
32
+ await this.browser.close();
33
+ }
34
+ }
35
+ }
36
+ exports.CustomWorld = CustomWorld;
37
+ (0, cucumber_1.setWorldConstructor)(CustomWorld);
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Generates a random alphanumeric string of specified length.
3
+ * @param {number} length - The number of characters in the generated string.
4
+ * @returns {string} - Randomly generated string.
5
+ */
6
+ export declare function generateRandomString(length: number): string;
7
+ /**
8
+ * Generates a random first name.
9
+ * @returns A random first name.
10
+ */
11
+ export declare function generateFirstName(): string;
12
+ /**
13
+ * Generates a random last name.
14
+ * @returns A random last name.
15
+ */
16
+ export declare function generateLastName(): string;
17
+ /**
18
+ * Generates a random household name.
19
+ * @returns A random household name, typically in the format "[LastName] Household".
20
+ */
21
+ export declare function generateHouseholdName(): string;
22
+ /**
23
+ * Generates a dynamic US address.
24
+ * @returns An object containing a full US address.
25
+ */
26
+ export declare function generateUSAddress(): {
27
+ streetAddressLine1: string;
28
+ streetAddressLine2: string;
29
+ city: string;
30
+ state: string;
31
+ zipCode: string;
32
+ country: string;
33
+ };
34
+ /**
35
+ * Generates a random phone number for a given country.
36
+ * @param country - The country for which to generate the phone number.
37
+ * @returns A random phone number.
38
+ */
39
+ export declare function generatePhoneNumber(country: string): string;
40
+ /**
41
+ * Generates a random email address with the yopmail.com domain.
42
+ * @returns A random email address.
43
+ */
44
+ export declare function generateYopmailEmail(): string;
45
+ /**
46
+ * Returns the current timestamp.
47
+ * @returns The current timestamp in milliseconds.
48
+ */
49
+ export declare function getTimestamp(): number;
50
+ /**
51
+ * Calculates the time difference between two timestamps and returns a formatted string.
52
+ * @param startTime - The starting timestamp in milliseconds.
53
+ * @param endTime - The ending timestamp in milliseconds.
54
+ * @returns A formatted string like "5 sec 34 ms".
55
+ */
56
+ export declare function getTimeDifference(startTime: number, endTime: number): string;
57
+ export declare function readAccountApiResponse(accountId: string): any;
58
+ /**
59
+ * Generates a random integer between 0 (inclusive) and the given length (exclusive).
60
+ * @param {number} length - The upper bound (non-inclusive) for the random number.
61
+ * If less than or equal to 0, the function returns 0.
62
+ * @returns {number} A random integer between 0 and length - 1, or 0 if length <= 0.
63
+ */
64
+ export declare function getRandomNumber(length: number): number;
65
+ /**
66
+ * Generates a random future date.
67
+ * @returns An object containing the day, month, and year of a random future date.
68
+ */
69
+ export declare function generateRandomFutureDate(): {
70
+ day: number;
71
+ month: number;
72
+ year: number;
73
+ };
74
+ /**
75
+ * @description
76
+ * This function provides flexible date formatting similar to moment.js.
77
+ * It supports both padded (e.g., 03) and unpadded (e.g., 3) date/time tokens.
78
+ * Ideal for logs, filenames, UI display, or readable timestamps.
79
+ *
80
+ * 🧩 Supported format tokens:
81
+ * ┌────────┬────────────────────────────┐
82
+ * │ Token │ Description │
83
+ * ├────────┼────────────────────────────┤
84
+ * │ YYYY │ 4-digit year (e.g. 2025) │
85
+ * │ M │ Month (1–12) │
86
+ * │ MM │ Month (01–12) │
87
+ * │ D │ Day of month (1–31) │
88
+ * │ DD │ Day of month (01–31) │
89
+ * │ h │ Hour (0–23) │
90
+ * │ hh │ Hour (00–23) │
91
+ * │ m │ Minute (0–59) │
92
+ * │ mm │ Minute (00–59) │
93
+ * │ s │ Second (0–59) │
94
+ * │ ss │ Second (00–59) │
95
+ * └────────┴────────────────────────────┘
96
+ *
97
+ * @examples
98
+ * getDate("YYYY-MM-DD hh:mm:ss") → "2025-11-03 04:05:09"
99
+ * getDate("YYYY-M-D h:m:s") → "2025-11-3 4:5:9"
100
+ * getDate("D/M/YYYY") → "3/11/2025"
101
+ *
102
+ * @param format - (Optional) The desired date format string. Defaults to "YYYY-MM-DD".
103
+ * @returns A formatted date/time string.
104
+ */
105
+ export declare function getDate(format?: string): string;
106
+ /**
107
+ * Normalizes a date input to a timestamp (ms since epoch).
108
+ * - If input is a string, it will be parsed with Date.parse().
109
+ * - If input is a number (timestamp), it will be used directly.
110
+ *
111
+ * @param input Date as a timestamp (ms) or string
112
+ * @returns timestamp in milliseconds
113
+ */
114
+ export declare function getParsedDate(input: number | string | null | undefined): number;