Skip to content

Files

testing-dom__clipboard

Clipboard

Copy / paste text example

The widget to copy text is @github/clipboard-copy-element custom element that comes from github/github-elements

Copy / paste test

See the cypress/e2e/spec.cy.js file. The test currently work only in Electron where the clipboard permission is granted when Cypress starts it.

The page index.html shows the copy button on "mouseover" event. When the text is copied to the clipboard, it shows a tiny toast popup.

See the Mozilla Clipboard docs

Other browsers

Work in progress, mostly because the default permissions prompt the user to allow the page to access the clipboard.

Videos

We show how to test the clipboard access from Cypress in these videos: