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

PressButtonHelper::pressButton()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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