67 lines
2.1 KiB
PHP
67 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace LoretaAudit\Tests\DataSetup\Traits\App\Helpers;
|
|
|
|
/**
|
|
* Trait for common CMS Dialog interactions
|
|
*/
|
|
trait dialogTrait
|
|
{
|
|
public function openConfirmDialog(string $triggerSelector, bool $scrollIntoView = false): void
|
|
{
|
|
if ($scrollIntoView) {
|
|
$this->scrollElementIntoView($triggerSelector, self::CSS_SELECTOR);
|
|
}
|
|
|
|
$this->byCssSelector($triggerSelector)->click();
|
|
$this->waitUntilDomReadyState();
|
|
}
|
|
|
|
public function cmsConfirmDialogActionYes(bool $waitRemove = true): void
|
|
{
|
|
$this->cmsConfirmDialogTriggerActions('#confirmDialog .buttons a#buttonYes', $waitRemove);
|
|
}
|
|
|
|
public function cmsConfirmDialogActionCancel(): void
|
|
{
|
|
$this->cmsConfirmDialogTriggerActions('#confirmDialog .buttons a#buttonNo');
|
|
}
|
|
|
|
public function cmsConfirmDialogSliderActionYes(string $id = '#buttonYes'): void
|
|
{
|
|
$this->cmsConfirmDialogTriggerActions("#dialogSlider .buttons a$id");
|
|
}
|
|
|
|
public function cmsConfirmDialogSliderActionClose(): void
|
|
{
|
|
$this->cmsConfirmDialogTriggerActions('#dialogSlider div.header.section-heading > h3 > a');
|
|
}
|
|
|
|
|
|
public function cmsConfirmDialogTriggerActions($actionSelector, bool $waitRemove = true): void
|
|
{
|
|
$this->scrollIntoViewHoverClick($actionSelector, self::CSS_SELECTOR);
|
|
if ($waitRemove) {
|
|
$this->elementWaitRemoved($actionSelector, self::CSS_SELECTOR);
|
|
}
|
|
$this->waitUntilDomReadyState();
|
|
}
|
|
|
|
public function assertDialogSliderHeaderMessage(string $message): void
|
|
{
|
|
$this->assertSame($message, $this->byCssSelector('#dialogSlider div.header.section-heading > h3')->getText());
|
|
}
|
|
|
|
public function assertDialogSliderBodyMessage(string $message): void
|
|
{
|
|
$this->assertSame($message, $this->byCssSelector('#dialogSlider div.slider-wrapper > div div > h4')->getText());
|
|
}
|
|
|
|
public function assertDialogSliderBodyDescMessage(string $message): void
|
|
{
|
|
$this->assertSame($message, $this->byCssSelector('#dialogSlider div.slider-wrapper > div div > p')->getText());
|
|
}
|
|
}
|