Skip to content

Commit

Permalink
MDL-66378 behat: Correct invalid uses of selection from dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Aug 17, 2019
1 parent 7ae0f78 commit 1cb4d36
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
4 changes: 2 additions & 2 deletions grade/report/history/tests/behat/basic_functionality.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion grade/report/singleview/tests/behat/singleview.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/editor/tinymce/tests/behat/disablecontrol.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions mod/glossary/tests/behat/categories.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
12 changes: 4 additions & 8 deletions user/tests/behat/behat_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]);
}

/**
Expand Down

0 comments on commit 1cb4d36

Please sign in to comment.