diff --git a/demos/_unit-test/grid-rowclick.php b/demos/_unit-test/grid-rowclick.php index ef9339c005..8691e37ed7 100644 --- a/demos/_unit-test/grid-rowclick.php +++ b/demos/_unit-test/grid-rowclick.php @@ -45,5 +45,5 @@ // this emulation is not perfect, as it works even with event.preventDefault() called $grid->table->js(true)->find('a')->on( 'click', - new JsFunction(['event'], [new JsExpression('window.location.href = \'#test\'; event.preventDefault();')]) + new JsFunction([], [new JsExpression('window.location.href = \'#test\''), 'preventDefault' => true]) ); diff --git a/demos/form-control/dropdown-plus.php b/demos/form-control/dropdown-plus.php index bd3d0e68da..404c7f0ad6 100644 --- a/demos/form-control/dropdown-plus.php +++ b/demos/form-control/dropdown-plus.php @@ -80,14 +80,14 @@ $form->addControl('values', [ Form\Control\Dropdown::class, 'caption' => 'Using values with default text', - 'empty' => 'Choose an option', + 'placeholder' => 'Choose an option', 'values' => ['default' => 'Default', 'option1' => 'Option 1', 'option2' => 'Option 2', 'option3' => 'Option 3'], ]); $form->addControl('icon', [ Form\Control\Dropdown::class, 'caption' => 'Using icon', - 'empty' => 'Choose an icon', + 'placeholder' => 'Choose an icon', 'values' => [ 'tag' => ['Tag', 'icon' => 'tag'], 'globe' => ['Globe', 'icon' => 'globe'], @@ -99,7 +99,7 @@ $form->addControl('multi', [ Form\Control\Dropdown::class, 'caption' => 'Multiple selection', - 'empty' => 'Choose has many options needed', + 'placeholder' => 'Choose has many options needed', 'multiple' => true, 'values' => ['default' => 'Default', 'option1' => 'Option 1', 'option2' => 'Option 2'], ]); diff --git a/src/Behat/Context.php b/src/Behat/Context.php index 5f95c7e62f..d3c731092b 100644 --- a/src/Behat/Context.php +++ b/src/Behat/Context.php @@ -280,7 +280,7 @@ protected function unquoteStepArgument(string $argument): string /** * Sleep for a certain time in ms. * - * @Then I wait :arg1 ms + * @When I wait :arg1 ms */ public function iWait(int $ms): void { @@ -349,7 +349,7 @@ public function iClickLink(string $label): void } /** - * @Then I click using selector :selector + * @When I click using selector :selector */ public function iClickUsingSelector(string $selector): void { @@ -362,7 +362,7 @@ public function iClickUsingSelector(string $selector): void * * One solution can be waiting for AJAX after each \WebDriver\AbstractWebDriver::curl() call. * - * @Then PATCH DRIVER I click using selector :selector + * @When PATCH DRIVER I click using selector :selector */ public function iClickPatchedUsingSelector(string $selector): void { @@ -378,7 +378,7 @@ public function iClickPatchedUsingSelector(string $selector): void } /** - * @Then I click paginator page :arg1 + * @When I click paginator page :arg1 */ public function iClickPaginatorPage(string $pageNumber): void { @@ -400,7 +400,7 @@ public function iFillField(string $selector, string $value): void // {{{ modal /** - * @Then I press Modal button :arg + * @When I press Modal button :arg */ public function iPressModalButton(string $buttonLabel): void { @@ -436,7 +436,7 @@ public function iFillModalField(string $fieldName, string $value): void } /** - * @Then I click close modal + * @When I click close modal */ public function iClickCloseModal(): void { @@ -446,7 +446,7 @@ public function iClickCloseModal(): void } /** - * @Then I hide js modal + * @When I hide js modal */ public function iHideJsModal(): void { @@ -487,7 +487,7 @@ public function iFillPanelField(string $fieldName, string $value): void } /** - * @Then I press Panel button :arg + * @When I press Panel button :arg */ public function iPressPanelButton(string $buttonLabel): void { @@ -501,7 +501,7 @@ public function iPressPanelButton(string $buttonLabel): void // {{{ tab /** - * @Given I click tab with title :arg1 + * @When I click tab with title :arg1 */ public function iClickTabWithTitle(string $tabTitle): void { @@ -541,7 +541,7 @@ public function inputValueShouldStartWith(string $inputName, string $text): void } /** - * @Then I search grid for :arg1 + * @When I search grid for :arg1 */ public function iSearchGridFor(string $text): void { @@ -550,23 +550,25 @@ public function iSearchGridFor(string $text): void } /** - * @Then I select value :arg1 in lookup :arg2 + * @When I select value :arg1 in lookup :arg2 */ public function iSelectValueInLookup(string $value, string $inputName): void { - $isSelectorXpath = $this->parseSelector($inputName)[0] === 'xpath'; - // get dropdown item from Fomantic-UI which is direct parent of input HTML element + $isSelectorXpath = $this->parseSelector($inputName)[0] === 'xpath'; $lookupElem = $this->findElement(null, ($isSelectorXpath ? $inputName : '//input[@name="' . $inputName . '"]') . '/parent::div'); + if ($value === '') { + $this->findElement($lookupElem, 'i.remove.icon')->click(); + + return; + } + // open dropdown and wait till fully opened (just a click is not triggering it) $this->getSession()->executeScript('$(arguments[0]).dropdown(\'show\')', [$lookupElem]); $this->jqueryWait('$(arguments[0]).hasClass(\'visible\')', [$lookupElem]); // select value - if ($value === '') { // TODO impl. native clearable - https://github.com/atk4/ui/issues/572 - $value = "\u{00a0}"; - } $valueElem = $this->findElement($lookupElem, '//div[text()="' . $value . '"]'); $this->getSession()->executeScript('$(arguments[0]).dropdown(\'set selected\', arguments[1]);', [$lookupElem, $valueElem->getAttribute('data-value')]); $this->jqueryWait(); @@ -678,31 +680,29 @@ public function scopeBuilderBoolRule(string $name, string $value): void } /** - * @Then ~^I check if input value for "([^"]*)" match text "([^"]*)"~ + * @Then ~^I check if input value for "([^"]*)" match text in "([^"]*)"$~ */ - public function compareInputValueToText(string $selector, string $text): void + public function compareInputValueText(string $compareSelector, string $compareToSelector): void { - $selector = $this->unquoteStepArgument($selector); - $text = $this->unquoteStepArgument($text); + $compareSelector = $this->unquoteStepArgument($compareSelector); + $compareToSelector = $this->unquoteStepArgument($compareToSelector); - $inputValue = $this->findElement(null, $selector)->getValue(); - if ($inputValue !== $text) { - throw new \Exception('Input value does not match: ' . $inputValue . ', expected: ' . $text); + if ($this->findElement(null, $compareSelector)->getValue() !== $this->findElement(null, $compareToSelector)->getText()) { + throw new \Exception('Input value does not match between: ' . $compareSelector . ' and ' . $compareToSelector); } } /** - * @Then ~^I check if input value for "([^"]*)" match text in "([^"]*)"$~ + * @Then ~^I check if input value for "([^"]*)" match text "([^"]*)"$~ */ - public function compareInputValueToElementText(string $inputName, string $selector): void + public function compareInputValueToText(string $selector, string $text): void { - $inputName = $this->unquoteStepArgument($inputName); $selector = $this->unquoteStepArgument($selector); + $text = $this->unquoteStepArgument($text); - $expectedText = $this->findElement(null, $selector)->getText(); - $input = $this->findElement(null, 'input[name="' . $inputName . '"]'); - if ($expectedText !== $input->getValue()) { - throw new \Exception('Input value does not match: ' . $input->getValue() . ', expected: ' . $expectedText); + $inputValue = $this->findElement(null, $selector)->getValue(); + if ($inputValue !== $text) { + throw new \Exception('Input value does not match: ' . $inputValue . ', expected: ' . $text); } } @@ -720,7 +720,7 @@ public function dump(string $arg1): void } /** - * @Then I click filter column name :arg1 + * @When I click filter column name :arg1 */ public function iClickFilterColumnName(string $columnName): void { @@ -747,7 +747,7 @@ public function containerShouldHaveNumberOfItem(string $selector, int $numberOfi } /** - * @Then I scroll to top + * @When I scroll to top */ public function iScrollToTop(): void { @@ -755,7 +755,7 @@ public function iScrollToTop(): void } /** - * @Then I scroll to bottom + * @When I scroll to bottom */ public function iScrollToBottom(): void { @@ -801,7 +801,7 @@ public function assertUrlRegExp(string $pattern): void } /** - * @Then ~^I check if text in "([^"]*)" match text in "([^"]*)"~ + * @Then ~^I check if text in "([^"]*)" match text in "([^"]*)"$~ */ public function compareElementText(string $compareSelector, string $compareToSelector): void { @@ -814,7 +814,7 @@ public function compareElementText(string $compareSelector, string $compareToSel } /** - * @Then ~^I check if text in "([^"]*)" match text "([^"]*)"~ + * @Then ~^I check if text in "([^"]*)" match text "([^"]*)"$~ */ public function textInContainerShouldMatch(string $selector, string $text): void { @@ -827,7 +827,7 @@ public function textInContainerShouldMatch(string $selector, string $text): void } /** - * @Then ~^I check if text in "([^"]*)" match regex "([^"]*)"~ + * @Then ~^I check if text in "([^"]*)" match regex "([^"]*)"$~ */ public function textInContainerShouldMatchRegex(string $selector, string $regex): void { diff --git a/src/Form/Control/Dropdown.php b/src/Form/Control/Dropdown.php index db7d0cf328..71b67878ea 100644 --- a/src/Form/Control/Dropdown.php +++ b/src/Form/Control/Dropdown.php @@ -32,9 +32,6 @@ class Dropdown extends Input */ public array $values; - /** @var string The string to set as an empty values. */ - public $empty = "\u{00a0}"; // Unicode NBSP - /** @var array Dropdown options as per Fomantic-UI dropdown options. */ public $dropdownOptions = []; @@ -161,18 +158,16 @@ protected function jsDropdown($when = false, $action = null): JsExpressionable protected function jsRenderDropdown(): JsExpressionable { - return $this->jsDropdown(true)->dropdown($this->dropdownOptions); + $dropdownOptions = $this->dropdownOptions; + if ($this->entityField === null || ($this->entityField->getField()->nullable || !$this->entityField->getField()->required)) { + $dropdownOptions['clearable'] = true; + } + + return $this->jsDropdown(true)->dropdown($dropdownOptions); } protected function htmlRenderValue(): void { - // add selection only if no value is required and Dropdown has no multiple selections enabled - if ($this->entityField !== null && !$this->entityField->getField()->required && !$this->multiple) { - $this->_tItem->set('value', ''); - $this->_tItem->set('title', $this->empty); - $this->template->dangerouslyAppendHtml('Item', $this->_tItem->renderToHtml()); - } - // model set? use this, else values property if ($this->model !== null) { if ($this->renderRowFunction) { @@ -202,12 +197,6 @@ protected function renderView(): void $this->template->dangerouslySetHtml('multipleClass', 'multiple'); } - if ($this->disabled || $this->readOnly) { - if ($this->multiple) { - $this->jsDropdown(true)->find('a i.delete.icon')->attr('class', 'disabled'); - } - } - if ($this->disabled) { $this->template->set('disabledClass', 'disabled'); $this->template->dangerouslySetHtml('disabled', 'disabled="disabled"'); @@ -216,7 +205,7 @@ protected function renderView(): void $this->template->dangerouslySetHtml('disabled', 'readonly="readonly"'); } - $this->template->set('DefaultText', $this->empty); + $this->template->set('DefaultText', $this->placeholder); $this->htmlRenderValue(); $this->jsRenderDropdown(); diff --git a/src/Form/Control/DropdownCascade.php b/src/Form/Control/DropdownCascade.php index 330605e39f..6a9455a7aa 100644 --- a/src/Form/Control/DropdownCascade.php +++ b/src/Form/Control/DropdownCascade.php @@ -67,7 +67,6 @@ public function set($value = null) /** * Generate new dropdown values based on cascadeInput model selected ID. - * Return an empty value set if ID is null. * * @param mixed $id * @@ -76,11 +75,7 @@ public function set($value = null) public function getNewValues($id): array { if ($id === null) { - return [[ - 'value' => '', - 'text' => $this->empty, - 'name' => $this->empty, - ]]; + return []; } $model = $this->cascadeFrom->model->load($id)->ref($this->reference); diff --git a/src/Form/Control/Lookup.php b/src/Form/Control/Lookup.php index 62edf74402..c675aec388 100644 --- a/src/Form/Control/Lookup.php +++ b/src/Form/Control/Lookup.php @@ -35,9 +35,6 @@ class Lookup extends Input /** @var CallbackLater Object used to capture requests from the browser. */ public $callback; - /** @var string Set this to true, to permit "empty" selection. If you set it to string, it will be used as a placeholder for empty value. */ - public $empty = "\u{00a0}"; // Unicode NBSP - /** * Either set this to array of fields which must be searched (e.g. "name", "surname"), or define this * as a callback to be executed callback($model, $query);. @@ -112,8 +109,9 @@ class Lookup extends Input public $settings = []; /** - * Define callback for generating the row data - * If left empty default callback Lookup::defaultRenderRow is used. + * Define callback for generating the row data. + * + * When null default callback Lookup::defaultRenderRow is used. * * @var \Closure($this, T): array{title: mixed} */ @@ -197,10 +195,6 @@ public function getData($limit = true): array $data[] = $this->renderRow($row); } - if (!$this->multiple && $this->empty) { - array_unshift($data, ['value' => '', 'title' => $this->empty]); - } - return $data; } @@ -363,6 +357,10 @@ protected function initDropdown($chain): void 'apiSettings' => array_merge(['url' => $this->getCallbackUrl() . '&q={query}'], $this->apiConfig), ], $this->settings); + if ($this->entityField === null || ($this->entityField->getField()->nullable || !$this->entityField->getField()->required)) { + $settings['clearable'] = true; + } + $chain->dropdown($settings); } diff --git a/src/Form/Control/ScopeBuilder.php b/src/Form/Control/ScopeBuilder.php index 22145615df..aa2a0545f4 100644 --- a/src/Form/Control/ScopeBuilder.php +++ b/src/Form/Control/ScopeBuilder.php @@ -756,6 +756,8 @@ public function detectDelimiter(string $value): string $max = array_keys($matches, max($matches), true); - return $max !== [] ? reset($max) : reset(static::$listDelimiters); + return $max !== [] + ? reset($max) + : reset(static::$listDelimiters); } } diff --git a/tests-behat/accordion.feature b/tests-behat/accordion.feature index ab423c3401..795e83e797 100644 --- a/tests-behat/accordion.feature +++ b/tests-behat/accordion.feature @@ -3,20 +3,20 @@ Feature: Accordion Scenario: Form Accordion Section is activated Given I am on "form/form-section-accordion.php" Then I should see "Email" - Then I fill in "email" with "xxx@xxx.com" + When I fill in "email" with "xxx@xxx.com" Scenario: Nested Accordion Given I am on "interactive/accordion-nested.php" - Then I click using selector "(//div[text()='Static Text'])[1]" - Then I click using selector "(//div[text()='Static Text'])[1]" - Then I click using selector "(//div[text()='Static Text'])[1]" - Then I click using selector "(//div[text()='Static Text'])[2]" - Then I click using selector "(//div[text()='Dynamic Text'])[3]" - Then I click using selector "(//div[text()='Dynamic Text'])[3]" - Then I click using selector "(//div[text()='Dynamic Text'])[3]" - Then I click using selector "(//div[text()='Dynamic Form'])[4]" - Then I click using selector "(//div[text()='Dynamic Form'])[4]" - Then I click using selector "(//div[text()='Dynamic Form'])[4]" - Then I fill in "email" with "xxx@xxx.com" + When I click using selector "(//div[text()='Static Text'])[1]" + When I click using selector "(//div[text()='Static Text'])[1]" + When I click using selector "(//div[text()='Static Text'])[1]" + When I click using selector "(//div[text()='Static Text'])[2]" + When I click using selector "(//div[text()='Dynamic Text'])[3]" + When I click using selector "(//div[text()='Dynamic Text'])[3]" + When I click using selector "(//div[text()='Dynamic Text'])[3]" + When I click using selector "(//div[text()='Dynamic Form'])[4]" + When I click using selector "(//div[text()='Dynamic Form'])[4]" + When I click using selector "(//div[text()='Dynamic Form'])[4]" + When I fill in "email" with "xxx@xxx.com" When I press button "Save" Then I should see "Subscribed xxx@xxx.com to newsletter." diff --git a/tests-behat/basicexecutor.feature b/tests-behat/basicexecutor.feature index 8aa47660cd..23e08af834 100644 --- a/tests-behat/basicexecutor.feature +++ b/tests-behat/basicexecutor.feature @@ -9,8 +9,8 @@ Feature: Basic Executor Given I am on "data-action/actions.php" When I press button "Run Import" Then I should see "Must not be empty" - Then I fill in "path" with "." - Then I press button "Run Import" + When I fill in "path" with "." + When I press button "Run Import" Then Toast display should contain text "Imported!" Scenario: preview diff --git a/tests-behat/callback.feature b/tests-behat/callback.feature index e0e24cc559..80cdb307ec 100644 --- a/tests-behat/callback.feature +++ b/tests-behat/callback.feature @@ -2,7 +2,7 @@ Feature: Callback Scenario: Given I am on "_unit-test/callback.php" - Then I press button "First" + When I press button "First" Then I should see "TestName" When I press Modal button "Save" Then Toast display should contain text "Save" @@ -10,13 +10,13 @@ Feature: Callback Scenario: Given I am on "_unit-test/callback-nested.php" - Then I press button "Load1" + When I press button "Load1" Then I should see "Loader-1" - Then I press button "Load2" + When I press button "Load2" Then I should see "Loader-2" Then I should see "Loader-3" - Then I click paginator page "2" - Then I click using selector "(//div.ui.atk-test.button)[1]" + When I click paginator page "2" + When I click using selector "(//div.ui.atk-test.button)[1]" Then Modal is open with text "Edit Country" - Then I press Modal button "Save" + When I press Modal button "Save" Then Toast display should contain text 'Country action "edit" with "Andorra" entity was executed.' diff --git a/tests-behat/card-deck.feature b/tests-behat/card-deck.feature index 61af0f9c58..c34e0cebe0 100644 --- a/tests-behat/card-deck.feature +++ b/tests-behat/card-deck.feature @@ -4,35 +4,35 @@ Feature: CardDeck Given I am on "_unit-test/card-deck.php" Scenario: add - Then I press button "Add Country" - Then I fill in "atk_fp_country__name" with "Test" - Then I fill in "atk_fp_country__iso" with "XT" - Then I fill in "atk_fp_country__iso3" with "XTT" - Then I fill in "atk_fp_country__numcode" with "123" - Then I fill in "atk_fp_country__phonecode" with "1" - Then I press Modal button "Save" + When I press button "Add Country" + When I fill in "atk_fp_country__name" with "Test" + When I fill in "atk_fp_country__iso" with "XT" + When I fill in "atk_fp_country__iso3" with "XTT" + When I fill in "atk_fp_country__numcode" with "123" + When I fill in "atk_fp_country__phonecode" with "1" + When I press Modal button "Save" Then Toast display should contain text 'Country action "add" with "Test" entity was executed.' Scenario: search - Then I fill in "atk-vue-search" with "united kingdom" + When I fill in "atk-vue-search" with "united kingdom" Then I should see "United Kingdom" Scenario: edit - Then I press button "Edit" + When I press button "Edit" Then Modal is open with text "Edit Country" - Then I press Modal button "Save" + When I press Modal button "Save" Then Toast display should contain text 'Country action "edit" with "United Kingdom" entity was executed.' # make sure search query stick Then I should see "United Kingdom" Scenario: delete - Then I press button "Delete" - Then I press Modal button "Ok" + When I press button "Delete" + When I press Modal button "Ok" Then Toast display should contain text 'Country action "delete" with "United Kingdom" entity was executed.' Scenario: delete - with unlocked DB When I persist DB changes across requests - Then I press button "Delete" - Then I press Modal button "Ok" + When I press button "Delete" + When I press Modal button "Ok" Then Toast display should contain text 'Record has been deleted!' Then I should not see "United Kingdom" diff --git a/tests-behat/card.feature b/tests-behat/card.feature index 88552ff173..5af0ad9637 100644 --- a/tests-behat/card.feature +++ b/tests-behat/card.feature @@ -2,17 +2,17 @@ Feature: Card Scenario: Card with entity, entity must not reload Given I am on "data-action/factory-view.php" - Then I click using selector "i.eye.icon" + When I click using selector "i.eye.icon" Then Modal is open with text "Display Preview prior to run the action" Then Modal is open with text "Previewing country France NO RELOAD" - Then I press Modal button "Preview" + When I press Modal button "Preview" Then Toast display should contain text "Success: Done previewing France" Scenario: Card with entity action, entity must not reload - ModalExecutor When I press button "Edit" Then Modal is open with text "Edit Country" Then I check if input value for ".modal.front input" match text "Czech Republic NO RELOAD" - Then I hide js modal + When I hide js modal Scenario: Card with entity action, entity must not reload - JsCallbackExecutor, exception is displayed When I press button "Delete" @@ -25,5 +25,5 @@ Feature: Card When I press button "Send Note" Then Modal is open with text "Note" in selector "label" When I fill in "note" with "This is a test note" - Then I press Modal button "Notify" + When I press Modal button "Notify" Then Toast display should contain text "This is a test note" diff --git a/tests-behat/crud.feature b/tests-behat/crud.feature index 3dca80d741..1c0dd19128 100644 --- a/tests-behat/crud.feature +++ b/tests-behat/crud.feature @@ -4,17 +4,17 @@ Feature: Crud Given I am on "_unit-test/crud.php" Scenario: add - Then I press button "Add Country" - Then I fill in "atk_fp_country__name" with "Test" - Then I fill in "atk_fp_country__iso" with "XT" - Then I fill in "atk_fp_country__iso3" with "XTT" - Then I fill in "atk_fp_country__numcode" with "123" - Then I fill in "atk_fp_country__phonecode" with "1" - Then I press Modal button "Save" + When I press button "Add Country" + When I fill in "atk_fp_country__name" with "Test" + When I fill in "atk_fp_country__iso" with "XT" + When I fill in "atk_fp_country__iso3" with "XTT" + When I fill in "atk_fp_country__numcode" with "123" + When I fill in "atk_fp_country__phonecode" with "1" + When I press Modal button "Save" Then Toast display should contain text 'Country action "add" with "Test" entity was executed.' Scenario: search - Then I search grid for "united kingdom" + When I search grid for "united kingdom" Then I should see "United Kingdom" Then I should not see "No records" @@ -23,22 +23,22 @@ Feature: Crud # TODO generalize JS reload with component reload When I click using selector "//th.sortable[//div[text()='Name']]" Then I should see "United Kingdom" - Then I press button "Add Country" - Then I fill in "atk_fp_country__name" with "Test 2" - Then I fill in "atk_fp_country__iso" with "XT" - Then I fill in "atk_fp_country__iso3" with "XTT" - Then I fill in "atk_fp_country__numcode" with "123" - Then I fill in "atk_fp_country__phonecode" with "1" - Then I press Modal button "Save" + When I press button "Add Country" + When I fill in "atk_fp_country__name" with "Test 2" + When I fill in "atk_fp_country__iso" with "XT" + When I fill in "atk_fp_country__iso3" with "XTT" + When I fill in "atk_fp_country__numcode" with "123" + When I fill in "atk_fp_country__phonecode" with "1" + When I press Modal button "Save" Then Toast display should contain text 'Country action "add" with "Test 2" entity was executed.' # TODO add should keep search # related with https://github.com/atk4/ui/issues/526 (list newly added record first) - Then I search grid for "united kingdo" + When I search grid for "united kingdo" Scenario: edit - Then I press button "Edit" + When I press button "Edit" Then Modal is open with text "Edit Country" - Then I press Modal button "Save" + When I press Modal button "Save" Then Toast display should contain text 'Country action "edit" with "United Kingdom" entity was executed.' # make sure search query stick Then I should see "United Kingdom" @@ -48,66 +48,66 @@ Feature: Crud # TODO modal should be always fully (re)loaded on open and fully destroyed once it is closed # https://github.com/atk4/ui/issues/1928 Given I am on "_unit-test/crud.php" - Then I search grid for "united kingdom" + When I search grid for "united kingdom" Then I should not see "My United Kingdom" When I persist DB changes across requests - Then I press button "Edit" + When I press button "Edit" Then Modal is open with text "Edit Country" - Then I fill in "atk_fp_country__name" with "My United Kingdom" - Then I press Modal button "Save" + When I fill in "atk_fp_country__name" with "My United Kingdom" + When I press Modal button "Save" Then Toast display should contain text 'Record has been saved!' Then I should see "My United Kingdom" Scenario: delete - Then I press button "Delete" - Then I press Modal button "Ok" + When I press button "Delete" + When I press Modal button "Ok" Then Toast display should contain text 'Country action "delete" with "United Kingdom" entity was executed.' Then I should not see "United Kingdom" Scenario: search across multiple columns - Then I search grid for "420 zech" + When I search grid for "420 zech" Then I should see "Czech Republic" Scenario: search no match - Then I search grid for "420X zech" + When I search grid for "420X zech" Then I should see "No records" Then I should not see "Czech Republic" Scenario: Modal in modal Given I am on "_unit-test/crud-nested.php" - Then I click using selector "(//div.ui.button[i.icon.book])[1]" + When I click using selector "(//div.ui.button[i.icon.book])[1]" Then Modal is open with text "Edit product category" - Then I click using selector "(//div.modal.active//div.ui.button[i.icon.edit])[1]" + When I click using selector "(//div.modal.active//div.ui.button[i.icon.edit])[1]" Then Modal is open with text "Edit Product" Then input "atk_fp_product__name" value should start with "Mustard" When I press Modal button "Save" - Then I click close modal + When I click close modal - Then I click using selector "(//div.ui.button[i.icon.book])[1]" + When I click using selector "(//div.ui.button[i.icon.book])[1]" Then Modal is open with text "Edit product category" - Then I click using selector "(//div.modal.active//div.ui.button[i.icon.edit])[2]" + When I click using selector "(//div.modal.active//div.ui.button[i.icon.edit])[2]" Then Modal is open with text "Edit Product" Then input "atk_fp_product__name" value should start with "Ketchup" When I press Modal button "Save" - Then I click close modal + When I click close modal - Then I click using selector "(//div.ui.button[i.icon.book])[2]" + When I click using selector "(//div.ui.button[i.icon.book])[2]" Then Modal is open with text "Edit product category" - Then I click using selector "(//div.modal.active//div.ui.button[i.icon.edit])[1]" + When I click using selector "(//div.modal.active//div.ui.button[i.icon.edit])[1]" Then Modal is open with text "Edit Product" Then input "atk_fp_product__name" value should start with "Cola" When I press Modal button "Save" - Then I click close modal + When I click close modal Scenario: edit /w array persistence (strict comparison) Given I am on "collection/crud3.php" - Then I click using selector "//table//tr[3]//i.icon.edit" + When I click using selector "//table//tr[3]//i.icon.edit" Then Modal is open with text "Edit Country" - Then I press Modal button "Save" + When I press Modal button "Save" Then Toast display should contain text "Record has been saved!" Scenario: delete /w array persistence (strict comparison) - Then I click using selector "//table//tr[3]//i.icon.trash" + When I click using selector "//table//tr[3]//i.icon.trash" Then Toast display should contain text "Record has been deleted!" diff --git a/tests-behat/dropdown.feature b/tests-behat/dropdown.feature index de2db135a5..7049143151 100644 --- a/tests-behat/dropdown.feature +++ b/tests-behat/dropdown.feature @@ -2,20 +2,29 @@ Feature: Dropdown Scenario: dropdown cascade Given I am on "form-control/dropdown-plus.php" - Then I select value "Beverages" in lookup "category_id" - Then I select value "Sugar/Sweetened" in lookup "sub_category_id" - Then I select value "Soda" in lookup "product_id" + When I select value "Beverages" in lookup "category_id" + When I select value "Sugar/Sweetened" in lookup "sub_category_id" + When I select value "Soda" in lookup "product_id" When I click using selector "(//div[text()='Save'])[2]" Then Modal is open with text '{ "category_id": "2", "sub_category_id": "9", "product_id": "4" }' in selector "p" - Then I click close modal + When I click close modal Then I should see "Soda" - Then I select value "Coffee and Tea" in lookup "sub_category_id" + When I select value "Coffee and Tea" in lookup "sub_category_id" Then I should not see "Soda" Then I should not see "Cola" Then I should not see "No results found." When I click using selector "//div.field[label[text()='Product ID']]//div.ui.dropdown" Then I should see "No results found." + Scenario: dropdown multiple + Given I am on "form-control/dropdown-plus.php" + Then I check if input value for "input[name='multi']" match text "" + When I select value "Option 2" in lookup "multi" + When I select value "Option 1" in lookup "multi" + Then I check if input value for "input[name='multi']" match text "option2,option1" + When I select value "" in lookup "multi" + Then I check if input value for "input[name='multi']" match text "" + Scenario: dropdown menu Given I am on "basic/menu.php" When I click using selector "//div.ui.dropdown[div[text()='With Callback']]" diff --git a/tests-behat/filter.feature b/tests-behat/filter.feature index 17e021426f..4f29426501 100644 --- a/tests-behat/filter.feature +++ b/tests-behat/filter.feature @@ -3,45 +3,45 @@ Feature: Table Filter Scenario: Given I am on "collection/tablefilter.php" Then I should see "Australia" - Then I click filter column name "atk_fp_country__name" + When I click filter column name "atk_fp_country__name" When I fill field using "//div.popup[2]//input[@name='value']" with "united kingdom" When I click using selector "//div.popup[2]//div[text()='Set']" Then I should not see "Australia" Then I should see "United Kingdom" - Then I click filter column name "atk_fp_country__phonecode" + When I click filter column name "atk_fp_country__phonecode" When I fill field using "//div.popup[6]//input[@name='value']" with "44" When I click using selector "//div.popup[6]//div[text()='Set']" Then I should see "United Kingdom" - Then I click filter column name "atk_fp_country__phonecode" + When I click filter column name "atk_fp_country__phonecode" When I fill field using "//div.popup[6]//input[@name='value']" with "4" When I click using selector "//div.popup[6]//div[text()='Set']" Then I should not see "United Kingdom" Then I should see "No records" - Then I click filter column name "atk_fp_country__phonecode" + When I click filter column name "atk_fp_country__phonecode" When I click using selector "//div.popup[6]//div[text()='Clear']" Then I should not see "No records" Then I should see "United Kingdom" - Then I click filter column name "is_uk" - Then I select value "Is No" in lookup "//div.popup[7]//input[@name='op']" + When I click filter column name "is_uk" + When I select value "Is No" in lookup "//div.popup[7]//input[@name='op']" When I click using selector "//div.popup[7]//div[text()='Set']" Then I should see "No records" - Then I click filter column name "is_uk" - Then I select value "Is Yes" in lookup "//div.popup[7]//input[@name='op']" + When I click filter column name "is_uk" + When I select value "Is Yes" in lookup "//div.popup[7]//input[@name='op']" When I click using selector "//div.popup[7]//div[text()='Set']" Then I should see "United Kingdom" - Then I press button "Clear Filters" + When I press button "Clear Filters" Then I should not see "United Kingdom" Then I should see "Australia" Then I should see "Argentina" Then I should see "Austria" - Then I click filter column name "atk_fp_country__id" + When I click filter column name "atk_fp_country__id" When I select value "=" in lookup "//div.popup[1]//input[@name='op']" When I fill field using "//div.popup[1]//input[@name='value']" with "13" When I click using selector "//div.popup[1]//div[text()='Set']" Then I should see "Australia" Then I should not see "Argentina" Then I should not see "Austria" - Then I click filter column name "atk_fp_country__id" + When I click filter column name "atk_fp_country__id" When I select value "< or equal" in lookup "//div.popup[1]//input[@name='op']" When I click using selector "//div.popup[1]//div[text()='Set']" Then I should see "Australia" diff --git a/tests-behat/form.feature b/tests-behat/form.feature index 3d568f8903..fe9167d9cb 100644 --- a/tests-behat/form.feature +++ b/tests-behat/form.feature @@ -8,7 +8,7 @@ Feature: Form When I press button "Compare Date" Then I should see "Date field vs control:" - Then I hide js modal + When I hide js modal When I click tab with title "Handler Output" When I fill in "email1" with "foo@bar" @@ -31,7 +31,7 @@ Feature: Form When I press button "Save3" Then I should see "some header" Then I should see "some text" - Then I hide js modal + When I hide js modal When I fill in "email5" with "foo@bar" When I press button "Save5" @@ -41,24 +41,24 @@ Feature: Form When I click tab with title "Handler Safety" When I press button "SaveE1" Then Modal is open with text "Error: Cannot use object of type stdClass as array" - Then I hide js modal + When I hide js modal When I press button "SaveE2" Then Modal is open with text "Atk4\Core\Exception: Test exception I." - Then I hide js modal + When I hide js modal When I press button "Modal Test" Then I check if input value for "#mf input[name='email']" match text "" When I fill Modal field "email" with "ee" Then I check if input value for "#mf input[name='email']" match text "ee" When I press Modal button "Save" Then Modal is open with text "Atk4\Core\Exception: Test exception II." - Then I hide js modal + When I hide js modal Then I check if input value for "#mf input[name='email']" match text "ee" - Then I hide js modal + When I hide js modal When I press button "Modal Test" Then I check if input value for "#mf input[name='email']" match text "" When I press Modal button "Save" Then Modal is open with text "Atk4\Core\Exception: Test exception II." - Then I hide js modal + When I hide js modal When I press Modal button "Save" Then Modal is open with text "Atk4\Core\Exception: Test exception II." diff --git a/tests-behat/grid.feature b/tests-behat/grid.feature index 14de23faaa..e0e6699521 100644 --- a/tests-behat/grid.feature +++ b/tests-behat/grid.feature @@ -2,20 +2,20 @@ Feature: Grid Scenario: search Given I am on "collection/grid.php" - Then I search grid for "kingdom" + When I search grid for "kingdom" Then I should see "United Kingdom" - Then I press button "Test" + When I press button "Test" Then Toast display should contain text "United Kingdom" - Then I click using selector "i.atk-remove-icon" + When I click using selector "i.atk-remove-icon" Then I should not see "United Kingdom" - Then I search grid for "kingdom" + When I search grid for "kingdom" Then I should see "United Kingdom" When I write "[escape]" into selector "input.atk-grid-search" Then I should not see "United Kingdom" Scenario: search no ajax Given I am on "collection/grid.php?no-ajax=1" - Then I search grid for "kingdom" + When I search grid for "kingdom" Then PATCH MINK the url should match "~_q=kingdom~" Then I should see "United Kingdom" @@ -30,7 +30,7 @@ Feature: Grid When I click using selector "//div[@id='grid']//tr[2]//div.ui.button[text()='Action Modal']" Then No toast should be displayed Then I should see "Clicked Action Modal: Albania" - Then I hide js modal + When I hide js modal When I click using selector "//div[@id='grid']//tr[2]//div.ui.dropdown[div[text()='Actions...']]" Then No toast should be displayed When I click using selector "//div[@id='grid']//tr[2]//div.ui.dropdown[div[text()='Actions...']]//div.menu/div[text()='Action MenuItem']" @@ -49,25 +49,25 @@ Feature: Grid Then Element "//div.ui.master.checkbox" should not contain class "checked" Then Element "//div.ui.master.checkbox" should contain class "indeterminate" Then Element "//div.ui.menu/div.item[text()='Show selected']" should not contain class "disabled" - Then I press button "Show selected" + When I press button "Show selected" Then Toast display should contain text "Selected: 1#" When I click using selector "//div.ui.master.checkbox" Then Element "//div.ui.master.checkbox" should contain class "checked" Then Element "//div.ui.master.checkbox" should not contain class "indeterminate" Then Element "//div.ui.menu/div.item[text()='Show selected']" should not contain class "disabled" - Then I press button "Show selected" + When I press button "Show selected" Then Toast display should contain text "Selected: 1, 2, 3, 4, 5#" When I click using selector "//div.ui.master.checkbox" Then Element "//div.ui.master.checkbox" should not contain class "checked" Then Element "//div.ui.master.checkbox" should not contain class "indeterminate" Then Element "//div.ui.menu/div.item[text()='Show selected']" should contain class "disabled" - Then I click paginator page "2" + When I click paginator page "2" When I click using selector "//tr[2]//div.ui.child.checkbox" When I click using selector "//tr[4]//div.ui.child.checkbox" Then Element "//div.ui.master.checkbox" should not contain class "checked" Then Element "//div.ui.master.checkbox" should contain class "indeterminate" Then Element "//div.ui.menu/div.item[text()='Show selected']" should not contain class "disabled" - Then I press button "Show selected" + When I press button "Show selected" Then Toast display should contain text "Selected: 7, 9#" Scenario: popup column header @@ -113,7 +113,7 @@ Feature: Grid Scenario: Row remote action - load record Given I am on "collection/grid.php" Then I should not see "Bahamas" - Then I click paginator page "2" + When I click paginator page "2" Then I should see "Bahamas" When I click using selector "//tr[td[text()='Bahamas']]//div.ui.button[text()='Say HI']" Then Toast display should contain text 'Loaded "Bahamas" from ID=16' @@ -129,7 +129,7 @@ Feature: Grid When I click using selector "//tr[5]//div.ui.checkbox" When I click using selector "//tr[8]//div.ui.checkbox" Then Element "//div.ui.menu/div.item[text()='Show selected']" should not contain class "disabled" - Then I press button "Show selected" + When I press button "Show selected" Then Toast display should contain text "Selected: 5, 8#" Scenario: Bulk modal action @@ -138,7 +138,7 @@ Feature: Grid When I click using selector "//tr[5]//div.ui.checkbox" When I click using selector "//tr[8]//div.ui.checkbox" Then Element "//div.ui.menu/div.item[text()='Delete selected']" should not contain class "disabled" - Then I press button "Delete selected" + When I press button "Delete selected" Then Modal is open with text "The selected records will be permanently deleted: 5, 8#" - Then I press button "Delete" + When I press button "Delete" Then I should see "Success" diff --git a/tests-behat/js.feature b/tests-behat/js.feature index 2c80a99f4d..26199a2812 100644 --- a/tests-behat/js.feature +++ b/tests-behat/js.feature @@ -28,6 +28,6 @@ Feature: JS Scenario: JsCallback exception is displayed When I press button "failure" Then Modal is open with text "Atk4\Ui\Exception: Everything is bad" - Then I hide js modal + When I hide js modal When I press button "failure" Then Modal is open with text "Atk4\Ui\Exception: Everything is bad" diff --git a/tests-behat/late-error.feature b/tests-behat/late-error.feature index c0d318df1d..f214607302 100644 --- a/tests-behat/late-error.feature +++ b/tests-behat/late-error.feature @@ -5,16 +5,16 @@ Feature: Late error handling When I press button "Test LateOutputError I: Headers already sent" Then Modal is open with text "API Server Error" Then Modal is open with text "!! FATAL UI ERROR: Headers already sent, more headers cannot be set at this stage !!" - Then I hide js modal + When I hide js modal Scenario: When I press button "Test LateOutputError II: Unexpected output detected" Then Modal is open with text "API Server Error" Then Modal is open with text "unmanaged output !! FATAL UI ERROR: Unexpected output detected !!" - Then I hide js modal + When I hide js modal Scenario: When I press button "Test LateOutputError III: Unexpected output detected" Then Modal is open with text "API Server Error" Then Modal is open with text "unmanaged output !! FATAL UI ERROR: Unexpected output detected !!" - Then I hide js modal + When I hide js modal diff --git a/tests-behat/lookup.feature b/tests-behat/lookup.feature index 89ad9f887c..e490f783eb 100644 --- a/tests-behat/lookup.feature +++ b/tests-behat/lookup.feature @@ -2,29 +2,36 @@ Feature: Lookup Scenario: Testing lookup in modal Given I am on "_unit-test/lookup.php" - Then I press button "Edit" - Then I select value "Dairy" in lookup "atk_fp_product__product_category_id" + When I press button "Edit" + When I select value "Dairy" in lookup "atk_fp_product__product_category_id" # '6f3c91cf51e02fd5' = substr(md5('product_sub_category'), 0, 16) - Then I select value "Yogourt" in lookup "atk_fp_product__6f3c91cf51e02fd5_id" - Then I press modal button "Save" + When I select value "Yogourt" in lookup "atk_fp_product__6f3c91cf51e02fd5_id" + When I press modal button "Save" Then Toast display should contain text 'Dairy - Yogourt' Scenario: Testing lookup in VirtualPage Given I am on "_unit-test/lookup-virtual-page.php" - Then I press button "Add Category" - Then I select value "Beverages" in lookup "category" - Then I press Modal button "Save" + When I press button "Add Category" + When I select value "Beverages" in lookup "category" + When I press Modal button "Save" Then Toast display should contain text "Beverages" - Scenario: Testing lookup add + Scenario: Testing lookup clear Given I am on "form-control/lookup.php" + Then I check if text in "//div.text[../input[@name='country1']]" match text "" + When I select value "Hong Kong" in lookup "//div.text[../input[@name='country1']]" + Then I check if text in "//div.text[../input[@name='country1']]" match text "Hong Kong" + When I select value "" in lookup "//div.text[../input[@name='country1']]" + Then I check if text in "//div.text[../input[@name='country1']]" match text "" + + Scenario: Testing lookup add Then I check if text in "//div.text[../input[@name='country2']]" match text "" - Then I press button "Add New" + When I press button "Add New" When I fill in "atk_fp_country__name" with "Plusia" When I fill in "atk_fp_country__iso" with "AA" When I fill in "atk_fp_country__iso3" with "AAA" When I fill in "atk_fp_country__numcode" with "88" When I fill in "atk_fp_country__phonecode" with "8" - Then I press Modal button "Save" + When I press Modal button "Save" Then Toast display should contain text 'Country action "add" with "Plusia" entity was executed.' Then I check if text in "//div.text[../input[@name='country2']]" match text "Plusia" diff --git a/tests-behat/modal-error.feature b/tests-behat/modal-error.feature index 11f924c0d3..78bf81d089 100644 --- a/tests-behat/modal-error.feature +++ b/tests-behat/modal-error.feature @@ -5,24 +5,24 @@ Feature: Nested modals /w error handling When I press button "Test" When I press button "Test Modal load PHP error" Then Modal is open with text "Error: Exception from Modal" - Then I hide js modal + When I hide js modal When I press button "Test Modal load PHP error" Then Modal is open with text "Error: Exception from Modal" - Then I hide js modal + When I hide js modal Scenario: Modal with JS error When I press button "Test Modal load JS error" Then Modal is open with text "API JavaScript Error" Then Modal is open with text 'Fomantic-UI "modal.onShow" setting cannot be customized outside atk' - Then I hide js modal + When I hide js modal When I press button "Test Modal load JS error" Then Modal is open with text 'Fomantic-UI "modal.onShow" setting cannot be customized outside atk' - Then I hide js modal + When I hide js modal Scenario: ModalExecutor with PHP error exception is displayed When I press button "Test ModalExecutor load PHP error" Then Modal is open with text "Atk4\Data\Exception: Record with specified ID was not found" - Then I hide js modal + When I hide js modal When I press button "Test ModalExecutor load PHP error" Then Modal is open with text "Atk4\Data\Exception: Record with specified ID was not found" - Then I hide js modal + When I hide js modal diff --git a/tests-behat/multiline.feature b/tests-behat/multiline.feature index 501a19e624..7a77aa558a 100644 --- a/tests-behat/multiline.feature +++ b/tests-behat/multiline.feature @@ -9,31 +9,31 @@ Feature: Multiline When I fill field using "div[name=-atk_fp_multiline_item__box] input" with "67" Then the "div[name=-atk_fp_multiline_item__total_sql]" element should contain "134" Then the "div[name=-atk_fp_multiline_item__total_php]" element should contain "134" - Then I press button "Save" + When I press button "Save" Then Toast display should contain text '"atk_fp_multiline_item__box": "67", "atk_fp_multiline_item__total_sql": "134" }' Scenario: add row When I click using selector "//tfoot//button[i.plus.icon]" Then I should not see "Must not be empty" - Then I press button "Save" + When I press button "Save" Then I should see "Must not be empty" When I fill field using "//tr[3]//div[@name='-atk_fp_multiline_item__item']/input" with "Paper" When I fill field using "//tr[3]//div[@name='-atk_fp_multiline_item__qty']/input" with "3" When I fill field using "//tr[3]//div[@name='-atk_fp_multiline_item__box']/input" with "5" Then I check if text in "//tr[3]//div[@name='-atk_fp_multiline_item__total_sql']" match text "15" Then I check if text in "//tr[3]//div[@name='-atk_fp_multiline_item__total_php']" match text "15" - Then I press button "Save" + When I press button "Save" Then Toast display should contain text '"atk_fp_multiline_item__box": "5", "atk_fp_multiline_item__total_sql": "15" } ]' Then I should not see "Must not be empty" Scenario: delete row When I click using selector "//tr[3]//input[@type='checkbox']" When I click using selector "//tfoot//button[i.trash.icon]" - Then I press button "Save" + When I press button "Save" Then Toast display should contain text '"atk_fp_multiline_item__box": "100", "atk_fp_multiline_item__total_sql": "200" } ]' Scenario: delete all rows When I click using selector "//thead//input[@type='checkbox']" When I click using selector "//tfoot//button[i.trash.icon]" - Then I press button "Save" + When I press button "Save" Then Toast display should contain text '[]' diff --git a/tests-behat/radio.feature b/tests-behat/radio.feature index 54facd42f7..21059c0335 100644 --- a/tests-behat/radio.feature +++ b/tests-behat/radio.feature @@ -9,18 +9,18 @@ Feature: Radio Then Toast display should contain text '"string_d": "M", "string_r": "M"' Then Element "//input[@name='int_r' and @checked='checked']" attribute "value" should contain text "7000" - Then I select value "female" in lookup "enum_d" + When I select value "female" in lookup "enum_d" When I click using selector "//div.ui.radio[not(self::*.checked)][input[@name='enum_r'] and label[text()='female']]" - Then I select value "female" in lookup "list_d" + When I select value "female" in lookup "list_d" When I click using selector "//div.ui.radio[not(self::*.checked)][input[@name='list_r'] and label[text()='female']]" When I press button "Save" Then Toast display should contain text '"enum_d": "female", "enum_r": "female"' Then Toast display should contain text '"list_d": "0", "list_r": "0"' Then Toast display should contain text '"int_d": "7 000", "int_r": "7 000"' Then Toast display should contain text '"string_d": "M", "string_r": "M"' - Then I select value "female" in lookup "int_d" + When I select value "female" in lookup "int_d" When I click using selector "//div.ui.radio[not(self::*.checked)][input[@name='int_r'] and label[text()='female']]" - Then I select value "female" in lookup "string_d" + When I select value "female" in lookup "string_d" When I click using selector "//div.ui.radio[not(self::*.checked)][input[@name='string_r'] and label[text()='female']]" When I press button "Save" Then Toast display should contain text '"enum_d": "female", "enum_r": "female"' @@ -28,18 +28,18 @@ Feature: Radio Then Toast display should contain text '"int_d": "5", "int_r": "5"' Then Toast display should contain text '"string_d": "F", "string_r": "F"' - Then I select value "" in lookup "enum_d" + When I select value "" in lookup "enum_d" When I click using selector "//div.ui.radio.checked[input[@name='enum_r']]" - Then I select value "" in lookup "list_d" + When I select value "" in lookup "list_d" When I click using selector "//div.ui.radio.checked[input[@name='list_r']]" When I press button "Save" Then Toast display should contain text '"enum_d": null, "enum_r": null' Then Toast display should contain text '"list_d": null, "list_r": null' Then Toast display should contain text '"int_d": "5", "int_r": "5"' Then Toast display should contain text '"string_d": "F", "string_r": "F"' - Then I select value "" in lookup "int_d" + When I select value "" in lookup "int_d" When I click using selector "//div.ui.radio.checked[input[@name='int_r']]" - Then I select value "" in lookup "string_d" + When I select value "" in lookup "string_d" When I click using selector "//div.ui.radio.checked[input[@name='string_r']]" When I press button "Save" Then Toast display should contain text '"enum_d": null, "enum_r": null' diff --git a/tests-behat/rightpanel.feature b/tests-behat/rightpanel.feature index 88abeecfc9..f426c9a0b9 100644 --- a/tests-behat/rightpanel.feature +++ b/tests-behat/rightpanel.feature @@ -4,13 +4,13 @@ Feature: RightPanel Given I am on "layout/layout-panel.php" When I press button "Button 1" Then I should see "button #1" - Then I press button "Reload Myself" - Then I press button "Complete" + When I press button "Reload Myself" + When I press button "Complete" Then I should see "Completed using button #1" Scenario: PanelModelAction Given I am on "layout/layout-panel.php" - Then I click using selector "(//div.atk-card)[1]" + When I click using selector "(//div.atk-card)[1]" When I press button "User Confirmation" When I press Modal button "Ok" Then Toast display should contain text "Confirm country" diff --git a/tests-behat/scopebuilder.feature b/tests-behat/scopebuilder.feature index d68d119cb1..5be9385d8b 100644 --- a/tests-behat/scopebuilder.feature +++ b/tests-behat/scopebuilder.feature @@ -10,7 +10,7 @@ Feature: ScopeBuilder Then date rule "atk_fp_stat__start_date" operator is "is on" and value is "Oct 22, 2020" Then date rule "atk_fp_stat__finish_time" operator is "is not on" and value is "22:22:00" Then bool rule "atk_fp_stat__is_commercial" has value "No" - Then I check if input value for "qb" match text in "p.atk-expected-input-result" + Then I check if input value for "//input[@name='qb']" match text in "p.atk-expected-input-result" When I press button "Save" Then Modal is open with text "TypeError: Unexpected non-scalar value" # TODO uncomment once "Object serialization is not supported" is fixed diff --git a/tests-behat/tab.feature b/tests-behat/tab.feature index 1b6fd481cf..2fed9c72c7 100644 --- a/tests-behat/tab.feature +++ b/tests-behat/tab.feature @@ -4,5 +4,5 @@ Feature: Tab Given I am on "interactive/tabs.php" Then Active tab should be "Default Active Tab" Then I should see "This is the active tab by default" - Then I click tab with title "Dynamic Lorem Ipsum" + When I click tab with title "Dynamic Lorem Ipsum" Then I should see "you will see a different text" diff --git a/tests-behat/tree-item-selector.feature b/tests-behat/tree-item-selector.feature index d463bbed95..2862e10e93 100644 --- a/tests-behat/tree-item-selector.feature +++ b/tests-behat/tree-item-selector.feature @@ -2,28 +2,28 @@ Feature: TreeItemSelector Scenario: single Given I am on "form-control/tree-item-selector.php" - Then I click using selector "(//div.atk-tree-loader)[2]//div[text()='Cleaner']" + When I click using selector "(//div.atk-tree-loader)[2]//div[text()='Cleaner']" Then Toast display should contain text "Selected: Cleaner" - Then I click using selector "(//div.atk-tree-loader)[2]//div[text()='Cleaner']" + When I click using selector "(//div.atk-tree-loader)[2]//div[text()='Cleaner']" Then No toast should be displayed - Then I click using selector "(//div.atk-tree-loader)[2]//i.icon.caret.right[../div/div[text()='Electronics']]" + When I click using selector "(//div.atk-tree-loader)[2]//i.icon.caret.right[../div/div[text()='Electronics']]" Then No toast should be displayed - Then I click using selector "(//div.atk-tree-loader)[2]//div[text()='Phone']" + When I click using selector "(//div.atk-tree-loader)[2]//div[text()='Phone']" Then No toast should be displayed Scenario: multiple - Then I click using selector "(//div.atk-tree-loader)[1]//div[text()='Cleaner']" + When I click using selector "(//div.atk-tree-loader)[1]//div[text()='Cleaner']" Then Toast display should contain text "Appliances" - Then I click using selector "(//div.atk-tree-loader)[1]//div[text()='Cleaner']" + When I click using selector "(//div.atk-tree-loader)[1]//div[text()='Cleaner']" Then Toast display should contain text "Appliances" Then Toast display should contain text "Cleaner" - Then I click using selector "(//div.atk-tree-loader)[1]//i.icon.caret.right[../div/div[text()='Electronics']]" + When I click using selector "(//div.atk-tree-loader)[1]//i.icon.caret.right[../div/div[text()='Electronics']]" Then No toast should be displayed - Then I click using selector "(//div.atk-tree-loader)[1]//div[text()='Phone']" + When I click using selector "(//div.atk-tree-loader)[1]//div[text()='Phone']" Then Toast display should contain text "Appliances" Then Toast display should contain text "Electronics > Phone > iPhone" - Then I click using selector "(//div.atk-tree-loader)[1]//div[text()='Phone']" + When I click using selector "(//div.atk-tree-loader)[1]//div[text()='Phone']" Then Toast display should contain text "Appliances" - Then I click using selector "(//div.atk-tree-loader)[1]//div[text()='Electronics']" + When I click using selector "(//div.atk-tree-loader)[1]//div[text()='Electronics']" Then Toast display should contain text "Appliances" Then Toast display should contain text "Electronics > Tv" diff --git a/tests-behat/useraction.feature b/tests-behat/useraction.feature index 34b7bffa16..36aa751adb 100644 --- a/tests-behat/useraction.feature +++ b/tests-behat/useraction.feature @@ -9,7 +9,7 @@ Feature: UserAction executor and UserConfirmation modal When I press button "Argument" Then Modal is open with text "Age" in selector "label" When I fill Modal field "age" with "22" - Then I press Modal button "Argument" + When I press Modal button "Argument" Then Toast display should contain text "22 is old enough to visit" Scenario: @@ -21,10 +21,10 @@ Feature: UserAction executor and UserConfirmation modal When I press button "Multi Step" Then Modal is open with text "Age" in selector "label" When I fill Modal field "age" with "22" - Then I press Modal button "Next" - Then I press Modal button "Next" + When I press Modal button "Next" + When I press Modal button "Next" Then Modal is open with text "Gender = m / Age = 22" - Then I press Modal button "Multi Step" + When I press Modal button "Multi Step" Then Toast display should contain text "Thank you Mr. at age 22" Scenario: testing VpExecutor @@ -32,7 +32,7 @@ Feature: UserAction executor and UserConfirmation modal When I press button "Argument" Then I should see "Age" When I fill in "age" with "22" - Then I press button "Argument" + When I press button "Argument" Scenario: testing return Then I should see "Assign Model action to button event" @@ -41,10 +41,10 @@ Feature: UserAction executor and UserConfirmation modal When I press button "Multi Step" Then I should see "Age" When I fill in "age" with "22" - Then I press button "Next" - Then I press button "Next" + When I press button "Next" + When I press button "Next" Then I should see "Gender = m / Age = 22" - Then I press button "Multi Step" + When I press button "Multi Step" Scenario: testing return Then I should see "Assign Model action to button event" @@ -54,17 +54,17 @@ Feature: UserAction executor and UserConfirmation modal When I press button "Argument" Then Panel is open with text "Age" in selector "label" When I fill Panel field "age" with "22" - Then I press Panel button "Argument" + When I press Panel button "Argument" Then Toast display should contain text "22 is old enough to visit" Scenario: testing multi in panel When I press button "Multi Step" Then Panel is open with text "Age" in selector "label" When I fill Panel field "age" with "22" - Then I press Panel button "Next" - Then I press Panel button "Next" + When I press Panel button "Next" + When I press Panel button "Next" Then Panel is open with text "Gender = m / Age = 22" - Then I press Panel button "Multi Step" + When I press Panel button "Multi Step" Then Toast display should contain text "Thank you Mr. at age 22" Scenario: testing JsCallbackExecutor with form input argument @@ -86,7 +86,7 @@ Feature: UserAction executor and UserConfirmation modal # TODO https://github.com/atk4/data/blob/5.2.0/src/Persistence.php#L496 should be unrolled # like in https://github.com/atk4/ui/blob/5.2.0/src/Form.php#L448 Then Modal is open with text "Atk4\Data\Exception: Must be numeric" - Then I hide js modal + When I hide js modal When I fill field using "//input[../div[text()='Greet Integer']]" with "" When I press button "Greet Integer" # TODO "required" must be honored @@ -102,29 +102,29 @@ Feature: UserAction executor and UserConfirmation modal Given I am on "_unit-test/useraction-no-id-arg.php" When I press button "Disabled" Then Modal is open with text "Atk4\Data\Exception: User action is disabled" - Then I hide js modal + When I hide js modal When I press button "Add" Then Modal is open with text "Add Country" - Then I hide js modal + When I hide js modal When I press button "Edit" Then Modal is open with text "Atk4\Data\Exception: User action can be executed on loaded entity only" - Then I hide js modal + When I hide js modal When I press button "Delete" - Then I press Modal button "Ok" + When I press Modal button "Ok" Then Modal is open with text "Atk4\Data\Exception: User action can be executed on loaded entity only" - Then I hide js modal + When I hide js modal When I press button "Callback" Then Modal is open with text "Atk4\Data\Exception: User action can be executed on loaded entity only" - Then I hide js modal + When I hide js modal When I press button "Preview" Then Modal is open with text "Atk4\Data\Exception: User action can be executed on loaded entity only" - Then I hide js modal + When I hide js modal When I press button "Argument" Then Modal is open with text "Atk4\Data\Exception: User action can be executed on loaded entity only" - Then I hide js modal + When I hide js modal When I press button "User Confirmation" Then Modal is open with text "Atk4\Data\Exception: User action can be executed on loaded entity only" - Then I hide js modal + When I hide js modal When I press button "Multi Step" Then Modal is open with text "Atk4\Data\Exception: User action can be executed on loaded entity only" - Then I hide js modal + When I hide js modal diff --git a/tests-behat/virtual-page.feature b/tests-behat/virtual-page.feature index da34206adc..68254e3ae1 100644 --- a/tests-behat/virtual-page.feature +++ b/tests-behat/virtual-page.feature @@ -2,34 +2,34 @@ Feature: VirtualPage Scenario: Given I am on "interactive/virtual.php" - Then I click link 'More info on Car' + When I click link 'More info on Car' Then I check if text in ".__atk-behat-test-car" match text "Car" - Then I press button "Open Lorem Ipsum" + When I press button "Open Lorem Ipsum" Then Modal is open with text 'This is yet another modal' Scenario: Given I am on "interactive/virtual.php" - Then I press button 'Load in Modal' + When I press button 'Load in Modal' Then Modal is open with text 'Contents of your pop-up here' - Then I click close modal + When I click close modal Scenario: - Then I click link 'Inside current layout' + When I click link 'Inside current layout' Then I check if text in ".__atk-behat-test-content" match text "Contents of your pop-up here" Scenario: Given I am on "interactive/virtual.php" - Then I click link 'On a blank page' + When I click link 'On a blank page' Then I check if text in ".__atk-behat-test-content" match text "Contents of your pop-up here" Scenario: Given I am on "_unit-test/virtual-page.php" - Then I click link 'Open First' + When I click link 'Open First' Then I check if text in ".__atk-behat-test-first" match text "First Level Page" - Then I click link 'Open Second' + When I click link 'Open Second' Then I check if text in ".__atk-behat-test-second" match text "Second Level Page" - Then I click link 'Open Third' + When I click link 'Open Third' Then I check if text in ".__atk-behat-test-third" match text "Third Level Page" - Then I select value "Beverages" in lookup "category" - Then I press button "Save" + When I select value "Beverages" in lookup "category" + When I press button "Save" Then Toast display should contain text 'Beverages' diff --git a/tests-behat/vue.feature b/tests-behat/vue.feature index bc697c45bf..cb36e7892f 100644 --- a/tests-behat/vue.feature +++ b/tests-behat/vue.feature @@ -25,12 +25,12 @@ Feature: Vue Scenario: testing InlineEdit - /w onChange callback When I fill field using "(//input[@name='atk_fp_country__name'])[2]" with "test callback" Then I should see "new value: test callback" - Then I hide js modal + When I hide js modal Scenario: testing ItemSearch When I fill in "atk-vue-search" with "united kingdom" Then I should see "United Kingdom" - Then I click using selector "//div.atk-item-search//i.remove.icon" + When I click using selector "//div.atk-item-search//i.remove.icon" Then I should not see "United Kingdom" When I fill in "atk-vue-search" with "united kingdom" Then I should see "United Kingdom"