@vitest/browser-playwright 4.0.9 → 4.0.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/README.md +1 -1
- package/dist/index.js +20 -12
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -45,4 +45,4 @@ Then run Vitest in the browser mode:
|
|
|
45
45
|
npx vitest --browser
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
[GitHub](https://github.com/vitest-dev/vitest/tree/main/packages/browser-playwright) | [Documentation](https://vitest.dev/
|
|
48
|
+
[GitHub](https://github.com/vitest-dev/vitest/tree/main/packages/browser-playwright) | [Documentation](https://vitest.dev/config/browser/playwright)
|
package/dist/index.js
CHANGED
|
@@ -514,7 +514,7 @@ async function takeScreenshot(context, name, options) {
|
|
|
514
514
|
}
|
|
515
515
|
const mask = options.mask?.map((selector) => context.iframe.locator(selector));
|
|
516
516
|
if (options.element) {
|
|
517
|
-
const { element: selector
|
|
517
|
+
const { element: selector, ...config } = options;
|
|
518
518
|
const element = context.iframe.locator(selector);
|
|
519
519
|
const buffer = await element.screenshot({
|
|
520
520
|
...config,
|
|
@@ -638,18 +638,23 @@ const annotateTraces = async ({ project }, { testId, traces }) => {
|
|
|
638
638
|
const vitest = project.vitest;
|
|
639
639
|
await Promise.all(traces.map((trace) => {
|
|
640
640
|
const entity = vitest.state.getReportedEntityById(testId);
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
641
|
+
const location = entity?.location ? {
|
|
642
|
+
file: entity.module.moduleId,
|
|
643
|
+
line: entity.location.line,
|
|
644
|
+
column: entity.location.column
|
|
645
|
+
} : undefined;
|
|
646
|
+
return vitest._testRun.recordArtifact(testId, {
|
|
647
|
+
type: "internal:annotation",
|
|
648
|
+
annotation: {
|
|
649
|
+
message: relative(project.config.root, trace),
|
|
650
|
+
type: "traces",
|
|
651
|
+
attachment: {
|
|
652
|
+
path: trace,
|
|
653
|
+
contentType: "application/octet-stream"
|
|
654
|
+
},
|
|
655
|
+
location
|
|
647
656
|
},
|
|
648
|
-
location
|
|
649
|
-
file: entity.module.moduleId,
|
|
650
|
-
line: entity.location.line,
|
|
651
|
-
column: entity.location.column
|
|
652
|
-
} : undefined
|
|
657
|
+
location
|
|
653
658
|
});
|
|
654
659
|
}));
|
|
655
660
|
};
|
|
@@ -956,6 +961,9 @@ class PlaywrightBrowserProvider {
|
|
|
956
961
|
};
|
|
957
962
|
if (this.project.config.browser.ui) {
|
|
958
963
|
options.viewport = null;
|
|
964
|
+
} else {
|
|
965
|
+
// if UI is disabled, keep the iframe scale to 1
|
|
966
|
+
options.viewport ??= this.project.config.browser.viewport;
|
|
959
967
|
}
|
|
960
968
|
const context = await browser.newContext(options);
|
|
961
969
|
await this._throwIfClosing(context);
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/browser-playwright",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.11",
|
|
5
5
|
"description": "Browser running for Vitest using playwright",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
8
|
-
"homepage": "https://vitest.dev/
|
|
8
|
+
"homepage": "https://vitest.dev/config/browser/playwright",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/vitest-dev/vitest.git",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"playwright": "*",
|
|
45
|
-
"vitest": "4.0.
|
|
45
|
+
"vitest": "4.0.11"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"playwright": {
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"tinyrainbow": "^3.0.3",
|
|
54
|
-
"@vitest/browser": "4.0.
|
|
55
|
-
"@vitest/mocker": "4.0.
|
|
54
|
+
"@vitest/browser": "4.0.11",
|
|
55
|
+
"@vitest/mocker": "4.0.11"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"playwright": "^1.56.1",
|
|
59
|
-
"vitest": "4.0.
|
|
59
|
+
"vitest": "4.0.11"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "premove dist && pnpm rollup -c",
|