search.html clipboard monitor, Anki add note Playwright tests #299
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tests for search.html's clipboard monitor and adding a note to Anki. Anki responses are mocked.
notes/questions:
The playwright manifest setup/teardown was added because I couldn't think of a way to use optional permissions - the permission popup would appear, and simply sit there until I either manually clicked it myself, or the test times out. Googling around, the best I could find were suspect hacks - e.g. simulating arrow key/enter clicks to hit OK on the popup. The solution I used might not be preferred, so explicitly pointing it out here.
There's a couple places where I felt the need to add a waitForTimeout; I couldn't find a behavior to wait on instead. Can try harder to find UI behavior to wait on if desired, but so far I wasn't able to find anything.
The current playwright config's
actionTimeout
is really long - would it be OK to just remove it (which would then default it to 10 seconds)? I haven't tested without it, but I can add in longer explicit timeouts wherever needed in place of it.Should audio download requests be mocked?
Can use less CSS locators if preferred.
The calls for toHaveScreenshot() in visual.spec.js seem to be causing the yomitan instance used by playwright to crash pretty often locally - don't personally have a fix for it or know for certain why.