test: Add firefox support for playwright pasteInMonaco#1463
Merged
mattrunyon merged 1 commit intodeephaven:mainfrom Aug 28, 2023
Merged
test: Add firefox support for playwright pasteInMonaco#1463mattrunyon merged 1 commit intodeephaven:mainfrom
mattrunyon merged 1 commit intodeephaven:mainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1463 +/- ##
=======================================
Coverage 45.75% 45.75%
=======================================
Files 515 515
Lines 35073 35073
Branches 8784 8784
=======================================
Hits 16048 16048
Misses 18974 18974
Partials 51 51
Flags with carried forward coverage won't be shown. Click here to find out more. |
mofojed
approved these changes
Aug 28, 2023
7796cdc to
00781f7
Compare
mofojed
reviewed
Aug 28, 2023
Comment on lines
+111
to
+133
| const page = locator.page(); | ||
| const isMac = os.platform() === 'darwin'; | ||
| const modifier = isMac ? 'Meta' : 'Control'; | ||
|
|
||
| // Create a hidden textarea with the contents to paste | ||
| const inputId = await page.evaluate(async evalText => { | ||
| const tempInput = document.createElement('textarea'); | ||
| tempInput.id = 'super-secret-temp-input-id'; | ||
| tempInput.value = evalText; | ||
| tempInput.style.width = '0'; | ||
| tempInput.style.height = '0'; | ||
| document.body.appendChild(tempInput); | ||
| tempInput.select(); | ||
| return tempInput.id; | ||
| }, text); | ||
|
|
||
| // Copy the contents of the textarea which was selected above | ||
| await page.keyboard.press(`${modifier}+C`); | ||
|
|
||
| // Remove the textarea | ||
| await page.evaluate(id => { | ||
| document.getElementById(id)?.remove(); | ||
| }, inputId); |
Member
There was a problem hiding this comment.
Is this whole chunk only needed for firefox ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Doesn't seem to be a single solution that works in all 3 browsers in headless mode, but between 2 solutions we can cover pasting in all 3 browsers