Testing Copy-to-Clipboard Buttons by Checking the Pasted Value
The article argues that a copy-to-clipboard test should verify the actual pasted content rather than relying on a 'Copied' confirmation message. It recommends defining the exact expected value, such as a complete public preview link, and checking that it is not a private address or stale string. Clipboard.writeText is described as resolving only after the write completes and possibly rejecting with NotAllowedError, so success messages should appear only after the operation succeeds. The author notes that a successful write confirms only the text was written, not that it is the correct link, and suggests comparing paste results in both a plain text field and the user's real destination. Clipboard correctness and access permissions are presented as separate checks within the same sharing workflow.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in