Commit 046a99b9 authored by Aaron Wells's avatar Aaron Wells Committed by Gerrit Code Review

Merge "Bug 1508204: behat test for removing tagged journal"

parents 3a4d4557 d9770f35
......@@ -105,11 +105,17 @@ class BehatForms extends BehatBase {
/**
* Clears the Select2 field
*
* @When /^(?:|I )clear the select2 field "(?P<field>(?:[^"]|\\")*)"$/
* @When /^(?:|I )clear value "(?P<textValues>(?:[^"]|\\")*)" from select2 field "(?P<field>(?:[^"]|\\")*)"$/
*/
public function iClearSelect2Field($field) {
public function iClearSelect2Field($textValues, $field) {
$page = $this->getSession()->getPage();
$this->getSession()->executeScript("jQuery('#{$field}').val('').trigger('change');");
foreach(preg_split('/,\s*/', $textValues) as $value) {
$option = $page->find('xpath', '//select[@id="' . $field . '"]//option[text()="' . $value . '"]');
$value = $option->getAttribute('value');
$value = json_encode($value);
$this->getSession()->executeScript("jQuery('#{$field} option[value=" . $value . "]').remove();");
}
$this->getSession()->executeScript("jQuery('#{$field}').trigger('change');");
}
/**
* Fill Select2 input field
......
......@@ -47,7 +47,7 @@ Scenario: Creating a Journal, publishing a draft, using tagged entry block
# Remove tag from first journal and save
Given I click on "Edit" in "My diary entry one" row
And I wait "1" seconds
And I clear the select2 field "editpost_tags"
And I clear value "mildred (1)" from select2 field "editpost_tags"
And I press "Save entry"
Then I should see "Journal entry saved"
And I should not see "mildred"
......
......@@ -4,21 +4,25 @@ In order to change the configuration of my Journal entry
As a user
So I can benefit from the different settings
Background:
Given the following "pages" exist:
| title | description| ownertype | ownername |
| Page 01 | admins page 01 | admin | admin |
Scenario: Turning on and of switches in Journal configuration block (Bug 1431569)
Given I log in as "admin" with password "Kupuhipa1"
# Navigating to switchbox in Journal block
And I choose "Journals" in "Content"
And I follow "New entry"
# Checking the default fields match
# Checking the default fields match
And the following fields match these values:
| Draft | 0 |
| Allow comments | 1 |
# Changing the switches once
# Changing the switches once
And I set the following fields to these values:
| Draft | 1 |
| Allow comments | 0 |
# Changing the switches back
# Changing the switches back
And I set the following fields to these values:
| Draft | 0 |
| Allow comments | 1 |
......@@ -31,20 +35,56 @@ Scenario: Creating a Journal entry
# Navigating to switchbox in Journal block
And I choose "Journals" in "Content"
And I follow "New entry"
# Checking the default fields match
# Checking the default fields match
And the following fields match these values:
| Title * | |
| Entry * | |
| Draft | 0 |
| Allow comments | 1 |
# Changing the switches once and filling out a journal
# Changing the switches once and filling out a journal
And I set the following fields to these values:
| Title * | Story of my life |
| Draft | 1 |
| Allow comments | 0 |
| Entry | Preventing bugs from appearing :D |
And I press "Save entry"
And I fill in select2 input "editpost_tags" with "one" and select "one"
And I scroll to the base of id "editpost_tags_container"
And I fill in select2 input "editpost_tags" with "test" and select "test"
And I press "Save entry"
And I follow "New entry"
And I set the following fields to these values:
| Title * | Story of my life, part 2 |
| Allow comments | 0 |
| Entry | Testing tags |
And I fill in select2 input "editpost_tags" with "two" and select "two"
And I scroll to the base of id "editpost_tags_container"
And I fill in select2 input "editpost_tags" with "test" and select "test"
And I press "Save entry"
And I follow "New entry"
And I set the following fields to these values:
| Title * | Story of my life, part 3 |
| Allow comments | 0 |
| Entry | Testing tags some more |
And I fill in select2 input "editpost_tags" with "three" and select "three"
And I scroll to the base of id "editpost_tags_container"
And I fill in select2 input "editpost_tags" with "test" and select "test"
And I press "Save entry"
And I choose "Pages" in "Portfolio"
And I follow "Page 01"
And I follow "Edit this page"
And I expand "Journals" node in the "div#content-editor-foldable" "css_element"
And I follow "Tagged journal entries" in the "div#blog" "css_element"
And I press "Add"
And I fill in select2 input "instconf_tagselect" with "one" and select "one"
And I wait "1" seconds
And I fill in select2 input "instconf_tagselect" with "two" and select "two"
And I wait "1" seconds
And I press "Save"
And I scroll to the base of id "column-container"
And I configure the block "Tagged journal entries"
And I wait "1" seconds
And I clear value "one" from select2 field "instconf_tagselect"
And I press "Save"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment