transit-core-taf 1.0.3 → 1.0.5

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 (47) hide show
  1. package/dist/transit-core-taf/baseapi/baseapihelpers.d.ts +1 -1
  2. package/dist/transit-core-taf/{base → baseui}/basepagevalidations.d.ts +13 -0
  3. package/dist/transit-core-taf/{base → baseui}/basepagevalidations.js +19 -0
  4. package/dist/transit-core-taf/{base → baseui}/logger.d.ts +1 -1
  5. package/dist/transit-core-taf/constants/test-tags.d.ts +0 -10
  6. package/dist/transit-core-taf/constants/test-tags.js +1 -11
  7. package/dist/transit-core-taf/fixtures.d.ts +5 -8
  8. package/dist/transit-core-taf/fixtures.js +5 -28
  9. package/dist/transit-core-taf/index.d.ts +7 -19
  10. package/dist/transit-core-taf/index.js +7 -19
  11. package/package.json +1 -1
  12. package/README.md +0 -0
  13. package/dist/transit-core-taf/constants/apiconstants.d.ts +0 -29
  14. package/dist/transit-core-taf/constants/apiconstants.js +0 -38
  15. package/dist/transit-core-taf/steps/basepageactions.steps.d.ts +0 -1
  16. package/dist/transit-core-taf/steps/basepageactions.steps.js +0 -78
  17. package/dist/transit-core-taf/steps/basepagevalidations.steps.d.ts +0 -1
  18. package/dist/transit-core-taf/steps/basepagevalidations.steps.js +0 -59
  19. package/dist/transit-core-taf/steps/basepagewaits.steps.d.ts +0 -1
  20. package/dist/transit-core-taf/steps/basepagewaits.steps.js +0 -29
  21. package/dist/transit-core-taf/steps/commonpageactions.steps.d.ts +0 -1
  22. package/dist/transit-core-taf/steps/commonpageactions.steps.js +0 -18
  23. package/dist/transit-core-taf/steps/commonpagevalidations.steps.d.ts +0 -1
  24. package/dist/transit-core-taf/steps/commonpagevalidations.steps.js +0 -16
  25. package/dist/transit-core-taf/steps/commonpagewaits.steps.d.ts +0 -1
  26. package/dist/transit-core-taf/steps/commonpagewaits.steps.js +0 -24
  27. package/dist/transit-core-taf/steps/hooks.d.ts +0 -1
  28. package/dist/transit-core-taf/steps/hooks.js +0 -10
  29. package/dist/transit-core-taf/steps/world.d.ts +0 -14
  30. package/dist/transit-core-taf/steps/world.js +0 -43
  31. package/dist/transit-core-taf/utils/envutils.d.ts +0 -2
  32. package/dist/transit-core-taf/utils/envutils.js +0 -55
  33. package/dist/transit-core-taf/utils/excelUtils.d.ts +0 -1
  34. package/dist/transit-core-taf/utils/excelUtils.js +0 -51
  35. package/dist/transit-core-taf/utils/networkutils.d.ts +0 -24
  36. package/dist/transit-core-taf/utils/networkutils.js +0 -53
  37. /package/dist/transit-core-taf/{base → baseui}/basepageactions.d.ts +0 -0
  38. /package/dist/transit-core-taf/{base → baseui}/basepageactions.js +0 -0
  39. /package/dist/transit-core-taf/{base → baseui}/basepagewaits.d.ts +0 -0
  40. /package/dist/transit-core-taf/{base → baseui}/basepagewaits.js +0 -0
  41. /package/dist/transit-core-taf/{base → baseui}/commonpageactions.d.ts +0 -0
  42. /package/dist/transit-core-taf/{base → baseui}/commonpageactions.js +0 -0
  43. /package/dist/transit-core-taf/{base → baseui}/commonpagevalidations.d.ts +0 -0
  44. /package/dist/transit-core-taf/{base → baseui}/commonpagevalidations.js +0 -0
  45. /package/dist/transit-core-taf/{base → baseui}/commonpagewaits.d.ts +0 -0
  46. /package/dist/transit-core-taf/{base → baseui}/commonpagewaits.js +0 -0
  47. /package/dist/transit-core-taf/{base → baseui}/logger.js +0 -0
@@ -1,4 +1,4 @@
1
- import { Logger } from "../base/logger";
1
+ import { Logger } from "../baseui/logger";
2
2
  export declare class BaseApi {
3
3
  private logger;
4
4
  constructor(logger: Logger);
@@ -293,4 +293,17 @@ export declare class BasePageValidations {
293
293
  * Accepts either locator or string ID.
294
294
  */
295
295
  validateElementsToHaveText(locators: any[], expectedTexts: string[]): Promise<void>;
296
+ /**
297
+ * Validates that a single locator is disabled.
298
+ * @param {Locator} element - Playwright locator to check.
299
+ * @returns {Promise<void>} Resolves when the element is confirmed disabled.
300
+ */
301
+ validateElementToBeDisabled(element: Locator): Promise<void>;
302
+ /**
303
+ * Validates that all provided locators are disabled.
304
+ *
305
+ * @param {Locator[]} elements - Array of Playwright locators to check.
306
+ * @returns {Promise<void>} Resolves when all elements are confirmed disabled.
307
+ */
308
+ validateElementsToBeDisabled(elements: Locator[]): Promise<void>;
296
309
  }
@@ -455,5 +455,24 @@ class BasePageValidations {
455
455
  await this.validateElementToHaveText(locator, expectedTexts[i]);
456
456
  }
457
457
  }
458
+ /**
459
+ * Validates that a single locator is disabled.
460
+ * @param {Locator} element - Playwright locator to check.
461
+ * @returns {Promise<void>} Resolves when the element is confirmed disabled.
462
+ */
463
+ async validateElementToBeDisabled(element) {
464
+ await (0, test_1.expect)(element).toBeDisabled();
465
+ }
466
+ /**
467
+ * Validates that all provided locators are disabled.
468
+ *
469
+ * @param {Locator[]} elements - Array of Playwright locators to check.
470
+ * @returns {Promise<void>} Resolves when all elements are confirmed disabled.
471
+ */
472
+ async validateElementsToBeDisabled(elements) {
473
+ for (const el of elements) {
474
+ await (0, test_1.expect)(el).toBeDisabled();
475
+ }
476
+ }
458
477
  }
459
478
  exports.BasePageValidations = BasePageValidations;
@@ -1,5 +1,5 @@
1
1
  export declare class Logger {
2
- testDescription: string;
2
+ private testDescription;
3
3
  constructor(testDescription: string);
4
4
  private log;
5
5
  info(message: string): void;
@@ -1,14 +1,4 @@
1
1
  export declare const tags: {
2
2
  REGRESSION: string;
3
3
  SMOKE: string;
4
- ACCOUNTSAPI: string;
5
- CREATION: string;
6
- CALENDAR: string;
7
- PHOTOBOOK: string;
8
- CARDS: string;
9
- PRINTS: string;
10
- DIGITALDATA: string;
11
- DEMO: string;
12
- CATALOGSEARCHAPI: string;
13
- DESIGNPORTALAPI: string;
14
4
  };
@@ -3,15 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tags = void 0;
4
4
  exports.tags = {
5
5
  REGRESSION: "@regression",
6
- SMOKE: "@smoke",
7
- ACCOUNTSAPI: "@accountsapi",
8
- CREATION: "@creation",
9
- CALENDAR: "@calendar",
10
- PHOTOBOOK: "@photobook",
11
- CARDS: "@cards",
12
- PRINTS: "@prints",
13
- DIGITALDATA: '@digitaldata',
14
- DEMO: "@demo",
15
- CATALOGSEARCHAPI: "@catalogsearchapi",
16
- DESIGNPORTALAPI: "@designportalapi",
6
+ SMOKE: "@smoke"
17
7
  };
@@ -1,10 +1,9 @@
1
- import { BasePageActions } from './base/basepageactions';
2
- import { BasePageValidations } from './base/basepagevalidations';
3
- import { BasePageWaits } from './base/basepagewaits';
4
- import { NetworkUtils } from './utils/networkutils';
1
+ import { BasePageActions } from './baseui/basepageactions';
2
+ import { BasePageValidations } from './baseui/basepagevalidations';
3
+ import { BasePageWaits } from './baseui/basepagewaits';
5
4
  import { BaseApi } from './baseapi/baseapihelpers';
6
- import { CommonPageActions } from './base/commonpageactions';
7
- import { Logger } from './base/logger';
5
+ import { CommonPageActions } from './baseui/commonpageactions';
6
+ import { Logger } from './baseui/logger';
8
7
  import path = require('path');
9
8
  import fs = require('fs');
10
9
  type MyFixtures = {
@@ -12,12 +11,10 @@ type MyFixtures = {
12
11
  actions: BasePageActions;
13
12
  validations: BasePageValidations;
14
13
  waits: BasePageWaits;
15
- networkUtils: NetworkUtils;
16
14
  baseApi: BaseApi;
17
15
  commonPageActions: CommonPageActions;
18
16
  };
19
17
  export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & MyFixtures, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
20
18
  export declare const expect: import("@playwright/test").Expect<{}>;
21
19
  export { tags } from './constants/test-tags';
22
- export * from './constants/apiconstants';
23
20
  export { path, fs };
@@ -1,28 +1,13 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
3
  exports.fs = exports.path = exports.tags = exports.expect = exports.test = void 0;
18
4
  const test_1 = require("@playwright/test");
19
- const basepageactions_1 = require("./base/basepageactions");
20
- const basepagevalidations_1 = require("./base/basepagevalidations");
21
- const basepagewaits_1 = require("./base/basepagewaits");
22
- const networkutils_1 = require("./utils/networkutils");
5
+ const basepageactions_1 = require("./baseui/basepageactions");
6
+ const basepagevalidations_1 = require("./baseui/basepagevalidations");
7
+ const basepagewaits_1 = require("./baseui/basepagewaits");
23
8
  const baseapihelpers_1 = require("./baseapi/baseapihelpers");
24
- const commonpageactions_1 = require("./base/commonpageactions");
25
- const logger_1 = require("./base/logger");
9
+ const commonpageactions_1 = require("./baseui/commonpageactions");
10
+ const logger_1 = require("./baseui/logger");
26
11
  const path = require("path");
27
12
  exports.path = path;
28
13
  const fs = require("fs");
@@ -53,13 +38,6 @@ exports.test = test_1.test.extend({
53
38
  const waits = new basepagewaits_1.BasePageWaits(page, logger);
54
39
  await use(waits);
55
40
  },
56
- /**
57
- * Fixture for NetworkUtils.
58
- */
59
- networkUtils: async ({ page, logger }, use) => {
60
- const networkUtils = new networkutils_1.NetworkUtils(page, logger);
61
- await use(networkUtils);
62
- },
63
41
  /**
64
42
  * Fixture for the BaseApi.
65
43
  */
@@ -78,4 +56,3 @@ exports.test = test_1.test.extend({
78
56
  exports.expect = exports.test.expect;
79
57
  var test_tags_1 = require("./constants/test-tags");
80
58
  Object.defineProperty(exports, "tags", { enumerable: true, get: function () { return test_tags_1.tags; } });
81
- __exportStar(require("./constants/apiconstants"), exports);
@@ -1,23 +1,11 @@
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';
1
+ export * from './baseui/basepagevalidations';
2
+ export * from './baseui/basepageactions';
3
+ export * from './baseui/basepagewaits';
4
+ export * from './baseui/commonpageactions';
5
+ export * from './baseui/commonpagevalidations';
6
+ export * from './baseui/commonpagewaits';
7
+ export * from './baseui/logger';
11
8
  export * from './utils/Utils';
12
9
  export * from './baseapi/baseapihelpers';
13
10
  export * from './baseapi/apiutils';
14
- export * from './constants/apiconstants';
15
11
  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';
@@ -14,26 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
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);
17
+ __exportStar(require("./baseui/basepagevalidations"), exports);
18
+ __exportStar(require("./baseui/basepageactions"), exports);
19
+ __exportStar(require("./baseui/basepagewaits"), exports);
20
+ __exportStar(require("./baseui/commonpageactions"), exports);
21
+ __exportStar(require("./baseui/commonpagevalidations"), exports);
22
+ __exportStar(require("./baseui/commonpagewaits"), exports);
23
+ __exportStar(require("./baseui/logger"), exports);
27
24
  __exportStar(require("./utils/Utils"), exports);
28
25
  __exportStar(require("./baseapi/baseapihelpers"), exports);
29
26
  __exportStar(require("./baseapi/apiutils"), exports);
30
- __exportStar(require("./constants/apiconstants"), exports);
31
27
  __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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "transit-core-taf",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Transit Core Automation Framework",
5
5
  "main": "dist/transit-core-taf/index.js",
6
6
  "types": "dist/transit-core-taf/index.d.ts",
package/README.md DELETED
File without changes
@@ -1,29 +0,0 @@
1
- export declare enum Channel {
2
- WEB = "web",
3
- IOS = "ios",
4
- ANDROID = "android",
5
- IOSTEST = "iostest"
6
- }
7
- export declare enum Context {
8
- DEFAULT = "/sfly/shutterfly/shutterfly-us/default"
9
- }
10
- export declare enum SearchType {
11
- KEYWORD = "keyword"
12
- }
13
- export declare enum AssetType {
14
- EMBELLISHMENT = "embellishment",
15
- LAYOUT = "layout",
16
- BACKGROUND = "background"
17
- }
18
- export declare enum DocType {
19
- DOCUMENT = "document",
20
- PRODUCT_CODE = "productCode",
21
- SKU_CODE = "skuCode",
22
- SELLABLE_PRODUCT_ID = "sellableProductId",
23
- SELLABLE_PRODUCT_VARIANT_ID = "sellableProductVariantId"
24
- }
25
- export declare enum PublishState {
26
- PUBLISHED_TO_PROD = "PUBLISHED_TO_PROD",
27
- PUBLISHED_TO_STAGE = "PUBLISHED_TO_STAGE",
28
- UNPUBLISHED = "UNPUBLISHED"
29
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PublishState = exports.DocType = exports.AssetType = exports.SearchType = exports.Context = exports.Channel = void 0;
4
- var Channel;
5
- (function (Channel) {
6
- Channel["WEB"] = "web";
7
- Channel["IOS"] = "ios";
8
- Channel["ANDROID"] = "android";
9
- Channel["IOSTEST"] = "iostest";
10
- })(Channel || (exports.Channel = Channel = {}));
11
- var Context;
12
- (function (Context) {
13
- Context["DEFAULT"] = "/sfly/shutterfly/shutterfly-us/default";
14
- })(Context || (exports.Context = Context = {}));
15
- var SearchType;
16
- (function (SearchType) {
17
- SearchType["KEYWORD"] = "keyword";
18
- })(SearchType || (exports.SearchType = SearchType = {}));
19
- var AssetType;
20
- (function (AssetType) {
21
- AssetType["EMBELLISHMENT"] = "embellishment";
22
- AssetType["LAYOUT"] = "layout";
23
- AssetType["BACKGROUND"] = "background";
24
- })(AssetType || (exports.AssetType = AssetType = {}));
25
- var DocType;
26
- (function (DocType) {
27
- DocType["DOCUMENT"] = "document";
28
- DocType["PRODUCT_CODE"] = "productCode";
29
- DocType["SKU_CODE"] = "skuCode";
30
- DocType["SELLABLE_PRODUCT_ID"] = "sellableProductId";
31
- DocType["SELLABLE_PRODUCT_VARIANT_ID"] = "sellableProductVariantId";
32
- })(DocType || (exports.DocType = DocType = {}));
33
- var PublishState;
34
- (function (PublishState) {
35
- PublishState["PUBLISHED_TO_PROD"] = "PUBLISHED_TO_PROD";
36
- PublishState["PUBLISHED_TO_STAGE"] = "PUBLISHED_TO_STAGE";
37
- PublishState["UNPUBLISHED"] = "UNPUBLISHED";
38
- })(PublishState || (exports.PublishState = PublishState = {}));
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const cucumber_1 = require("@cucumber/cucumber");
4
- (0, cucumber_1.When)('I click the element {string}', async function (selector) {
5
- if (!this.page || !this.basePageActions)
6
- throw new Error('Page or basePageActions not found');
7
- const element = this.page.locator(selector);
8
- await this.basePageActions.clickElement(element);
9
- });
10
- (0, cucumber_1.When)('I click the locator {string}', async function (selector) {
11
- if (!this.page || !this.basePageActions)
12
- throw new Error('Page or basePageActions not found');
13
- const element = this.page.locator(selector);
14
- await this.basePageActions.clickByLocator(element);
15
- });
16
- (0, cucumber_1.When)('I click the button with text {string}', async function (buttonText) {
17
- if (!this.page || !this.basePageActions)
18
- throw new Error('Page or basePageActions not found');
19
- await this.basePageActions.clickButtonByText(buttonText);
20
- });
21
- (0, cucumber_1.When)('I click the element with ID {string}', async function (id) {
22
- if (!this.page || !this.basePageActions)
23
- throw new Error('Page or basePageActions not found');
24
- await this.basePageActions.clickById(id);
25
- });
26
- (0, cucumber_1.When)('I fill the input {string} with {string}', async function (selector, value) {
27
- if (!this.page || !this.basePageActions)
28
- throw new Error('Page or basePageActions not found');
29
- const element = this.page.locator(selector);
30
- await this.basePageActions.fillInput(element, value);
31
- });
32
- (0, cucumber_1.When)('I clear the input {string}', async function (selector) {
33
- if (!this.page || !this.basePageActions)
34
- throw new Error('Page or basePageActions not found');
35
- const element = this.page.locator(selector);
36
- await this.basePageActions.clearInput(element);
37
- });
38
- (0, cucumber_1.When)('I type {string} into {string} slowly', async function (text, selector) {
39
- if (!this.page || !this.basePageActions)
40
- throw new Error('Page or basePageActions not found');
41
- const element = this.page.locator(selector);
42
- await this.basePageActions.typeSlowly(element, text);
43
- });
44
- (0, cucumber_1.When)('I hover over the element {string}', async function (selector) {
45
- if (!this.page || !this.basePageActions)
46
- throw new Error('Page or basePageActions not found');
47
- const element = this.page.locator(selector);
48
- await this.basePageActions.hoverOverElement(element);
49
- });
50
- (0, cucumber_1.When)('I press the {string} key on {string}', async function (key, selector) {
51
- if (!this.page || !this.basePageActions)
52
- throw new Error('Page or basePageActions not found');
53
- const element = this.page.locator(selector);
54
- await this.basePageActions.pressKey(element, key);
55
- });
56
- (0, cucumber_1.When)('I check the checkbox {string}', async function (selector) {
57
- if (!this.page || !this.basePageActions)
58
- throw new Error('Page or basePageActions not found');
59
- const element = this.page.locator(selector);
60
- await this.basePageActions.checkCheckbox(element);
61
- });
62
- (0, cucumber_1.When)('I uncheck the checkbox {string}', async function (selector) {
63
- if (!this.page || !this.basePageActions)
64
- throw new Error('Page or basePageActions not found');
65
- const element = this.page.locator(selector);
66
- await this.basePageActions.uncheckCheckbox(element);
67
- });
68
- (0, cucumber_1.When)('I select the option {string} from {string}', async function (value, selector) {
69
- if (!this.page || !this.basePageActions)
70
- throw new Error('Page or basePageActions not found');
71
- const element = this.page.locator(selector);
72
- await this.basePageActions.selectOption(element, value);
73
- });
74
- (0, cucumber_1.When)('I reload the page', async function () {
75
- if (!this.page || !this.basePageActions)
76
- throw new Error('Page or basePageActions not found');
77
- await this.basePageActions.reloadPage();
78
- });
@@ -1,59 +0,0 @@
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
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,29 +0,0 @@
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
- });
@@ -1,18 +0,0 @@
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
- });
@@ -1,16 +0,0 @@
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
- });
@@ -1,24 +0,0 @@
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
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
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
- });
@@ -1,14 +0,0 @@
1
- import { IWorldOptions, World } from '@cucumber/cucumber';
2
- import { Page, Browser, BrowserContext } from '@playwright/test';
3
- import { BasePageActions } from '../base/basepageactions';
4
- import { Logger } from '../base/logger';
5
- export declare class CustomWorld extends World {
6
- browser: Browser | null;
7
- context: BrowserContext | null;
8
- page: Page | null;
9
- logger: Logger;
10
- basePageActions: BasePageActions | null;
11
- constructor(options: IWorldOptions);
12
- openBrowser(): Promise<void>;
13
- closeBrowser(): Promise<void>;
14
- }
@@ -1,43 +0,0 @@
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 basepageactions_1 = require("../base/basepageactions");
7
- const logger_1 = require("../base/logger");
8
- class CustomWorld extends cucumber_1.World {
9
- browser;
10
- context;
11
- page;
12
- logger;
13
- basePageActions;
14
- constructor(options) {
15
- super(options);
16
- this.browser = null;
17
- this.context = null;
18
- this.page = null;
19
- this.logger = new logger_1.Logger('Default Test');
20
- this.basePageActions = null;
21
- }
22
- async openBrowser() {
23
- this.browser = await test_1.chromium.launch({ headless: false });
24
- this.context = await this.browser.newContext();
25
- this.page = await this.context.newPage();
26
- if (this.page) {
27
- this.basePageActions = new basepageactions_1.BasePageActions(this.page, this.logger);
28
- }
29
- }
30
- async closeBrowser() {
31
- if (this.page) {
32
- await this.page.close();
33
- }
34
- if (this.context) {
35
- await this.context.close();
36
- }
37
- if (this.browser) {
38
- await this.browser.close();
39
- }
40
- }
41
- }
42
- exports.CustomWorld = CustomWorld;
43
- (0, cucumber_1.setWorldConstructor)(CustomWorld);
@@ -1,2 +0,0 @@
1
- export declare function getEnvFilePath(): string;
2
- export declare function updateEnvFile(key: string, value: string): void;
@@ -1,55 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.getEnvFilePath = getEnvFilePath;
37
- exports.updateEnvFile = updateEnvFile;
38
- const fs = __importStar(require("fs"));
39
- const path = __importStar(require("path"));
40
- function getEnvFilePath() {
41
- const env = process.env.ENV || 'stage';
42
- return path.resolve(process.cwd(), `.env.${env}`);
43
- }
44
- function updateEnvFile(key, value) {
45
- const envFilePath = getEnvFilePath();
46
- let content = fs.readFileSync(envFilePath, { encoding: 'utf8' });
47
- const keyPattern = new RegExp(`^${key}=.*$`, 'm');
48
- if (keyPattern.test(content)) {
49
- content = content.replace(keyPattern, `${key}=${value}`);
50
- }
51
- else {
52
- content += `\n${key}=${value}`;
53
- }
54
- fs.writeFileSync(envFilePath, content);
55
- }
@@ -1 +0,0 @@
1
- export declare function getExcelDataSync(filePath: string, sheetName: string): unknown[];
@@ -1,51 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.getExcelDataSync = getExcelDataSync;
37
- const XLSX = __importStar(require("xlsx"));
38
- function getExcelDataSync(filePath, sheetName) {
39
- try {
40
- const workbook = XLSX.readFile(filePath);
41
- const worksheet = workbook.Sheets[sheetName];
42
- if (!worksheet) {
43
- throw new Error(`Sheet "${sheetName}" not found in the Excel file.`);
44
- }
45
- return XLSX.utils.sheet_to_json(worksheet);
46
- }
47
- catch (error) {
48
- console.error(`Error reading Excel file at ${filePath}:`, error);
49
- return [];
50
- }
51
- }
@@ -1,24 +0,0 @@
1
- import { Page } from "playwright";
2
- import { Logger } from "../base/logger";
3
- export declare class NetworkUtils {
4
- private page;
5
- private logger;
6
- constructor(page: Page, logger: Logger);
7
- /** Intercept the API call and abort it to simulate a failure */
8
- abortRoute(urlPattern: string): Promise<void>;
9
- /**
10
- * Waits for a specific network response with a given status code.
11
- * @param urlPattern The URL pattern to match.
12
- * @param expectedStatusCode The expected HTTP status code.
13
- * @param timeout The timeout in milliseconds.
14
- * @returns A promise that resolves with the response object if successful, otherwise null.
15
- */
16
- waitForApiResponse(urlPattern: string, expectedStatusCode: number, timeout?: number): Promise<import("playwright-core").Response | null>;
17
- /**
18
- * Waits for a specific network response and returns its body.
19
- * @param urlPattern The URL pattern to match.
20
- * @param timeout The timeout in milliseconds.
21
- * @returns A promise that resolves with the response body if successful, otherwise null.
22
- */
23
- getResponseBody(urlPattern: string, timeout?: number): Promise<any>;
24
- }
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NetworkUtils = void 0;
4
- class NetworkUtils {
5
- page;
6
- logger;
7
- constructor(page, logger) {
8
- this.page = page;
9
- this.logger = logger;
10
- }
11
- /** Intercept the API call and abort it to simulate a failure */
12
- async abortRoute(urlPattern) {
13
- await this.page.route(urlPattern, async (route) => {
14
- try {
15
- await route.abort();
16
- }
17
- catch (error) {
18
- this.logger.error(`Abort error message:${error}`);
19
- }
20
- });
21
- }
22
- /**
23
- * Waits for a specific network response with a given status code.
24
- * @param urlPattern The URL pattern to match.
25
- * @param expectedStatusCode The expected HTTP status code.
26
- * @param timeout The timeout in milliseconds.
27
- * @returns A promise that resolves with the response object if successful, otherwise null.
28
- */
29
- waitForApiResponse(urlPattern, expectedStatusCode, timeout = 60000) {
30
- return this.page.waitForResponse((response) => response.request().url().includes(urlPattern) &&
31
- response.status() === expectedStatusCode, { timeout }).catch(error => {
32
- this.logger.error(`Failed to receive response from ${urlPattern} with status ${expectedStatusCode} within ${timeout}ms. Error: ${error}`);
33
- return null;
34
- });
35
- }
36
- /**
37
- * Waits for a specific network response and returns its body.
38
- * @param urlPattern The URL pattern to match.
39
- * @param timeout The timeout in milliseconds.
40
- * @returns A promise that resolves with the response body if successful, otherwise null.
41
- */
42
- async getResponseBody(urlPattern, timeout = 60000) {
43
- try {
44
- const response = await this.page.waitForResponse((response) => response.request().url().includes(urlPattern), { timeout });
45
- return await response.json();
46
- }
47
- catch (error) {
48
- this.logger.error(`Failed to receive response from ${urlPattern} within ${timeout}ms. Error: ${error}`);
49
- return null;
50
- }
51
- }
52
- }
53
- exports.NetworkUtils = NetworkUtils;