PnotifyHelper   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A closeNotification() 0 23 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
use Codeception\Module\WebDriver;
14
15
class PnotifyHelper extends \Codeception\Module
16
{
17
    public function closeNotification(string $text): void
18
    {
19
        /** @var WebDriver $I */
20
        $I = $this->getModule('WebDriver');
21
        $I->waitForElement('.ui-pnotify', 180);
22
        $I->see($text, '.ui-pnotify');
23
        $I->moveMouseOver(['css' => '.ui-pnotify']);
24
        $I->wait(0.5);
25
        $I->executeJS(<<<JS
26
            const selector = "div.ui-pnotify-closer>span[title='Close']";
27
            const closeUntillItsDead = () => {
28
                const bttn = document.querySelector(selector);
29
                if (bttn) {
30
                    bttn.click();
31
                    setTimeout(closeUntillItsDead, 300);
32
                }
33
            };
34
            closeUntillItsDead();
35
           
36
JS
37
        );
38
        $I->waitForElementNotVisible('.ui-pnotify');
39
    }
40
}
41