Improving keyboard tests stability

I noticed that Keyboard tests are sometimes failing. 
This two small changes should improve stability of this test.