/** * @param string $source * @param string $target * * @When /^I put the "([^"]*)" column before the "([^"]*)" one$/ */ public function iPutTheColumnBeforeTheOne($source, $target) { $this->datagrid->openColumnsPopin(); $this->wait(); $this->datagrid->moveColumn($source, $target); $this->wait(); }
/** * @param string $not * @param string $viewLabel * * @Then /^I should( not)? see the "([^"]*)" view$/ * * @throws ExpectationException */ public function iShouldSeeTheView($not, $viewLabel) { $view = $this->datagrid->findView($viewLabel); if ('' !== $not && null !== $view || '' === $not && null === $view) { throw $this->createExpectationException(sprintf('View "%s" should%s be available.', $viewLabel, $not)); } }
/** * @param string $filterName * @param mixed $values * @param string $operator * * @throws \InvalidArgumentException */ protected function filterByDate($filterName, $values, $operator) { if (!is_array($values)) { $values = [$values, $values]; } $filter = $this->datagrid->getFilter($filterName); $this->datagrid->openFilter($filter); $criteriaElt = $filter->find('css', 'div.filter-criteria'); $criteriaElt->find('css', 'select.filter-select-oro')->selectOption($operator); $datepickers = $filter->findAll('css', '.date-visual-element'); foreach ($datepickers as $i => $datepicker) { if ($datepicker->isVisible()) { $datepicker->setValue($values[$i]); } } $filter->find('css', 'button.filter-update')->click(); }
/** * @param string $filterName * @param mixed $values * @param string $operator * * @throws \InvalidArgumentException */ protected function filterByDate($filterName, $values, $operator) { if (!is_array($values)) { $values = [$values, $values]; } $filter = $this->datagrid->getFilter($filterName); if (!$filter) { throw new \InvalidArgumentException("Could not find filter for {$filterName}."); } $this->datagrid->openFilter($filter); $criteriaElt = $filter->find('css', 'div.filter-criteria'); $criteriaElt->find('css', 'select.filter-select-oro')->selectOption($operator); $script = <<<'JS' require(['jquery', 'jquery-ui'], function ($) { $inputs = $('input.hasDatepicker:visible'); $inputs.first().datepicker('setDate', $.datepicker.parseDate('yy-mm-dd', '%s')); $inputs.last().datepicker('setDate', $.datepicker.parseDate('yy-mm-dd', '%s')); }); JS; $this->getSession()->getDriver()->executeScript(vsprintf($script, $values)); $filter->find('css', 'button.filter-update')->click(); }
/** * {@inheritdoc} */ public function __construct($session, $pageFactory, $parameters = []) { parent::__construct($session, $pageFactory, $parameters); $this->elements = array_merge($this->elements, ['Categories tree' => ['css' => '#tree'], 'Tree select' => ['css' => '#tree_select'], 'Locales dropdown' => ['css' => '#locale-switcher']]); }
/** * {@inheritdoc} */ public function __construct($session, $pageFactory, $parameters = []) { parent::__construct($session, $pageFactory, $parameters); $this->elements = array_merge($this->elements, ['Categories tree' => ['css' => '#tree'], 'Main context selector' => ['css' => '#container', 'decorators' => ['Pim\\Behat\\Decorator\\ContextSwitcherDecorator']], 'Tree select' => ['css' => '#tree_select'], 'Locales dropdown' => ['css' => '#locale-switcher'], 'Sidebar collapse button' => ['css' => '.sidebar .sidebar-controls i.icon-double-angle-left'], 'Sidebar expand button' => ['css' => '.separator.collapsed i.icon-double-angle-right']]); }
/** * {@inheritdoc} */ public function __construct($session, $pageFactory, $parameters = []) { parent::__construct($session, $pageFactory, $parameters); $this->elements = array_merge($this->elements, ['Categories tree' => ['css' => '#tree'], 'Main context selector' => ['css' => '#container', 'decorators' => ['Pim\\Behat\\Decorator\\ContextSwitcherDecorator']], 'Tree select' => ['css' => '#tree_select'], 'Locales dropdown' => ['css' => '#locale-switcher']]); }