Closed akoskm closed 3 years ago
@akoskm
Hello,
We need to examine your "undo" logic in some example. Could you please share it with us? Also, make sure you are using the latest TestCafe version (1.14.2).
While I'm working on that, here's what happens in the app when I hit Cmd+Z:
{
id: 'undo',
label: 'Undo',
accelerator: 'CmdOrCtrl+Z',
enabled: false,
click: () => {
this.mainWindow.webContents.send('undo-request');
},
},
then this undo-request
is captured in my renderer:
const handleUndoRequest = () => {
if (!backstageVisible) {
canvas?.getCommandStack().undo();
ipcRenderer.send('command-stack-action', getCommandStackState());
}
};
ipcRenderer.on('undo-request', handleUndoRequest);
fun fact: while paused in the TestCafe debugger, if I hit Cmd+Z on my keyboard, Undo works.
Another fun fact: I tried hitting Cmd+Z while having a text field in focus. The first Cmd+Z did what it supposed to do, the second Cmd+Z entered the letter Z
in the input, and the third Cmd+Z entered another Z
in the input. 🤔
It seems to me like the meta modifier is active during the first keypress.
This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.
Please reopen this, this is still an issue.
Looking at https://github.com/DevExpress/testcafe-browser-provider-electron/issues/23, are shortcuts even supported with this plugin?
I can provide you more details and send private gists.
Big update on this:
when I go to the app's native menu and click Undo/Redo it triggers the correct function in my applications.
I did another test. Consider this simple keypress logger:
http://jsfiddle.net/3Lkujw71/5/
I put the same code in my electron app and here's how it turned out:
https://user-images.githubusercontent.com/3111627/122672193-8a5ece00-d1ca-11eb-8db7-7d45b8b13907.mov
they Key*
logs that you see are generated while I had the testcafe in "unlocked" state and I hit some keys.
What you see on the video is when I'm stepping through testcafe instructions that simulate a certain keypress. When this happens my event logger prints an ""
code to the console while the keyCode
is 122.
Thank you for the additional details. I reproduced the behavior you described. The e.code
parameter is empty because TestCafe does not currently emulate it. Thus, this issue duplicates the https://github.com/DevExpress/testcafe/issues/3146 feature request, so I'm closing it.
@VasilyStrelyaev thanks for the feedback! It seems to be a long-standing feature request. Is this something missing from TestCafe or this plugin?
@akoskm
Hello,
This is a TestCafe issue. We will examine your usage scenario while fixing the original TestCafe automation issue.
Thanks, @Farfurix this is awesome!
I subscribed to that issue!
Consecutive keypress of the same key combination doesn't seem to have the same effect. I have something like this in my test:
and the following menu structure in my application menu:
Here's what happens when I run the test:
debug()
I step over to the firstpressKey
pressKey
https://user-images.githubusercontent.com/3111627/118359075-09386980-b582-11eb-91e1-9b27a3505e91.mov
While paused at this point, if I press the key combination Cmd+Z on my keyboard, it executes the Undo command as it should.