Skip to content

Commit bcee516

Browse files
author
Tim McMackin
committed
Mock clipboard behavior
1 parent c5573e1 commit bcee516

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/playwright/site.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ test('navigation', async ({ page }) => {
1616
});
1717

1818
test('code copy buttons', async ({ page, context }) => {
19+
20+
await page.addInitScript(() => {
21+
let clipboard = '';
22+
23+
Object.defineProperty(navigator, 'clipboard', {
24+
configurable: false,
25+
writable: false,
26+
value: {
27+
writeText: async (text) => {
28+
clipboard = text;
29+
},
30+
readText: async () => clipboard,
31+
},
32+
});
33+
});
34+
1935
await context.grantPermissions(['clipboard-read']);
2036
await page.goto('https://docs.etherlink.com/get-started/network-information');
2137

0 commit comments

Comments
 (0)