[Behat] Cure the build

This commit is contained in:
Arminek 2016-11-17 09:57:25 +01:00
parent bea9153911
commit af826a4067
5 changed files with 1 additions and 65 deletions

View file

@ -15,10 +15,3 @@ Feature: Reordering taxons
Then I should see 4 taxons on the list Then I should see 4 taxons on the list
And I should see the taxon named "T-Shirts" in the list And I should see the taxon named "T-Shirts" in the list
But the first taxon on the list should be "Watches" But the first taxon on the list should be "Watches"
@ui @javascript
Scenario: Changing order of the taxons by dragging
When I want to see all taxons in store
And I move "Wallets" taxon before "T-shirts" taxon
Then I should see 4 taxons on the list
And they should have order like "Wallets", "T-Shirts", "Watches" and "Belts"

View file

@ -181,14 +181,6 @@ final class ManagingTaxonsContext implements Context
$this->createPage->moveUp($taxon); $this->createPage->moveUp($taxon);
} }
/**
* @When /^I move ("[^"]+" taxon) before ("[^"]+" taxon)$/
*/
public function iMoveTaxonBeforeTaxon(TaxonInterface $taxonToMove, TaxonInterface $targetTaxon)
{
$this->createPage->insertBefore($taxonToMove, $targetTaxon);
}
/** /**
* @Given /^I choose ("[^"]+" as a parent taxon)$/ * @Given /^I choose ("[^"]+" as a parent taxon)$/
*/ */

View file

@ -156,30 +156,6 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
return $this->getLeaves($parentTaxon)[0]->getText(); return $this->getLeaves($parentTaxon)[0]->getText();
} }
/**
* {@inheritDoc}
*/
public function insertBefore(TaxonInterface $draggableTaxon, TaxonInterface $targetTaxon)
{
$seleniumDriver = $this->getSeleniumDriver();
$draggableTaxonLocator = sprintf('.item[data-id="%s"]', $draggableTaxon->getId());
$targetTaxonLocator = sprintf('.item[data-id="%s"]', $targetTaxon->getId());
$script = <<<JS
(function ($) {
$('$draggableTaxonLocator').simulate('drag-n-drop',{
dragTarget: $('$targetTaxonLocator'),
interpolation: {stepWidth: 10, stepDelay: 30}
});
})(jQuery);
JS;
$seleniumDriver->executeScript($script);
$this->getDocument()->waitFor(5, function () use ($draggableTaxonLocator) {
return !$this->getDocument()->find('css', $draggableTaxonLocator)->hasClass('dragging-started');
});
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -262,22 +238,6 @@ JS;
return end($items); return end($items);
} }
/**
* @return Selenium2Driver
*
* @throws UnsupportedDriverActionException
*/
private function getSeleniumDriver()
{
/** @var Selenium2Driver $driver */
$driver = $this->getDriver();
if (!$driver instanceof Selenium2Driver) {
throw new UnsupportedDriverActionException('This action is not supported by %s', $driver);
}
return $driver;
}
private function waitForSlugGenerationIfNecessary() private function waitForSlugGenerationIfNecessary()
{ {
if ($this->getDriver() instanceof Selenium2Driver) { if ($this->getDriver() instanceof Selenium2Driver) {

View file

@ -98,12 +98,6 @@ interface CreatePageInterface extends BaseCreatePageInterface
*/ */
public function getFirstLeafName(TaxonInterface $parentTaxon = null); public function getFirstLeafName(TaxonInterface $parentTaxon = null);
/**
* @param TaxonInterface $draggableTaxon
* @param TaxonInterface $targetTaxon
*/
public function insertBefore(TaxonInterface $draggableTaxon, TaxonInterface $targetTaxon);
/** /**
* @param TaxonInterface|null $parentTaxon * @param TaxonInterface|null $parentTaxon
* *

View file

@ -24,10 +24,7 @@ var paths = {
'../ShippingBundle/Resources/public/js/**', '../ShippingBundle/Resources/public/js/**',
'../UiBundle/Resources/private/js/**', '../UiBundle/Resources/private/js/**',
'../UserBundle/Resources/public/js/sylius-user.js', '../UserBundle/Resources/public/js/sylius-user.js',
'Resources/private/js/**', 'Resources/private/js/**'
'../../../../node_modules/jquery-simulate-ext/libs/jquery.simulate.js',
'../../../../node_modules/jquery-simulate-ext/src/jquery.simulate.ext.js',
'../../../../node_modules/jquery-simulate-ext/src/jquery.simulate.drag-n-drop.js'
], ],
sass: [ sass: [
'../UiBundle/Resources/private/sass/**' '../UiBundle/Resources/private/sass/**'