2013-12-02 19:25:21 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace tests\_pages;
|
|
|
|
|
2013-12-17 07:27:33 +08:00
|
|
|
use yii\codeception\BasePage;
|
2013-12-02 19:25:21 +08:00
|
|
|
|
2013-12-17 07:27:33 +08:00
|
|
|
class LoginPage extends BasePage
|
|
|
|
{
|
2013-12-02 19:25:21 +08:00
|
|
|
public static $URL = '?r=site/login';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* login form username text field locator
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $username = 'input[name="LoginForm[username]"]';
|
|
|
|
/**
|
|
|
|
* login form password text field locator
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $password = 'input[name="LoginForm[password]"]';
|
|
|
|
/**
|
|
|
|
* login form submit button locator
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $button = 'button[type=submit]';
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param string $username
|
|
|
|
* @param string $password
|
|
|
|
*/
|
|
|
|
public function login($username, $password)
|
|
|
|
{
|
2013-12-17 07:27:33 +08:00
|
|
|
$this->guy->fillField($this->username, $username);
|
|
|
|
$this->guy->fillField($this->password, $password);
|
2013-12-02 19:25:21 +08:00
|
|
|
$this->guy->click($this->button);
|
|
|
|
}
|
|
|
|
}
|