@empiricalrun/playwright-utils 0.19.8 → 0.19.11

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,28 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.19.11
4
+
5
+ ### Patch Changes
6
+
7
+ - 55a70ee: fix: revert to old version of playwright
8
+ - Updated dependencies [55a70ee]
9
+ - @empiricalrun/test-gen@0.42.3
10
+
11
+ ## 0.19.10
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [87743d9]
16
+ - @empiricalrun/test-gen@0.42.2
17
+
18
+ ## 0.19.9
19
+
20
+ ### Patch Changes
21
+
22
+ - 533df57: docs: for fixture methods in playwright-utils
23
+ - Updated dependencies [ce2b8c7]
24
+ - @empiricalrun/test-gen@0.42.1
25
+
3
26
  ## 0.19.8
4
27
 
5
28
  ### Patch Changes
package/docs/email.md CHANGED
@@ -1,8 +1,8 @@
1
- ## Email automation
1
+ # Email automation
2
2
 
3
- ### Example usage
3
+ ## Example usage
4
4
 
5
- #### Dynamic email
5
+ ### Dynamic email
6
6
 
7
7
  This dynamically generates a random email address that can
8
8
  be used for the test (e.g. invite a new user).
@@ -24,7 +24,7 @@ expect(
24
24
  ).toBeTruthy();
25
25
  ```
26
26
 
27
- #### Static email
27
+ ### Static email
28
28
 
29
29
  This uses a known (static) email that can be used to login
30
30
  into an application.
@@ -0,0 +1,55 @@
1
+ # Fixtures
2
+
3
+ The playwright-utils package provides fixtures that wrap around Playwright's built-in
4
+ `page`, `context` fixtures to provide a mouse highlighter (which makes it easier to
5
+ see actions taken in a video).
6
+
7
+ To use this, you probably just want to use the `baseTestFixture` import and use it in your
8
+ fixtures file.
9
+
10
+ ```ts
11
+ import { test as base, Page } from "@playwright/test";
12
+ import { baseTestFixture } from "@empiricalrun/playwright-utils/test";
13
+
14
+ export const test = baseTestFixture(base);
15
+ export const expect = test.expect;
16
+ ```
17
+
18
+ The packages also expose methods to enable advanced use-cases.
19
+
20
+ ## Get a new browser context
21
+
22
+ This package provides a fixture `customContextPageProvider` which is a good way to create
23
+ a fresh, new browser context, and a page inside it.
24
+
25
+ There are two benefits of using this to create contexts or pages:
26
+ 1. Videos get recorded and attached to the test report
27
+ 2. Mouse highlights are available
28
+
29
+ ```ts
30
+ import { test, expect } from "./fixtures";
31
+
32
+ test("Example test", async ({ page: builtInPage, customContextPageProvider }) => {
33
+ // builtInPage is from default browser context
34
+ const { page: newPage, context } = await customContextPageProvider();
35
+ // newPage is from this other browser context
36
+ });
37
+ ```
38
+
39
+ ## Inject mouse highlighter manually
40
+
41
+ In some cases, you want to inject mouse highlights to a page. This is useful if the test
42
+ requires `launchPersistentContext`, which means the browser context is created manually.
43
+
44
+ With `injectLocatorHighlightScripts`, you can still get mouse highlights in any page.
45
+
46
+ ```ts
47
+ import { injectLocatorHighlightScripts, baseTestFixture } from "@empiricalrun/playwright-utils/test";
48
+
49
+ export const test = baseTestFixture(base).extend<TestOptions>({
50
+ customPage: async ({ page }, use) => {
51
+ injectLocatorHighlightScripts(page);
52
+ await use(page);
53
+ },
54
+ });
55
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.19.8",
3
+ "version": "0.19.11",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "author": "Empirical Team <hey@empirical.run>",
24
24
  "devDependencies": {
25
- "@playwright/test": "1.49.1",
25
+ "@playwright/test": "1.47.1",
26
26
  "@types/async-retry": "^1.4.8",
27
27
  "@types/babel__code-frame": "^7.0.6",
28
28
  "@types/console-log-level": "^1.4.5",
@@ -37,12 +37,12 @@
37
37
  "mailosaur": "^8.6.1",
38
38
  "md5": "^2.3.0",
39
39
  "mime": "3.0.0",
40
- "playwright-core": "1.49.1",
40
+ "playwright-core": "1.47.1",
41
41
  "puppeteer-extra-plugin-recaptcha": "^3.6.8",
42
42
  "rimraf": "^6.0.1",
43
43
  "@empiricalrun/llm": "^0.9.29",
44
- "@empiricalrun/test-gen": "^0.42.0",
45
- "@empiricalrun/r2-uploader": "^0.3.8"
44
+ "@empiricalrun/r2-uploader": "^0.3.8",
45
+ "@empiricalrun/test-gen": "^0.42.3"
46
46
  },
47
47
  "scripts": {
48
48
  "dev": "tsc --build --watch",