Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

feat(electron): add a test for clipboard access (#2606)

Pavel Feldmancc84506cbb0f
diff --git a/test/electron/electron.spec.js b/test/electron/electron.spec.js
index 2daa01a3e1..b5fe8fe136 100644
--- a/test/electron/electron.spec.js
+++ b/test/electron/electron.spec.js
@@ -108,6 +108,12 @@ describe('Electron', function() {
const window = await application.firstWindow();
expect(await window.title()).toBe('Hello World!');
});
+ it('should have a clipboard instance', async ({ application }) => {
+ const clipboardContentToWrite = 'Hello from Playwright';
+ await application.evaluate(async ({clipboard}, text) => clipboard.writeText(text), clipboardContentToWrite);
+ const clipboardContentRead = await application.evaluate(async ({clipboard}) => clipboard.readText());
+ await expect(clipboardContentRead).toEqual(clipboardContentToWrite);
+ });
});
describe('Electron per window', function() {