From bd58fd15d43b1e39c2f14d948b845e12de3991ac Mon Sep 17 00:00:00 2001 From: webzwo0i Date: Sat, 14 Nov 2020 17:18:42 +0100 Subject: [PATCH] simulate real keypress event --- tests/frontend/specs/alphabet.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/frontend/specs/alphabet.js b/tests/frontend/specs/alphabet.js index 5d16c983a..db8a00ae6 100644 --- a/tests/frontend/specs/alphabet.js +++ b/tests/frontend/specs/alphabet.js @@ -17,7 +17,12 @@ describe("All the alphabet works n stuff", function(){ // simulate key presses to delete content firstTextElement.sendkeys('{selectall}'); // select all firstTextElement.sendkeys('{del}'); // clear the first line - firstTextElement.sendkeys(expectedString); // insert the string + + let code; + for (let index = 0; index < expectedString.length; index++){ + code = expectedString.charCodeAt(index); + $(firstTextElement).trigger({type: 'keypress', which: code, keyCode: code, ctrlKey: false}); + } helper.waitFor(function(){ return inner$("div").first().text() === expectedString;