Skip to content

Commit

Permalink
Fix @javascript scenarios about channels menu taxon
Browse files Browse the repository at this point in the history
  • Loading branch information
Zales0123 committed Jun 22, 2022
1 parent 2f8c6c9 commit 92656a8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/Sylius/Behat/Page/Admin/Channel/UpdatePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

namespace Sylius\Behat\Page\Admin\Channel;

use Behat\Mink\Driver\Selenium2Driver;
use Behat\Mink\Element\NodeElement;
use DMore\ChromeDriver\ChromeDriver;
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
use Sylius\Behat\Behaviour\Toggles;
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
Expand Down Expand Up @@ -97,7 +99,18 @@ public function changeMenuTaxon(string $menuTaxon): void

public function getMenuTaxon(): string
{
return $this->getElement('menu_taxon')->getParent()->find('css', '.search > .text')->getText();
$element = $this->getElement('menu_taxon');

if (
$this->getDriver() instanceof Selenium2Driver ||
$this->getDriver() instanceof ChromeDriver
) {
$this->getDocument()->waitFor(1, function () use ($element) {
return $element->getText() !== '';
});
}

return $element->getText();
}

public function getUsedTheme(): string
Expand Down Expand Up @@ -125,7 +138,7 @@ protected function getDefinedElements(): array
'default_tax_zone' => '#sylius_channel_defaultTaxZone',
'enabled' => '#sylius_channel_enabled',
'locales' => '#sylius_channel_locales',
'menu_taxon' => '#sylius_channel_menuTaxon',
'menu_taxon' => '#sylius_channel_menuTaxon ~ .text',
'name' => '#sylius_channel_name',
'tax_calculation_strategy' => '#sylius_channel_taxCalculationStrategy',
]);
Expand Down

0 comments on commit 92656a8

Please sign in to comment.