Search code examples
automated-testskeypresse2e-testingweb-testingtestcafe

Does testcafe support pressKey("shift+enter")?


I am trying to test if pressing the shift+enter keys will result in a newline. I've checked the docs and they do not have this combination listed there; will this combination ever be added in or is it already there and I just missed it?


Solution

  • It depends on your editor implementation. If your editor uses a contenteditable element inside, then according to the documentation it supports only the following combinations: 'ctrl+a', 'backspace', 'delete', 'left' and 'right' (only if text within the element is selected).

    https://devexpress.github.io/testcafe/documentation/test-api/actions/press-key.html

    However, it should work fine with the textarea element.