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

[Bug]: Copy content with Meta+A and Meta+C #12000

Closed
aslushnikov opened this issue Feb 10, 2022 · 1 comment · Fixed by #10828 or #15577
Closed

[Bug]: Copy content with Meta+A and Meta+C #12000

aslushnikov opened this issue Feb 10, 2022 · 1 comment · Fixed by #10828 or #15577

Comments

@aslushnikov
Copy link
Contributor

Discussed in https://github.com/microsoft/playwright/discussions/11930

Originally posted by saguilarolmo February 8, 2022
I'm doing a test where I have to simulate the user's action when doing ctrl+A (a paragraph is automatically selected) and then ctrl+C to check that the content of the clipboard is the same as the selected text.
To do this, I have tried to do this:

const codeText = await this.page.codeText.innerText()
  await this.page.context().grantPermissions(["clipboard-write"])
  await this.page.codeText.focus()

  await this.page.keyboard.press("Control+A")
  await this.page.keyboard.press("Control+C")
...

This test works when I run it inside a docker container using Linux.

The problem is when I try to run this same test in a macOS environment. To do so, the only thing that changes is Control+A for Meta+A and the same for C.

const codeText = await this.page.codeText.innerText()
  await this.page.context().grantPermissions(["clipboard-write"])
  await this.page.codeText.focus()

  await this.page.keyboard.press("Meta+A")
  await this.page.keyboard.press("Meta+C")
...

I have checked that Meta+A selects the text correctly, but Meta+C does not save the selected content to the clipboard.

Is there a reason for this or is it a bug?

@aslushnikov
Copy link
Contributor Author

aslushnikov commented Feb 28, 2022

For the record: copy shortcut does not work:

  • WebKit WPE
  • WebKit on MacOS (at least headless)

Requires further investigation

For the record number 2: Undo shortcut does not work:

  • WebKit WPE && GTK

aslushnikov added a commit that referenced this issue Feb 28, 2022
It's a straightforward change to support new, common, keyboard commands

Note that I've tested this locally with Chrome on my Mac but it seems that CI doesn't want to pass Chrome tests - it's running on ubuntu though. Does this mean that I should introduce per-platform editing commands? At the moment there is only a single [`macEditingCommands`](https://github.com/microsoft/playwright/blob/0ed33522c572b974905f642408050d007860e33e/packages/playwright-core/src/server/macEditingCommands.ts) file.

References #12000

Co-authored-by: Andrey Lushnikov <aslushnikov@gmail.com>
@aslushnikov aslushnikov reopened this Feb 28, 2022
@mxschmitt mxschmitt changed the title bug: Copy content with Meta+A and Meta+C [Bug]: Copy content with Meta+A and Meta+C Jun 22, 2022
yury-s added a commit that referenced this issue Jul 5, 2022
…#15390)

This is what WebPageProxy::executeEditCommand does via WebPageProxy::willPerformPasteCommand.

Refs: #8114, #12000
Pretty-diff: yury-s/WebKit@4213f02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant