Skip to content

test: Add firefox support for playwright pasteInMonaco#1463

Merged
mattrunyon merged 1 commit intodeephaven:mainfrom
mattrunyon:paste-in-monaco-all-browsers
Aug 28, 2023
Merged

test: Add firefox support for playwright pasteInMonaco#1463
mattrunyon merged 1 commit intodeephaven:mainfrom
mattrunyon:paste-in-monaco-all-browsers

Conversation

@mattrunyon
Copy link
Copy Markdown
Collaborator

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

@mattrunyon mattrunyon requested a review from mofojed August 27, 2023 21:26
@mattrunyon mattrunyon self-assigned this Aug 27, 2023
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 27, 2023

Codecov Report

Merging #1463 (00781f7) into main (ee1cd54) will not change coverage.
The diff coverage is n/a.

@@           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           
Flag Coverage Δ
unit 45.75% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@mattrunyon mattrunyon force-pushed the paste-in-monaco-all-browsers branch from 7796cdc to 00781f7 Compare August 28, 2023 14:14
@mattrunyon mattrunyon merged commit 6ff27a6 into deephaven:main Aug 28, 2023
@mattrunyon mattrunyon deleted the paste-in-monaco-all-browsers branch August 28, 2023 14:55
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 28, 2023
Comment thread tests/utils.ts
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);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this whole chunk only needed for firefox ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants