@vitest/browser-playwright 5.0.0-beta.1 → 5.0.0-beta.2
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.js +12 -9
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseKeyDef, resolveScreenshotPath, defineBrowserProvider } from '@vitest/browser';
|
|
2
2
|
export { defineBrowserCommand } from '@vitest/browser';
|
|
3
3
|
import { createManualModuleSource } from '@vitest/mocker/node';
|
|
4
4
|
import c from 'tinyrainbow';
|
|
@@ -173,9 +173,9 @@ const basename = function(p, extension) {
|
|
|
173
173
|
// - locator('[data-vitest="true"]').contentFrame().getByRole('button')
|
|
174
174
|
// ⇓
|
|
175
175
|
// - getByRole('button')
|
|
176
|
-
function getDescribedLocator(context, selector) {
|
|
177
|
-
const
|
|
178
|
-
return typeof
|
|
176
|
+
function getDescribedLocator(context, { locator, selector }) {
|
|
177
|
+
const iframeLocator = context.iframe.locator(selector);
|
|
178
|
+
return typeof iframeLocator.describe === "function" ? iframeLocator.describe(locator) : iframeLocator;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
const clear = async (context, selector) => {
|
|
@@ -198,7 +198,7 @@ const tripleClick = async (context, selector, options = {}) => {
|
|
|
198
198
|
|
|
199
199
|
const dragAndDrop = async (context, source, target, options_) => {
|
|
200
200
|
const frame = await context.frame();
|
|
201
|
-
await frame.dragAndDrop(source, target, options_);
|
|
201
|
+
await frame.dragAndDrop(source.selector, target.selector, options_);
|
|
202
202
|
};
|
|
203
203
|
|
|
204
204
|
const fill = async (context, selector, text, options = {}) => {
|
|
@@ -540,7 +540,10 @@ async function takeScreenshot(context, name, options) {
|
|
|
540
540
|
path
|
|
541
541
|
};
|
|
542
542
|
}
|
|
543
|
-
const buffer = await getDescribedLocator(context,
|
|
543
|
+
const buffer = await getDescribedLocator(context, {
|
|
544
|
+
selector: "body",
|
|
545
|
+
locator: "locator('body')"
|
|
546
|
+
}).screenshot({
|
|
544
547
|
...options,
|
|
545
548
|
mask,
|
|
546
549
|
path: savePath,
|
|
@@ -627,14 +630,14 @@ const markTrace = async (context, payload) => {
|
|
|
627
630
|
if (!context.provider.tracingContexts.has(context.sessionId)) {
|
|
628
631
|
return;
|
|
629
632
|
}
|
|
630
|
-
const { name,
|
|
633
|
+
const { name, element, stack } = payload;
|
|
631
634
|
const location = parseLocation(context, stack);
|
|
632
635
|
// mark trace via group/groupEnd with dummy calls to force snapshot.
|
|
633
636
|
// https://github.com/microsoft/playwright/issues/39308
|
|
634
637
|
await context.context.tracing.group(name, { location });
|
|
635
638
|
try {
|
|
636
|
-
if (
|
|
637
|
-
const locator = getDescribedLocator(context,
|
|
639
|
+
if (element) {
|
|
640
|
+
const locator = getDescribedLocator(context, element);
|
|
638
641
|
if (typeof locator._expect === "function") {
|
|
639
642
|
await locator._expect("to.be.attached", {
|
|
640
643
|
isNot: false,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/browser-playwright",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.0-beta.
|
|
4
|
+
"version": "5.0.0-beta.2",
|
|
5
5
|
"description": "Browser running for Vitest using playwright",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"playwright": "*",
|
|
45
|
-
"vitest": "5.0.0-beta.
|
|
45
|
+
"vitest": "5.0.0-beta.2"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"playwright": {
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"tinyrainbow": "^3.1.0",
|
|
54
|
-
"@vitest/
|
|
55
|
-
"@vitest/
|
|
54
|
+
"@vitest/browser": "5.0.0-beta.2",
|
|
55
|
+
"@vitest/mocker": "5.0.0-beta.2"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"playwright": "^1.59.0",
|
|
59
|
-
"vitest": "5.0.0-beta.
|
|
59
|
+
"vitest": "5.0.0-beta.2"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "premove dist && pnpm rollup -c",
|