Completed
Push — master ( ea202b...86b0e9 )
by Dmitry
13:39
created

WaitHelper::waitForPageUpdate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * HiPanel core package
4
 *
5
 * @link      https://hipanel.com/
6
 * @package   hipanel-core
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2014-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\tests\_support\Helper;
12
13
class WaitHelper extends \Codeception\Module
14
{
15
    /**
16
     * @var int Default delay to wait while page updating
17
     */
18
    protected int $defaultDelay = 5;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
19
20
    /**
21
     * @param int $timeOut
22
     * @throws \Codeception\Exception\ModuleException
23
     */
24
    public function waitForPageUpdate($timeOut = 180): void
25
    {
26
        $I = $this->getModule('WebDriver');
27
28
        try {
29
            $I->waitForJS('return $.active == 0;', $timeOut);
30
        } catch (\Facebook\WebDriver\Exception\JavascriptErrorException $exception) {
31
            $I->wait($this->defaultDelay);
32
        }
33
    }
34
}
35