-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLoginPage.php
More file actions
65 lines (55 loc) · 1.2 KB
/
LoginPage.php
File metadata and controls
65 lines (55 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* This file is part of the QA-Tools library.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @copyright Michael Iwersen <mi.iwersen@gmail.com>
* @link https://github.com/qa-tools/behat-example
*/
namespace QATools\Example\Pages;
use QATools\QATools\HtmlElements\Element\Form;
use QATools\QATools\HtmlElements\Element\TextBlock;
use QATools\QATools\HtmlElements\TypifiedPage;
/**
* Class LoginPage.
*
* @page-url('/')
* @url-match-full('/')
*/
class LoginPage extends TypifiedPage
{
/**
* The login form.
*
* @var Form
* @find-by('id' => 'login-form')
*/
public $loginForm;
/**
* The error label.
*
* @var TextBlock
* @find-by('css' => '.alert')
*/
public $errorPane;
/**
* Does the login.
*
* @param string $username The username.
* @param string $password The password.
* @param string $success The success page.
* @param string $failure The failure page.
*
* @return static
*/
public function login($username, $password)
{
$this->loginForm->fill(array(
'username' => $username,
'password' => $password,
));
$this->loginForm->submit();
return $this;
}
}