Merge branch '1.11' into 1.12

* 1.11:
  [bug]Send request to GUS with https
  Adjust PR template file for 1.11 and 1.12 branches
  [Behat] Extract javascript driver check
This commit is contained in:
Grzegorz Sadowski 2022-08-02 07:41:42 +02:00
commit 384394a8eb
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
16 changed files with 57 additions and 31 deletions

View file

@ -1,6 +1,6 @@
| Q | A |
|-----------------|--------------------------------------------------------------|
| Branch? | 1.10, 1.11 or master <!-- see the comment below --> |
| Branch? | 1.11 or 1.12 <!-- see the comment below --> |
| Bug fix? | no/yes |
| New feature? | no/yes |
| BC breaks? | no/yes |
@ -9,8 +9,8 @@
| License | MIT |
<!--
- Bug fixes must be submitted against the 1.10 or 1.11 branch(the lowest possible)
- Features and deprecations must be submitted against the master branch
- Bug fixes must be submitted against the 1.11 branch
- Features and deprecations must be submitted against the 1.12 branch
- Make sure that the correct base branch is set
To be sure you are not breaking any Backward Compatibilities, check the documentation:

View file

@ -20,6 +20,7 @@ use Sylius\Behat\Behaviour\ChecksCodeImmutability;
use Sylius\Behat\Behaviour\Toggles;
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
use Sylius\Behat\Service\AutocompleteHelper;
use Sylius\Behat\Service\DriverHelper;
class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
{
@ -101,10 +102,7 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
{
$element = $this->getElement('menu_taxon');
if (
$this->getDriver() instanceof Selenium2Driver ||
$this->getDriver() instanceof ChromeDriver
) {
if (DriverHelper::isJavascript($this->getDriver())) {
$this->getDocument()->waitFor(1, function () use ($element) {
return $element->getText() !== '';
});

View file

@ -19,6 +19,7 @@ use DMore\ChromeDriver\ChromeDriver;
use Sylius\Behat\Behaviour\SpecifiesItsCode;
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
use Sylius\Behat\Service\AutocompleteHelper;
use Sylius\Behat\Service\DriverHelper;
use Sylius\Behat\Service\SlugGenerationHelper;
use Sylius\Component\Core\Model\TaxonInterface;
use Webmozart\Assert\Assert;
@ -36,7 +37,7 @@ class CreateConfigurableProductPage extends BaseCreatePage implements CreateConf
$name,
);
if ($this->getDriver() instanceof Selenium2Driver || $this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isJavascript($this->getDriver())) {
SlugGenerationHelper::waitForSlugGeneration($this->getSession(), $this->getElement('slug'));
}
}

View file

@ -19,6 +19,7 @@ use DMore\ChromeDriver\ChromeDriver;
use Sylius\Behat\Behaviour\SpecifiesItsCode;
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
use Sylius\Behat\Service\AutocompleteHelper;
use Sylius\Behat\Service\DriverHelper;
use Sylius\Behat\Service\SlugGenerationHelper;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\TaxonInterface;
@ -40,7 +41,7 @@ class CreateSimpleProductPage extends BaseCreatePage implements CreateSimpleProd
$this->activateLanguageTab($localeCode);
$this->getElement('name', ['%locale%' => $localeCode])->setValue($name);
if ($this->getDriver() instanceof Selenium2Driver || $this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isJavascript($this->getDriver())) {
SlugGenerationHelper::waitForSlugGeneration(
$this->getSession(),
$this->getElement('slug', ['%locale%' => $localeCode]),
@ -205,7 +206,7 @@ class CreateSimpleProductPage extends BaseCreatePage implements CreateSimpleProd
public function activateLanguageTab(string $locale): void
{
if (!$this->getDriver() instanceof Selenium2Driver && !$this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isNotJavascript($this->getDriver())) {
return;
}

View file

@ -19,6 +19,7 @@ use DMore\ChromeDriver\ChromeDriver;
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
use Sylius\Behat\Service\AutocompleteHelper;
use Sylius\Behat\Service\DriverHelper;
use Sylius\Behat\Service\SlugGenerationHelper;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\TaxonInterface;
@ -37,7 +38,7 @@ class UpdateSimpleProductPage extends BaseUpdatePage implements UpdateSimpleProd
$this->activateLanguageTab($localeCode);
$this->getElement('name', ['%locale%' => $localeCode])->setValue($name);
if ($this->getDriver() instanceof Selenium2Driver || $this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isJavascript($this->getDriver())) {
SlugGenerationHelper::waitForSlugGeneration(
$this->getSession(),
$this->getElement('slug', ['%locale%' => $localeCode]),
@ -346,7 +347,7 @@ class UpdateSimpleProductPage extends BaseUpdatePage implements UpdateSimpleProd
public function activateLanguageTab(string $locale): void
{
if (!$this->getDriver() instanceof Selenium2Driver && !$this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isNotJavascript($this->getDriver())) {
return;
}

View file

@ -13,13 +13,12 @@ declare(strict_types=1);
namespace Sylius\Behat\Page\Admin\ShippingMethod;
use Behat\Mink\Driver\Selenium2Driver;
use Behat\Mink\Element\NodeElement;
use Behat\Mink\Exception\ElementNotFoundException;
use DMore\ChromeDriver\ChromeDriver;
use Sylius\Behat\Behaviour\SpecifiesItsCode;
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
use Sylius\Behat\Service\TabsHelper;
use Sylius\Behat\Service\DriverHelper;
use Sylius\Component\Core\Formatter\StringInflector;
use Webmozart\Assert\Assert;
@ -64,7 +63,7 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
public function checkChannel($channelName): void
{
if ($this->getDriver() instanceof Selenium2Driver || $this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isJavascript($this->getDriver())) {
$this->getElement('channel', ['%channel%' => $channelName])->click();
return;

View file

@ -19,6 +19,7 @@ use Behat\Mink\Exception\ElementNotFoundException;
use DMore\ChromeDriver\ChromeDriver;
use Sylius\Behat\Behaviour\SpecifiesItsCode;
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
use Sylius\Behat\Service\DriverHelper;
use Sylius\Behat\Service\JQueryHelper;
use Sylius\Behat\Service\SlugGenerationHelper;
use Sylius\Component\Core\Model\TaxonInterface;
@ -79,7 +80,7 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
$this->activateLanguageTab($languageCode);
$this->getElement('name', ['%language%' => $languageCode])->setValue($name);
if ($this->getDriver() instanceof Selenium2Driver || $this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isJavascript($this->getDriver())) {
SlugGenerationHelper::waitForSlugGeneration(
$this->getSession(),
$this->getElement('slug', ['%language%' => $languageCode]),
@ -110,7 +111,7 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
public function activateLanguageTab(string $locale): void
{
if (!$this->getDriver() instanceof Selenium2Driver && !$this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isNotJavascript($this->getDriver())) {
return;
}

View file

@ -20,6 +20,7 @@ use DMore\ChromeDriver\ChromeDriver;
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
use Sylius\Behat\Service\AutocompleteHelper;
use Sylius\Behat\Service\DriverHelper;
use Sylius\Behat\Service\SlugGenerationHelper;
use Sylius\Component\Core\Model\TaxonInterface;
use Webmozart\Assert\Assert;
@ -45,7 +46,7 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
$this->activateLanguageTab($languageCode);
$this->getDocument()->fillField(sprintf('sylius_taxon_translations_%s_name', $languageCode), $name);
if ($this->getDriver() instanceof Selenium2Driver || $this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isJavascript($this->getDriver())) {
SlugGenerationHelper::waitForSlugGeneration(
$this->getSession(),
$this->getElement('slug', ['%language%' => $languageCode]),
@ -190,7 +191,7 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
public function activateLanguageTab(string $locale): void
{
if (!$this->getDriver() instanceof Selenium2Driver && !$this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isNotJavascript($this->getDriver())) {
return;
}

View file

@ -20,6 +20,7 @@ use Behat\Mink\Exception\UnsupportedDriverActionException;
use Behat\Mink\Session;
use DMore\ChromeDriver\ChromeDriver;
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;
use Sylius\Behat\Service\DriverHelper;
use Sylius\Behat\Service\JQueryHelper;
use Sylius\Component\Core\Factory\AddressFactoryInterface;
use Sylius\Component\Core\Model\AddressInterface;
@ -48,8 +49,7 @@ class AddressPage extends SymfonyPage implements AddressPageInterface
public function chooseDifferentShippingAddress(): void
{
$driver = $this->getDriver();
if ($driver instanceof Selenium2Driver || $driver instanceof ChromeDriver) {
if (DriverHelper::isJavascript($this->getDriver())) {
$this->getElement('different_shipping_address_label')->click();
return;

View file

@ -19,6 +19,7 @@ use Behat\Mink\Session;
use DMore\ChromeDriver\ChromeDriver;
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;
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;
@ -234,7 +235,7 @@ class CompletePage extends SymfonyPage implements CompletePageInterface
public function tryToOpen(array $urlParameters = []): void
{
if ($this->getDriver() instanceof Selenium2Driver || $this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isJavascript($this->getDriver())) {
$start = microtime(true);
$end = $start + 15;
do {

View file

@ -17,6 +17,7 @@ use Behat\Mink\Driver\Selenium2Driver;
use Behat\Mink\Exception\ElementNotFoundException;
use DMore\ChromeDriver\ChromeDriver;
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;
use Sylius\Behat\Service\DriverHelper;
class SelectPaymentPage extends SymfonyPage implements SelectPaymentPageInterface
{
@ -27,7 +28,7 @@ class SelectPaymentPage extends SymfonyPage implements SelectPaymentPageInterfac
public function selectPaymentMethod(string $paymentMethod): void
{
if ($this->getDriver() instanceof Selenium2Driver || $this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isJavascript($this->getDriver())) {
$this->getElement('payment_method_select', ['%payment_method%' => $paymentMethod])->click();
return;

View file

@ -18,6 +18,7 @@ use Behat\Mink\Element\NodeElement;
use Behat\Mink\Exception\ElementNotFoundException;
use DMore\ChromeDriver\ChromeDriver;
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;
use Sylius\Behat\Service\DriverHelper;
class SelectShippingPage extends SymfonyPage implements SelectShippingPageInterface
{
@ -28,7 +29,7 @@ class SelectShippingPage extends SymfonyPage implements SelectShippingPageInterf
public function selectShippingMethod(string $shippingMethod): void
{
if ($this->getDriver() instanceof Selenium2Driver || $this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isJavascript($this->getDriver())) {
$this->getElement('shipping_method_select', ['%shipping_method%' => $shippingMethod])->click();
return;

View file

@ -21,6 +21,7 @@ use DMore\ChromeDriver\ChromeDriver;
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;
use FriendsOfBehat\PageObjectExtension\Page\UnexpectedPageException;
use Sylius\Behat\Page\Shop\Cart\SummaryPageInterface;
use Sylius\Behat\Service\DriverHelper;
use Sylius\Behat\Service\JQueryHelper;
use Sylius\Component\Product\Model\ProductInterface;
use Sylius\Component\Product\Model\ProductOptionInterface;
@ -81,8 +82,7 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
{
$attributesTable = $this->getElement('attributes');
$driver = $this->getDriver();
if ($driver instanceof Selenium2Driver || $driver instanceof ChromeDriver) {
if (DriverHelper::isJavascript($this->getDriver())) {
try {
$attributesTab = $this->getElement('tab', ['%name%' => 'attributes']);
if (!$attributesTab->hasAttribute('[data-test-active]')) {
@ -294,8 +294,7 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
return;
}
$driver = $this->getDriver();
if ($driver instanceof Selenium2Driver || $driver instanceof ChromeDriver) {
if (DriverHelper::isJavascript($this->getDriver())) {
$variantRadio->click();
return;
@ -389,7 +388,7 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
private function waitForCartSummary(): void
{
if ($this->getDriver() instanceof Selenium2Driver || $this->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isJavascript($this->getDriver())) {
JQueryHelper::waitForAsynchronousActionsToFinish($this->getSession());
$this->getDocument()->waitFor(3, fn (): bool => $this->summaryPage->isOpen());
}

View file

@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace Sylius\Behat\Service;
use Behat\Mink\Driver\DriverInterface;
use Behat\Mink\Driver\Selenium2Driver;
use DMore\ChromeDriver\ChromeDriver;
abstract class DriverHelper
{
public static function isJavascript(DriverInterface $driver): bool
{
return $driver instanceof Selenium2Driver || $driver instanceof ChromeDriver;
}
public static function isNotJavascript(DriverInterface $driver): bool
{
return !$driver instanceof Selenium2Driver && !$driver instanceof ChromeDriver;
}
}

View file

@ -44,7 +44,7 @@ abstract class SlugGenerationHelper
public static function isSlugReadonly(Session $session, NodeElement $element): bool
{
if (!$session->getDriver() instanceof Selenium2Driver && !$session->getDriver() instanceof ChromeDriver) {
if (DriverHelper::isNotJavascript($session->getDriver())) {
return $element->hasAttribute('readonly');
}

View file

@ -13,7 +13,7 @@
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sylius.admin.notification.uri">http://gus.sylius.com/version</parameter>
<parameter key="sylius.admin.notification.uri">https://gus.sylius.com/version</parameter>
</parameters>
<services>