-
Notifications
You must be signed in to change notification settings - Fork 16
/
TableNavigationTab.php
47 lines (40 loc) · 1.38 KB
/
TableNavigationTab.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);
namespace Ibexa\AdminUi\Behat\Component;
use Ibexa\Behat\Browser\Component\Component;
use Ibexa\Behat\Browser\Element\Criterion\ElementTextFragmentCriterion;
use Ibexa\Behat\Browser\Locator\VisibleCSSLocator;
use PHPUnit\Framework\Assert;
class TableNavigationTab extends Component
{
public function getActiveTabName(): string
{
return $this->getHTMLPage()->find($this->getLocator('activeNavLink'))->getText();
}
public function goToTab(string $tabName): void
{
if ($this->getActiveTabName() == $tabName) {
return;
} else {
$tab = $this->getHTMLPage()->setTimeout(3)
->findAll($this->getLocator('navLink'))
->getByCriterion(new ElementTextFragmentCriterion($tabName));
$tab->click();
}
}
public function verifyIsLoaded(): void
{
Assert::assertTrue($this->getHTMLPage()->find($this->getLocator('activeNavLink'))->isVisible());
}
protected function specifyLocators(): array
{
return [
new VisibleCSSLocator('activeNavLink', '.ibexa-tabs__tab--active'),
new VisibleCSSLocator('navLink', '.ibexa-tabs__tab'),
];
}
}