fix: replace fill('') with keyboard select-all and backspace for clipboard paste setup#3297
Conversation
56b4243 to
667fa39
Compare
|
|
||
| const modifier = process.platform === 'darwin' ? 'Meta' : 'Control'; | ||
|
|
||
| await page.keyboard.press(`${modifier}+A`); |
There was a problem hiding this comment.
Is there a reason why this is needed?
Should add an inline comment for docs.
There was a problem hiding this comment.
In this test, we verify that the copied fields (id, status, timestamp, etc.) are the ones we expect. We do this by pasting the value into a text input and then checking it. Since we use the same input to verify different fields, we first need to delete the previously pasted value before pasting the next one.
I’m not sure why the fill suddenly stopped working, so this is a workaround for it.
There was a problem hiding this comment.
Added inline comments ✅
There was a problem hiding this comment.
could we not use navigator.clipboard.readText() as a more efficient way to read the clipboard?
https://stackoverflow.com/questions/72265518/how-to-access-the-clipboard-contents-using-playwright-in-typescript
There was a problem hiding this comment.
I tried that, had to add a different config and it only worked on chromium 😞
There was a problem hiding this comment.
i see. perhaps a page reload between each assertion would be less hacky to at least clear input state
There was a problem hiding this comment.
this feels like a really odd workaround for something that should be quite straightforward. can we rethink the approach please.
There was a problem hiding this comment.
@Ziinc I left some comments about this issue. I've also come up with a somewhat different approach — instead of relying on an already existing input, I create my own to test against and then remove it afterward. Let me know what you think.
667fa39 to
7021024
Compare
7021024 to
52fb425
Compare
…board paste setup
52fb425 to
b2222ea
Compare
…board paste setup (#3297) Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
No description provided.