Completed
Pull Request — master (#51)
by
unknown
04:10
created

PressButtonHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A pressButton() 0 7 1
A waitForPageUpdate() 0 6 1
1
<?php
2
3
namespace hipanel\tests\_support\Helper;
4
5
class PressButtonHelper extends \Codeception\Module
6
{
7
    /**
8
     * @param $textOnButton
9
     * @throws \Codeception\Exception\ModuleException
10
     */
11
    public function pressButton($textOnButton): void
12
    {
13
        $I = $this->getModule('WebDriver');
14
15
        $I->click("//button[text() = '{$textOnButton}']");
16
        $this->waitForPageUpdate();
17
    }
18
19
    /**
20
     * @param int $timeOut
21
     * @throws \Codeception\Exception\ModuleException
22
     */
23
    public function waitForPageUpdate($timeOut = 60): void
24
    {
25
        $I = $this->getModule('WebDriver');
26
27
        $I->waitForJS("return $.active == 0;", $timeOut);
28
    }
29
}
30