mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-05 20:57:12 +00:00
Merge 0d0a5c7096 into f2914c3200
This commit is contained in:
commit
cf900bf2d0
119 changed files with 463 additions and 832 deletions
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Behaviour;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
|
||||
trait ChecksCodeImmutability
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Behaviour;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
|
||||
trait CountsChannelBasedErrors
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Behaviour;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
|
||||
trait Toggles
|
||||
{
|
||||
|
|
|
|||
60
src/Sylius/Behat/Behaviour/WaitsForElements.php
Normal file
60
src/Sylius/Behat/Behaviour/WaitsForElements.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Sylius Sp. z o.o.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Behat\Behaviour;
|
||||
|
||||
use Behat\Mink\Driver\PantherDriver;
|
||||
use Behat\Mink\Driver\Selenium2Driver;
|
||||
use DMore\ChromeDriver\ChromeDriver;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
|
||||
trait WaitsForElements
|
||||
{
|
||||
protected function getElement(string $name, array $parameters = []): NodeElement
|
||||
{
|
||||
if ($this->isJavascript()) {
|
||||
$this->waitForPageToLoad();
|
||||
}
|
||||
|
||||
return new NodeElement(parent::getElement($name, $parameters)->getXpath(), $this->getSession());
|
||||
}
|
||||
|
||||
protected function waitForPageToLoad(): void
|
||||
{
|
||||
$this
|
||||
->getSession()
|
||||
->wait(1, "document.readyState === 'complete' && !document.querySelector('[data-live-is-loading]')")
|
||||
;
|
||||
}
|
||||
|
||||
protected function waitForLiveComponentToFinish(): void
|
||||
{
|
||||
if (!$this->isJavascript()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->getSession()->wait(
|
||||
1,
|
||||
"document.readyState === 'complete' && " .
|
||||
"document.querySelectorAll('[data-live-is-loading]').length === 0 && " .
|
||||
"document.querySelectorAll('[busy]').length === 0",
|
||||
);
|
||||
}
|
||||
|
||||
protected function isJavascript(): bool
|
||||
{
|
||||
$driver = $this->getDriver();
|
||||
|
||||
return $driver instanceof Selenium2Driver || $driver instanceof ChromeDriver || $driver instanceof PantherDriver;
|
||||
}
|
||||
}
|
||||
|
|
@ -15,9 +15,9 @@ namespace Sylius\Behat\Context\Setup;
|
|||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Step\Given;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Service\SharedStorageInterface;
|
||||
use Sylius\Component\Core\Event\ProductUpdated;
|
||||
use Sylius\Component\Core\Formatter\StringInflector;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ use Sylius\Behat\Page\Admin\ProductReview\IndexPageInterface as ProductReviewInd
|
|||
use Sylius\Behat\Page\Admin\ProductVariant\CreatePageInterface as VariantCreatePageInterface;
|
||||
use Sylius\Behat\Page\Admin\ProductVariant\GeneratePageInterface;
|
||||
use Sylius\Behat\Page\Admin\ProductVariant\UpdatePageInterface as VariantUpdatePageInterface;
|
||||
use Sylius\Behat\Service\Helper\JavaScriptTestHelperInterface;
|
||||
use Sylius\Behat\Service\NotificationCheckerInterface;
|
||||
use Sylius\Behat\Service\Resolver\CurrentPageResolverInterface;
|
||||
use Sylius\Behat\Service\SharedStorageInterface;
|
||||
|
|
@ -63,7 +62,6 @@ final readonly class ManagingProductsContext implements Context
|
|||
private CurrentPageResolverInterface $currentPageResolver,
|
||||
private NotificationCheckerInterface $notificationChecker,
|
||||
private VariantUpdatePageInterface $variantUpdatePage,
|
||||
private JavaScriptTestHelperInterface $testHelper,
|
||||
private AssociationsFormElementInterface $associationsFormElement,
|
||||
private AttributesFormElementInterface $attributesFormElement,
|
||||
private ChannelPricingsFormElementInterface $channelPricingsFormElement,
|
||||
|
|
@ -78,7 +76,7 @@ final readonly class ManagingProductsContext implements Context
|
|||
*/
|
||||
public function iWantToCreateANewSimpleProduct(): void
|
||||
{
|
||||
$this->testHelper->waitUntilPageOpens($this->createSimpleProductPage);
|
||||
$this->createSimpleProductPage->open();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -86,7 +84,7 @@ final readonly class ManagingProductsContext implements Context
|
|||
*/
|
||||
public function iWantToCreateANewConfigurableProduct(): void
|
||||
{
|
||||
$this->testHelper->waitUntilPageOpens($this->createConfigurableProductPage);
|
||||
$this->createConfigurableProductPage->open();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -524,7 +522,7 @@ final readonly class ManagingProductsContext implements Context
|
|||
{
|
||||
$this->sharedStorage->set('product', $product);
|
||||
|
||||
$this->testHelper->waitUntilPageOpens($this->updateSimpleProductPage, ['id' => $product->getId()]);
|
||||
$this->updateSimpleProductPage->open(['id' => $product->getId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1191,16 +1189,6 @@ final readonly class ManagingProductsContext implements Context
|
|||
$this->iSetItsPriceTo('', $channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then this product should( still) have slug :value in :localeCode (locale)
|
||||
*/
|
||||
public function thisProductElementShouldHaveSlugIn(string $slug, string $localeCode): void
|
||||
{
|
||||
$this->testHelper->waitUntilAssertionPasses(function () use ($localeCode, $slug): void {
|
||||
Assert::same($this->translationsFormElement->getSlug($localeCode), $slug);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I set its shipping category as :shippingCategoryName
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ use Sylius\Behat\Page\Admin\Crud\CreatePageInterface;
|
|||
use Sylius\Behat\Page\Admin\Crud\CreatePageInterface as BaseCreatePageInterface;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePageInterface;
|
||||
use Sylius\Behat\Page\Admin\Product\UpdateSimpleProductPageInterface;
|
||||
use Sylius\Behat\Service\Helper\JavaScriptTestHelper;
|
||||
use Sylius\Behat\Service\NotificationCheckerInterface;
|
||||
use Sylius\Behat\Service\SharedStorageInterface;
|
||||
use Sylius\Component\Core\Model\ProductInterface;
|
||||
|
|
@ -42,7 +41,6 @@ final readonly class ManagingTaxonsContext implements Context
|
|||
private ImageFormElementInterface $imageFormElement,
|
||||
private TreeElementInterface $treeElement,
|
||||
private NotificationCheckerInterface $notificationChecker,
|
||||
private JavaScriptTestHelper $testHelper,
|
||||
private UpdateSimpleProductPageInterface $updateSimpleProductPage,
|
||||
private TaxonomyFormElementInterface $productTaxonomyFormElement,
|
||||
) {
|
||||
|
|
@ -62,7 +60,7 @@ final readonly class ManagingTaxonsContext implements Context
|
|||
*/
|
||||
public function iWantToCreateANewTaxonForParent(TaxonInterface $taxon): void
|
||||
{
|
||||
$this->testHelper->waitUntilPageOpens($this->createForParentPage, ['id' => $taxon->getId()]);
|
||||
$this->createForParentPage->open(['id' => $taxon->getId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -72,7 +70,7 @@ final readonly class ManagingTaxonsContext implements Context
|
|||
{
|
||||
$this->sharedStorage->set('taxon', $taxon);
|
||||
|
||||
$this->testHelper->waitUntilPageOpens($this->updatePage, ['id' => $taxon->getId()]);
|
||||
$this->updatePage->open(['id' => $taxon->getId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -356,7 +356,21 @@ final class AddressBookContext implements Context
|
|||
*/
|
||||
public function iShouldBeAbleToUpdateItWithoutUnexpectedAlert(): void
|
||||
{
|
||||
$this->addressBookUpdatePage->waitForFormToStopLoading();
|
||||
try {
|
||||
Assert::true(
|
||||
$this->addressBookUpdatePage->isFormAccessible(),
|
||||
'Expected to be able to interact with the address form, but the page appears to be blocked (possibly by an alert)',
|
||||
);
|
||||
|
||||
$provinceValue = $this->addressBookUpdatePage->getSpecifiedProvince();
|
||||
Assert::contains($provinceValue, '<img', 'The province value should contain the escaped HTML tag');
|
||||
} catch (\Exception $e) {
|
||||
throw new \RuntimeException(
|
||||
'An XSS alert may have appeared and blocked the page interaction: ' . $e->getMessage(),
|
||||
0,
|
||||
$e,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ use FriendsOfBehat\PageObjectExtension\Page\UnexpectedPageException;
|
|||
use Sylius\Behat\Page\Shop\Checkout\AddressPageInterface;
|
||||
use Sylius\Behat\Page\Shop\Checkout\SelectShippingPageInterface;
|
||||
use Sylius\Behat\Service\Factory\AddressFactoryInterface;
|
||||
use Sylius\Behat\Service\Helper\JavaScriptTestHelperInterface;
|
||||
use Sylius\Behat\Service\SharedStorageInterface;
|
||||
use Sylius\Component\Addressing\Comparator\AddressComparatorInterface;
|
||||
use Sylius\Component\Addressing\Model\CountryInterface;
|
||||
|
|
@ -36,7 +35,6 @@ final readonly class CheckoutAddressingContext implements Context
|
|||
private AddressFactoryInterface $addressFactory,
|
||||
private AddressComparatorInterface $addressComparator,
|
||||
private SelectShippingPageInterface $selectShippingPage,
|
||||
private JavaScriptTestHelperInterface $testHelper,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -467,9 +465,7 @@ final readonly class CheckoutAddressingContext implements Context
|
|||
*/
|
||||
public function addressShouldBeFilledAsShippingAddress(AddressInterface $address)
|
||||
{
|
||||
$this->testHelper->waitUntilAssertionPasses(function () use ($address): void {
|
||||
Assert::true($this->addressComparator->equal($address, $this->addressPage->getPreFilledShippingAddress()));
|
||||
});
|
||||
Assert::true($this->addressComparator->equal($address, $this->addressPage->getPreFilledShippingAddress()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -477,9 +473,7 @@ final readonly class CheckoutAddressingContext implements Context
|
|||
*/
|
||||
public function addressShouldBeFilledAsBillingAddress(AddressInterface $address): void
|
||||
{
|
||||
$this->testHelper->waitUntilAssertionPasses(function () use ($address): void {
|
||||
Assert::true($this->addressComparator->equal($address, $this->addressPage->getPreFilledBillingAddress()));
|
||||
});
|
||||
Assert::true($this->addressComparator->equal($address, $this->addressPage->getPreFilledBillingAddress()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -550,7 +544,21 @@ final readonly class CheckoutAddressingContext implements Context
|
|||
*/
|
||||
public function iShouldBeAbleToUpdateTheAddressWithoutUnexpectedAlert(): void
|
||||
{
|
||||
$this->addressPage->waitForFormToStopLoading();
|
||||
try {
|
||||
Assert::true(
|
||||
$this->addressPage->isFormAccessible(),
|
||||
'Expected to be able to interact with the address form, but the page appears to be blocked (possibly by an alert)',
|
||||
);
|
||||
|
||||
$provinceValue = $this->addressPage->getSpecifiedBillingProvince();
|
||||
Assert::contains($provinceValue, '<img', 'The province value should contain the escaped HTML tag');
|
||||
} catch (\Exception $e) {
|
||||
throw new \RuntimeException(
|
||||
'An XSS alert may have appeared and blocked the page interaction: ' . $e->getMessage(),
|
||||
0,
|
||||
$e,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
|||
namespace Sylius\Behat\Context\Ui\Shop;
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Shop\Product\ShowPageInterface;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin\CatalogPromotion;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
use Sylius\Behat\Service\TabsHelper;
|
||||
|
||||
|
|
@ -83,19 +83,16 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
|
||||
$this->getElement('end_date_date')->setValue(date('Y-m-d', $timestamp));
|
||||
$this->getElement('end_date_time')->setValue(date('H:i', $timestamp));
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function addScope(string $type): void
|
||||
{
|
||||
$this->getElement('add_scope_button', ['%type%' => $type])->press();
|
||||
$this->waitForFormUpdate();
|
||||
$this->getElement('add_scope_button', ['%type%' => $type])->click();
|
||||
}
|
||||
|
||||
public function addAction(string $type): void
|
||||
{
|
||||
$this->getElement('add_action_button', ['%type%' => $type])->press();
|
||||
$this->waitForFormUpdate();
|
||||
$this->getElement('add_action_button', ['%type%' => $type])->click();
|
||||
}
|
||||
|
||||
public function selectScopeOption(array $names): void
|
||||
|
|
@ -108,8 +105,6 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
$name,
|
||||
);
|
||||
}
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function fillActionOption(string $option, string $value): void
|
||||
|
|
@ -186,8 +181,6 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
$name,
|
||||
);
|
||||
}
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function removeLastAction(): void
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ class ExcludeTaxonsFromShowingLowestPriceInputElement extends BaseFormElement im
|
|||
$excludeTaxonElement->getXpath(),
|
||||
$taxon->getName(),
|
||||
);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function removeExcludedTaxon(TaxonInterface $taxon): void
|
||||
|
|
@ -50,7 +49,6 @@ class ExcludeTaxonsFromShowingLowestPriceInputElement extends BaseFormElement im
|
|||
$excludeTaxonElement->getXpath(),
|
||||
$taxon->getName(),
|
||||
);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function hasTaxonExcluded(TaxonInterface $taxon): bool
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin\Channel;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Element\SyliusElement;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin\Crud;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Element\SyliusElement;
|
||||
|
||||
class FormElement extends SyliusElement implements FormElementInterface
|
||||
|
|
@ -66,14 +66,6 @@ class FormElement extends SyliusElement implements FormElementInterface
|
|||
]);
|
||||
}
|
||||
|
||||
protected function waitForFormUpdate(): void
|
||||
{
|
||||
$form = $this->getElement('form');
|
||||
|
||||
usleep(500000); // we need to sleep, as sometimes the check below is executed faster than the form sets the busy attribute
|
||||
$form->waitFor(1500, fn () => !$form->hasAttribute('busy'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $parameters
|
||||
*
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class SearchFilterElement extends SyliusElement implements SearchFilterElementIn
|
|||
public function searchWith(string $phrase): void
|
||||
{
|
||||
$this->getElement('filter_search')->setValue($phrase);
|
||||
$this->getElement('filter_button')->press();
|
||||
$this->getElement('filter_button')->click();
|
||||
}
|
||||
|
||||
protected function getDefinedElements(): array
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin\Customer;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Behaviour\NamesIt;
|
||||
use Sylius\Behat\Behaviour\SpecifiesItsField;
|
||||
use Sylius\Behat\Behaviour\Toggles;
|
||||
use Sylius\Behat\Context\Ui\Admin\Helper\SecurePasswordTrait;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Service\SharedStorageInterface;
|
||||
|
||||
class FormElement extends BaseFormElement implements FormElementInterface
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin\CustomerGroup;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
|
||||
class FormElement extends BaseFormElement implements FormElementInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,32 +13,38 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Element\SyliusElement;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
|
||||
class NotificationsElement extends SyliusElement implements NotificationsElementInterface
|
||||
{
|
||||
public function hasNotification(string $type, string $message): bool
|
||||
{
|
||||
$flashesContainer = $this->getElement('flashes_container');
|
||||
// Use parent::getElement to get element without waiting (it's already waited by SyliusElement)
|
||||
// Then wait for it to be visible explicitly
|
||||
try {
|
||||
$flashesContainer = parent::getElement('flashes_container');
|
||||
|
||||
if (DriverHelper::isJavascript($this->getDriver())) {
|
||||
$flashesContainer->waitFor(5, function () use ($flashesContainer) {
|
||||
return $flashesContainer->isVisible();
|
||||
});
|
||||
}
|
||||
|
||||
/** @var array<NodeElement> $flashes */
|
||||
$flashes = $flashesContainer->findAll('css', '[data-test-sylius-flash-message]');
|
||||
|
||||
foreach ($flashes as $flash) {
|
||||
if (str_contains($flash->getText(), $message) && $flash->getAttribute('data-test-sylius-flash-message-type') === $type) {
|
||||
return true;
|
||||
if ($this->isJavascript()) {
|
||||
$flashesContainer->waitFor(5, function () use ($flashesContainer) {
|
||||
return $flashesContainer->isVisible();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
/** @var array<NodeElement> $flashes */
|
||||
$flashes = $flashesContainer->findAll('css', '[data-test-sylius-flash-message]');
|
||||
|
||||
foreach ($flashes as $flash) {
|
||||
if (str_contains($flash->getText(), $message) && $flash->getAttribute('data-test-sylius-flash-message-type') === $type) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch (\Exception $e) {
|
||||
// If flashes container is not found, return false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function getDefinedElements(): array
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ namespace Sylius\Behat\Element\Admin\Product;
|
|||
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
use Sylius\Component\Core\Model\ProductInterface;
|
||||
use Sylius\Component\Product\Model\ProductAssociationTypeInterface;
|
||||
|
|
@ -41,7 +40,6 @@ class AssociationsFormElement extends BaseFormElement implements AssociationsFor
|
|||
$associationField->getXpath(),
|
||||
$productName,
|
||||
);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,10 +81,6 @@ class AssociationsFormElement extends BaseFormElement implements AssociationsFor
|
|||
|
||||
protected function changeTab(): void
|
||||
{
|
||||
if (DriverHelper::isNotJavascript($this->getDriver())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->getElement('side_navigation_tab', ['%name%' => 'associations'])->click();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ namespace Sylius\Behat\Element\Admin\Product;
|
|||
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
|
||||
class AttributesFormElement extends BaseFormElement implements AttributesFormElementInterface
|
||||
|
|
@ -33,16 +32,12 @@ class AttributesFormElement extends BaseFormElement implements AttributesFormEle
|
|||
$this->changeTab();
|
||||
$this->selectAttributeToBeAdded($attributeName);
|
||||
$this->getElement('attribute_add_button')->click();
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function addSelectedAttributes(): void
|
||||
{
|
||||
$this->changeTab();
|
||||
$this->getElement('attribute_add_button')->click();
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function updateAttribute(string $attributeName, string $value, string $localeCode): void
|
||||
|
|
@ -59,16 +54,13 @@ class AttributesFormElement extends BaseFormElement implements AttributesFormEle
|
|||
};
|
||||
|
||||
$attributeValue->blur();
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function removeAttribute(string $attributeName): void
|
||||
{
|
||||
$this->changeTab();
|
||||
|
||||
$this->getElement('attribute_delete_button', ['%attribute_name%' => $attributeName])->press();
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
$this->getElement('attribute_delete_button', ['%attribute_name%' => $attributeName])->click();
|
||||
}
|
||||
|
||||
public function hasAttribute(string $attributeName): bool
|
||||
|
|
@ -162,19 +154,11 @@ class AttributesFormElement extends BaseFormElement implements AttributesFormEle
|
|||
|
||||
protected function changeTab(): void
|
||||
{
|
||||
if (DriverHelper::isNotJavascript($this->getDriver())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->getElement('side_navigation_tab', ['%name%' => 'attributes'])->click();
|
||||
}
|
||||
|
||||
protected function changeAttributeTab(string $attributeName): void
|
||||
{
|
||||
if (DriverHelper::isNotJavascript($this->getDriver())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->getElement('attribute_tab', ['%name%' => $attributeName])->click();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
|||
namespace Sylius\Behat\Element\Admin\Product;
|
||||
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Component\Core\Model\ChannelInterface;
|
||||
|
||||
class ChannelPricingsFormElement extends BaseFormElement implements ChannelPricingsFormElementInterface
|
||||
|
|
@ -62,10 +61,6 @@ class ChannelPricingsFormElement extends BaseFormElement implements ChannelPrici
|
|||
|
||||
protected function changeChannelAccordion(string $channelCode): void
|
||||
{
|
||||
if (DriverHelper::isNotJavascript($this->getDriver())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$accordion = $this->getElement('channel_accordion', ['%channel_code%' => $channelCode]);
|
||||
|
||||
if ($accordion->hasClass('collapsed')) {
|
||||
|
|
@ -75,10 +70,6 @@ class ChannelPricingsFormElement extends BaseFormElement implements ChannelPrici
|
|||
|
||||
protected function changeTab(): void
|
||||
{
|
||||
if (DriverHelper::isNotJavascript($this->getDriver())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->getElement('side_navigation_tab', ['%name%' => 'channel-pricing'])->click();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin\Product;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
use Sylius\Component\Core\Model\ProductVariantInterface;
|
||||
|
||||
|
|
@ -37,8 +36,6 @@ class MediaFormElement extends BaseFormElement implements MediaFormElementInterf
|
|||
|
||||
$this->getElement('add_image')->click();
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
|
||||
$images = $this->getElement('images');
|
||||
$imagesSubform = $images->findAll('css', '[data-test-image-subform]');
|
||||
$imageSubform = end($imagesSubform);
|
||||
|
|
@ -73,7 +70,6 @@ class MediaFormElement extends BaseFormElement implements MediaFormElementInterf
|
|||
|
||||
$imageSubform = $this->getElement('image_subform_with_type', ['%type%' => $type]);
|
||||
$imageSubform->find('css', '[data-test-image-delete]')->click();
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function removeFirstImage(): void
|
||||
|
|
@ -82,7 +78,6 @@ class MediaFormElement extends BaseFormElement implements MediaFormElementInterf
|
|||
|
||||
$firstSubform = $this->getFirstImageSubform();
|
||||
$firstSubform->find('css', '[data-test-image-delete]')->click();
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function hasImageWithType(string $type): bool
|
||||
|
|
@ -244,10 +239,6 @@ class MediaFormElement extends BaseFormElement implements MediaFormElementInterf
|
|||
|
||||
protected function changeTab(): void
|
||||
{
|
||||
if (DriverHelper::isNotJavascript($this->getDriver())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->getElement('side_navigation_tab', ['%name%' => 'media'])->click();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ use Behat\Mink\Exception\ElementNotFoundException;
|
|||
use Behat\Mink\Session;
|
||||
use FriendsOfBehat\SymfonyExtension\Mink\MinkParameters;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
use Sylius\Component\Taxonomy\Model\TaxonInterface;
|
||||
|
||||
|
|
@ -40,7 +39,6 @@ class TaxonomyFormElement extends BaseFormElement implements TaxonomyFormElement
|
|||
$this->getElement('main_taxon')->getXpath(),
|
||||
$taxonName,
|
||||
);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function getMainTaxon(): ?string
|
||||
|
|
@ -140,10 +138,6 @@ class TaxonomyFormElement extends BaseFormElement implements TaxonomyFormElement
|
|||
|
||||
protected function changeTab(): void
|
||||
{
|
||||
if (DriverHelper::isNotJavascript($this->getDriver())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->getElement('side_navigation_tab', ['%name%' => 'taxonomy'])->click();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
|||
namespace Sylius\Behat\Element\Admin\Product;
|
||||
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
|
||||
class TranslationsFormElement extends BaseFormElement implements TranslationsFormElementInterface
|
||||
{
|
||||
|
|
@ -34,7 +33,6 @@ class TranslationsFormElement extends BaseFormElement implements TranslationsFor
|
|||
public function generateSlug(string $localeCode): void
|
||||
{
|
||||
$this->getElement('generate_product_slug_button', ['%locale_code%' => $localeCode])->click();
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function getSlug(string $locale): string
|
||||
|
|
@ -61,10 +59,6 @@ class TranslationsFormElement extends BaseFormElement implements TranslationsFor
|
|||
|
||||
public function activateLanguageTab(string $localeCode): void
|
||||
{
|
||||
if (DriverHelper::isNotJavascript($this->getDriver())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$languageTabTitle = $this->getElement('language_tab', ['%locale_code%' => $localeCode]);
|
||||
if (!$languageTabTitle->hasClass('active')) {
|
||||
$languageTabTitle->click();
|
||||
|
|
@ -89,10 +83,6 @@ class TranslationsFormElement extends BaseFormElement implements TranslationsFor
|
|||
|
||||
protected function expandTranslationAccordion(string $localeCode): void
|
||||
{
|
||||
if (DriverHelper::isNotJavascript($this->getDriver())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$translationAccordion = $this->getElement('product_translation_accordion', ['%locale_code%' => $localeCode]);
|
||||
|
||||
if ($translationAccordion->getAttribute('aria-expanded') === 'true') {
|
||||
|
|
@ -104,10 +94,6 @@ class TranslationsFormElement extends BaseFormElement implements TranslationsFor
|
|||
|
||||
protected function changeTab(): void
|
||||
{
|
||||
if (DriverHelper::isNotJavascript($this->getDriver())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->getElement('side_navigation_tab', ['%name%' => 'translations'])->click();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin\ProductAssociationType;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
|
||||
class FormElement extends BaseFormElement implements FormElementInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class FilterElement extends SyliusElement implements FilterElementInterface
|
|||
|
||||
public function filter(): void
|
||||
{
|
||||
$this->getElement('filter_button')->press();
|
||||
$this->getElement('filter_button')->click();
|
||||
}
|
||||
|
||||
protected function getDefinedElements(): array
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin\ProductAttribute;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Behaviour\SpecifiesItsField;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
|
||||
class FormElement extends BaseFormElement implements FormElementInterface
|
||||
{
|
||||
|
|
@ -52,7 +52,6 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
public function addAttributeValue(string $value, string $localeCode): void
|
||||
{
|
||||
$this->getElement('add_button')->click();
|
||||
$this->waitForFormUpdate();
|
||||
|
||||
$lastChoice = $this->getLastChoiceElement();
|
||||
$lastChoice->find('css', 'input[data-test-locale="' . $localeCode . '"]')->setValue($value);
|
||||
|
|
@ -62,7 +61,6 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
{
|
||||
$input = $this->getElement('choice_direct_input', ['%value%' => $value, '%locale_code%' => $localeCode]);
|
||||
$this->getElement('delete_button', ['%key%' => $input->getAttribute('data-test-key')])->click();
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function nameIt(string $name, string $language): void
|
||||
|
|
@ -122,6 +120,8 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
);
|
||||
}
|
||||
|
||||
return end($choices);
|
||||
$lastChoice = end($choices);
|
||||
|
||||
return new NodeElement($lastChoice->getXpath(), $this->getSession());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin\ProductOption;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Behaviour\SpecifiesItsField;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
|
||||
class FormElement extends BaseFormElement implements FormElementInterface
|
||||
{
|
||||
|
|
@ -34,20 +34,17 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
foreach ($optionValues as $optionValueElement) {
|
||||
if ($optionValueElement->has('css', sprintf('input[value="%s"]', $optionValue))) {
|
||||
$optionValueElement->find('css', '[data-test-delete-option-value]')->click();
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function addOptionValue(string $code, string $localeCode, string $value): void
|
||||
{
|
||||
$this->getElement('add_option_value')->press();
|
||||
$this->waitForFormUpdate();
|
||||
$this->getElement('add_option_value')->click();
|
||||
|
||||
$lastValue = $this->getElement('last_option_value');
|
||||
$lastValue->find('css', '[data-test-code]')->setValue($code);
|
||||
$lastValue->find('css', sprintf('[id$="_translations_%s_value"]', $localeCode))->setValue($value);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function hasOptionValue(string $optionValue, string $localeCode): bool
|
||||
|
|
@ -58,7 +55,6 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
public function applyToAllOptionValues(string $code, string $localeCode): void
|
||||
{
|
||||
$this->getElement('apply_to_all', ['%value_code%' => $code, '%locale_code%' => $localeCode])->click();
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
protected function getDefinedElements(): array
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin\Promotion;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
use Sylius\Behat\Service\TabsHelper;
|
||||
|
||||
|
|
@ -93,14 +93,12 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
|
||||
public function addAction(string $type): void
|
||||
{
|
||||
$this->getElement('add_action_button', ['%type%' => $type])->press();
|
||||
$this->waitForFormUpdate();
|
||||
$this->getElement('add_action_button', ['%type%' => $type])->click();
|
||||
}
|
||||
|
||||
public function removeLastAction(): void
|
||||
{
|
||||
$this->getLastAction()->find('css', 'button[data-test-delete]')->press();
|
||||
$this->waitForFormUpdate();
|
||||
$this->getLastAction()->find('css', 'button[data-test-delete]')->click();
|
||||
}
|
||||
|
||||
public function fillActionOption(string $option, string $value): void
|
||||
|
|
@ -121,14 +119,12 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
|
||||
public function addRule(string $type): void
|
||||
{
|
||||
$this->getElement('add_rule_button', ['%type%' => $type])->press();
|
||||
$this->waitForFormUpdate();
|
||||
$this->getElement('add_rule_button', ['%type%' => $type])->click();
|
||||
}
|
||||
|
||||
public function removeLastRule(): void
|
||||
{
|
||||
$this->getLastRule()->find('css', 'button[data-test-delete]')->press();
|
||||
$this->waitForFormUpdate();
|
||||
$this->getLastRule()->find('css', 'button[data-test-delete]')->click();
|
||||
}
|
||||
|
||||
public function selectRuleOption(string $option, string $value, bool $multiple = false): void
|
||||
|
|
@ -161,8 +157,6 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
$value,
|
||||
);
|
||||
}
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function selectAutocompleteActionFilterOptions(array $values, string $channelCode, string $filterType): void
|
||||
|
|
@ -176,8 +170,6 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
$value,
|
||||
);
|
||||
}
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function checkIfRuleConfigurationFormIsVisible(): bool
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin\PromotionCoupon;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Behaviour\SpecifiesItsField;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
|
||||
class FormElement extends BaseFormElement implements FormElementInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
|||
namespace Sylius\Behat\Element\Admin\ShippingMethod;
|
||||
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Behat\Service\TabsHelper;
|
||||
|
||||
class FormElement extends BaseFormElement implements FormElementInterface
|
||||
|
|
@ -104,13 +103,11 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
public function chooseCalculator(string $calculatorName): void
|
||||
{
|
||||
$this->getElement('calculator')->selectOption($calculatorName);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function addRule(string $type): void
|
||||
{
|
||||
$this->getElement('add_rule_button', ['%type%' => $type])->press();
|
||||
$this->waitForFormUpdate();
|
||||
$this->getElement('add_rule_button', ['%type%' => $type])->click();
|
||||
}
|
||||
|
||||
public function fillLastRuleOption(string $fieldName, string $value): void
|
||||
|
|
@ -173,10 +170,6 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
|
||||
protected function selectCalculatorConfigurationChannelTab(string $channelCode): void
|
||||
{
|
||||
if (!DriverHelper::isJavascript($this->getDriver())) {
|
||||
throw new \RuntimeException('This method can be used only with JavaScript enabled');
|
||||
}
|
||||
|
||||
$this->getElement('calculator_configuration_channel_tab', ['%channelCode%' => $channelCode])->click();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,13 +13,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin\Taxon;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use FriendsOfBehat\SymfonyExtension\Mink\MinkParameters;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Behaviour\SpecifiesItsField;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
use Sylius\Component\Core\Model\TaxonInterface;
|
||||
|
||||
|
|
@ -56,7 +55,6 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
public function generateSlug(string $localeCode): void
|
||||
{
|
||||
$this->getElement('generate_slug_button', ['%locale_code%' => $localeCode])->click();
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function describeItAs(string $description, string $localeCode): void
|
||||
|
|
@ -89,19 +87,15 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
$this->getElement('parent')->getXpath(),
|
||||
$taxon->getName(),
|
||||
);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function removeCurrentParent(): void
|
||||
{
|
||||
$this->autocompleteHelper->clear($this->getDriver(), $this->getElement('parent')->getXpath());
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function getTranslationFieldValue(string $element, string $localeCode): string
|
||||
{
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
|
||||
return $this->getElement($element, ['%locale_code%' => $localeCode])->getValue();
|
||||
}
|
||||
|
||||
|
|
@ -142,10 +136,6 @@ class FormElement extends BaseFormElement implements FormElementInterface
|
|||
|
||||
protected function expandTranslationAccordion(string $localeCode): void
|
||||
{
|
||||
if (DriverHelper::isNotJavascript($this->getDriver())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$translationAccordion = $this->getElement('translation_accordion', ['%locale_code%' => $localeCode]);
|
||||
|
||||
if ($translationAccordion->getAttribute('aria-expanded') === 'true') {
|
||||
|
|
|
|||
|
|
@ -20,8 +20,7 @@ class ImageFormElement extends BaseFormElement implements ImageFormElementInterf
|
|||
{
|
||||
public function attachImage(string $path, ?string $type = null): void
|
||||
{
|
||||
$this->getElement('add_image')->press();
|
||||
$this->waitForFormUpdate();
|
||||
$this->getElement('add_image')->click();
|
||||
|
||||
$lastImage = $this->getElement('last_image');
|
||||
|
||||
|
|
@ -48,14 +47,12 @@ class ImageFormElement extends BaseFormElement implements ImageFormElementInterf
|
|||
|
||||
public function removeImageWithType(string $type): void
|
||||
{
|
||||
$this->getElement('delete_image', ['%type%' => $type])->press();
|
||||
$this->waitForFormUpdate();
|
||||
$this->getElement('delete_image', ['%type%' => $type])->click();
|
||||
}
|
||||
|
||||
public function removeFirstImage(): void
|
||||
{
|
||||
$this->getElement('first_image')->find('css', '[data-test-delete-image]')->press();
|
||||
$this->waitForFormUpdate();
|
||||
$this->getElement('first_image')->find('css', '[data-test-delete-image]')->click();
|
||||
}
|
||||
|
||||
public function isImageWithTypeDisplayed(string $type): bool
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
|||
namespace Sylius\Behat\Element\Admin\Taxon;
|
||||
|
||||
use Sylius\Behat\Element\SyliusElement;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
|
||||
class TreeElement extends SyliusElement implements TreeElementInterface
|
||||
{
|
||||
|
|
@ -32,8 +31,6 @@ class TreeElement extends SyliusElement implements TreeElementInterface
|
|||
|
||||
public function countTaxons(): int
|
||||
{
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
|
||||
return count($this->getElement('tree_taxons')->findAll('css', '[data-test-tree-taxon]'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Admin\Zone;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Behaviour\NamesIt;
|
||||
use Sylius\Behat\Behaviour\SpecifiesItsField;
|
||||
use Sylius\Behat\Element\Admin\Crud\FormElement as BaseFormElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
|
||||
class FormElement extends BaseFormElement implements FormElementInterface
|
||||
{
|
||||
|
|
|
|||
44
src/Sylius/Behat/Element/DocumentElement.php
Normal file
44
src/Sylius/Behat/Element/DocumentElement.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Sylius Sp. z o.o.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Behat\Element;
|
||||
|
||||
use Behat\Mink\Element\DocumentElement as BaseDocumentElement;
|
||||
use Behat\Mink\Element\NodeElement as BaseNodeElement;
|
||||
|
||||
final class DocumentElement extends BaseDocumentElement
|
||||
{
|
||||
public function find($selector, $locator)
|
||||
{
|
||||
$element = parent::find($selector, $locator);
|
||||
|
||||
if (null === $element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new NodeElement($element->getXpath(), $this->getSession());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return NodeElement[]
|
||||
*/
|
||||
public function findAll($selector, $locator): array
|
||||
{
|
||||
$elements = parent::findAll($selector, $locator);
|
||||
|
||||
return array_map(
|
||||
fn (BaseNodeElement $element) => new NodeElement($element->getXpath(), $this->getSession()),
|
||||
$elements,
|
||||
);
|
||||
}
|
||||
}
|
||||
99
src/Sylius/Behat/Element/NodeElement.php
Normal file
99
src/Sylius/Behat/Element/NodeElement.php
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Sylius Sp. z o.o.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Behat\Element;
|
||||
|
||||
use Behat\Mink\Element\NodeElement as BaseNodeElement;
|
||||
use Behat\Mink\Exception\UnsupportedDriverActionException;
|
||||
use Sylius\Behat\Behaviour\WaitsForElements;
|
||||
|
||||
class NodeElement extends BaseNodeElement
|
||||
{
|
||||
use WaitsForElements;
|
||||
|
||||
public function click(): void
|
||||
{
|
||||
try {
|
||||
parent::click();
|
||||
} catch (UnsupportedDriverActionException) {
|
||||
// In non-JS (SymfonyDriver), only certain elements are clickable
|
||||
}
|
||||
|
||||
// JS scenarios: trigger click and wait for LiveComponent
|
||||
if ($this->isJavascript()) {
|
||||
$this->waitForLiveComponentToFinish();
|
||||
}
|
||||
}
|
||||
|
||||
public function press(): void
|
||||
{
|
||||
if ($this->isJavascript()) {
|
||||
// For press() (form submission), manually trigger the press without our click() override
|
||||
$this->getDriver()->click($this->getXpath());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
parent::press();
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
parent::setValue($value);
|
||||
|
||||
if ($this->isJavascript()) {
|
||||
$this->waitForLiveComponentToFinish();
|
||||
}
|
||||
}
|
||||
|
||||
public function selectOption($option, $multiple = false): void
|
||||
{
|
||||
parent::selectOption($option, $multiple);
|
||||
|
||||
if ($this->isJavascript()) {
|
||||
$this->waitForLiveComponentToFinish();
|
||||
}
|
||||
}
|
||||
|
||||
public function find($selector, $locator)
|
||||
{
|
||||
$element = parent::find($selector, $locator);
|
||||
|
||||
if (null === $element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new self($element->getXpath(), $this->getSession());
|
||||
}
|
||||
|
||||
public function findAll($selector, $locator): array
|
||||
{
|
||||
$elements = parent::findAll($selector, $locator);
|
||||
|
||||
return array_map(
|
||||
fn (BaseNodeElement $element) => new self($element->getXpath(), $this->getSession()),
|
||||
$elements,
|
||||
);
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
$parent = parent::getParent();
|
||||
|
||||
if (null === $parent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new self($parent->getXpath(), $this->getSession());
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Product\IndexPage;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Element\SyliusElement;
|
||||
|
||||
class VerticalMenuElement extends SyliusElement implements VerticalMenuElementInterface
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Product\ShowPage;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Element\SyliusElement;
|
||||
|
||||
class AssociationsElement extends SyliusElement implements AssociationsElementInterface
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Product\ShowPage;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Element\SyliusElement;
|
||||
|
||||
class PricingElement extends SyliusElement implements PricingElementInterface
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Product\ShowPage;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
|
||||
interface PricingElementInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,14 +13,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Product\ShowPage;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Element\SyliusElement;
|
||||
|
||||
class VariantsElement extends SyliusElement implements VariantsElementInterface
|
||||
{
|
||||
public function countVariantsOnPage(): int
|
||||
{
|
||||
/** @var NodeElement $variants|array */
|
||||
$variants = $this->getDocument()->findAll('css', '[data-test-variant]');
|
||||
|
||||
return \count($variants);
|
||||
|
|
@ -38,11 +37,11 @@ class VariantsElement extends SyliusElement implements VariantsElementInterface
|
|||
string $currentStock,
|
||||
string $channelCode,
|
||||
): bool {
|
||||
/** @var NodeElement $variantRow */
|
||||
$variantRows = $this->getDocument()->findAll('css', '[data-test-variant]');
|
||||
|
||||
/** @var NodeElement $variant */
|
||||
foreach ($variantRows as $variant) {
|
||||
foreach ($variantRows as $variantRow) {
|
||||
$variant = new NodeElement($variantRow->getXpath(), $this->getSession());
|
||||
|
||||
if (
|
||||
$this->hasProductWithGivenNameCodePriceAndCurrentStock(
|
||||
$variant,
|
||||
|
|
@ -65,7 +64,6 @@ class VariantsElement extends SyliusElement implements VariantsElementInterface
|
|||
string $lowestPriceBeforeDiscount,
|
||||
string $channelCode,
|
||||
): bool {
|
||||
/** @var NodeElement $variant */
|
||||
$variant = $this->getDocument()->find('css', sprintf('[data-test-lowest-price-before-the-discount="%s.%s"]', $productVariantCode, $channelCode));
|
||||
|
||||
if ($variant) {
|
||||
|
|
|
|||
|
|
@ -14,24 +14,17 @@ declare(strict_types=1);
|
|||
namespace Sylius\Behat\Element;
|
||||
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
|
||||
class SaveElement extends SyliusElement implements SaveElementInterface
|
||||
final class SaveElement extends SyliusElement implements SaveElementInterface
|
||||
{
|
||||
public function saveChanges(): void
|
||||
{
|
||||
if (DriverHelper::isJavascript($this->getDriver())) {
|
||||
$this->getDocument()->find('css', 'body')->click();
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
}
|
||||
|
||||
try {
|
||||
$this->getElement('update_changes_button')->press();
|
||||
$this->getElement('update_changes_button')->click();
|
||||
} catch (ElementNotFoundException) {
|
||||
// Fallback for elements with different data-test attributes
|
||||
$this->getElement('save_changes_button')->press();
|
||||
$this->getElement('save_changes_button')->click();
|
||||
}
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
}
|
||||
|
||||
protected function getDefinedElements(): array
|
||||
|
|
|
|||
|
|
@ -13,12 +13,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Shop\Account;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Context\Ui\Admin\Helper\SecurePasswordTrait;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Element\SyliusElement;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Behat\Service\SharedStorageInterface;
|
||||
|
||||
class RegisterElement extends SyliusElement implements RegisterElementInterface
|
||||
|
|
@ -36,14 +35,11 @@ class RegisterElement extends SyliusElement implements RegisterElementInterface
|
|||
public function register(): void
|
||||
{
|
||||
$this->getElement('register_button')->click();
|
||||
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
}
|
||||
|
||||
public function specifyEmail(?string $email): void
|
||||
{
|
||||
$this->getElement('email')->setValue($email);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function getEmail(): string
|
||||
|
|
@ -54,37 +50,31 @@ class RegisterElement extends SyliusElement implements RegisterElementInterface
|
|||
public function specifyFirstName(?string $firstName): void
|
||||
{
|
||||
$this->getElement('first_name')->setValue($firstName);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function specifyLastName(?string $lastName): void
|
||||
{
|
||||
$this->getElement('last_name')->setValue($lastName);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function specifyPassword(string $password): void
|
||||
{
|
||||
$this->getElement('password')->setValue($this->replaceWithSecurePassword($password));
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function specifyPhoneNumber(string $phoneNumber): void
|
||||
{
|
||||
$this->getElement('phone_number')->setValue($phoneNumber);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function verifyPassword(string $password): void
|
||||
{
|
||||
$this->getElement('password_verification')->setValue($this->confirmSecurePassword($password));
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function subscribeToTheNewsletter(): void
|
||||
{
|
||||
$this->getElement('newsletter')->check();
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -117,14 +107,6 @@ class RegisterElement extends SyliusElement implements RegisterElementInterface
|
|||
]);
|
||||
}
|
||||
|
||||
protected function waitForFormUpdate(): void
|
||||
{
|
||||
$form = $this->getElement('form');
|
||||
|
||||
usleep(500000); // we need to sleep, as sometimes the check below is executed faster than the form sets the busy attribute
|
||||
$form->waitFor(1500, fn () => !$form->hasAttribute('busy'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $parameters
|
||||
*
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element\Shop;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Element\SyliusElement;
|
||||
|
||||
class MenuElement extends SyliusElement implements MenuElementInterface
|
||||
|
|
|
|||
|
|
@ -13,34 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Element;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use FriendsOfBehat\PageObjectExtension\Element\Element as BaseElement;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Behat\Behaviour\WaitsForElements;
|
||||
|
||||
abstract class SyliusElement extends BaseElement
|
||||
{
|
||||
/** @param array<string, mixed> $parameters */
|
||||
protected function getElement(string $name, array $parameters = []): NodeElement
|
||||
{
|
||||
$this->waitForLiveComponentToFinish();
|
||||
|
||||
return parent::getElement($name, $parameters);
|
||||
}
|
||||
|
||||
protected function waitForLiveComponentToFinish(): void
|
||||
{
|
||||
if (DriverHelper::isJavascript($this->getDriver()) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Wait for ALL LiveComponents to complete their operations
|
||||
// Returns immediately if condition is already met
|
||||
// Max 10 seconds for: DOM ready, no loading indicators, no busy elements
|
||||
$this->getSession()->wait(
|
||||
10000,
|
||||
"document.readyState === 'complete' && " .
|
||||
"document.querySelectorAll('[data-live-is-loading]').length === 0 && " .
|
||||
"document.querySelectorAll('[busy]').length === 0",
|
||||
);
|
||||
}
|
||||
use WaitsForElements;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\CatalogPromotion;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
|
||||
|
||||
class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Channel;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Behaviour\DescribesIt;
|
||||
use Sylius\Behat\Behaviour\NamesIt;
|
||||
use Sylius\Behat\Behaviour\SpecifiesItsField;
|
||||
use Sylius\Behat\Behaviour\Toggles;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
|
|
|
|||
|
|
@ -113,7 +113,6 @@ trait FormTrait
|
|||
$this->getElement('menu_taxon')->getXpath(),
|
||||
$menuTaxon,
|
||||
);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function getTaxCalculationStrategy(): string
|
||||
|
|
|
|||
|
|
@ -13,13 +13,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Channel;
|
||||
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\IndexPage as BaseIndexPage;
|
||||
|
||||
class IndexPage extends BaseIndexPage implements IndexPageInterface
|
||||
{
|
||||
public function getUsedThemeName(string $channelCode): ?string
|
||||
{
|
||||
$table = $this->getDocument()->find('css', 'table');
|
||||
$table = new NodeElement($this->getDocument()->find('css', 'table')->getXpath(), $this->getSession());
|
||||
|
||||
$row = $this->getTableAccessor()->getRowWithFields($table, ['code' => $channelCode]);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Channel;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Behaviour\Toggles;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Country;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Behaviour\Toggles;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
|
|
@ -134,6 +134,12 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
|||
|
||||
protected function getProvinceElement(string $provinceName): NodeElement|null
|
||||
{
|
||||
return $this->getDocument()->find('xpath', sprintf('//*[@data-test-province and .//*[contains(@value, \'%s\')]]', $provinceName));
|
||||
$element = $this->getDocument()->find('xpath', sprintf('//*[@data-test-province and .//*[contains(@value, \'%s\')]]', $provinceName));
|
||||
|
||||
if (null === $element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new NodeElement($element->getXpath(), $this->getSession());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,13 +13,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Crud;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\DriverException;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Behat\Mink\Session;
|
||||
use FriendsOfBehat\PageObjectExtension\Page\UnexpectedPageException;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
|
||||
class CreatePage extends SyliusPage implements CreatePageInterface
|
||||
|
|
@ -35,12 +34,8 @@ class CreatePage extends SyliusPage implements CreatePageInterface
|
|||
|
||||
public function create(): void
|
||||
{
|
||||
if (DriverHelper::isJavascript($this->getDriver())) {
|
||||
$this->blur();
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
$this->blur();
|
||||
$this->getDocument()->pressButton('Create');
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
}
|
||||
|
||||
public function getValidationMessage(string $element, array $parameters = []): string
|
||||
|
|
@ -84,15 +79,6 @@ class CreatePage extends SyliusPage implements CreatePageInterface
|
|||
]);
|
||||
}
|
||||
|
||||
protected function waitForFormUpdate(): void
|
||||
{
|
||||
$form = $this->getElement('form');
|
||||
sleep(1); // we need to sleep, as sometimes the check below is executed faster than the form sets the busy attribute
|
||||
$form->waitFor(1500, function () use ($form) {
|
||||
return !$form->hasAttribute('busy');
|
||||
});
|
||||
}
|
||||
|
||||
protected function verifyStatusCode(): void
|
||||
{
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -13,12 +13,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Crud;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Behat\Service\Accessor\TableAccessorInterface;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
|
|
@ -109,7 +108,7 @@ class IndexPage extends SyliusPage implements IndexPageInterface
|
|||
$deletedRow = $tableAccessor->getRowWithFields($table, $parameters);
|
||||
$actionButtons = $tableAccessor->getFieldFromRow($table, $deletedRow, 'actions');
|
||||
|
||||
$actionButtons->find('css', '[data-test-modal="delete"] [data-test-confirm-button]')->press();
|
||||
$actionButtons->find('css', '[data-test-modal="delete"] [data-test-confirm-button]')->click();
|
||||
}
|
||||
|
||||
public function getActionsForResource(array $parameters): NodeElement
|
||||
|
|
@ -137,7 +136,7 @@ class IndexPage extends SyliusPage implements IndexPageInterface
|
|||
|
||||
public function filter(): void
|
||||
{
|
||||
$this->getElement('filter')->press();
|
||||
$this->getElement('filter')->click();
|
||||
}
|
||||
|
||||
public function bulkDelete(): void
|
||||
|
|
@ -158,8 +157,6 @@ class IndexPage extends SyliusPage implements IndexPageInterface
|
|||
|
||||
public function isEnabledFilterApplied(): bool
|
||||
{
|
||||
DriverHelper::waitForElement($this->getSession(), '[data-test-criterion-enabled]');
|
||||
|
||||
return $this->getElement('enabled_filter')->getValue() === 'true';
|
||||
}
|
||||
|
||||
|
|
@ -199,15 +196,6 @@ class IndexPage extends SyliusPage implements IndexPageInterface
|
|||
return !$this->getElement('filters_toggle')->hasClass('collapsed');
|
||||
}
|
||||
|
||||
protected function waitForFormUpdate(): void
|
||||
{
|
||||
$form = $this->getElement('filters_form');
|
||||
usleep(500000); // we need to sleep, as sometimes the check below is executed faster than the form sets the busy attribute
|
||||
$form->waitFor(1500, function () use ($form) {
|
||||
return !$form->hasAttribute('busy');
|
||||
});
|
||||
}
|
||||
|
||||
protected function getDefinedElements(): array
|
||||
{
|
||||
return array_merge(parent::getDefinedElements(), [
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Crud;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\SyliusPageInterface;
|
||||
|
||||
interface IndexPageInterface extends SyliusPageInterface
|
||||
|
|
|
|||
|
|
@ -13,13 +13,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Crud;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\DriverException;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Behat\Mink\Session;
|
||||
use FriendsOfBehat\PageObjectExtension\Page\UnexpectedPageException;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Component\Core\Formatter\StringInflector;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
|
||||
|
|
@ -36,11 +35,8 @@ class UpdatePage extends SyliusPage implements UpdatePageInterface
|
|||
|
||||
public function saveChanges(): void
|
||||
{
|
||||
if (DriverHelper::isJavascript($this->getDriver())) {
|
||||
$this->blur();
|
||||
}
|
||||
$this->blur();
|
||||
$this->getDocument()->find('css', '[data-test-update-changes-button]')->click();
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
}
|
||||
|
||||
public function cancelChanges(): void
|
||||
|
|
@ -95,15 +91,6 @@ class UpdatePage extends SyliusPage implements UpdatePageInterface
|
|||
]);
|
||||
}
|
||||
|
||||
protected function waitForFormUpdate(): void
|
||||
{
|
||||
$form = $this->getElement('form');
|
||||
sleep(1); // we need to sleep, as sometimes the check below is executed faster than the form sets the busy attribute
|
||||
$form->waitFor(1500, function () use ($form) {
|
||||
return !$form->hasAttribute('busy');
|
||||
});
|
||||
}
|
||||
|
||||
protected function verifyStatusCode(): void
|
||||
{
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -62,8 +62,6 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
|
|||
$this->getElement('filter_group')->getXpath(),
|
||||
$groupName,
|
||||
);
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
protected function getDefinedElements(): array
|
||||
|
|
|
|||
|
|
@ -14,13 +14,12 @@ declare(strict_types=1);
|
|||
namespace Sylius\Behat\Page\Admin\Customer;
|
||||
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
|
||||
class ShowPage extends SyliusPage implements ShowPageInterface
|
||||
{
|
||||
public function deleteAccount(): void
|
||||
{
|
||||
$this->getElement('delete_account_button')->press();
|
||||
$this->getElement('delete_account_button')->click();
|
||||
}
|
||||
|
||||
public function getCustomerEmail(): string
|
||||
|
|
@ -87,9 +86,13 @@ class ShowPage extends SyliusPage implements ShowPageInterface
|
|||
|
||||
public function impersonate(): void
|
||||
{
|
||||
if (DriverHelper::isJavascript($this->getDriver())) {
|
||||
if ($this->isJavascript() === true) {
|
||||
$this->getElement('actions_button')->click();
|
||||
$this->getElement('impersonate_button')->click();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->getElement('impersonate_button')->click();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
|
|||
$this->getElement('product_filter')->getXpath(),
|
||||
$productName,
|
||||
);
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
protected function getDefinedElements(): array
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Order;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\IndexPage as BaseIndexPage;
|
||||
use Sylius\Behat\Service\Accessor\TableAccessorInterface;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
|
|
@ -112,7 +112,5 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
|
|||
$autocomplete->getXpath(),
|
||||
$value,
|
||||
);
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,12 +13,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Order;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Behat\Service\Accessor\TableAccessorInterface;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Component\Core\Model\OrderInterface;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
|
||||
|
|
@ -97,7 +96,7 @@ class ShowPage extends SyliusPage implements ShowPageInterface
|
|||
|
||||
public function shipOrder(OrderInterface $order): void
|
||||
{
|
||||
$this->getElement('shipment_ship_button')->press();
|
||||
$this->getElement('shipment_ship_button')->click();
|
||||
}
|
||||
|
||||
public function hasPayment(string $paymentMethodName): bool
|
||||
|
|
@ -341,8 +340,6 @@ class ShowPage extends SyliusPage implements ShowPageInterface
|
|||
|
||||
public function getOrderCurrency(): string
|
||||
{
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
|
||||
return $this->getElement('currency')->getText();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Order;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
|
||||
use Sylius\Component\Addressing\Model\AddressInterface;
|
||||
|
||||
|
|
@ -66,13 +66,11 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
|||
public function changeBillingCountry(string $countryCode): void
|
||||
{
|
||||
$this->getElement('billing_country')->selectOption($countryCode);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function changeShippingCountry(string $countryCode): void
|
||||
{
|
||||
$this->getElement('shipping_country')->selectOption($countryCode);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function getAvailableProvincesForBillingAddress(): array
|
||||
|
|
@ -144,9 +142,4 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
|||
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function waitForFormUpdate(): void
|
||||
{
|
||||
$this->getElement('live_form')->waitFor('5', fn (NodeElement $element) => !$element->hasAttribute('busy'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Payment;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\IndexPage as BaseIndexPage;
|
||||
|
||||
class IndexPage extends BaseIndexPage implements IndexPageInterface
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Payment\PaymentRequest;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\IndexPage as BaseIndexPage;
|
||||
use Sylius\Behat\Service\Accessor\TableAccessorInterface;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
|
|
@ -68,7 +68,5 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
|
|||
$autocomplete->getXpath(),
|
||||
$value,
|
||||
);
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\PaymentMethod;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Behaviour\SpecifiesItsField;
|
||||
use Sylius\Behat\Behaviour\Toggles;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
|
||||
|
||||
class CreatePage extends BaseCreatePage implements CreatePageInterface
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\PaymentMethod;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Behaviour\Toggles;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
|
||||
|
||||
class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
||||
|
|
|
|||
|
|
@ -13,11 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Product;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Context\Ui\Admin\Helper\NavigationTrait;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
|
||||
|
|
@ -48,8 +47,6 @@ class CreateConfigurableProductPage extends BaseCreatePage implements CreateConf
|
|||
|
||||
public function create(): void
|
||||
{
|
||||
$this->waitForFormUpdate();
|
||||
|
||||
parent::create();
|
||||
}
|
||||
|
||||
|
|
@ -100,10 +97,6 @@ class CreateConfigurableProductPage extends BaseCreatePage implements CreateConf
|
|||
|
||||
protected function changeTab(): void
|
||||
{
|
||||
if (DriverHelper::isNotJavascript($this->getDriver())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->getElement('side_navigation_tab', ['%name%' => 'details'])->click();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Product;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Context\Ui\Admin\Helper\NavigationTrait;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
|
||||
|
|
@ -53,8 +52,6 @@ class CreateSimpleProductPage extends BaseCreatePage implements CreateSimpleProd
|
|||
|
||||
public function create(): void
|
||||
{
|
||||
$this->waitForFormUpdate();
|
||||
|
||||
parent::create();
|
||||
}
|
||||
|
||||
|
|
@ -67,10 +64,6 @@ class CreateSimpleProductPage extends BaseCreatePage implements CreateSimpleProd
|
|||
|
||||
protected function changeTab(string $tabName): void
|
||||
{
|
||||
if (DriverHelper::isNotJavascript($this->getDriver())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->getElement('side_navigation_tab', ['%name%' => $tabName])->click();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class IndexPage extends CrudIndexPage implements IndexPageInterface
|
|||
|
||||
public function filter(): void
|
||||
{
|
||||
$this->getElement('filter')->press();
|
||||
$this->getElement('filter')->click();
|
||||
}
|
||||
|
||||
public function filterByTaxon(string $taxonName): void
|
||||
|
|
@ -46,8 +46,6 @@ class IndexPage extends CrudIndexPage implements IndexPageInterface
|
|||
$this->getElement('taxon_filter')->getXpath(),
|
||||
$taxonName,
|
||||
);
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function filterByMainTaxon(string $taxonName): void
|
||||
|
|
@ -57,8 +55,6 @@ class IndexPage extends CrudIndexPage implements IndexPageInterface
|
|||
$this->getElement('main_taxon_filter')->getXpath(),
|
||||
$taxonName,
|
||||
);
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function chooseChannelFilter(string $channelName): void
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ namespace Sylius\Behat\Page\Admin\Product;
|
|||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\IndexPage as CrudIndexPage;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
class IndexPerTaxonPage extends CrudIndexPage implements IndexPerTaxonPageInterface
|
||||
|
|
@ -54,10 +53,9 @@ class IndexPerTaxonPage extends CrudIndexPage implements IndexPerTaxonPageInterf
|
|||
public function savePositions(): void
|
||||
{
|
||||
$saveConfigurationButton = $this->getElement('save_configuration_button');
|
||||
$saveConfigurationButton->press();
|
||||
$saveConfigurationButton->click();
|
||||
|
||||
$this->getDocument()->waitFor(5, fn () => null === $saveConfigurationButton->find('css', '.loading'));
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
}
|
||||
|
||||
public function filterByName(string $name): void
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Product;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Context\Ui\Admin\Helper\NavigationTrait;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Component\Core\Model\ProductVariantInterface;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
|
|
@ -119,18 +119,21 @@ class ShowPage extends SyliusPage implements ShowPageInterface
|
|||
|
||||
protected function getPricingRow(string $variantName, string $channelName): NodeElement
|
||||
{
|
||||
/** @var NodeElement|null $pricingRow */
|
||||
$pricingRow = $this->getDocument()->find(
|
||||
'css',
|
||||
sprintf('tr:contains("%s") + tr', $variantName),
|
||||
);
|
||||
|
||||
if ($pricingRow === null) {
|
||||
throw new \InvalidArgumentException(sprintf('Cannot find variant row for "%s"', $variantName));
|
||||
}
|
||||
|
||||
$pricingRow = $pricingRow->find('css', sprintf('td:contains("%s")', $channelName));
|
||||
|
||||
if ($pricingRow === null) {
|
||||
throw new \InvalidArgumentException(sprintf('Cannot find pricing row for variant "%s" in channel "%s"', $variantName, $channelName));
|
||||
}
|
||||
|
||||
return $pricingRow;
|
||||
return new NodeElement($pricingRow->getXpath(), $this->getSession());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Product;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Context\Ui\Admin\Helper\NavigationTrait;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
|
||||
use Sylius\Behat\Service\AutocompleteHelper;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelper;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
|
||||
|
|
@ -47,8 +47,6 @@ class UpdateConfigurableProductPage extends BaseUpdatePage implements UpdateConf
|
|||
|
||||
public function saveChanges(): void
|
||||
{
|
||||
$this->waitForFormUpdate();
|
||||
|
||||
parent::saveChanges();
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +54,7 @@ class UpdateConfigurableProductPage extends BaseUpdatePage implements UpdateConf
|
|||
{
|
||||
$optionElement = $this->getElement('options')->getParent();
|
||||
|
||||
return AutocompleteHelper::isValueVisible($this->getSession(), $optionElement, $option);
|
||||
return AutocompleteHelper::isValueVisible($optionElement, $option);
|
||||
}
|
||||
|
||||
public function isProductOptionsDisabled(): bool
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Product;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Context\Ui\Admin\Helper\NavigationTrait;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
use Sylius\Component\Core\Model\ChannelInterface;
|
||||
|
|
@ -44,8 +44,6 @@ class UpdateSimpleProductPage extends BaseUpdatePage implements UpdateSimpleProd
|
|||
|
||||
public function saveChanges(): void
|
||||
{
|
||||
$this->waitForFormUpdate();
|
||||
|
||||
parent::saveChanges();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,8 +60,6 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
|
|||
$this->getElement('product_filter')->getXpath(),
|
||||
$productName,
|
||||
);
|
||||
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
protected function changeState(string $state, array $parameters): void
|
||||
|
|
|
|||
|
|
@ -39,13 +39,12 @@ class GeneratePage extends BaseCreatePage implements GeneratePageInterface
|
|||
|
||||
public function generate(): void
|
||||
{
|
||||
$this->getElement('generate_button')->press();
|
||||
$this->getElement('generate_button')->click();
|
||||
}
|
||||
|
||||
public function removeVariant(int $nth): void
|
||||
{
|
||||
$this->getElement('delete_button', ['%position%' => $nth])->click();
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function isGenerationPossible(): bool
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\ProductVariant;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\IndexPage as BaseIndexPage;
|
||||
use Sylius\Component\Core\Model\ProductVariantInterface;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
|
@ -48,7 +48,7 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
|
|||
|
||||
public function savePositions(): void
|
||||
{
|
||||
$this->getElement('save_configuration_button')->press();
|
||||
$this->getElement('save_configuration_button')->click();
|
||||
|
||||
$this->getDocument()->waitFor(5, fn () => null === $this->getElement('save_configuration_button')->find('css', '.loading'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\ProductVariant;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
|
||||
use Sylius\Component\Core\Model\ChannelInterface;
|
||||
use Sylius\Component\Currency\Model\CurrencyInterface;
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Promotion;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Behaviour\NamesIt;
|
||||
use Sylius\Behat\Behaviour\SpecifiesItsField;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
|
||||
|
||||
class CreatePage extends BaseCreatePage implements CreatePageInterface
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Promotion;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\IndexPage as BaseIndexPage;
|
||||
use Sylius\Component\Promotion\Model\PromotionInterface;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Promotion;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Behaviour\CountsChannelBasedErrors;
|
||||
use Sylius\Behat\Behaviour\NamesIt;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
|
||||
|
||||
class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class GeneratePage extends BasePage implements GeneratePageInterface
|
|||
{
|
||||
public function generate(): void
|
||||
{
|
||||
$this->getElement('generate_button')->press();
|
||||
$this->getElement('generate_button')->click();
|
||||
}
|
||||
|
||||
public function specifyPrefix(string $prefix): void
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\Shipment;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\IndexPage as BaseIndexPage;
|
||||
use Sylius\Behat\Service\Accessor\TableAccessorInterface;
|
||||
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||
|
|
@ -45,7 +45,6 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
|
|||
$this->getElement('filter_channel')->getXpath(),
|
||||
$channelName,
|
||||
);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function chooseShippingMethodFilter(string $shippingMethodName): void
|
||||
|
|
@ -55,7 +54,6 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
|
|||
$this->getElement('filter_shipping_method')->getXpath(),
|
||||
$shippingMethodName,
|
||||
);
|
||||
$this->waitForFormUpdate();
|
||||
}
|
||||
|
||||
public function isShipmentWithOrderNumberInPosition(string $orderNumber, int $position): bool
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\ShippingCategory;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
|
||||
|
||||
class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\ShippingMethod;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\IndexPage as BaseIndexPage;
|
||||
use Sylius\Component\Core\Model\ShippingMethodInterface;
|
||||
use Sylius\Resource\Model\ResourceInterface;
|
||||
|
|
@ -40,16 +40,16 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
|
|||
{
|
||||
$actions = $this->getActionsForResource(['name' => $name]);
|
||||
$archiveRestoreModal = $actions->find('css', '[data-test-modal="archive-restore"]');
|
||||
$archiveRestoreModal->find('css', '[data-test-trigger-button="Archive"]')->press();
|
||||
$archiveRestoreModal->find('css', '[data-test-confirm-button]')->press();
|
||||
$archiveRestoreModal->find('css', '[data-test-trigger-button="Archive"]')->click();
|
||||
$archiveRestoreModal->find('css', '[data-test-confirm-button]')->click();
|
||||
}
|
||||
|
||||
public function restoreShippingMethod(string $name): void
|
||||
{
|
||||
$actions = $this->getActionsForResource(['name' => $name]);
|
||||
$archiveRestoreModal = $actions->find('css', '[data-test-modal="archive-restore"]');
|
||||
$archiveRestoreModal->find('css', '[data-test-trigger-button="Restore"]')->press();
|
||||
$archiveRestoreModal->find('css', '[data-test-confirm-button]')->press();
|
||||
$archiveRestoreModal->find('css', '[data-test-trigger-button="Restore"]')->click();
|
||||
$archiveRestoreModal->find('css', '[data-test-confirm-button]')->click();
|
||||
}
|
||||
|
||||
public function isShippingMethodDisabled(ShippingMethodInterface $shippingMethod): bool
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Admin\TaxRate;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
|
||||
|
||||
class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ namespace Sylius\Behat\Page\Shop\Account\AddressBook;
|
|||
use Behat\Mink\Exception\DriverException;
|
||||
use FriendsOfBehat\PageObjectExtension\Page\UnexpectedPageException;
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Component\Core\Model\AddressInterface;
|
||||
|
||||
class CreatePage extends SyliusPage implements CreatePageInterface
|
||||
|
|
@ -34,20 +33,16 @@ class CreatePage extends SyliusPage implements CreatePageInterface
|
|||
$this->getElement('country')->selectOption($address->getCountryCode());
|
||||
$this->getElement('city')->setValue($address->getCity());
|
||||
$this->getElement('postcode')->setValue($address->getPostcode());
|
||||
|
||||
DriverHelper::waitForFormToStopLoading($this->getSession());
|
||||
}
|
||||
|
||||
public function selectCountry(string $name): void
|
||||
{
|
||||
$this->getElement('country')->selectOption($name);
|
||||
|
||||
DriverHelper::waitForFormToStopLoading($this->getSession());
|
||||
}
|
||||
|
||||
public function addAddress(): void
|
||||
{
|
||||
$this->getElement('add_button')->press();
|
||||
$this->getElement('add_button')->click();
|
||||
}
|
||||
|
||||
public function hasProvinceValidationMessage(): bool
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
|||
namespace Sylius\Behat\Page\Shop\Account\AddressBook;
|
||||
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
class IndexPage extends SyliusPage implements IndexPageInterface
|
||||
|
|
@ -52,19 +51,17 @@ class IndexPage extends SyliusPage implements IndexPageInterface
|
|||
|
||||
public function editAddress(string $fullName): void
|
||||
{
|
||||
$this->getElement('edit_address', ['%full_name%' => $fullName])->press();
|
||||
$this->getElement('edit_address', ['%full_name%' => $fullName])->click();
|
||||
}
|
||||
|
||||
public function deleteAddress(string $fullName): void
|
||||
{
|
||||
$this->getElement('delete_button', ['%full_name%' => $fullName])->press();
|
||||
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
$this->getElement('delete_button', ['%full_name%' => $fullName])->click();
|
||||
}
|
||||
|
||||
public function setAsDefault(string $fullName): void
|
||||
{
|
||||
$this->getElement('set_as_default_button', ['%full_name%' => $fullName])->press();
|
||||
$this->getElement('set_as_default_button', ['%full_name%' => $fullName])->click();
|
||||
}
|
||||
|
||||
public function hasNoDefaultAddress(): bool
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ namespace Sylius\Behat\Page\Shop\Account\AddressBook;
|
|||
use Behat\Mink\Exception\DriverException;
|
||||
use FriendsOfBehat\PageObjectExtension\Page\UnexpectedPageException;
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
|
||||
class UpdatePage extends SyliusPage implements UpdatePageInterface
|
||||
{
|
||||
|
|
@ -63,24 +62,28 @@ class UpdatePage extends SyliusPage implements UpdatePageInterface
|
|||
|
||||
public function selectCountry(string $name): void
|
||||
{
|
||||
DriverHelper::waitForFormToStopLoading($this->getSession());
|
||||
|
||||
$country = $this->getElement('country');
|
||||
$country->selectOption($name);
|
||||
|
||||
DriverHelper::waitForFormToStopLoading($this->getSession());
|
||||
}
|
||||
|
||||
public function waitForFormToStopLoading(): void
|
||||
public function isFormAccessible(): bool
|
||||
{
|
||||
DriverHelper::waitForFormToStopLoading($this->getSession());
|
||||
try {
|
||||
try {
|
||||
$provinceElement = parent::getElement('province_name');
|
||||
} catch (\Exception) {
|
||||
$provinceElement = parent::getElement('province_code');
|
||||
}
|
||||
|
||||
return $provinceElement->isVisible();
|
||||
} catch (\Exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function saveChanges(): void
|
||||
{
|
||||
DriverHelper::waitForFormToStopLoading($this->getSession());
|
||||
|
||||
$this->getElement('save_button')->press();
|
||||
$this->getElement('save_button')->click();
|
||||
}
|
||||
|
||||
protected function getDefinedElements(): array
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ interface UpdatePageInterface extends SyliusPageInterface
|
|||
|
||||
public function selectCountry(string $name): void;
|
||||
|
||||
public function waitForFormToStopLoading(): void;
|
||||
public function isFormAccessible(): bool;
|
||||
|
||||
public function saveChanges(): void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class DashboardPage extends SyliusPage implements DashboardPageInterface
|
|||
|
||||
public function pressResendVerificationEmail(): void
|
||||
{
|
||||
$this->getElement('verification_button')->press();
|
||||
$this->getElement('verification_button')->click();
|
||||
}
|
||||
|
||||
protected function getDefinedElements(): array
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ use Behat\Mink\Session;
|
|||
use Sylius\Behat\Context\Ui\Admin\Helper\SecurePasswordTrait;
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Behat\Service\Accessor\TableAccessorInterface;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Behat\Service\SharedStorageInterface;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
|
||||
|
|
@ -48,8 +47,6 @@ class LoginPage extends SyliusPage implements LoginPageInterface
|
|||
public function logIn(): void
|
||||
{
|
||||
$this->getElement('login_button')->click();
|
||||
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
}
|
||||
|
||||
public function specifyPassword(string $password): void
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ namespace Sylius\Behat\Page\Shop\Account;
|
|||
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
|
||||
class ProfileUpdatePage extends SyliusPage implements ProfileUpdatePageInterface
|
||||
{
|
||||
|
|
@ -62,8 +61,7 @@ class ProfileUpdatePage extends SyliusPage implements ProfileUpdatePageInterface
|
|||
|
||||
public function saveChanges(): void
|
||||
{
|
||||
$this->getElement('save_changes_button')->press();
|
||||
$this->waitForElementToBeReady();
|
||||
$this->getElement('save_changes_button')->click();
|
||||
}
|
||||
|
||||
public function subscribeToTheNewsletter(): void
|
||||
|
|
@ -87,11 +85,4 @@ class ProfileUpdatePage extends SyliusPage implements ProfileUpdatePageInterface
|
|||
'subscribe_newsletter' => '[data-test-subscribe-newsletter]',
|
||||
]);
|
||||
}
|
||||
|
||||
protected function waitForElementToBeReady(): void
|
||||
{
|
||||
if (DriverHelper::isJavascript($this->getDriver())) {
|
||||
$this->getDocument()->waitFor(1, fn (): bool => $this->isOpen());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class RegisterPage extends SyliusPage implements RegisterPageInterface
|
|||
|
||||
public function register(): void
|
||||
{
|
||||
$this->getElement('create_account_button')->press();
|
||||
$this->getElement('create_account_button')->click();
|
||||
}
|
||||
|
||||
public function specifyEmail(string $email): void
|
||||
|
|
|
|||
|
|
@ -109,20 +109,20 @@ class SummaryPage extends ShopPage implements SummaryPageInterface
|
|||
|
||||
public function removeProduct(string $productName): void
|
||||
{
|
||||
$this->getElement('remove_item', ['%name%' => $productName])->press();
|
||||
$this->getElement('remove_item', ['%name%' => $productName])->click();
|
||||
$this->waitForComponentsUpdate();
|
||||
}
|
||||
|
||||
public function applyCoupon(string $couponCode): void
|
||||
{
|
||||
$this->getElement('coupon_field')->setValue($couponCode);
|
||||
$this->getElement('apply_coupon_button')->press();
|
||||
$this->getElement('apply_coupon_button')->click();
|
||||
$this->waitForComponentsUpdate();
|
||||
}
|
||||
|
||||
public function removeCoupon(): void
|
||||
{
|
||||
$this->getElement('remove_coupon')->press();
|
||||
$this->getElement('remove_coupon')->click();
|
||||
$this->waitForComponentsUpdate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,13 +13,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Shop\Checkout;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Behat\Mink\Exception\UnsupportedDriverActionException;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Context\Ui\Admin\Helper\SecurePasswordTrait;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\Shop\Page as ShopPage;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Behat\Service\SharedStorageInterface;
|
||||
use Sylius\Component\Core\Factory\AddressFactoryInterface;
|
||||
use Sylius\Component\Core\Model\AddressInterface;
|
||||
|
|
@ -165,7 +164,7 @@ class AddressPage extends ShopPage implements AddressPageInterface
|
|||
$this->waitForElementUpdate('form');
|
||||
|
||||
try {
|
||||
$this->getElement('login_button')->press();
|
||||
$this->getElement('login_button')->click();
|
||||
} catch (ElementNotFoundException) {
|
||||
$this->getElement('login_button')->click();
|
||||
}
|
||||
|
|
@ -201,12 +200,8 @@ class AddressPage extends ShopPage implements AddressPageInterface
|
|||
|
||||
public function nextStep(): void
|
||||
{
|
||||
if (DriverHelper::isJavascript($this->getDriver())) {
|
||||
$this->blur();
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
}
|
||||
$this->getElement('next_step')->press();
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
$this->blur();
|
||||
$this->getElement('next_step')->click();
|
||||
}
|
||||
|
||||
public function backToStore(): void
|
||||
|
|
@ -221,6 +216,26 @@ class AddressPage extends ShopPage implements AddressPageInterface
|
|||
$this->getElement('billing_province')->setValue($provinceName);
|
||||
}
|
||||
|
||||
public function getSpecifiedBillingProvince(): string
|
||||
{
|
||||
$this->waitForElementUpdate('form');
|
||||
|
||||
return $this->getElement('billing_province')->getValue();
|
||||
}
|
||||
|
||||
public function isFormAccessible(): bool
|
||||
{
|
||||
try {
|
||||
// Use parent::getElement to bypass automatic waiting and check if elements are accessible NOW
|
||||
$emailElement = parent::getElement('customer_email');
|
||||
$provinceElement = parent::getElement('billing_province');
|
||||
|
||||
return $emailElement->isVisible() && $provinceElement->isVisible();
|
||||
} catch (\Exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function specifyShippingAddressProvince(string $provinceName): void
|
||||
{
|
||||
$this->waitForElementUpdate('form');
|
||||
|
|
@ -281,11 +296,6 @@ class AddressPage extends ShopPage implements AddressPageInterface
|
|||
return $this->getOptionsFromSelect($this->getElement('billing_country'));
|
||||
}
|
||||
|
||||
public function waitForFormToStopLoading(): void
|
||||
{
|
||||
DriverHelper::waitForFormToStopLoading($this->getSession());
|
||||
}
|
||||
|
||||
protected function getDefinedElements(): array
|
||||
{
|
||||
return array_merge(parent::getDefinedElements(), [
|
||||
|
|
|
|||
|
|
@ -58,8 +58,12 @@ interface AddressPageInterface extends ShopPageInterface
|
|||
|
||||
public function specifyBillingAddressProvince(string $provinceName): void;
|
||||
|
||||
public function getSpecifiedBillingProvince(): string;
|
||||
|
||||
public function specifyShippingAddressProvince(string $provinceName): void;
|
||||
|
||||
public function isFormAccessible(): bool;
|
||||
|
||||
public function hasShippingAddressInput(): bool;
|
||||
|
||||
public function hasBillingAddressInput(): bool;
|
||||
|
|
@ -83,6 +87,4 @@ interface AddressPageInterface extends ShopPageInterface
|
|||
public function isDifferentShippingAddressChecked(): bool;
|
||||
|
||||
public function isShippingAddressVisible(): bool;
|
||||
|
||||
public function waitForFormToStopLoading(): void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Shop\Checkout;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Behat\Service\Accessor\TableAccessorInterface;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
use Sylius\Component\Core\Model\AddressInterface;
|
||||
use Sylius\Component\Core\Model\ProductInterface;
|
||||
use Sylius\Component\Core\Model\ShippingMethodInterface;
|
||||
|
|
@ -181,9 +180,7 @@ class CompletePage extends SyliusPage implements CompletePageInterface
|
|||
|
||||
public function confirmOrder(): void
|
||||
{
|
||||
$this->getElement('confirm_button')->press();
|
||||
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
$this->getElement('confirm_button')->click();
|
||||
}
|
||||
|
||||
public function changeAddress(): void
|
||||
|
|
@ -233,22 +230,6 @@ class CompletePage extends SyliusPage implements CompletePageInterface
|
|||
return str_contains($shippingPromotions->getText(), $promotionName);
|
||||
}
|
||||
|
||||
public function tryToOpen(array $urlParameters = []): void
|
||||
{
|
||||
if (DriverHelper::isJavascript($this->getDriver())) {
|
||||
$start = microtime(true);
|
||||
$end = $start + 15;
|
||||
do {
|
||||
parent::tryToOpen($urlParameters);
|
||||
sleep(3);
|
||||
} while (!$this->isOpen() && microtime(true) < $end);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
parent::tryToOpen($urlParameters);
|
||||
}
|
||||
|
||||
protected function getDefinedElements(): array
|
||||
{
|
||||
return array_merge(parent::getDefinedElements(), [
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ namespace Sylius\Behat\Page\Shop\Checkout;
|
|||
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
|
||||
class SelectPaymentPage extends SyliusPage implements SelectPaymentPageInterface
|
||||
{
|
||||
|
|
@ -26,13 +25,6 @@ class SelectPaymentPage extends SyliusPage implements SelectPaymentPageInterface
|
|||
|
||||
public function selectPaymentMethod(string $paymentMethod): void
|
||||
{
|
||||
if (DriverHelper::isJavascript($this->getDriver())) {
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
$this->getElement('payment_method_select', ['%payment_method%' => $paymentMethod])->click();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$paymentMethodOptionElement = $this->getElement('payment_method_option', ['%payment_method%' => $paymentMethod]);
|
||||
$paymentMethodOptionElement->selectOption($paymentMethodOptionElement->getAttribute('value'));
|
||||
}
|
||||
|
|
@ -59,8 +51,7 @@ class SelectPaymentPage extends SyliusPage implements SelectPaymentPageInterface
|
|||
|
||||
public function nextStep(): void
|
||||
{
|
||||
$this->getElement('next_step')->press();
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
$this->getElement('next_step')->click();
|
||||
}
|
||||
|
||||
public function changeShippingMethod(): void
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ namespace Sylius\Behat\Page\Shop\Checkout;
|
|||
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
use Sylius\Behat\Service\DriverHelper;
|
||||
|
||||
class SelectShippingPage extends SyliusPage implements SelectShippingPageInterface
|
||||
{
|
||||
|
|
@ -26,13 +25,6 @@ class SelectShippingPage extends SyliusPage implements SelectShippingPageInterfa
|
|||
|
||||
public function selectShippingMethod(string $shippingMethod): void
|
||||
{
|
||||
if (DriverHelper::isJavascript($this->getDriver())) {
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
$this->getElement('shipping_method_select', ['%shipping_method%' => $shippingMethod])->click();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$shippingMethodOptionElement = $this->getElement('shipping_method_option', ['%shipping_method%' => $shippingMethod]);
|
||||
$shippingMethodOptionElement->selectOption($shippingMethodOptionElement->getAttribute('value'));
|
||||
}
|
||||
|
|
@ -75,8 +67,11 @@ class SelectShippingPage extends SyliusPage implements SelectShippingPageInterfa
|
|||
|
||||
public function nextStep(): void
|
||||
{
|
||||
$this->getElement('next_step')->press();
|
||||
DriverHelper::waitForPageToLoad($this->getSession());
|
||||
$this->getElement('next_step')->click();
|
||||
|
||||
$this->getDocument()->waitFor(5, function () {
|
||||
return !$this->isOpen();
|
||||
});
|
||||
}
|
||||
|
||||
public function changeAddress(): void
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Behat\Page\Shop;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\UnsupportedDriverActionException;
|
||||
use Sylius\Behat\Element\NodeElement;
|
||||
use Sylius\Behat\Page\SyliusPage;
|
||||
|
||||
class HomePage extends SyliusPage implements HomePageInterface
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue