/** * {@inheritdoc} */ public function selectMainTaxon(TaxonInterface $taxon) { $this->openTaxonBookmarks(); Assert::isInstanceOf($this->getDriver(), Selenium2Driver::class); $this->getDriver()->executeScript(sprintf('$(\'input.search\').val(\'%s\')', $taxon->getName())); $this->getElement('search')->click(); $this->getElement('search')->waitFor(10, function () { return $this->hasElement('search_item_selected'); }); $itemSelected = $this->getElement('search_item_selected'); $itemSelected->click(); }
/** * @param TaxonInterface $taxon * @param string $direction * * @throws ElementNotFoundException */ private function moveLeaf(TaxonInterface $taxon, $direction) { Assert::oneOf($direction, [self::MOVE_DIRECTION_UP, self::MOVE_DIRECTION_DOWN]); $leaves = $this->getLeaves(); foreach ($leaves as $leaf) { if ($leaf->getText() === $taxon->getName()) { $moveButton = $leaf->getParent()->find('css', sprintf('.sylius-taxon-move-%s', $direction)); $moveButton->click(); $moveButton->waitFor(5, function () use($moveButton) { return $this->isOpen() && !$moveButton->hasClass('loading'); }); return; } } throw new ElementNotFoundException($this->getDriver(), sprintf('Move %s button for %s taxon', $direction, $taxon->getName())); }
/** * {@inheritdoc} */ public function chooseParent(TaxonInterface $taxon) { $this->getElement('parent')->selectOption($taxon->getName(), false); }
/** * @Then /^this taxon should (belongs to "[^"]+")$/ */ public function thisTaxonShouldBelongsTo(TaxonInterface $taxon) { Assert::true($this->updatePage->hasResourceValues(['parent' => $taxon->getId()]), sprintf('Current taxon should have %s parent taxon.', $taxon->getName())); }
/** * @Then the first taxon on the list should be :taxon */ public function theFirstTaxonOnTheListShouldBe(TaxonInterface $taxon) { Assert::same($this->createPage->getFirstLeafName(), $taxon->getName(), sprintf('Expected %s as a first taxon, but got %s.', $taxon->getName(), $this->createPage->getFirstLeafName())); }