pw-element-interactions 0.0.4 → 0.0.6

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.
@@ -1,18 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Interactions = exports.DropdownSelectType = void 0;
4
- /**
5
- * Defines the strategy for selecting an option from a dropdown element.
6
- */
7
- var DropdownSelectType;
8
- (function (DropdownSelectType) {
9
- /** Selects a completely random, non-disabled option with a valid value. */
10
- DropdownSelectType["RANDOM"] = "random";
11
- /** Selects an option based on its zero-based index in the dropdown. */
12
- DropdownSelectType["INDEX"] = "index";
13
- /** Selects an option based on its exact 'value' attribute. */
14
- DropdownSelectType["VALUE"] = "value";
15
- })(DropdownSelectType || (exports.DropdownSelectType = DropdownSelectType = {}));
3
+ exports.Interactions = void 0;
4
+ const Options_1 = require("../enum/Options");
5
+ const ElementUtilities_1 = require("../utils/ElementUtilities");
16
6
  /**
17
7
  * The `Interactions` class provides a robust set of methods for interacting
18
8
  * with DOM elements via Playwright Locators. It abstracts away common boilerplate
@@ -20,12 +10,17 @@ var DropdownSelectType;
20
10
  */
21
11
  class Interactions {
22
12
  page;
13
+ ELEMENT_TIMEOUT;
14
+ utils;
23
15
  /**
24
16
  * Initializes the Interactions class.
25
17
  * @param page - The current Playwright Page object.
18
+ * @param timeout - Optional override for the default element timeout.
26
19
  */
27
- constructor(page) {
20
+ constructor(page, timeout = 30000) {
28
21
  this.page = page;
22
+ this.ELEMENT_TIMEOUT = timeout;
23
+ this.utils = new ElementUtilities_1.Utils(this.ELEMENT_TIMEOUT);
29
24
  }
30
25
  /**
31
26
  * Performs a standard Playwright click on the given locator.
@@ -33,7 +28,8 @@ class Interactions {
33
28
  * @param locator - The Playwright Locator pointing to the target element.
34
29
  */
35
30
  async click(locator) {
36
- await locator.click();
31
+ await this.utils.waitForState(locator, 'visible');
32
+ await locator.click({ timeout: this.ELEMENT_TIMEOUT });
37
33
  }
38
34
  /**
39
35
  * Dispatches a native 'click' event directly to the element.
@@ -42,6 +38,7 @@ class Interactions {
42
38
  * @param locator - The Playwright Locator pointing to the target element.
43
39
  */
44
40
  async clickWithoutScrolling(locator) {
41
+ await this.utils.waitForState(locator, 'attached');
45
42
  await locator.dispatchEvent('click');
46
43
  }
47
44
  /**
@@ -52,7 +49,7 @@ class Interactions {
52
49
  */
53
50
  async clickIfPresent(locator) {
54
51
  if (await locator.isVisible()) {
55
- await locator.click();
52
+ await locator.click({ timeout: this.ELEMENT_TIMEOUT });
56
53
  }
57
54
  else {
58
55
  console.log(`[Action] -> Locator was not visible. Skipping click.`);
@@ -64,7 +61,8 @@ class Interactions {
64
61
  * @param text - The string to type into the input field.
65
62
  */
66
63
  async fill(locator, text) {
67
- await locator.fill(text);
64
+ await this.utils.waitForState(locator, 'visible');
65
+ await locator.fill(text, { timeout: this.ELEMENT_TIMEOUT });
68
66
  }
69
67
  /**
70
68
  * Uploads a local file to an `<input type="file">` element.
@@ -72,45 +70,131 @@ class Interactions {
72
70
  * @param filePath - The local file system path to the file you want to upload.
73
71
  */
74
72
  async uploadFile(locator, filePath) {
73
+ await this.utils.waitForState(locator, 'attached');
75
74
  console.log(`[Action] -> Uploading file from path "${filePath}"`);
76
- await locator.setInputFiles(filePath);
75
+ await locator.setInputFiles(filePath, { timeout: this.ELEMENT_TIMEOUT });
77
76
  }
78
77
  /**
79
78
  * Unified method to interact with `<select>` dropdown elements based on the specified `DropdownSelectType`.
80
79
  * If no options are provided, it safely defaults to randomly selecting an enabled, non-empty option.
81
- * * @param locator - The Playwright Locator pointing to the `<select>` element.
80
+ * @param locator - The Playwright Locator pointing to the `<select>` element.
82
81
  * @param options - Configuration specifying whether to select by 'random', 'index', or 'value'.
83
82
  * @returns A promise that resolves to the exact 'value' attribute of the newly selected option.
84
83
  * @throws Error if 'value' or 'index' is missing when their respective types are chosen, or if no enabled options exist.
85
84
  */
86
- async selectDropdown(locator, options = { type: DropdownSelectType.RANDOM }) {
87
- const type = options.type ?? DropdownSelectType.RANDOM;
88
- if (type === DropdownSelectType.VALUE) {
85
+ async selectDropdown(locator, options = { type: Options_1.DropdownSelectType.RANDOM }) {
86
+ await this.utils.waitForState(locator, 'visible');
87
+ const type = options.type ?? Options_1.DropdownSelectType.RANDOM;
88
+ if (type === Options_1.DropdownSelectType.VALUE) {
89
89
  if (options.value === undefined) {
90
90
  throw new Error('[Action] Error -> "value" must be provided when using DropdownSelectType.VALUE.');
91
91
  }
92
- const selected = await locator.selectOption({ value: options.value });
92
+ const selected = await locator.selectOption({ value: options.value }, { timeout: this.ELEMENT_TIMEOUT });
93
93
  return selected[0];
94
94
  }
95
- if (type === DropdownSelectType.INDEX) {
95
+ if (type === Options_1.DropdownSelectType.INDEX) {
96
96
  if (options.index === undefined) {
97
97
  throw new Error('[Action] Error -> "index" must be provided when using DropdownSelectType.INDEX.');
98
98
  }
99
- const selected = await locator.selectOption({ index: options.index });
99
+ const selected = await locator.selectOption({ index: options.index }, { timeout: this.ELEMENT_TIMEOUT });
100
100
  return selected[0];
101
101
  }
102
102
  const enabledOptions = locator.locator('option:not([disabled]):not([value=""])');
103
+ await this.utils.waitForState(enabledOptions.first(), 'attached').catch(() => { });
103
104
  const count = await enabledOptions.count();
104
105
  if (count === 0) {
105
106
  throw new Error('[Action] Error -> No enabled options found to select!');
106
107
  }
107
108
  const randomIndex = Math.floor(Math.random() * count);
108
- const valueToSelect = await enabledOptions.nth(randomIndex).getAttribute('value');
109
+ const valueToSelect = await enabledOptions.nth(randomIndex).getAttribute('value', { timeout: this.ELEMENT_TIMEOUT });
109
110
  if (valueToSelect === null) {
110
111
  throw new Error(`[Action] Error -> Option at index ${randomIndex} is missing a "value" attribute.`);
111
112
  }
112
- const selected = await locator.selectOption({ value: valueToSelect });
113
+ const selected = await locator.selectOption({ value: valueToSelect }, { timeout: this.ELEMENT_TIMEOUT });
113
114
  return selected[0];
114
115
  }
116
+ /**
117
+ * Hovers over the specified element. Useful for triggering dropdowns or tooltips.
118
+ * @param locator - The Playwright Locator pointing to the target element.
119
+ */
120
+ async hover(locator) {
121
+ await this.utils.waitForState(locator, 'visible');
122
+ await locator.hover({ timeout: this.ELEMENT_TIMEOUT });
123
+ }
124
+ /**
125
+ * Scrolls the element into view if it is not already visible in the viewport.
126
+ * @param locator - The Playwright Locator pointing to the target element.
127
+ */
128
+ async scrollIntoView(locator) {
129
+ await this.utils.waitForState(locator, 'attached');
130
+ await locator.scrollIntoViewIfNeeded({ timeout: this.ELEMENT_TIMEOUT });
131
+ }
132
+ /**
133
+ * Drags an element either to a specified target element, a target element with an offset, or by a coordinate offset.
134
+ * @param locator - The Playwright Locator pointing to the element to drag.
135
+ * @param options - Configuration specifying a 'targetLocator', offsets, or both.
136
+ */
137
+ async dragAndDrop(locator, options) {
138
+ await this.utils.waitForState(locator, 'visible');
139
+ if (options.target) {
140
+ await this.utils.waitForState(options.target, 'visible');
141
+ if (options.xOffset !== undefined && options.yOffset !== undefined) {
142
+ const targetBox = await options.target.boundingBox();
143
+ if (!targetBox) {
144
+ throw new Error(`[Action] Error -> Unable to get bounding box for target element.`);
145
+ }
146
+ const targetPosition = {
147
+ x: (targetBox.width / 2) + options.xOffset,
148
+ y: (targetBox.height / 2) + options.yOffset
149
+ };
150
+ await locator.dragTo(options.target, {
151
+ targetPosition,
152
+ timeout: this.ELEMENT_TIMEOUT
153
+ });
154
+ return;
155
+ }
156
+ await locator.dragTo(options.target, { timeout: this.ELEMENT_TIMEOUT });
157
+ return;
158
+ }
159
+ if (options.xOffset !== undefined && options.yOffset !== undefined) {
160
+ const box = await locator.boundingBox();
161
+ if (!box) {
162
+ throw new Error(`[Action] Error -> Unable to get bounding box for element to perform drag action.`);
163
+ }
164
+ const startX = box.x + box.width / 2;
165
+ const startY = box.y + box.height / 2;
166
+ await this.page.mouse.move(startX, startY);
167
+ await this.page.mouse.down();
168
+ await this.page.mouse.move(startX + options.xOffset, startY + options.yOffset, { steps: 10 });
169
+ await this.page.mouse.up();
170
+ return;
171
+ }
172
+ throw new Error(`[Action] Error -> You must provide either 'targetLocator', or both 'xOffset' and 'yOffset' in DragAndDropOptions.`);
173
+ }
174
+ /**
175
+ * Filters a locator list and returns the first element that contains the specified text.
176
+ * If the element is not found, it prints the available text contents of the base locator for debugging.
177
+ * @param baseLocator The base Playwright Locator.
178
+ * @param pageName The name of the page block in the JSON repository.
179
+ * @param elementName The specific element name to look up.
180
+ * @param desiredText The string of text to search for within the elements.
181
+ * @param strict If true, throws an error if the element is not found. Defaults to false.
182
+ * @returns A promise that resolves to the matched Playwright Locator, or null if not found.
183
+ */
184
+ async getByText(baseLocator, pageName, elementName, desiredText, strict = false) {
185
+ const locator = baseLocator.filter({ hasText: desiredText }).first();
186
+ if ((await locator.count()) === 0) {
187
+ const rawTexts = await baseLocator.allInnerTexts();
188
+ const availableTexts = rawTexts
189
+ .map((text) => text.trim())
190
+ .filter((text) => text.length > 0);
191
+ const msg = `Element '${elementName}' on '${pageName}' with text "${desiredText}" not found.\nAvailable texts found in locator: ${availableTexts.length > 0 ? `\n- ${availableTexts.join('\n- ')}` : 'None (Base locator found no elements or elements had no text)'}`;
192
+ if (strict)
193
+ throw new Error(msg);
194
+ console.warn(msg);
195
+ return null;
196
+ }
197
+ return locator;
198
+ }
115
199
  }
116
200
  exports.Interactions = Interactions;
@@ -20,7 +20,6 @@ class Navigation {
20
20
  * @param url - The absolute or relative URL to navigate to.
21
21
  */
22
22
  async toUrl(url) {
23
- console.log(`[Navigate] -> Navigating to URL: ${url}`);
24
23
  await this.page.goto(url);
25
24
  }
26
25
  /**
@@ -28,7 +27,6 @@ class Navigation {
28
27
  * Useful for resetting application state or checking data persistence.
29
28
  */
30
29
  async reload() {
31
- console.log(`[Navigate] -> Refreshing the current page`);
32
30
  await this.page.reload();
33
31
  }
34
32
  /**
@@ -37,7 +35,6 @@ class Navigation {
37
35
  * @param direction - The direction to move in history: either 'BACKWARDS' or 'FORWARDS'.
38
36
  */
39
37
  async backOrForward(direction) {
40
- console.log(`[Navigate] -> Moving browser history ${direction.toLowerCase()}`);
41
38
  if (direction === 'BACKWARDS') {
42
39
  await this.page.goBack();
43
40
  }
@@ -52,7 +49,6 @@ class Navigation {
52
49
  * @param height - The desired height of the viewport in pixels.
53
50
  */
54
51
  async setViewport(width, height) {
55
- console.log(`[Navigate] -> Setting viewport size to ${width}x${height}`);
56
52
  await this.page.setViewportSize({ width, height });
57
53
  }
58
54
  }
@@ -1,24 +1,28 @@
1
1
  import { Page, Locator } from '@playwright/test';
2
+ import { CountVerifyOptions, TextVerifyOptions } from '../enum/Options';
2
3
  /**
3
4
  * The `Verifications` class provides a unified wrapper around Playwright's `expect` assertions.
4
- * It standardizes timeouts, adds helpful logging, and includes advanced custom verifications
5
+ * It standardizes timeouts and includes advanced custom, robust verifications
5
6
  * (like image decoding) to keep your test assertions clean and reliable.
6
7
  */
7
8
  export declare class Verifications {
8
9
  private page;
9
10
  /** The standard timeout applied to all verifications in this class. */
10
- private readonly ELEMENT_TIMEOUT;
11
+ private ELEMENT_TIMEOUT;
11
12
  /**
12
13
  * Initializes the Verifications class.
13
14
  * @param page - The current Playwright Page object.
15
+ * @param timeout - Optional override for the default element timeout.
14
16
  */
15
- constructor(page: Page);
17
+ constructor(page: Page, timeout?: number);
16
18
  /**
17
- * Asserts that the specified element's text exactly matches the expected text.
19
+ * Asserts the text content of an element.
20
+ * Can verify exact text matches or simply check that the element contains some text.
18
21
  * @param locator - The Playwright Locator pointing to the target element.
19
- * @param expectedText - The exact text string expected to be inside the element.
22
+ * @param expectedText - The exact text string expected (optional if checking 'notEmpty').
23
+ * @param options - Configuration to alter the verification behavior.
20
24
  */
21
- text(locator: Locator, expectedText: string): Promise<void>;
25
+ text(locator: Locator, expectedText?: string, options?: TextVerifyOptions): Promise<void>;
22
26
  /**
23
27
  * Asserts that the specified element contains the expected substring.
24
28
  * @param locator - The Playwright Locator pointing to the target element.
@@ -32,9 +36,10 @@ export declare class Verifications {
32
36
  presence(locator: Locator): Promise<void>;
33
37
  /**
34
38
  * Asserts that the specified element is either hidden or completely detached from the DOM.
35
- * @param locator - The Playwright Locator pointing to the target element.
39
+ * Accepts a Locator or a raw selector string to prevent unnecessary repository waits.
40
+ * @param selectorOrLocator - The Playwright Locator or raw selector string.
36
41
  */
37
- absence(locator: Locator): Promise<void>;
42
+ absence(selectorOrLocator: Locator | string): Promise<void>;
38
43
  /**
39
44
  * Asserts the interactive state of an element (whether it is enabled or disabled).
40
45
  * Useful for checking buttons or input fields.
@@ -60,9 +65,15 @@ export declare class Verifications {
60
65
  * It checks for visibility, ensures a valid 'src' attribute exists, confirms the
61
66
  * 'naturalWidth' is greater than 0, and evaluates the browser's native `decode()`
62
67
  * promise to guarantee the image is fully rendered and not a broken link.
63
- * * @param imagesLocator - The Playwright Locator pointing to the image element(s).
68
+ * @param imagesLocator - The Playwright Locator pointing to the image element(s).
64
69
  * @param scroll - Whether to smoothly scroll the image(s) into the viewport before verifying (default: true).
65
70
  * @throws Will throw an error if no images are found matching the locator or if any image fails to decode.
66
71
  */
67
72
  images(imagesLocator: Locator, scroll?: boolean): Promise<void>;
73
+ /**
74
+ * Asserts the number of elements matching the locator based on the provided conditions.
75
+ * @param locator - The Playwright Locator pointing to the target elements.
76
+ * @param options - Configuration specifying 'exact', 'greaterThan', or 'lessThan' logic.
77
+ */
78
+ count(locator: Locator, options: CountVerifyOptions): Promise<void>;
68
79
  }
@@ -4,26 +4,40 @@ exports.Verifications = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  /**
6
6
  * The `Verifications` class provides a unified wrapper around Playwright's `expect` assertions.
7
- * It standardizes timeouts, adds helpful logging, and includes advanced custom verifications
7
+ * It standardizes timeouts and includes advanced custom, robust verifications
8
8
  * (like image decoding) to keep your test assertions clean and reliable.
9
9
  */
10
10
  class Verifications {
11
11
  page;
12
12
  /** The standard timeout applied to all verifications in this class. */
13
- ELEMENT_TIMEOUT = 10000;
13
+ ELEMENT_TIMEOUT;
14
14
  /**
15
15
  * Initializes the Verifications class.
16
16
  * @param page - The current Playwright Page object.
17
+ * @param timeout - Optional override for the default element timeout.
17
18
  */
18
- constructor(page) {
19
+ constructor(page, timeout = 30000) {
19
20
  this.page = page;
21
+ this.ELEMENT_TIMEOUT = timeout;
20
22
  }
23
+ // ==========================================
24
+ // Standard Assertions
25
+ // ==========================================
21
26
  /**
22
- * Asserts that the specified element's text exactly matches the expected text.
27
+ * Asserts the text content of an element.
28
+ * Can verify exact text matches or simply check that the element contains some text.
23
29
  * @param locator - The Playwright Locator pointing to the target element.
24
- * @param expectedText - The exact text string expected to be inside the element.
30
+ * @param expectedText - The exact text string expected (optional if checking 'notEmpty').
31
+ * @param options - Configuration to alter the verification behavior.
25
32
  */
26
- async text(locator, expectedText) {
33
+ async text(locator, expectedText, options) {
34
+ if (options?.notEmpty) {
35
+ await (0, test_1.expect)(locator).not.toBeEmpty({ timeout: this.ELEMENT_TIMEOUT });
36
+ return;
37
+ }
38
+ if (expectedText === undefined) {
39
+ throw new Error(`[Verify] -> You must provide either an 'expectedText' string or set '{ notEmpty: true }' in options.`);
40
+ }
27
41
  await (0, test_1.expect)(locator).toHaveText(expectedText, { timeout: this.ELEMENT_TIMEOUT });
28
42
  }
29
43
  /**
@@ -43,10 +57,13 @@ class Verifications {
43
57
  }
44
58
  /**
45
59
  * Asserts that the specified element is either hidden or completely detached from the DOM.
46
- * @param locator - The Playwright Locator pointing to the target element.
60
+ * Accepts a Locator or a raw selector string to prevent unnecessary repository waits.
61
+ * @param selectorOrLocator - The Playwright Locator or raw selector string.
47
62
  */
48
- async absence(locator) {
49
- console.log(`[Verify] -> Asserting absence of "${locator}"`);
63
+ async absence(selectorOrLocator) {
64
+ const locator = typeof selectorOrLocator === 'string'
65
+ ? this.page.locator(selectorOrLocator)
66
+ : selectorOrLocator;
50
67
  await (0, test_1.expect)(locator).toBeHidden({ timeout: this.ELEMENT_TIMEOUT });
51
68
  }
52
69
  /**
@@ -56,7 +73,6 @@ class Verifications {
56
73
  * @param state - The expected state: either 'enabled' or 'disabled'.
57
74
  */
58
75
  async state(locator, state) {
59
- console.log(`[Verify] -> Asserting state of "${locator}" is: "${state}"`);
60
76
  if (state === 'enabled') {
61
77
  await (0, test_1.expect)(locator).toBeEnabled({ timeout: this.ELEMENT_TIMEOUT });
62
78
  }
@@ -70,7 +86,6 @@ class Verifications {
70
86
  * @param text - The substring expected to be present within the active URL.
71
87
  */
72
88
  async urlContains(text) {
73
- console.log(`[Verify] -> Asserting current URL contains: "${text}"`);
74
89
  await (0, test_1.expect)(this.page).toHaveURL(new RegExp(text, 'i'), { timeout: this.ELEMENT_TIMEOUT });
75
90
  }
76
91
  /**
@@ -87,7 +102,7 @@ class Verifications {
87
102
  * It checks for visibility, ensures a valid 'src' attribute exists, confirms the
88
103
  * 'naturalWidth' is greater than 0, and evaluates the browser's native `decode()`
89
104
  * promise to guarantee the image is fully rendered and not a broken link.
90
- * * @param imagesLocator - The Playwright Locator pointing to the image element(s).
105
+ * @param imagesLocator - The Playwright Locator pointing to the image element(s).
91
106
  * @param scroll - Whether to smoothly scroll the image(s) into the viewport before verifying (default: true).
92
107
  * @throws Will throw an error if no images are found matching the locator or if any image fails to decode.
93
108
  */
@@ -117,7 +132,37 @@ class Verifications {
117
132
  });
118
133
  (0, test_1.expect)(isDecoded, `Image ${i + 1} failed to decode for ${imagesLocator}`).toBe(true);
119
134
  }
120
- console.log(`[Verify] -> Successfully verified ${productImages.length} images for "${imagesLocator}"`);
135
+ }
136
+ /**
137
+ * Asserts the number of elements matching the locator based on the provided conditions.
138
+ * @param locator - The Playwright Locator pointing to the target elements.
139
+ * @param options - Configuration specifying 'exact', 'greaterThan', or 'lessThan' logic.
140
+ */
141
+ async count(locator, options) {
142
+ if (options.exactly !== undefined && options.exactly < 0) {
143
+ throw new Error(`[Verify] -> 'exact' count cannot be negative.`);
144
+ }
145
+ if (options.greaterThan !== undefined && options.greaterThan < 0) {
146
+ throw new Error(`[Verify] -> 'greaterThan' count cannot be negative.`);
147
+ }
148
+ if (options.lessThan !== undefined && options.lessThan <= 0) {
149
+ throw new Error(`[Verify] -> 'lessThan' must be greater than 0. Element counts cannot be negative.`);
150
+ }
151
+ if (options.exactly !== undefined) {
152
+ await (0, test_1.expect)(locator).toHaveCount(options.exactly, { timeout: this.ELEMENT_TIMEOUT });
153
+ return;
154
+ }
155
+ if (options.greaterThan === undefined && options.lessThan === undefined) {
156
+ throw new Error(`[Verify] -> You must provide 'exact', 'greaterThan', or 'lessThan' in CountVerifyOptions.`);
157
+ }
158
+ await locator.first().waitFor({ state: 'attached', timeout: this.ELEMENT_TIMEOUT }).catch(() => { });
159
+ const actualCount = await locator.count();
160
+ if (options.greaterThan !== undefined) {
161
+ (0, test_1.expect)(actualCount, `Expected count > ${options.greaterThan}, but got ${actualCount}`).toBeGreaterThan(options.greaterThan);
162
+ }
163
+ if (options.lessThan !== undefined) {
164
+ (0, test_1.expect)(actualCount, `Expected count < ${options.lessThan}, but got ${actualCount}`).toBeLessThan(options.lessThan);
165
+ }
121
166
  }
122
167
  }
123
168
  exports.Verifications = Verifications;
@@ -0,0 +1,24 @@
1
+ import { Page } from '@playwright/test';
2
+ import { Interactions } from '../Interaction';
3
+ import { Navigation } from '../Navigation';
4
+ import { Verifications } from '../Verification';
5
+ import { Extractions } from '../Extraction';
6
+ import { Utils } from '../../utils/ElementUtilities';
7
+ /**
8
+ * A facade class that centralizes package capabilities.
9
+ * It provides access to navigation, interaction, verification,
10
+ * extraction, and utility functions through a single interface.
11
+ */
12
+ export declare class ElementInteractions {
13
+ interact: Interactions;
14
+ verify: Verifications;
15
+ extract: Extractions;
16
+ navigate: Navigation;
17
+ utils: Utils;
18
+ /**
19
+ * Initializes the ElementInteractions facade.
20
+ * @param page - The current Playwright Page object.
21
+ * @param timeout - Optional global timeout override (in milliseconds) for all interactions and verifications. Defaults to 30000 ms (30 seconds).
22
+ */
23
+ constructor(page: Page, timeout?: number);
24
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ElementInteractions = void 0;
4
+ const Interaction_1 = require("../Interaction");
5
+ const Navigation_1 = require("../Navigation");
6
+ const Verification_1 = require("../Verification");
7
+ const Extraction_1 = require("../Extraction");
8
+ const ElementUtilities_1 = require("../../utils/ElementUtilities");
9
+ /**
10
+ * A facade class that centralizes package capabilities.
11
+ * It provides access to navigation, interaction, verification,
12
+ * extraction, and utility functions through a single interface.
13
+ */
14
+ class ElementInteractions {
15
+ interact;
16
+ verify;
17
+ extract;
18
+ navigate;
19
+ utils;
20
+ /**
21
+ * Initializes the ElementInteractions facade.
22
+ * @param page - The current Playwright Page object.
23
+ * @param timeout - Optional global timeout override (in milliseconds) for all interactions and verifications. Defaults to 30000 ms (30 seconds).
24
+ */
25
+ constructor(page, timeout) {
26
+ this.interact = new Interaction_1.Interactions(page, timeout);
27
+ this.verify = new Verification_1.Verifications(page, timeout);
28
+ this.navigate = new Navigation_1.Navigation(page);
29
+ this.extract = new Extraction_1.Extractions(page);
30
+ this.utils = new ElementUtilities_1.Utils(timeout);
31
+ }
32
+ }
33
+ exports.ElementInteractions = ElementInteractions;