AbstractRegister   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 47
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A goToAccountPage() 0 8 1
A openOsCommerce() 0 11 1
A goToAccountCreate() 0 8 1
1
<?php
2
3
namespace Test\Register;
4
5
use Facebook\WebDriver\WebDriverBy;
6
use Facebook\WebDriver\WebDriverExpectedCondition;
7
use Test\PagantisOscommerceTest;
8
9
/**
10
 * Class AbstractRegister
11
 * @package Test\Register
12
 */
13
abstract class AbstractRegister extends PagantisOscommerceTest
14
{
15
    /**
16
     * Success message
17
     */
18
    const SUCCESS_MESSAGE = '¡Su cuenta ha sido creada!';
19
20
    /**
21
     * OpenOsCommerce page
22
     */
23
    public function openOsCommerce()
24
    {
25
        $this->webDriver->get(self::OSCURL);
26
27
        $this->webDriver->wait(10, 500)->until(
28
            WebDriverExpectedCondition::titleContains(
29
                self::TITLE
30
            )
31
        );
32
33
        $this->assertEquals(self::TITLE, $this->webDriver->getTitle());
34
    }
35
36
    /**
37
     * Go to my account page
38
     */
39
    public function goToAccountPage()
40
    {
41
        $myAccountSearch = WebDriverBy::id('tdb3');
42
        $condition = WebDriverExpectedCondition::visibilityOfElementLocated($myAccountSearch);
43
        $this->waitUntil($condition);
44
        $myAccountElement = $this->webDriver->findElement($myAccountSearch);
45
        $this->webDriver->executeScript("arguments[0].scrollIntoView(true);", array($myAccountElement));
46
        $myAccountElement->click();
47
    }
48
49
    /**
50
     * Go To account create
51
     */
52
    public function goToAccountCreate()
53
    {
54
        $myAccountSearch = WebDriverBy::id('tdb2');
55
        $condition = WebDriverExpectedCondition::visibilityOfElementLocated($myAccountSearch);
56
        $this->waitUntil($condition);
57
        $myAccountElement = $this->webDriver->findElement($myAccountSearch);
58
        $this->webDriver->executeScript("arguments[0].scrollIntoView(true);", array($myAccountElement));
59
        $myAccountElement->click();
60
    }
61
}
62