transit-core-taf 1.0.4 → 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.
- package/dist/transit-core-taf/baseapi/apiutils.d.ts +9 -0
- package/dist/transit-core-taf/baseapi/apiutils.js +23 -0
- package/dist/transit-core-taf/baseapi/baseapihelpers.d.ts +10 -0
- package/dist/transit-core-taf/baseapi/baseapihelpers.js +45 -0
- package/dist/transit-core-taf/baseui/basepageactions.d.ts +178 -0
- package/dist/transit-core-taf/baseui/basepageactions.js +288 -0
- package/dist/transit-core-taf/baseui/basepagevalidations.d.ts +309 -0
- package/dist/transit-core-taf/baseui/basepagevalidations.js +478 -0
- package/dist/transit-core-taf/baseui/basepagewaits.d.ts +54 -0
- package/dist/transit-core-taf/baseui/basepagewaits.js +169 -0
- package/dist/transit-core-taf/baseui/commonpageactions.d.ts +40 -0
- package/dist/transit-core-taf/baseui/commonpageactions.js +118 -0
- package/dist/transit-core-taf/baseui/commonpagevalidations.d.ts +10 -0
- package/dist/transit-core-taf/baseui/commonpagevalidations.js +21 -0
- package/dist/transit-core-taf/baseui/commonpagewaits.d.ts +28 -0
- package/dist/transit-core-taf/baseui/commonpagewaits.js +57 -0
- package/dist/transit-core-taf/baseui/logger.d.ts +10 -0
- package/dist/transit-core-taf/baseui/logger.js +42 -0
- package/dist/transit-core-taf/constants/test-tags.d.ts +4 -0
- package/dist/transit-core-taf/constants/test-tags.js +7 -0
- package/dist/transit-core-taf/fixtures.d.ts +20 -0
- package/dist/transit-core-taf/fixtures.js +58 -0
- package/dist/transit-core-taf/global-setup.d.ts +2 -0
- package/dist/transit-core-taf/global-setup.js +103 -0
- package/dist/transit-core-taf/index.d.ts +11 -0
- package/dist/transit-core-taf/index.js +27 -0
- package/dist/transit-core-taf/utils/Utils.d.ts +114 -0
- package/dist/transit-core-taf/utils/Utils.js +219 -0
- package/package.json +7 -4
- package/README.md +0 -286
package/README.md
DELETED
|
@@ -1,286 +0,0 @@
|
|
|
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".
|