@empiricalrun/playwright-utils 0.13.0 → 0.13.3

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.13.3
4
+
5
+ ### Patch Changes
6
+
7
+ - ef03473: fix: specify start time for `waitForEmail`
8
+
9
+ ## 0.13.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 73a40d9: fix: throw if captcha env var is missing
14
+
15
+ ## 0.13.1
16
+
17
+ ### Patch Changes
18
+
19
+ - 5882a20: feat: add inline master agent support
20
+
3
21
  ## 0.13.0
4
22
 
5
23
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/captcha/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAKxC,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,UAAU,GAAG,YAAY,CAAC;CACrC,CAAC;AAMF,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,mBAAiC,iBAe3C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/captcha/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAKxC,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,UAAU,GAAG,YAAY,CAAC;CACrC,CAAC;AAMF,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,mBAAiC,iBAmB3C"}
@@ -12,10 +12,14 @@ const defaultOpts = {
12
12
  async function solveRecaptcha(page, options = defaultOpts) {
13
13
  const { provider } = options;
14
14
  if (provider === "2captcha") {
15
+ const token = process.env.TWOCAPTCHA_API_KEY;
16
+ if (!token) {
17
+ throw new Error("Missing environment variable: TWOCAPTCHA_API_KEY");
18
+ }
15
19
  const rcPlugin = (0, puppeteer_extra_plugin_recaptcha_1.default)({
16
20
  provider: {
17
21
  id: "2captcha",
18
- token: process.env.TWOCAPTCHA_API_KEY,
22
+ token,
19
23
  },
20
24
  visualFeedback: true,
21
25
  });
@@ -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,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAIF,KAAK,kBAAkB,GAAG;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qBAAa,WAAW;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,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;CAkCjD"}
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,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAIF,KAAK,kBAAkB,GAAG;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qBAAa,WAAW;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,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
- }, { timeout: this.timeout });
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,
@@ -294,8 +294,7 @@ function reportFolderFromEnv() {
294
294
  }
295
295
  function getHtmlReportOptionProcessEnv() {
296
296
  // Note: PW_TEST_HTML_REPORT_OPEN is for backwards compatibility.
297
- // const htmlOpenEnv = process.env.PLAYWRIGHT_HTML_OPEN || process.env.PW_TEST_HTML_REPORT_OPEN;
298
- const htmlOpenEnv = false;
297
+ const htmlOpenEnv = process.env.PLAYWRIGHT_HTML_OPEN || process.env.PW_TEST_HTML_REPORT_OPEN;
299
298
  if (!htmlOpenEnv)
300
299
  return undefined;
301
300
  if (!isHtmlReportOption(htmlOpenEnv)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.13.0",
3
+ "version": "0.13.3",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"