Skip to content

Commit

Permalink
wpcept: fill user login field twice
Browse files Browse the repository at this point in the history
The first time it is filled, it sometimes isn't ready to receive the
keystrokes yet, and may end up as `dmin` instead of `admin`. Filling it
twice seems to avoid this, and prevent random test failures.

See WordPoints/wordpoints#526
  • Loading branch information
JDGrimes committed Jun 8, 2017
1 parent 3669f15 commit 6fcc958
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wpcept/includes/AcceptanceTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public function amLoggedInAsAdminOnPage( $page ) {
$this->amOnPage(
add_query_arg( 'redirect_to', rawurlencode( $page ), '/wp-login.php' )
);

$this->fillField( '#user_login', 'admin' );
$this->fillField( '#user_login', 'admin' );
$this->fillField( '#user_pass', 'password' );
$this->click( '#wp-submit' );
Expand Down Expand Up @@ -81,6 +83,8 @@ public function waitUntilElementInteractable( $element, $timeout = null ) {

} catch ( \Facebook\WebDriver\Exception\InvalidElementStateException $e ) {

} catch ( \Exception $e ) {

codecept_debug(
'Error while waiting for new reaction:' . $e->getMessage()
);
Expand Down

0 comments on commit 6fcc958

Please sign in to comment.