@test2doc/playwright 0.12.0 → 0.12.1
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 +48 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -427,3 +427,51 @@ export default defineConfig({
|
|
|
427
427
|
...
|
|
428
428
|
})
|
|
429
429
|
```
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
#### Highlight multiple elements
|
|
433
|
+
In the event that you need to highlight multiple elements, you can pass in an array with `MultiLocatorScreenshot` objects.
|
|
434
|
+
|
|
435
|
+
The `MultiLocatorScreenshot` has 2 keys, `target`, a Playwright Locator, and options, which is a combination of `PageScreenshotOptions` and Annotation options.
|
|
436
|
+
|
|
437
|
+
**Note:** Only the first item in the array will be attempted to scroll into view.
|
|
438
|
+
|
|
439
|
+
```ts
|
|
440
|
+
test.describe(withDocMeta("describe block"), async () => {
|
|
441
|
+
test("test block", async ({ page }, testInfo) => {
|
|
442
|
+
...
|
|
443
|
+
test.step("step block", async () => {
|
|
444
|
+
await page.goto("http://localhost:5173/")
|
|
445
|
+
|
|
446
|
+
await screenshot(
|
|
447
|
+
testInfo,
|
|
448
|
+
[
|
|
449
|
+
{
|
|
450
|
+
target: page.getByRole(
|
|
451
|
+
"header", { name: "Page Title" }
|
|
452
|
+
),
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
target: page.getByRole(
|
|
456
|
+
"aside", { name: "Sidebar" }
|
|
457
|
+
),
|
|
458
|
+
options: {
|
|
459
|
+
annotation: {
|
|
460
|
+
text: "Sidebar Element",
|
|
461
|
+
position: "left",
|
|
462
|
+
showArrow: true,
|
|
463
|
+
arrowStrokeStyle: "red",
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
},
|
|
467
|
+
],
|
|
468
|
+
{
|
|
469
|
+
// Values applied to all annotations
|
|
470
|
+
annotation: {
|
|
471
|
+
font: "14px 'Times New Roman', Times, serif"
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
)
|
|
475
|
+
})
|
|
476
|
+
})
|
|
477
|
+
```
|