示例#1
0
 /**
  * Вход в учетную запись по логину и паролю
  *
  * В этом методе заполняются поля: логин и пароль, после чего нажимается кнопка "Вход"
  *
  * @param string $username Имя пользователя
  * @param string $password Пароль учетной записи
  *
  * @Given /^я вхожу в учетную запись с именем "([^"]*)" и паролем "([^"]*)"$/
  */
 public function login($username, $password)
 {
     $this->minkContext->visit('/login');
     $this->minkContext->fillField('username', $username);
     $this->minkContext->fillField('password', $password);
     $this->minkContext->pressButton('Войти');
 }
 /**
  * @Given I log in as an admin
  */
 public function ILogInAsAnAdmin()
 {
     $this->minkContext->visit('wp-login.php');
     $this->minkContext->fillField('log', getenv('WORDPRESS_ADMIN_USERNAME'));
     $this->minkContext->fillField('pwd', getenv('WORDPRESS_ADMIN_PASSWORD'));
     $this->minkContext->pressButton('wp-submit');
     $this->minkContext->assertPageAddress("wp-admin/");
 }
示例#3
0
 /**
  * Presses button with specified id|name|title|alt|value.
  *
  * @When I press the :button button
  */
 public function pressButton($button)
 {
     // Wait for any open autocomplete boxes to finish closing.  They block
     // form-submission if they are still open.
     // Use a step 'I press the "Esc" key in the "LABEL" field' to close
     // autocomplete suggestion boxes with Mink.  "Click" events on the
     // autocomplete suggestion do not work.
     try {
         $this->getSession()->wait(1000, 'typeof(jQuery)=="undefined" || jQuery("#autocomplete").length === 0');
     } catch (UnsupportedDriverActionException $e) {
         // The jQuery probably failed because the driver does not support
         // javascript.  That is okay, because if the driver does not support
         // javascript, it does not support autocomplete boxes either.
     }
     // Use the Mink Extension step definition.
     return parent::pressButton($button);
 }