Add support for testing the clipboard in the WPT-framework
Categories
(Testing :: web-platform-tests, enhancement, P2)
Tracking
(Not tracked)
People
(Reporter: mbrodesser-Igalia, Unassigned)
References
(Blocks 1 open bug)
Details
This can be read as an introduction.
Currently, the clipboard isn't testable in WPT. Also not for mozilla-only tests using SpecialPowers
. The latter, because SpecialPowers.getClipboardData
uses custom code to retrieve data from the clipboard.
In order to be able to write WPT reading from the clipboard and writing to it, there are two potential options:
- Use
execCommand("paste")
andexecCommand("copy")
. - Use the asynchronous clipboard API and the permissions API.
1) requires permissions using the web-extension permissions clipboardRead
and clipboardWrite
. Currently, they are presumably not conveniently accessible from WPT. See this mochitest.
2) requires passing clipboard-read
and clipboard-write
(note the difference to 1)) to the permissions API. The latter apparently isn't implemented in Gecko. Moreover, navigator.clipboard.read()
and navigator.clipboard.write()
are required, but not implemented in Gecko.
As long as neither 1) nor 2) are conveniently useable, clipboard tests are likely to be written as Mochitests.
Follow-ups should be:
- Improving the test-coverage of the clipboard.
- Transforming Mochitests testing the clipboard to WPT.
Reporter | ||
Updated•4 years ago
|
Comment 1•4 years ago
|
||
There are some other options here like having a WebDriver endpoint specifically for clipboard access (this could be limited in some way so that it would only allow access to things copied in the same WebDriver session or so).
Reporter | ||
Comment 2•4 years ago
|
||
Some notes from :annevk, for the record:
"Note that we don't plan to support clipboard-write (or clipboard-read), I don't think we really need either to support read() and write()"
"I think for paste we should do what Safari should does. Which is that it works with a user gesture + the user selecting "Paste" from the single-item menu that appears and the read and write APIs can be the same, essentially"
Comment 3•2 years ago
|
||
The easiest thing here is probably to have a way (e.g. a WebDriver command) to auto-accept the user gesture for tests.
Description
•