SignupAcceptanceCest::testSignupPage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Tests\Acceptance;
6
7
use App\Tests\Support\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('Login cannot be blank.');
48
        $I->see('Password cannot be blank.');
49
        $I->see('Password must contain at least 8 characters.');
50
        $I->see('Confirm password cannot be blank.');
51
        $I->seeElement('button', ['name' => 'register-button']);
52
    }
53
54
    public function testRegisterUsernameExistData(AcceptanceTester $I): void
55
    {
56
        $I->amGoingTo('go to the register page.');
57
        $I->amOnPage('/signup');
58
59
        $I->fillField('#signup-login', 'admin');
60
        $I->fillField('#signup-password', '12345678');
61
        $I->fillField('#signup-passwordverify', '12345678');
62
63
        $I->click('Submit', '#signupForm');
64
65
        $I->expectTo('see registration register validation.');
66
        $I->see('User with this login already exists');
67
        $I->seeElement('button', ['name' => 'register-button']);
68
    }
69
70
    public function testRegisterWrongPassword(AcceptanceTester $I): void
71
    {
72
        $I->amGoingTo('go to the register page.');
73
        $I->amOnPage('/signup');
74
75
        $I->fillField('#signup-login', 'admin1');
76
        $I->fillField('#signup-password', '12345678');
77
        $I->fillField('#signup-passwordverify', '12345');
78
79
        $I->click('Submit', '#signupForm');
80
81
        $I->expectTo('see registration register validation.');
82
        $I->see('Passwords do not match');
83
    }
84
}
85