@empiricalrun/playwright-utils 0.13.2 → 0.13.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.
- package/CHANGELOG.md +13 -0
- package/README.md +14 -0
- package/dist/email.d.ts.map +1 -1
- package/dist/email.js +7 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.13.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [2f520d3]
|
|
8
|
+
- @empiricalrun/r2-uploader@0.2.0
|
|
9
|
+
|
|
10
|
+
## 0.13.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- ef03473: fix: specify start time for `waitForEmail`
|
|
15
|
+
|
|
3
16
|
## 0.13.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -58,3 +58,17 @@ const email = await client.waitForEmail();
|
|
|
58
58
|
// Get login OTP
|
|
59
59
|
const loginCode = email.codes[0];
|
|
60
60
|
```
|
|
61
|
+
|
|
62
|
+
#### Add reporter
|
|
63
|
+
|
|
64
|
+
To use the custom HTML reporter, add the following to your Playwright config:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { defineConfig } from "@playwright/test";
|
|
68
|
+
import { baseConfig } from "@empiricalrun/playwright-utils";
|
|
69
|
+
|
|
70
|
+
export default defineConfig({
|
|
71
|
+
...baseConfig,
|
|
72
|
+
...
|
|
73
|
+
});
|
|
74
|
+
```
|
package/dist/email.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,WAAW,CAAC;AAGxC,KAAK,IAAI,GAAG;IACV,IAAI,CAA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,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,SAAc;gBAEV,IAAI,GAAE,kBAAuB;IAWzC,UAAU;IAIJ,YAAY,IAAI,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;CAwCjD"}
|
package/dist/email.js
CHANGED
|
@@ -24,10 +24,16 @@ class EmailClient {
|
|
|
24
24
|
return this.address;
|
|
25
25
|
}
|
|
26
26
|
async waitForEmail() {
|
|
27
|
+
const now = new Date();
|
|
28
|
+
const bufferPeriod = 5000;
|
|
29
|
+
const receivedAfter = new Date(now.getTime() - bufferPeriod);
|
|
27
30
|
try {
|
|
28
31
|
const email = await this.client.messages.get(this.serverId, {
|
|
29
32
|
sentTo: this.address,
|
|
30
|
-
}, {
|
|
33
|
+
}, {
|
|
34
|
+
timeout: this.timeout,
|
|
35
|
+
receivedAfter,
|
|
36
|
+
});
|
|
31
37
|
const codesAsString = (email.html?.codes || []).map((code) => code.value);
|
|
32
38
|
return {
|
|
33
39
|
subject: email.subject,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/playwright-utils",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"playwright-extra": "^4.3.6",
|
|
40
40
|
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
|
41
41
|
"@empiricalrun/llm": "^0.9.1",
|
|
42
|
-
"@empiricalrun/r2-uploader": "^0.
|
|
42
|
+
"@empiricalrun/r2-uploader": "^0.2.0"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"dev": "tsc --build --watch",
|