-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
158 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?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\Behat\Browser\Element\Action; | ||
|
||
use Ibexa\Behat\Browser\Element\ElementInterface; | ||
|
||
interface ActionInterface | ||
{ | ||
public function execute(ElementInterface $element): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?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\Behat\Browser\Element\Action; | ||
|
||
use Ibexa\Behat\Browser\Element\ElementInterface; | ||
|
||
class ChainAction implements ActionInterface | ||
{ | ||
/** @var ActionInterface[] */ | ||
private array $actions; | ||
|
||
public function __construct(array $actions) | ||
{ | ||
$this->actions = $actions; | ||
} | ||
|
||
public function execute(ElementInterface $element): void | ||
{ | ||
foreach ($this->actions as $action) { | ||
$action->execute($element); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?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\Behat\Browser\Element\Action; | ||
|
||
use Ibexa\Behat\Browser\Element\ElementInterface; | ||
|
||
class Click implements ActionInterface | ||
{ | ||
public function execute(ElementInterface $element): void | ||
{ | ||
$element->click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?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\Behat\Browser\Element\Action; | ||
|
||
use Ibexa\Behat\Browser\Element\ElementInterface; | ||
|
||
class MouseOver implements ActionInterface | ||
{ | ||
public function execute(ElementInterface $element): void | ||
{ | ||
$element->mouseOver(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?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\Behat\Browser\Element\Action; | ||
|
||
use Ibexa\Behat\Browser\Element\ElementInterface; | ||
|
||
class MouseOverAndClick implements ActionInterface | ||
{ | ||
public function execute(ElementInterface $element): void | ||
{ | ||
$action = new ChainAction([ | ||
new MouseOver(), | ||
new Wait(50), | ||
new Click(), | ||
]); | ||
$action->execute($element); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?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\Behat\Browser\Element\Action; | ||
|
||
use Ibexa\Behat\Browser\Element\ElementInterface; | ||
|
||
class Wait implements ActionInterface | ||
{ | ||
private int $timeMilliseconds; | ||
|
||
public function __construct(int $timeMilliseconds) | ||
{ | ||
$this->timeMilliseconds = $timeMilliseconds; | ||
} | ||
|
||
public function execute(ElementInterface $element): void | ||
{ | ||
usleep(100 * $this->timeMilliseconds); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters