@chrryai/waffles 2.2.70 → 2.2.74
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/README.md +41 -46
- package/package.json +19 -19
package/README.md
CHANGED
|
@@ -31,29 +31,24 @@ npm install @chrryai/waffles @playwright/test
|
|
|
31
31
|
## 🚀 Quick Start
|
|
32
32
|
|
|
33
33
|
```typescript
|
|
34
|
-
import { test, expect } from "@playwright/test"
|
|
35
|
-
import {
|
|
36
|
-
wait,
|
|
37
|
-
simulateInputPaste,
|
|
38
|
-
waitForElement,
|
|
39
|
-
generateTestEmail,
|
|
40
|
-
} from "@chrryai/waffles"
|
|
34
|
+
import { test, expect } from "@playwright/test";
|
|
35
|
+
import { wait, simulateInputPaste, waitForElement, generateTestEmail } from "@chrryai/waffles";
|
|
41
36
|
|
|
42
37
|
test("chat interaction", async ({ page }) => {
|
|
43
|
-
await page.goto("https://yourapp.com")
|
|
38
|
+
await page.goto("https://yourapp.com");
|
|
44
39
|
|
|
45
40
|
// Wait for chat to load
|
|
46
|
-
await waitForElement(page, '[data-testid="chat-textarea"]')
|
|
41
|
+
await waitForElement(page, '[data-testid="chat-textarea"]');
|
|
47
42
|
|
|
48
43
|
// Simulate pasting text
|
|
49
|
-
await simulateInputPaste(page, "Hello, AI!")
|
|
44
|
+
await simulateInputPaste(page, "Hello, AI!");
|
|
50
45
|
|
|
51
46
|
// Wait for response
|
|
52
|
-
await wait(1000)
|
|
47
|
+
await wait(1000);
|
|
53
48
|
|
|
54
49
|
// Assert
|
|
55
|
-
await expect(page.locator(".message")).toBeVisible()
|
|
56
|
-
})
|
|
50
|
+
await expect(page.locator(".message")).toBeVisible();
|
|
51
|
+
});
|
|
57
52
|
```
|
|
58
53
|
|
|
59
54
|
## 📚 API Reference
|
|
@@ -65,7 +60,7 @@ test("chat interaction", async ({ page }) => {
|
|
|
65
60
|
Wait for a specified number of milliseconds.
|
|
66
61
|
|
|
67
62
|
```typescript
|
|
68
|
-
await wait(1000) // Wait 1 second
|
|
63
|
+
await wait(1000); // Wait 1 second
|
|
69
64
|
```
|
|
70
65
|
|
|
71
66
|
#### `waitForElement(page, selector, timeout?)`
|
|
@@ -73,7 +68,7 @@ await wait(1000) // Wait 1 second
|
|
|
73
68
|
Wait for an element to be visible.
|
|
74
69
|
|
|
75
70
|
```typescript
|
|
76
|
-
await waitForElement(page, ".loading-spinner", 5000)
|
|
71
|
+
await waitForElement(page, ".loading-spinner", 5000);
|
|
77
72
|
```
|
|
78
73
|
|
|
79
74
|
#### `waitForElementToDisappear(page, selector, timeout?)`
|
|
@@ -81,7 +76,7 @@ await waitForElement(page, ".loading-spinner", 5000)
|
|
|
81
76
|
Wait for an element to disappear.
|
|
82
77
|
|
|
83
78
|
```typescript
|
|
84
|
-
await waitForElementToDisappear(page, ".loading-spinner")
|
|
79
|
+
await waitForElementToDisappear(page, ".loading-spinner");
|
|
85
80
|
```
|
|
86
81
|
|
|
87
82
|
### Input Simulation
|
|
@@ -91,7 +86,7 @@ await waitForElementToDisappear(page, ".loading-spinner")
|
|
|
91
86
|
Simulate pasting text into a textarea.
|
|
92
87
|
|
|
93
88
|
```typescript
|
|
94
|
-
await simulateInputPaste(page, "Pasted content")
|
|
89
|
+
await simulateInputPaste(page, "Pasted content");
|
|
95
90
|
```
|
|
96
91
|
|
|
97
92
|
#### `simulatePaste(page, text, buttonSelector?)`
|
|
@@ -99,7 +94,7 @@ await simulateInputPaste(page, "Pasted content")
|
|
|
99
94
|
Simulate pasting using clipboard API and clicking paste button.
|
|
100
95
|
|
|
101
96
|
```typescript
|
|
102
|
-
await simulatePaste(page, "Clipboard content")
|
|
97
|
+
await simulatePaste(page, "Clipboard content");
|
|
103
98
|
```
|
|
104
99
|
|
|
105
100
|
### Navigation
|
|
@@ -114,7 +109,7 @@ const url = getURL({
|
|
|
114
109
|
path: "/chat",
|
|
115
110
|
isMember: true,
|
|
116
111
|
memberFingerprint: "abc-123",
|
|
117
|
-
})
|
|
112
|
+
});
|
|
118
113
|
```
|
|
119
114
|
|
|
120
115
|
#### `scrollToBottom(page)`
|
|
@@ -122,7 +117,7 @@ const url = getURL({
|
|
|
122
117
|
Scroll to the bottom of the page.
|
|
123
118
|
|
|
124
119
|
```typescript
|
|
125
|
-
await scrollToBottom(page)
|
|
120
|
+
await scrollToBottom(page);
|
|
126
121
|
```
|
|
127
122
|
|
|
128
123
|
### Utilities
|
|
@@ -132,7 +127,7 @@ await scrollToBottom(page)
|
|
|
132
127
|
Capitalize the first letter of a string.
|
|
133
128
|
|
|
134
129
|
```typescript
|
|
135
|
-
capitalizeFirstLetter("hello") // "Hello"
|
|
130
|
+
capitalizeFirstLetter("hello"); // "Hello"
|
|
136
131
|
```
|
|
137
132
|
|
|
138
133
|
#### `generateTestEmail(prefix?)`
|
|
@@ -140,7 +135,7 @@ capitalizeFirstLetter("hello") // "Hello"
|
|
|
140
135
|
Generate a unique test email.
|
|
141
136
|
|
|
142
137
|
```typescript
|
|
143
|
-
const email = generateTestEmail("user") // user-1234567890-abc123@test.com
|
|
138
|
+
const email = generateTestEmail("user"); // user-1234567890-abc123@test.com
|
|
144
139
|
```
|
|
145
140
|
|
|
146
141
|
#### `generateTestPassword(length?)`
|
|
@@ -148,7 +143,7 @@ const email = generateTestEmail("user") // user-1234567890-abc123@test.com
|
|
|
148
143
|
Generate a random password for testing.
|
|
149
144
|
|
|
150
145
|
```typescript
|
|
151
|
-
const password = generateTestPassword(16)
|
|
146
|
+
const password = generateTestPassword(16);
|
|
152
147
|
```
|
|
153
148
|
|
|
154
149
|
### Cleanup
|
|
@@ -158,7 +153,7 @@ const password = generateTestPassword(16)
|
|
|
158
153
|
Clear browser local storage.
|
|
159
154
|
|
|
160
155
|
```typescript
|
|
161
|
-
await clearLocalStorage(page)
|
|
156
|
+
await clearLocalStorage(page);
|
|
162
157
|
```
|
|
163
158
|
|
|
164
159
|
#### `clearCookies(page)`
|
|
@@ -166,7 +161,7 @@ await clearLocalStorage(page)
|
|
|
166
161
|
Clear browser cookies.
|
|
167
162
|
|
|
168
163
|
```typescript
|
|
169
|
-
await clearCookies(page)
|
|
164
|
+
await clearCookies(page);
|
|
170
165
|
```
|
|
171
166
|
|
|
172
167
|
### Screenshots
|
|
@@ -176,7 +171,7 @@ await clearCookies(page)
|
|
|
176
171
|
Take a screenshot with a custom name.
|
|
177
172
|
|
|
178
173
|
```typescript
|
|
179
|
-
await takeScreenshot(page, "error-state", true)
|
|
174
|
+
await takeScreenshot(page, "error-state", true);
|
|
180
175
|
```
|
|
181
176
|
|
|
182
177
|
## 🎨 Real-World Examples
|
|
@@ -184,43 +179,43 @@ await takeScreenshot(page, "error-state", true)
|
|
|
184
179
|
### Testing Chat Flow
|
|
185
180
|
|
|
186
181
|
```typescript
|
|
187
|
-
import { test } from "@playwright/test"
|
|
188
|
-
import { simulateInputPaste, waitForElement, wait } from "@chrryai/waffles"
|
|
182
|
+
import { test } from "@playwright/test";
|
|
183
|
+
import { simulateInputPaste, waitForElement, wait } from "@chrryai/waffles";
|
|
189
184
|
|
|
190
185
|
test("complete chat interaction", async ({ page }) => {
|
|
191
|
-
await page.goto("https://app.com/chat")
|
|
186
|
+
await page.goto("https://app.com/chat");
|
|
192
187
|
|
|
193
188
|
// Wait for chat to be ready
|
|
194
|
-
await waitForElement(page, '[data-testid="chat-textarea"]')
|
|
189
|
+
await waitForElement(page, '[data-testid="chat-textarea"]');
|
|
195
190
|
|
|
196
191
|
// Send message
|
|
197
|
-
await simulateInputPaste(page, "What's the weather?")
|
|
198
|
-
await page.click('[data-testid="send-button"]')
|
|
192
|
+
await simulateInputPaste(page, "What's the weather?");
|
|
193
|
+
await page.click('[data-testid="send-button"]');
|
|
199
194
|
|
|
200
195
|
// Wait for AI response
|
|
201
|
-
await wait(2000)
|
|
202
|
-
await waitForElement(page, ".ai-message")
|
|
203
|
-
})
|
|
196
|
+
await wait(2000);
|
|
197
|
+
await waitForElement(page, ".ai-message");
|
|
198
|
+
});
|
|
204
199
|
```
|
|
205
200
|
|
|
206
201
|
### Testing Authentication
|
|
207
202
|
|
|
208
203
|
```typescript
|
|
209
|
-
import { test } from "@playwright/test"
|
|
210
|
-
import { generateTestEmail, generateTestPassword, wait } from "@chrryai/waffles"
|
|
204
|
+
import { test } from "@playwright/test";
|
|
205
|
+
import { generateTestEmail, generateTestPassword, wait } from "@chrryai/waffles";
|
|
211
206
|
|
|
212
207
|
test("user registration", async ({ page }) => {
|
|
213
|
-
const email = generateTestEmail("newuser")
|
|
214
|
-
const password = generateTestPassword()
|
|
208
|
+
const email = generateTestEmail("newuser");
|
|
209
|
+
const password = generateTestPassword();
|
|
215
210
|
|
|
216
|
-
await page.goto("https://app.com/signup")
|
|
217
|
-
await page.fill('[name="email"]', email)
|
|
218
|
-
await page.fill('[name="password"]', password)
|
|
219
|
-
await page.click('button[type="submit"]')
|
|
211
|
+
await page.goto("https://app.com/signup");
|
|
212
|
+
await page.fill('[name="email"]', email);
|
|
213
|
+
await page.fill('[name="password"]', password);
|
|
214
|
+
await page.click('button[type="submit"]');
|
|
220
215
|
|
|
221
|
-
await wait(1000)
|
|
222
|
-
await expect(page).toHaveURL(/dashboard/)
|
|
223
|
-
})
|
|
216
|
+
await wait(1000);
|
|
217
|
+
await expect(page).toHaveURL(/dashboard/);
|
|
218
|
+
});
|
|
224
219
|
```
|
|
225
220
|
|
|
226
221
|
## 🤝 Contributing
|
package/package.json
CHANGED
|
@@ -1,27 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chrryai/waffles",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.74",
|
|
4
4
|
"description": "Production-ready Playwright testing utilities and helpers for modern web apps",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"testing",
|
|
6
|
+
"automation",
|
|
8
7
|
"e2e",
|
|
9
|
-
"
|
|
8
|
+
"playwright",
|
|
10
9
|
"test-helpers",
|
|
11
|
-
"
|
|
10
|
+
"test-utils",
|
|
11
|
+
"testing",
|
|
12
12
|
"typescript"
|
|
13
13
|
],
|
|
14
14
|
"homepage": "https://github.com/chrryai/waffles",
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/chrryai/waffles/issues"
|
|
17
17
|
},
|
|
18
|
+
"license": "AGPL-3.0",
|
|
19
|
+
"author": "Ibrahim Velinov",
|
|
18
20
|
"repository": {
|
|
19
21
|
"type": "git",
|
|
20
22
|
"url": "https://github.com/chrryai/waffles.git"
|
|
21
23
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
24
29
|
"sideEffects": false,
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"module": "./dist/index.mjs",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
25
33
|
"exports": {
|
|
26
34
|
".": {
|
|
27
35
|
"types": "./dist/index.d.ts",
|
|
@@ -29,14 +37,9 @@
|
|
|
29
37
|
"require": "./dist/index.js"
|
|
30
38
|
}
|
|
31
39
|
},
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"files": [
|
|
36
|
-
"dist",
|
|
37
|
-
"README.md",
|
|
38
|
-
"LICENSE"
|
|
39
|
-
],
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
40
43
|
"dependencies": {
|
|
41
44
|
"@faker-js/faker": "^9.3.0",
|
|
42
45
|
"@playwright/test": "^1.49.1",
|
|
@@ -55,10 +58,7 @@
|
|
|
55
58
|
"peerDependencies": {
|
|
56
59
|
"@playwright/test": "^1.40.0",
|
|
57
60
|
"react": "^18.0.0 || ^19.0.0",
|
|
58
|
-
"@chrryai/chrry": "2.2.
|
|
59
|
-
},
|
|
60
|
-
"publishConfig": {
|
|
61
|
-
"access": "public"
|
|
61
|
+
"@chrryai/chrry": "2.2.74"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "pnpm exec tsup",
|