In gui testing you might need to slow input down to human levels

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the testing category.

Last Updated: 2024-04-25

I had a browser test (Laravel Dusk) that was interacting within an iframe. It was supposed to type the credit card number "4242 4242 4242 4242" but it ended up with "4242 22 44 22 44".

I don't know what caused this weird spacing, but I do know the fix was to slow it down:

<? php

foreach (str_split('4242424242424242') as $char) {
  $browser->append('cardnumber', $char)->pause(100); 
}