Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write a test for clipboard copy on CSS page #103

Closed
masakudamatsu opened this issue Apr 13, 2020 · 2 comments
Closed

Write a test for clipboard copy on CSS page #103

masakudamatsu opened this issue Apr 13, 2020 · 2 comments
Labels

Comments

@masakudamatsu
Copy link
Owner

masakudamatsu commented Apr 13, 2020

TODO: at least try to test if the Clipboard API is called by clicking the copy button.

  • I'm not sure how to mock an API function inside the function defined in a React Component, rather than imported from a module or as a prop.

Cypress doesn't support the access to the clipboard content.

Maybe feasible as a component test by using the Clipboard API.

We also need to test if the error message is shown after failing to copy into clipboard.

@masakudamatsu
Copy link
Owner Author

In the component test, using the navigator.clipboard.readText() does not allow us to access to the content of the clipboard.

We need to figure out an alternative.

@masakudamatsu
Copy link
Owner Author

We disable the copy button when Clipboard API and its fallback fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant