Passed
Pull Request — master (#14)
by pablo
01:32
created

Password::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 17
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Pagantis\SeleniumFormUtils\Step;
4
5
use Facebook\WebDriver\WebDriverBy;
6
use Facebook\WebDriver\WebDriverExpectedCondition;
7
use Clearpay\Clearpay\Test\ClearpayMagentoTest;
0 ignored issues
show
Bug introduced by
The type Clearpay\Clearpay\Test\ClearpayMagentoTest was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
/**
10
 * Class Password
11
 *
12
 * @package Clearpay\SeleniumFormUtils\Step
13
 */
14
class Password extends AbstractStep
15
{
16
    /**
17
     * Handler step
18
     */
19
    const STEP = 'Password';
20
21
    const PASSWORD = 'P4gantis$';
22
23
    /**
24
     * Default message for errors
25
     */
26
    const ERROR = 'Parece que no ha funcionado';
27
28
    /**
29
     * First step Confirm retrieved data
30
     *
31
     * @param bool $rejected
32
     * @return bool
33
     * @throws \Exception
34
     */
35
    public function run($rejected = false)
36
    {
37
        //Wait after redirection
38
        $simulatorElementSearch = WebDriverBy::name('password');
39
        $condition  = WebDriverExpectedCondition::presenceOfElementLocated($simulatorElementSearch);
40
        $this->webDriver->wait()->until($condition);
41
42
        //Fill email
43
        $fillEmail = $this->webDriver->findElement($simulatorElementSearch)->clear()->sendKeys(self::PASSWORD);
0 ignored issues
show
Unused Code introduced by
The assignment to $fillEmail is dead and can be removed.
Loading history...
44
45
        //Click on confirm
46
        $formContinue = $this->webDriver->findElement(WebDriverBy::id('continueBtn'));
47
        $formContinue->click();
48
49
        sleep(5);
50
51
        return true;
52
    }
53
}
54