mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
bug #11549 Behat for reordering taxon feature ()
This PR was merged into the 1.7 branch.
Discussion
----------
| Q | A
| --------------- | -----
| Branch? | 1.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Related tickets |
| License | MIT
<!--
- Bug fixes must be submitted against the 1.6 or 1.7 branches (the lowest possible)
- Features and deprecations must be submitted against the master branch
- Make sure that the correct base branch is set
-->
Commits
-------
eb54c52702 Behat for reordering taxon feature
This commit is contained in:
commit
23f3828dfc
4 changed files with 58 additions and 2 deletions
|
|
@ -8,7 +8,7 @@ Feature: Reordering taxons
|
|||
Given the store classifies its products as "T-Shirts", "Watches", "Belts" and "Wallets"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui @javascript @todo
|
||||
@ui @javascript
|
||||
Scenario: Moving up the taxon on list
|
||||
When I want to see all taxons in store
|
||||
And I move up "Watches" taxon
|
||||
|
|
@ -16,7 +16,7 @@ Feature: Reordering taxons
|
|||
And I should see the taxon named "T-Shirts" in the list
|
||||
But the first taxon on the list should be "Watches"
|
||||
|
||||
@ui @javascript @todo
|
||||
@ui @javascript
|
||||
Scenario: Moving down the taxon on list
|
||||
When I want to see all taxons in store
|
||||
And I move down "T-Shirts" taxon
|
||||
|
|
|
|||
|
|
@ -398,6 +398,30 @@ final class ManagingTaxonsContext implements Context
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I move up :taxonName taxon
|
||||
*/
|
||||
public function iMoveUpTaxon(string $taxonName)
|
||||
{
|
||||
$this->createPage->moveUpTaxon($taxonName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I move down :taxonName taxon
|
||||
*/
|
||||
public function iMoveDownTaxon(string $taxonName)
|
||||
{
|
||||
$this->createPage->moveDownTaxon($taxonName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the first taxon on the list should be :taxonName
|
||||
*/
|
||||
public function theFirstTaxonOnTheListShouldBe(string $taxonName)
|
||||
{
|
||||
Assert::same($this->createPage->getFirstTaxonOnTheList(), $taxonName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CreatePageInterface|CreateForParentPageInterface|UpdatePageInterface
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -120,6 +120,31 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
|
|||
}
|
||||
}
|
||||
|
||||
public function moveUpTaxon(string $name): void
|
||||
{
|
||||
$taxonElement = $this->getElement('tree_item', ['%taxon%' => $name]);
|
||||
$treeAction = $taxonElement->getParent()->getParent()->find('css', '.sylius-tree__action');
|
||||
$treeAction->click();
|
||||
JQueryHelper::waitForAsynchronousActionsToFinish($this->getSession());
|
||||
$treeAction->find('css', '.sylius-taxon-move-up .up')->click();
|
||||
JQueryHelper::waitForAsynchronousActionsToFinish($this->getSession());
|
||||
}
|
||||
|
||||
public function moveDownTaxon(string $name): void
|
||||
{
|
||||
$taxonElement = $this->getElement('tree_item', ['%taxon%' => $name]);
|
||||
$treeAction = $taxonElement->getParent()->getParent()->find('css', '.sylius-tree__action');
|
||||
$treeAction->click();
|
||||
JQueryHelper::waitForAsynchronousActionsToFinish($this->getSession());
|
||||
$treeAction->find('css', '.sylius-taxon-move-down .down')->click();
|
||||
JQueryHelper::waitForAsynchronousActionsToFinish($this->getSession());
|
||||
}
|
||||
|
||||
public function getFirstTaxonOnTheList(): string
|
||||
{
|
||||
return $this->getLeaves()[0]->getText();
|
||||
}
|
||||
|
||||
protected function getElement(string $name, array $parameters = []): NodeElement
|
||||
{
|
||||
if (!isset($parameters['%language%'])) {
|
||||
|
|
@ -140,6 +165,7 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
|
|||
'name' => '#sylius_taxon_translations_%language%_name',
|
||||
'slug' => '#sylius_taxon_translations_%language%_slug',
|
||||
'tree' => '.sylius-tree',
|
||||
'tree_item' => '.sylius-tree__item a:contains("%taxon%")',
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,4 +49,10 @@ interface CreatePageInterface extends BaseCreatePageInterface
|
|||
public function getLeaves(TaxonInterface $parentTaxon = null): array;
|
||||
|
||||
public function activateLanguageTab(string $locale): void;
|
||||
|
||||
public function moveUpTaxon(string $name): void;
|
||||
|
||||
public function moveDownTaxon(string $name): void;
|
||||
|
||||
public function getFirstTaxonOnTheList(): string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue