Passed
Branch update-yii-dataview (d90e66)
by Wilmer
13:07
created

SignupAcceptanceCest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
eloc 41
c 2
b 0
f 0
dl 0
loc 73
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testRegisterUsernameExistData() 0 14 1
A testRegisterSuccess() 0 13 1
A testSignupPage() 0 7 1
A testRegisterEmptyData() 0 16 1
A testRegisterWrongPassword() 0 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Tests\Acceptance;
6
7
use App\Tests\AcceptanceTester;
8
9
final class SignupAcceptanceCest
10
{
11
    public function testSignupPage(AcceptanceTester $I): void
12
    {
13
        $I->amGoingTo('go to the register page.');
14
        $I->amOnPage('/signup');
15
16
        $I->expectTo('see register page.');
17
        $I->see('Signup');
18
    }
19
20
    public function testRegisterSuccess(AcceptanceTester $I): void
21
    {
22
        $I->amGoingTo('go to the register page.');
23
        $I->amOnPage('/signup');
24
25
        $I->fillField('#signup-login', 'admin');
26
        $I->fillField('#signup-password', '12345678');
27
        $I->fillField('#signup-passwordverify', '12345678');
28
29
        $I->click('Submit', '#signupForm');
30
31
        $I->expectTo('see register success message.');
32
        $I->see('Hello, everyone!');
33
    }
34
35
    public function testRegisterEmptyData(AcceptanceTester $I): void
36
    {
37
        $I->amGoingTo('go to the register page.');
38
        $I->amOnPage('/signup');
39
40
        $I->fillField('#signup-login', '');
41
        $I->fillField('#signup-password', '');
42
        $I->fillField('#signup-passwordverify', '');
43
44
        $I->click('Submit', '#signupForm');
45
46
        $I->expectTo('see registration register validation.');
47
        $I->see('Value cannot be blank');
48
        $I->see('Value cannot be blank');
49
        $I->see('Value cannot be blank');
50
        $I->seeElement('button', ['name' => 'register-button']);
51
    }
52
53
    public function testRegisterUsernameExistData(AcceptanceTester $I): void
54
    {
55
        $I->amGoingTo('go to the register page.');
56
        $I->amOnPage('/signup');
57
58
        $I->fillField('#signup-login', 'admin');
59
        $I->fillField('#signup-password', '12345678');
60
        $I->fillField('#signup-passwordverify', '12345678');
61
62
        $I->click('Submit', '#signupForm');
63
64
        $I->expectTo('see registration register validation.');
65
        $I->see('User with this login already exists');
66
        $I->seeElement('button', ['name' => 'register-button']);
67
    }
68
69
    public function testRegisterWrongPassword(AcceptanceTester $I): void
70
    {
71
        $I->amGoingTo('go to the register page.');
72
        $I->amOnPage('/signup');
73
74
        $I->fillField('#signup-login', 'admin1');
75
        $I->fillField('#signup-password', '12345678');
76
        $I->fillField('#signup-passwordverify', '12345');
77
78
        $I->click('Submit', '#signupForm');
79
80
        $I->expectTo('see registration register validation.');
81
        $I->see('Passwords do not match');
82
    }
83
}
84