karate icon indicating copy to clipboard operation
karate copied to clipboard

[UI Tests] unknown character with capital letters in forms

Open Ranitzky opened this issue 2 years ago • 4 comments

Issue

When executing an UI Test on forms with capital letters, we receive warnings. The issue does not happen, when lower case characters are entered.

Files

myproject.zip

How to reproduce

Download linked file and execute tests with mvn clean test -Dtest=UiRunner

Feature: Capital letters

Scenario: Enter a password
  Given driver "https://the-internet.herokuapp.com/login"

  When input("#password", "ABC")

Actual Result

Log with warnings

10:14:12.107 [main] WARN  c.i.k.driver.chrome_1647422049068 - unknown character / key code: A
10:14:12.108 [main] DEBUG c.i.k.driver.chrome_1647422049068 - >> {"id":8,"sessionId":"57871B91768D3DB125313A6B485E536C","method":"Input.dispatchKeyEvent","params":{"modifiers":0,"type":"char","text":"A"}}
10:14:12.126 [nioEventLoopGroup-2-1] DEBUG c.i.k.driver.chrome_1647422049068 - << {"id":8,"result":{},"sessionId":"57871B91768D3DB125313A6B485E536C"}
10:14:12.127 [main] WARN  c.i.k.driver.chrome_1647422049068 - unknown character / key code: B
10:14:12.128 [main] DEBUG c.i.k.driver.chrome_1647422049068 - >> {"id":9,"sessionId":"57871B91768D3DB125313A6B485E536C","method":"Input.dispatchKeyEvent","params":{"modifiers":0,"type":"char","text":"B"}}
10:14:12.144 [nioEventLoopGroup-2-1] DEBUG c.i.k.driver.chrome_1647422049068 - << {"id":9,"result":{},"sessionId":"57871B91768D3DB125313A6B485E536C"}
10:14:12.144 [main] WARN  c.i.k.driver.chrome_1647422049068 - unknown character / key code: C
10:14:12.145 [main] DEBUG c.i.k.driver.chrome_1647422049068 - >> {"id":10,"sessionId":"57871B91768D3DB125313A6B485E536C","method":"Input.dispatchKeyEvent","params":{"modifiers":0,"type":"char","text":"C"}}
10:14:12.152 [nioEventLoopGroup-2-1] DEBUG c.i.k.driver.chrome_1647422049068 - << {"id":10,"result":{},"sessionId":"57871B91768D3DB125313A6B485E536C"}

Expectiation

No Warning logged

Ranitzky avatar Mar 16 '22 09:03 Ranitzky

@Ranitzky thank you very much for the way to replicate. it may take some time for me to get to this so I've tagged this as help wanted. do consider trying to investigate or if you can submit a PR that would be awesome. you can get some hints on what code to look at from this recent fix that I made: https://github.com/karatelabs/karate/commit/a61c3b3600582bd47d8f478b919283911014e351

ptrthomas avatar Mar 16 '22 10:03 ptrthomas

Just to add on to above issue : When I'm trying to run my code through jenkins, it won't accept capital letter and fail right away. While running locally, it throws warning and at least allow us to move further with test input. But while running through jenkins, it becomes a blocker. Test code : And input('#password', 'tESting2023', default_delay_input)

Failure logs:

20:45:37.258 [main] WARN c.intuit.karate.driver.DriverOptions - unknown character / key code: E 20:46:07.312 [main] ERROR c.intuit.karate.driver.DriverOptions - << timed out after milliseconds: 30000 - [id: 107, method: Runtime.evaluate, params: {"expression":"var e = document.querySelector("#password"); e.focus(); try { e.selectionStart = e.selectionEnd = e.value.length } catch(x) {}","returnByValue":true}] 20:46:07.323 [main] ERROR com.intuit.karate - classpath:features/login.feature:32 And input('#password', 'tESting2023', default_delay_input)

js failed: 01: input('#password', 'tESting2023', default_delay_input) <<<< org.graalvm.polyglot.PolyglotException: failed to get reply for: [id: 107, method: Runtime.evaluate, params: {"expression":"var e = document.querySelector("#password"); e.focus(); try { e.selectionStart = e.selectionEnd = e.value.length } catch(x) {}","returnByValue":true}]

  • com.intuit.karate.driver.DevToolsDriver.sendAndWait(DevToolsDriver.java:152)
  • com.intuit.karate.driver.DevToolsMessage.send(DevToolsMessage.java:216)
  • com.intuit.karate.driver.DevToolsMessage.send(DevToolsMessage.java:212)
  • com.intuit.karate.driver.DevToolsDriver.evalOnce(DevToolsDriver.java:252)
  • com.intuit.karate.driver.DevToolsDriver.eval(DevToolsDriver.java:260)
  • com.intuit.karate.driver.DevToolsDriver.eval(DevToolsDriver.java:256)
  • com.intuit.karate.driver.DevToolsDriver.input(DevToolsDriver.java:549)

classpath:features/login.feature:32 20:46:07.324 [nioEventLoopGroup-2-1] WARN c.intuit.karate.driver.DriverOptions - devtools error: [id: 108, error: {code=-32603, message=Internal error}] 20:46:07.326 [main] ERROR com.intuit.karate - classpath:features/login.feature:32 And input('#password', 'tESting2023', default_delay_input) scenario [run] failed null

swatisangwan avatar Mar 17 '22 20:03 swatisangwan

@swatisangwan please try adding a delay (for each keystroke) when using input() else, I will not be able to look into this without a way to replicate: https://github.com/karatelabs/karate/tree/master/karate-core#input - also try 1.2.0.RC5 because some fixes went into that. we need community support to resolve these issues faster

ptrthomas avatar Mar 18 '22 04:03 ptrthomas

@ptrthomas The above issues for warning with capital letters had been resolved with PR! cc: @Ranitzky

bipin-k avatar Jul 11 '22 09:07 bipin-k

1.3.0 released

ptrthomas avatar Nov 02 '22 17:11 ptrthomas