Completed
Push — master ( 20b8ce...b87dd6 )
by Alexey
05:19
created

SignupCest::signupSuccessfully()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
namespace frontend\tests\functional;
3
4
use frontend\tests\FunctionalTester;
5
6
/**
7
 * Class SignupCest
8
 * @package frontend\tests\functional
9
 */
10
class SignupCest
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $formId = '#form-signup';
16
17
    /**
18
     * @param FunctionalTester $I
19
     */
20
    public function _before(FunctionalTester $I)
21
    {
22
        $I->amOnRoute('/users/default/signup');
23
    }
24
25
    /**
26
     * @param FunctionalTester $I
27
     */
28
    public function signupWithEmptyFields(FunctionalTester $I)
29
    {
30
        $I->see('Sign Up', 'h1');
31
        $I->see('Please fill in the following fields to sign up:');
32
        $I->submitForm($this->formId, []);
33
        $I->seeValidationError('Username cannot be blank.');
34
        $I->seeValidationError('Email cannot be blank.');
35
        $I->seeValidationError('Password cannot be blank.');
36
37
    }
38
39
    /**
40
     * @param FunctionalTester $I
41
     */
42
    public function signupWithWrongEmail(FunctionalTester $I)
43
    {
44
        $I->submitForm(
45
            $this->formId, [
46
            'SignupForm[username]'  => 'tester',
47
            'SignupForm[email]'     => 'ttttt',
48
            'SignupForm[password]'  => 'tester_password',
49
        ]
50
        );
51
        $I->dontSee('Username cannot be blank.', '.help-block');
52
        $I->dontSee('Password cannot be blank.', '.help-block');
53
        $I->see('Email is not a valid email address.', '.help-block');
54
    }
55
56
    /**
57
     * @param FunctionalTester $I
58
     */
59
    public function signupSuccessfully(FunctionalTester $I)
60
    {
61
        $I->submitForm($this->formId, [
62
            'SignupForm[username]' => 'testers',
63
            'SignupForm[email]' => '[email protected]',
64
            'SignupForm[password]' => '123456',
65
        ]);
66
67
        $I->see('It remains to activate your account.');
68
    }
69
}
70