MDL-66378 behat: Correct invalid uses of selection from dropdown

This commit is contained in:
Andrew Nicols 2019-08-15 08:47:17 +08:00
parent beae3feb54
commit 44de5278a5
5 changed files with 11 additions and 15 deletions

View File

@ -77,7 +77,7 @@ Feature: A teacher checks the grade history report in a course
| Student 2 | The greatest assignment ever | 50.00 | 70.00 | Teacher 2 |
| Student 2 | Rewarding assignment | 60.00 | 80.00 | Teacher 2 |
# Test filtering by assignment.
And I click on "The greatest assignment ever" "option" in the "#id_itemid" "css_element"
And I set the field "Grade item" to "The greatest assignment ever"
And I press "Submit"
And the following should exist in the "gradereport_history" table:
| First name/Surname | Grade item | Original grade | Revised grade | Grader |
@ -87,7 +87,7 @@ Feature: A teacher checks the grade history report in a course
| Student 1 | Rewarding assignment | | 60.00 | Teacher 1 |
| Student 1 | Rewarding assignment | 60.00 | 80.00 | Teacher 2 |
# Test filtering by grader.
And I click on "Teacher 1" "option" in the "#id_grader" "css_element"
And I set the field "Grader" to "Teacher 1"
And I press "Submit"
And the following should exist in the "gradereport_history" table:
| First name/Surname | Grade item | Original grade | Revised grade | Grader |

View File

@ -98,7 +98,7 @@ Feature: We can use Single view
And I log in as "teacher2"
And I am on "Course 1" course homepage
Given I navigate to "View > Single view" in the course gradebook
And I click on "Student 4" "option"
And I select "Student 4" from the "Select user..." singleselect
And the "Exclude for Test assignment one" "checkbox" should be disabled
And the "Override for Test assignment one" "checkbox" should be enabled

View File

@ -22,7 +22,7 @@ Feature: Tinymce with enable/disable function.
@javascript
Scenario: Check disable Tinymce editor.
When I click on "option[value=1]" "css_element" in the "select#id_mycontrol" "css_element"
When I set the field "My control" to "Disable"
Then the "class" attribute of "a#id_myeditor_pdw_toggle" "css_element" should contain "mceButtonDisabled"
And the "class" attribute of "table#id_myeditor_formatselect" "css_element" should contain "mceListBoxDisabled"
And the "class" attribute of "a#id_myeditor_bold" "css_element" should contain "mceButtonDisabled"
@ -39,7 +39,7 @@ Feature: Tinymce with enable/disable function.
@javascript
Scenario: Check enable Tinymce editor.
When I click on "option[value=0]" "css_element" in the "select#id_mycontrol" "css_element"
When I set the field "My control" to "Enable"
Then the "class" attribute of "a#id_myeditor_pdw_toggle" "css_element" should contain "mceButtonEnabled"
And the "class" attribute of "table#id_myeditor_formatselect" "css_element" should contain "mceListBoxEnabled"
And the "class" attribute of "a#id_myeditor_bold" "css_element" should contain "mceButtonEnabled"

View File

@ -85,7 +85,7 @@ Feature: Glossary entries can be organised in categories
And "//h4[contains(.,'EntryCategoryNL')]" "xpath_element" should appear after "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
And I should not see "EntryNoCategory"
And I set the field "hook" to "Not categorised"
And I click on "Not categorised" "option" in the "#catmenu select" "css_element"
And I set the field "Categories" to "Not categorised"
And I should see "EntryNoCategory"
And I should not see "EntryCategoryNL"
And I should not see "EntryCategoryAL"
@ -112,7 +112,7 @@ Feature: Glossary entries can be organised in categories
And I should not see "EntryNoCategory"
And I should not see "EntryCategoryAL"
And I should see "EntryCategoryBoth"
And I click on "Not categorised" "option" in the "#catmenu select" "css_element"
And I set the field "Categories" to "Not categorised"
And I should see "EntryNoCategory"
And I should see "EntryCategoryAL"
And I should not see "EntryCategoryBoth"

View File

@ -46,14 +46,10 @@ class behat_user extends behat_base {
* @param string $nodetext The menu item to select.
*/
public function i_choose_from_the_participants_page_bulk_action_menu($nodetext) {
$nodetext = behat_context_helper::escape($nodetext);
// Open the select.
$this->execute("behat_general::i_click_on", array("//select[@id='formactionid']", "xpath_element"));
// Click on the option.
$this->execute("behat_general::i_click_on", array("//select[@id='formactionid']" .
"/option[contains(., " . $nodetext . ")]", "xpath_element"));
$this->execute("behat_forms::i_set_the_field_to", [
"With selected users...",
$this->escape($nodetext)
]);
}
/**