@letsrunit/playwright 0.1.0 → 0.2.6
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/index.d.ts +3 -2
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +19 -9
- package/src/field/calendar.ts +1 -2
- package/src/field/native-select.ts +1 -2
- package/src/screenshot.ts +8 -1
- package/src/scrub-html.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letsrunit/playwright",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Playwright extensions and utilities for letsrunit",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"testing",
|
|
@@ -11,16 +11,25 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "https://github.com/letsrunit/letsrunit.git",
|
|
14
|
+
"url": "https://github.com/letsrunit-hq/letsrunit.git",
|
|
15
15
|
"directory": "packages/playwright"
|
|
16
16
|
},
|
|
17
|
-
"bugs": "https://github.com/letsrunit/letsrunit/issues",
|
|
18
|
-
"homepage": "https://github.com/letsrunit/letsrunit#readme",
|
|
19
|
-
"private": false,
|
|
17
|
+
"bugs": "https://github.com/letsrunit-hq/letsrunit/issues",
|
|
18
|
+
"homepage": "https://github.com/letsrunit-hq/letsrunit#readme",
|
|
20
19
|
"type": "module",
|
|
21
20
|
"main": "./dist/index.js",
|
|
22
21
|
"publishConfig": {
|
|
23
|
-
"access": "public"
|
|
22
|
+
"access": "public",
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"module": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
24
33
|
},
|
|
25
34
|
"files": [
|
|
26
35
|
"dist",
|
|
@@ -35,7 +44,7 @@
|
|
|
35
44
|
},
|
|
36
45
|
"packageManager": "yarn@4.10.3",
|
|
37
46
|
"dependencies": {
|
|
38
|
-
"@letsrunit/utils": "
|
|
47
|
+
"@letsrunit/utils": "0.2.6",
|
|
39
48
|
"@playwright/test": "^1.57.0",
|
|
40
49
|
"case": "^1.6.3",
|
|
41
50
|
"diff": "^8.0.3",
|
|
@@ -61,7 +70,8 @@
|
|
|
61
70
|
"exports": {
|
|
62
71
|
".": {
|
|
63
72
|
"types": "./dist/index.d.ts",
|
|
64
|
-
"import": "./dist/index.js"
|
|
73
|
+
"import": "./dist/index.js",
|
|
74
|
+
"default": "./dist/index.js"
|
|
65
75
|
}
|
|
66
76
|
}
|
|
67
|
-
}
|
|
77
|
+
}
|
package/src/field/calendar.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { isArray, isDate, isRange } from '@letsrunit/utils';
|
|
2
|
-
import { uniqueItem } from '@letsrunit/utils/src/array';
|
|
1
|
+
import { isArray, isDate, isRange, uniqueItem } from '@letsrunit/utils';
|
|
3
2
|
import type { Locator } from '@playwright/test';
|
|
4
3
|
import { formatDate, formatDateForInput, getMonthNames } from '../utils/date';
|
|
5
4
|
import { waitForAnimationsToFinish } from '../wait';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { isRange, type Scalar } from '@letsrunit/utils';
|
|
2
|
-
import { diffArray } from '@letsrunit/utils/src/array';
|
|
1
|
+
import { diffArray, isRange, type Scalar } from '@letsrunit/utils';
|
|
3
2
|
import type { Locator } from '@playwright/test';
|
|
4
3
|
import type { Loc, SetOptions, Value } from './types';
|
|
5
4
|
|
package/src/screenshot.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { hashKey } from '@letsrunit/utils';
|
|
2
|
-
import type { Page, PageScreenshotOptions } from '@playwright/test';
|
|
2
|
+
import type { LocatorScreenshotOptions, Page, PageScreenshotOptions } from '@playwright/test';
|
|
3
|
+
|
|
4
|
+
export async function screenshotElement(page: Page, selector: string, options?: LocatorScreenshotOptions): Promise<File> {
|
|
5
|
+
const buffer = await page.locator(selector).first().screenshot(options);
|
|
6
|
+
const filename = await hashKey('screenshot-{hash}.png', buffer);
|
|
7
|
+
|
|
8
|
+
return new File([new Uint8Array(buffer)], filename, { type: 'image/png' });
|
|
9
|
+
}
|
|
3
10
|
|
|
4
11
|
export async function screenshot(page: Page, options?: PageScreenshotOptions): Promise<File> {
|
|
5
12
|
const buffer = options?.mask?.length ? await screenshotWithMask(page, options) : await page.screenshot(options);
|
package/src/scrub-html.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// - Collapses whitespace in text nodes (but NOT inside <pre>/<code>)
|
|
7
7
|
// - Does NOT change tag names, does NOT unwrap containers, does NOT reorder content
|
|
8
8
|
|
|
9
|
-
import { memoize } from '@letsrunit/utils
|
|
9
|
+
import { memoize } from '@letsrunit/utils';
|
|
10
10
|
import type { Page } from '@playwright/test';
|
|
11
11
|
import stringify from 'fast-json-stable-stringify';
|
|
12
12
|
import { JSDOM } from 'jsdom';
|