transit-core-taf 1.0.3 → 1.0.4

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 +286 -0
  2. package/package.json +4 -7
  3. package/dist/transit-core-taf/base/basepageactions.d.ts +0 -178
  4. package/dist/transit-core-taf/base/basepageactions.js +0 -288
  5. package/dist/transit-core-taf/base/basepagevalidations.d.ts +0 -296
  6. package/dist/transit-core-taf/base/basepagevalidations.js +0 -459
  7. package/dist/transit-core-taf/base/basepagewaits.d.ts +0 -54
  8. package/dist/transit-core-taf/base/basepagewaits.js +0 -169
  9. package/dist/transit-core-taf/base/commonpageactions.d.ts +0 -40
  10. package/dist/transit-core-taf/base/commonpageactions.js +0 -118
  11. package/dist/transit-core-taf/base/commonpagevalidations.d.ts +0 -10
  12. package/dist/transit-core-taf/base/commonpagevalidations.js +0 -21
  13. package/dist/transit-core-taf/base/commonpagewaits.d.ts +0 -28
  14. package/dist/transit-core-taf/base/commonpagewaits.js +0 -57
  15. package/dist/transit-core-taf/base/logger.d.ts +0 -10
  16. package/dist/transit-core-taf/base/logger.js +0 -42
  17. package/dist/transit-core-taf/baseapi/apiutils.d.ts +0 -9
  18. package/dist/transit-core-taf/baseapi/apiutils.js +0 -23
  19. package/dist/transit-core-taf/baseapi/baseapihelpers.d.ts +0 -10
  20. package/dist/transit-core-taf/baseapi/baseapihelpers.js +0 -45
  21. package/dist/transit-core-taf/constants/apiconstants.d.ts +0 -29
  22. package/dist/transit-core-taf/constants/apiconstants.js +0 -38
  23. package/dist/transit-core-taf/constants/test-tags.d.ts +0 -14
  24. package/dist/transit-core-taf/constants/test-tags.js +0 -17
  25. package/dist/transit-core-taf/fixtures.d.ts +0 -23
  26. package/dist/transit-core-taf/fixtures.js +0 -81
  27. package/dist/transit-core-taf/global-setup.d.ts +0 -2
  28. package/dist/transit-core-taf/global-setup.js +0 -103
  29. package/dist/transit-core-taf/index.d.ts +0 -23
  30. package/dist/transit-core-taf/index.js +0 -39
  31. package/dist/transit-core-taf/steps/basepageactions.steps.d.ts +0 -1
  32. package/dist/transit-core-taf/steps/basepageactions.steps.js +0 -78
  33. package/dist/transit-core-taf/steps/basepagevalidations.steps.d.ts +0 -1
  34. package/dist/transit-core-taf/steps/basepagevalidations.steps.js +0 -59
  35. package/dist/transit-core-taf/steps/basepagewaits.steps.d.ts +0 -1
  36. package/dist/transit-core-taf/steps/basepagewaits.steps.js +0 -29
  37. package/dist/transit-core-taf/steps/commonpageactions.steps.d.ts +0 -1
  38. package/dist/transit-core-taf/steps/commonpageactions.steps.js +0 -18
  39. package/dist/transit-core-taf/steps/commonpagevalidations.steps.d.ts +0 -1
  40. package/dist/transit-core-taf/steps/commonpagevalidations.steps.js +0 -16
  41. package/dist/transit-core-taf/steps/commonpagewaits.steps.d.ts +0 -1
  42. package/dist/transit-core-taf/steps/commonpagewaits.steps.js +0 -24
  43. package/dist/transit-core-taf/steps/hooks.d.ts +0 -1
  44. package/dist/transit-core-taf/steps/hooks.js +0 -10
  45. package/dist/transit-core-taf/steps/world.d.ts +0 -14
  46. package/dist/transit-core-taf/steps/world.js +0 -43
  47. package/dist/transit-core-taf/utils/Utils.d.ts +0 -114
  48. package/dist/transit-core-taf/utils/Utils.js +0 -219
  49. package/dist/transit-core-taf/utils/envutils.d.ts +0 -2
  50. package/dist/transit-core-taf/utils/envutils.js +0 -55
  51. package/dist/transit-core-taf/utils/excelUtils.d.ts +0 -1
  52. package/dist/transit-core-taf/utils/excelUtils.js +0 -51
  53. package/dist/transit-core-taf/utils/networkutils.d.ts +0 -24
  54. package/dist/transit-core-taf/utils/networkutils.js +0 -53
package/README.md CHANGED
@@ -0,0 +1,286 @@
1
+ # Shutterfly Automation
2
+
3
+ This project contains automated tests for the Shutterfly website, specifically focusing on the product personalization workflow. It is built using Playwright.
4
+
5
+ ## Project Overview
6
+
7
+ The primary purpose of this project is to automate the testing of user flows on the Shutterfly platform. The main test case covers:
8
+
9
+ 1. **User Login**: Logging into the Shutterfly stage environment.
10
+ 2. **Product Selection**: Navigating to a product category (e.g., Desk Calendars) and selecting a product.
11
+ 3. **Personalization**: Opening the product personalization interface (the "builder").
12
+ 4. **Builder Functionality**: Interacting with various features within the builder, such as:
13
+ * Adding photos
14
+ * Changing layouts
15
+ * Applying backgrounds
16
+ * Adding stickers
17
+ * Modifying date options
18
+
19
+ ## Technologies Used
20
+
21
+ * **Test Framework**: [Playwright](https://playwright.dev/)
22
+ * **Language**: TypeScript
23
+ * **Dependencies**:
24
+ * `aurora-core`: Core library for Shutterfly automation.
25
+ * `builder-taf`: Test automation framework for the builder interface.
26
+ * `dotenv`: For managing environment variables.
27
+
28
+ ## Getting Started
29
+
30
+ ### Prerequisites
31
+
32
+ * Node.js and npm installed.
33
+ * A `.env` file with the necessary credentials (`USERNAME`, `PASSWORD`) for the stage environment.
34
+
35
+ ### Installation
36
+
37
+ 1. Clone the repository:
38
+ ```bash
39
+ git clone https://github.com/sflyinc-shutterfly/shutterflyautomation.git
40
+ ```
41
+ 2. Navigate to the project directory:
42
+ ```bash
43
+ cd shutterflyautomation
44
+ ```
45
+ 3. Install the dependencies:
46
+ ```bash
47
+ npm install
48
+ ```
49
+ ### Certificate errors during `npm install`
50
+ If you see a certificate error while running `npm install` or `npm i`, follow this process:
51
+
52
+ ```bash
53
+ npm config set strict-ssl false
54
+ NODE_TLS_REJECT_UNAUTHORIZED=0 npm i
55
+ NODE_TLS_REJECT_UNAUTHORIZED=0 npx playwright install
56
+
57
+ ### Running Tests
58
+
59
+ To run the tests, execute the following command:
60
+
61
+ ```bash
62
+ npm run tests
63
+ ```
64
+
65
+ This will run the `basictest.spec.ts` test in headed mode with debugging enabled, as configured in `package.json`.
66
+
67
+ ### Local Run and Debug
68
+
69
+ To run a specific test file, right-click on the spec file in your IDE, copy the relative path, and replace the path in the `package.json` scripts (`test:api` or `test:ui`).
70
+
71
+ The scripts are:
72
+ ```json
73
+ "test:api": "ENV=stage npx playwright test --project=api-tests tests/api-tests/projectsandrendering/projects/books.spec.ts --workers=1",
74
+ "test:ui": "ENV=stage npx playwright test --headed tests/builder-tests/photobooks/layoutApplyToPhotoBook.spec.ts"
75
+ ```
76
+
77
+ > **Note:** The `test:api` and `test:ui` scripts are intended for local runs. Any modifications made to them for debugging or specific test runs should not be committed to the repository.
78
+
79
+ > **Important:** Changes to `package.json` and `package-lock.json` should not be committed unless they involve dependency updates or new scripts necessary for CI/CD.
80
+
81
+ Then, execute the desired script from your terminal:
82
+
83
+ ### Running Tests
84
+
85
+ - **Run all tests:**
86
+ ```bash
87
+ npx playwright test
88
+ ```
89
+ - **Run tests with a specific tag (e.g., `@smoke`):**
90
+ ```bash
91
+ npx playwright test --grep @smoke
92
+ ```
93
+ - **Run tests on a specific environment (e.g., stage):**
94
+ ```bash
95
+ npm run test:stage
96
+ ```
97
+ - **Run a single test in headed/debug mode:**
98
+ ```bash
99
+ npm run test:single
100
+ ```
101
+ - **View the HTML report:**
102
+ ```bash
103
+ npx playwright show-report
104
+ ```
105
+
106
+ > **Note on Local Testing:** When running a single test locally using `npm run test:single`, you may add debugging statements (e.g., `console.log`). These changes should not be committed to the repository unless they are intended to be part of the final implementation for CI/CD.
107
+
108
+ ---
109
+
110
+ ## Architecture
111
+
112
+ This section provides an overview of the test automation architecture for both API and UI tests. The framework is designed to be modular, allowing the core functionalities to be published as an npm module and reused across different Playwright projects.
113
+
114
+ ### API Test Architecture
115
+
116
+ The following diagram illustrates the architecture of the API tests. The core logic, including API helpers and fixtures, is encapsulated within the `src` directory, which can be published as a package.
117
+
118
+ ```mermaid
119
+ graph TD
120
+ subgraph "aurora-core-taf Repository"
121
+ A[tests/api-tests/**/*.spec.ts] --> B{Playwright Test Runner};
122
+ B --> C[src/apihelpers];
123
+ C --> D[src/resources];
124
+ B --> E[src/fixtures.ts];
125
+ C --> F[External APIs];
126
+ end
127
+
128
+ subgraph "Published NPM Module"
129
+ G["@sfly/aurora-core-taf"]
130
+ subgraph "Contents"
131
+ direction LR
132
+ C --- G;
133
+ D --- G;
134
+ E --- G;
135
+ end
136
+ end
137
+
138
+ subgraph "Another-Playwright-Repo"
139
+ H[tests/**/*.spec.ts] --> I{Playwright Test Runner};
140
+ I --> G;
141
+ end
142
+
143
+ style G fill:#f9f,stroke:#333,stroke-width:2px
144
+ ```
145
+
146
+ ### UI (Builder) Test Architecture
147
+
148
+ The UI tests follow the Page Object Model (POM) pattern. The pages, locators, and base classes are part of the reusable `src` directory.
149
+
150
+ ```mermaid
151
+ graph TD
152
+ subgraph "aurora-core-taf Repository"
153
+ A[tests/builder-tests/**/*.spec.ts] --> B{Playwright Test Runner};
154
+ B --> C[src/fixtures.ts];
155
+ C --> D[src/builder/pages];
156
+ D --> E[src/builder/locators];
157
+ D --> F[src/base];
158
+ B --> G[Shutterfly Application];
159
+ end
160
+
161
+ subgraph "Published NPM Module"
162
+ H["@sfly/aurora-core-taf"]
163
+ subgraph "Contents"
164
+ direction LR
165
+ C --- H;
166
+ D --- H;
167
+ E --- H;
168
+ F --- H;
169
+ end
170
+ end
171
+
172
+ subgraph "Another-Playwright-Repo"
173
+ I[tests/**/*.spec.ts] --> J{Playwright Test Runner};
174
+ J --> H;
175
+ J --> K[Another Application];
176
+ end
177
+
178
+ style H fill:#f9f,stroke:#333,stroke-width:2px
179
+ ```
180
+
181
+ **To run API Tests:**
182
+ ```bash
183
+ npm run test:api
184
+ ```
185
+
186
+ **To run UI Tests:**
187
+ ```bash
188
+ npm run test:ui
189
+ ```
190
+
191
+ To debug a test, add the `--debug` flag to the script in `package.json` before running it. For example:
192
+ ```json
193
+ "test:api": "ENV=stage npx playwright test --debug --project=api-tests tests/api-tests/projectsandrendering/projects/books.spec.ts --workers=1"
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Coding Standards for Automation Framework
199
+
200
+ This section outlines the coding standards and conventions to be followed when working with the Playwright automation framework in this repository.
201
+
202
+ ### **1. Project Structure (Page Object Model)**
203
+
204
+ The framework follows the **Page Object Model (POM)** design pattern.
205
+
206
+ - **`builder-taf/src/pages`**: Contains page object classes that encapsulate the logic for interacting with a specific page (e.g., `HomePage`, `BuilderPage`).
207
+ - **`builder-taf/src/locators`**: Contains locator classes that define the selectors for the elements on a page (e.g., `HomePageLocators`). This separates the locators from the page logic.
208
+ - **`builder-taf/src/base`**: Contains base classes for common actions and waits (e.g., `BasePageWaits`).
209
+ - **`tests/`**: Contains the actual test files (`.spec.ts`). Tests are organized into subdirectories based on the feature or application area (e.g., `tests/cards`, `tests/calendar`).
210
+
211
+ ### **2. Naming Conventions**
212
+
213
+ - **Files**: All filenames should be **lowercase**.
214
+ - Page classes: `[pagename]page.ts` (e.g., `homepage.ts`)
215
+ - Locator classes: `[pagename]pagelocators.ts` (e.g., `homepagelocators.ts`)
216
+ - Test files: `[testname].spec.ts` (e.g., `cardsreturnrecipientaddress.spec.ts`)
217
+ - **Classes**: Use **PascalCase** for class names (e.g., `HomePage`, `HomePageLocators`).
218
+ - **Methods & Functions**: Use **camelCase** for methods and functions (e.g., `closeHomepagePopup`, `clickOnCalendar`).
219
+ - **Variables & Properties**: Use **camelCase** for variables and properties (e.g., `homePageLocators`, `discountPopupCloseButton`).
220
+
221
+ ### **3. Coding Style & Best Practices**
222
+
223
+ - **TypeScript**: The framework is written in TypeScript. Use appropriate types for variables, parameters, and return values.
224
+ - **Asynchronous Operations**: Use `async/await` for all asynchronous operations (e.g., Playwright actions).
225
+ - **Comments**: Use JSDoc-style comments (`/** ... */`) to document all page action functions. This helps with code clarity and auto-generation of documentation. For example:
226
+ ```typescript
227
+ /**
228
+ * Navigates to a specific URL and waits for the page to load.
229
+ * @param url The URL to navigate to.
230
+ */
231
+ ```
232
+
233
+ ```typescript
234
+ /** Comments Section should be followed as this for single line comments */
235
+ ```
236
+ - **Fixtures**: Use Playwright fixtures (`builder-taf/src/fixtures.ts`) to provide instances of page objects to the tests. This promotes code reuse and simplifies test setup.
237
+ - **Base Classes**: Utilize `BasePageActions`, `BasePageValidations`, and `BasePageWaits` for common actions, validations, and waits. These base classes help avoid repetitive code and ensure consistency across the framework.
238
+ - **Environment Variables**: Store sensitive information like usernames and passwords in environment variables (`process.env`) and not directly in the code.
239
+ - **Waits**:
240
+ - Prefer using explicit waits provided by `BasePageWaits` (e.g., `waits.waitForPageLoad()`).
241
+ - Static waits (`waits.waitForSeconds()`) should be used sparingly and only when necessary, with a comment explaining the reason.
242
+
243
+ ### **4. Test Structure**
244
+
245
+ - **Grouping**: Use `test.describe()` to group related tests.
246
+ - **Test Names**: Write clear and descriptive test names that explain the purpose of the test. Include the relevant test case ID if applicable (e.g., `C5564361`).
247
+ - **Assertions**: Use `expect` from Playwright for assertions to validate the application's state.
248
+ - **Tags**: Use tags to categorize tests (e.g., `@smoke`, `@regression`). This allows for running specific subsets of tests.
249
+
250
+ ### **5. TestRail Integration**
251
+
252
+ - **Case ID**: All test cases should have the corresponding TestRail case ID mentioned in a comment block above the test case. This helps in tracking the automation status of the test cases.
253
+ For Example:
254
+ ```typescript
255
+ /** C5586855 - Verify Remove using Drag and Drop in Photo Contextual Menu */
256
+ ```
257
+ - **Status Update**: Once a pull request (PR) with the automated test case is merged, the status of the corresponding test case in TestRail needs to be updated to "Automated".
258
+
259
+ ---
260
+
261
+ ## Pull Request Review Checklist
262
+
263
+ This checklist should be used when reviewing pull requests to ensure that the code adheres to the coding standards and best practices of this framework.
264
+
265
+ ### **1. Code Quality & Style**
266
+ - [ ] **TypeScript**: Is the code written in TypeScript with appropriate types for variables, parameters, and return values?
267
+ - [ ] **Async/Await**: Are all asynchronous operations handled with `async/await`?
268
+ - [ ] **Comments**: Are all page action functions documented with JSDoc-style comments?
269
+ - [ ] **Readability**: Is the code easy to read and understand?
270
+
271
+ ### **2. Framework & Best Practices**
272
+ - [ ] **Fixtures**: Are Playwright fixtures used for test setup?
273
+ - [ ] **Base Classes**: Are `BasePageActions`, `BasePageValidations`, and `BasePageWaits` utilized for common actions?
274
+ - [ ] **Environment Variables**: Is sensitive information stored in environment variables and not hardcoded?
275
+ - [ ] **Waits**: Are explicit waits used instead of static waits wherever possible? If static waits are used, is there a valid reason provided in the comments?
276
+
277
+ ### **3. Test Structure & Naming**
278
+ - [ ] **Grouping**: Are related tests grouped using `test.describe()`?
279
+ - [ ] **Test Names**: Are the test names clear, descriptive, and include the TestRail case ID?
280
+ - [ ] **Assertions**: Are assertions made using `expect` from Playwright?
281
+ - [ ] **Tags**: Are appropriate tags (e.g., `@smoke`, `@regression`) used for the tests?
282
+ - [ ] **Naming Conventions**: Do all files, classes, methods, and variables follow the established naming conventions?
283
+
284
+ ### **4. TestRail Integration**
285
+ - [ ] **Case ID**: Is the TestRail case ID present in a comment block above the test case?
286
+ - [ ] **TestRail Status**: Once a pull request (PR) with the automated test case is merged, the status of the corresponding test case in TestRail needs to be updated to "Automated".
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.4",
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",
@@ -8,7 +8,6 @@
8
8
  "dist/transit-core-taf"
9
9
  ],
10
10
  "devDependencies": {
11
- "@cucumber/cucumber": "^11.3.0",
12
11
  "@faker-js/faker": "^9.9.0",
13
12
  "@playwright/test": "^1.54.1",
14
13
  "@types/node": "^24.3.1",
@@ -16,7 +15,6 @@
16
15
  "@types/pngjs": "^6.0.5",
17
16
  "dotenv": "^16.6.1",
18
17
  "npm-run-all": "^4.1.5",
19
- "ts-node": "^10.9.2",
20
18
  "typescript": "^5.0.0",
21
19
  "xlsx": "^0.18.5"
22
20
  },
@@ -24,9 +22,8 @@
24
22
  "playwright": "^1.54.1"
25
23
  },
26
24
  "scripts": {
27
- "build": "tsc",
28
- "test:cucumber": "cucumber-js"
25
+ "build": "tsc"
29
26
  },
30
- "author": "Transit Core",
27
+ "author": "Aurora Core",
31
28
  "license": "ISC"
32
- }
29
+ }
@@ -1,178 +0,0 @@
1
- import { Locator, Page } from '@playwright/test';
2
- import { Logger } from './logger';
3
- export declare class BasePageActions {
4
- private page;
5
- private waits;
6
- private logger;
7
- constructor(page: Page, logger: Logger);
8
- /**
9
- * Waits for an element to be visible and clicks on it.
10
- * Logs the action and provides an error message if the element isn't visible in time.
11
- * @param element The locator of the element to click.
12
- * @param timeout Optional timeout in ms to wait for visibility (default: 30s).
13
- */
14
- clickElement(element: Locator, timeout?: number): Promise<void>;
15
- /**
16
- * Clicks an element using its locator.
17
- * @param {Locator} element - The Playwright locator of the element to click.
18
- * @param {Object} [options={}] - Click options.
19
- * @param {number} [options.timeout=120000] - Maximum time to wait for the element.
20
- * @param {boolean} [options.force=false] - Whether to force the click (useful if the element is not interactable).
21
- */
22
- clickByLocator(element: Locator, options?: {
23
- timeout?: number;
24
- force?: boolean;
25
- }): Promise<void>;
26
- /**
27
- * Locates a button with the specified text on the page.
28
- *
29
- * Note: This function currently only creates the locator but does not perform a click.
30
- *
31
- * @param buttonText - The visible text of the button to locate.
32
- */
33
- clickButtonByText(buttonText: string, timeout?: number): Promise<void>;
34
- /**
35
- * Locates a button with the specified text on the page.
36
- *
37
- * Note: This function currently only creates the locator but does not perform a click.
38
- *
39
- * @param buttonText - The visible text of the button to locate.
40
- */
41
- clickById(id: string, clickIfVisible?: boolean, timeout?: number): Promise<void>;
42
- /**
43
- * Fills an input element with a given value.
44
- * @param element The locator of the input element.
45
- * @param value The value to fill the input with.
46
- */
47
- fillInput(element: Locator, value: string): Promise<void>;
48
- /**
49
- * Clears the value of an input element.
50
- * @param element The locator of the input element.
51
- */
52
- clearInput(element: Locator): Promise<void>;
53
- /**
54
- * Types a text into an element slowly, with a specified delay between keystrokes.
55
- * @param element The locator of the element to type into.
56
- * @param text The text to type.
57
- * @param delay The delay between keystrokes in milliseconds (default is 100).
58
- */
59
- typeSlowly(element: Locator, text: string, delay?: number): Promise<void>;
60
- /**
61
- * Hovers over a given element.
62
- * @param element The locator of the element to hover over.
63
- */
64
- hoverOverElement(element: Locator, timeout?: number): Promise<void>;
65
- /**
66
- * Presses a key on a given element.
67
- * @param element The locator of the element.
68
- * @param key The key to press (e.g., 'Enter', 'ArrowDown').
69
- */
70
- pressKey(element: Locator, key: string): Promise<void>;
71
- /**
72
- * Checks a checkbox if it is not already checked.
73
- * @param element The locator of the checkbox element.
74
- */
75
- checkCheckbox(element: Locator): Promise<void>;
76
- /**
77
- * Unchecks a checkbox if it is already checked.
78
- * @param element The locator of the checkbox element.
79
- */
80
- uncheckCheckbox(element: Locator): Promise<void>;
81
- /**
82
- * Selects an option from a dropdown element by its value.
83
- * @param element The locator of the select element.
84
- * @param value The value of the option to select.
85
- */
86
- selectOption(element: Locator, value: string): Promise<void>;
87
- /**
88
- * Retrieves the text content of an element by its ID.
89
- *
90
- * @param id - The ID of the HTML element to retrieve text from.
91
- * @returns The text content of the specified element.
92
- */
93
- getElementTextById(id: string): Promise<string | undefined>;
94
- /**
95
- * Retrieves the text content of an element by its Locator.
96
- * @param locator - The Locator of the HTML element to retrieve text from.
97
- * @returns The text content of the specified element.
98
- */
99
- getElementTextByLocator(locator: Locator): Promise<string>;
100
- /**Gets the specified attribute value of an element using its ID.
101
- * @param id The ID of the element.
102
- * @param attribute The attribute name (e.g., 'value', 'min', 'max')
103
- */
104
- getElementAttributeValueById(id: string, attribute: string): Promise<string | undefined>;
105
- /**
106
- * Gets the specified attribute value of an element using a Locator.
107
- * @param locator The Playwright Locator for the element.
108
- * @param attribute The attribute name (e.g., 'value', 'min', 'max').
109
- * @returns The attribute value as a string (or undefined if not present).
110
- */
111
- getAttributeValueByLocator(locator: Locator, attribute: string): Promise<string | undefined>;
112
- /** Fills an input element identified by its ID with a given value.
113
- * - Waits for the input to be visible before filling.
114
- *
115
- * @param elementId - The ID of the input element.
116
- * @param value - The value to fill the input with.
117
- */
118
- fillInputById(elementId: string, value: string): Promise<void>;
119
- /**
120
- * Clicks a tab by its text and validates that it's selected using accessibility and style attributes.
121
- * @param tabText - Visible text of the tab (e.g., "Crop").
122
- * @param timeout - Optional timeout for the click action.
123
- */
124
- validateCropTabSelected(tabLocator: Locator, timeout?: number): Promise<void>;
125
- /**
126
- * Counts the number of objects in the array where the given key is null or undefined.
127
- * @param items - The array of items to check.
128
- * @param key - The key to inspect on each item.
129
- * @returns The number of items where the key is null or undefined.
130
- */
131
- getNullCountByType(items: any[], key: string): Promise<number>;
132
- /**
133
- * Sets the viewport size and waits for DOM content to be loaded.
134
- * @param viewport - An object with width and height properties.
135
- */
136
- setViewport(viewport: {
137
- width: number;
138
- height: number;
139
- }): Promise<void>;
140
- /**
141
- * Reloads the current page and waits until the DOM is fully loaded.
142
- * @param options - Optional reload options (timeout, waitUntil).
143
- */
144
- reloadPage(options?: {
145
- timeout?: number;
146
- waitUntil?: 'load' | 'domcontentloaded' | 'networkidle';
147
- }): Promise<void>;
148
- /**
149
- * Universal drag-and-drop method for builder elements (photos, layouts, backgrounds, stickers).
150
- * Accepts either a string selector or a Playwright Locator for both source and target.
151
- * @param source - Locator or string selector for the element to drag.
152
- * @param target - Locator or string selector for the drop target.
153
- * @param attribute - (Optional) Attribute to return from the dragged element (default: "data-id").
154
- * @returns The attribute value if available, otherwise null.
155
- */
156
- dragElementToTarget(source: Locator | string, target: Locator | string, attribute?: string): Promise<string | null>;
157
- /**
158
- * Gives the textcontent of all elements .
159
- * @param locator The ID of the element.
160
- * Returns array of values of all the elements textcontent
161
- */
162
- getAllTextContents(locator: Locator): Promise<string[]>;
163
- /**
164
- * @param locator The ID of the element.
165
- * Click on element if its not expanded
166
- */
167
- clickIfNotExpanded(locator: Locator): Promise<void>;
168
- /**
169
- * Performs a mouse click at the given screen coordinates.
170
- * @param x - The x-coordinate for the click.
171
- * @param y - The y-coordinate for the click.
172
- * @param options - Optional click options like button or clickCount.
173
- */
174
- mouseClickAt(x: number, y: number, options?: {
175
- button?: 'left' | 'right' | 'middle';
176
- clickCount?: number;
177
- }): Promise<void>;
178
- }