MDL-46891 behat: Driver specific fixes.

1. Browserkit doesn't handle [] in name
2. Grades are not visible in viewport and might fail
   with few drivers, increasing size of window to ensure
   grades are visible and can be modified.
3. Click edit first to see grade link
4. Expand fields before setting value
5. Updated xpath, as crawler update it.
6. Hover fails to show icon
This commit is contained in:
Rajesh Taneja
2016-03-11 10:51:16 +08:00
parent b73e5047af
commit e01012e96d
16 changed files with 40 additions and 27 deletions
@@ -12,7 +12,6 @@ Feature: Forms manipulation
When I set the field "First name" to "Field value"
And I set the field "Select a country" to "Japan"
And I set the field "Unmask" to "1"
And I expand all fieldsets
Then the field "First name" matches value "Field value"
And the "Select a country" select box should contain "Japan"
And the field "Unmask" matches value "1"
@@ -44,6 +44,7 @@ Feature: We can use calculated grade totals
And I follow "Course 1"
And I navigate to "Grades" node in "Course administration"
And I turn editing mode on
And I change window size to "large"
And I give the grade "60.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "20.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "40.00" to the user "Student 1" for the grade item "Test assignment three"
@@ -58,6 +59,7 @@ Feature: We can use calculated grade totals
| Hidden | 1 |
And I set the following settings for grade item "Test assignment eight":
| Hidden | 1 |
And I change window size to "medium"
And I navigate to "Course grade settings" node in "Grade administration > Setup"
And I set the field "Grade display type" to "Real (percentage)"
And I press "Save changes"
@@ -15,14 +15,14 @@ Feature: Atto accessibility checker
And I wait "2" seconds
And I click on "Image" "button"
And the field "Enter URL" matches value "/broken-image"
And I set the field "Describe this image" to "No more warning!"
And I set the field "Describe this image for someone who cannot see it" to "No more warning!"
And I press "Save image"
And I press "Accessibility checker"
And I should see "Congratulations, no accessibility problems found!"
And I click on ".moodle-dialogue-focused .closebutton" "css_element"
And I select the text in the "Description" Atto editor
And I click on "Image" "button"
And I set the field "Describe this image" to ""
And I set the field "Describe this image for someone who cannot see it" to ""
And I set the field "Description not necessary" to "1"
And I press "Save image"
And I press "Accessibility checker"
@@ -17,7 +17,7 @@ Feature: Add images to Atto
And I click on "Private files" "link"
And I click on "moodle-logo.png" "link"
And I click on "Select this file" "button"
And I set the field "Describe this image" to "It's the Moodle"
And I set the field "Describe this image for someone who cannot see it" to "It's the Moodle"
# Wait for the page to "settle".
And I wait until the page is ready
And the field "Width" matches value "204"
@@ -45,7 +45,7 @@ Feature: Add images to Atto
And I follow "Edit profile"
And I select the text in the "Description" Atto editor
And I click on "Image" "button"
Then the field "Describe this image" matches value "It's the Moodle"
Then the field "Describe this image for someone who cannot see it" matches value "It's the Moodle"
And the field "Width" matches value "123"
And the field "Height" matches value "456"
@@ -58,7 +58,7 @@ Feature: Add images to Atto
And I select the text in the "Description" Atto editor
When I click on "Image" "button"
Then the field "Enter URL" matches value "/nothing/here"
And I set the field "Describe this image" to "Something"
And I set the field "Describe this image for someone who cannot see it" to "Something"
And I set the field "Enter URL" to ""
And I press "Save image"
And I set the field "Description" to "<p>Image: <img src='/nothing/again' width='123' height='456' alt='Awesome!'>.</p>"
+3 -1
View File
@@ -1158,7 +1158,9 @@ class behat_general extends behat_base {
// Check if value exists in specific row/column.
// Get row xpath.
$rowxpath = $tablexpath."/tbody/tr[th[normalize-space(.)=" . $rowliteral . "] or td[normalize-space(.)=" . $rowliteral . "]]";
// GoutteDriver uses DomCrawler\Crawler and it is making XPath relative to the current context, so use descendant.
$rowxpath = $tablexpath."/tbody/tr[descendant::th[normalize-space(.)=" . $rowliteral .
"] | descendant::td[normalize-space(.)=" . $rowliteral . "]]";
$columnvaluexpath = $rowxpath . $columnpositionxpath . "[contains(normalize-space(.)," . $valueliteral . ")]";
+5 -5
View File
@@ -25,13 +25,13 @@ Feature: Check that messages can be deleted
And "Delete" "link" should exist in the "#message_1" "css_element"
And "Delete" "link" should exist in the "#message_2" "css_element"
# Confirm that there is a confirmation box before deleting, and that when we cancel the messages remain.
And I hover "#message_2" "css_element"
And I click on "#message_2" "css_element"
And I click on "Delete" "link" in the "#message_2" "css_element"
And I press "Cancel"
And I should see "Hey bud, what's happening?"
And I should see "Whoops, forgot to mention that I drank all your beers. Lol."
# Confirm we can delete a message and then can no longer see it.
And I hover "#message_2" "css_element"
And I click on "#message_2" "css_element"
And I click on "Delete" "link" in the "#message_2" "css_element"
And I press "Delete"
And I should see "Hey bud, what's happening?"
@@ -69,10 +69,10 @@ Feature: Check that messages can be deleted
And "Delete" "link" should exist in the "#message_3" "css_element"
And "Delete" "link" should exist in the "#message_4" "css_element"
# Now, delete one of the messages that User 1 sent and one by User 2.
And I hover "#message_1" "css_element"
And I click on "#message_1" "css_element"
And I click on "Delete" "link" in the "#message_1" "css_element"
And I press "Delete"
And I hover "#message_2" "css_element"
And I click on "#message_2" "css_element"
And I click on "Delete" "link" in the "#message_2" "css_element"
And I press "Delete"
# Confirm that the messages are no longer listed.
@@ -111,7 +111,7 @@ Feature: Check that messages can be deleted
# Send a message from the admin to User 1
And I send "Hey there, this is the all-powerful administrator. Obey my commands." message to "User 1" user
# Check the admin is still able to delete messages.
And I hover "#message_1" "css_element"
And I click on "#message_1" "css_element"
And I click on "Delete" "link" in the "#message_1" "css_element"
And I press "Delete"
And I should not see "Hey there, this is the all-powerful administrator. Obey my commands."
@@ -51,6 +51,7 @@ Feature: In an assignment, teacher can annotate PDF files during grading
And I follow "Course 1"
And I follow "Test assignment name"
And I follow "View/grade all submissions"
And I click on "Edit" "link" in the "Submitted for grading" "table_row"
And I click on "Grade" "link" in the "Submitted for grading" "table_row"
And I follow "Launch PDF editor..."
And I change window size to "large"
@@ -129,6 +130,7 @@ Feature: In an assignment, teacher can annotate PDF files during grading
And I follow "Course 1"
And I follow "Test assignment name"
And I follow "View/grade all submissions"
And I click on "Edit" "link" in the "Student 2" "table_row"
And I click on "Grade" "link" in the "Student 2" "table_row"
And I follow "Launch PDF editor..."
And I change window size to "large"
@@ -26,8 +26,8 @@ Feature: In an assignment, teachers can edit a students submission inline
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| assignfeedback_comments_enabled | 1 |
| assignfeedback_comments_commentinline | 1 |
| assignfeedback_file_enabled | 1 |
| assignfeedback_comments_commentinline | 1 |
And I log out
And I log in as "student1"
And I follow "Course 1"
@@ -31,8 +31,7 @@ Feature: Users can be required to specify certain fields when adding entries to
| Required | yes |
| Options | Required Checkbox Option 1 |
And I follow "Fields"
And I set the field "newtype" to "Checkbox"
And I click on "Go" "button" in the ".fieldadd" "css_element"
And I select "Checkbox" from the "newtype" singleselect
And I set the following fields to these values:
| Field name | Required Two-Option Checkbox |
| Field description | Required Two-Option Checkbox |
@@ -79,8 +78,7 @@ Feature: Users can be required to specify certain fields when adding entries to
| Required | yes |
| Options | Option 1 |
And I follow "Fields"
And I set the field "newtype" to "Multimenu"
And I click on "Go" "button" in the ".fieldadd" "css_element"
And I select "Multimenu" from the "newtype" singleselect
And I set the following fields to these values:
| Field name | Required Two-Option Multimenu |
| Field description | Required Two-Option Multimenu |
@@ -112,8 +112,6 @@ Feature: Test creating different types of feedback questions
And I should see "C1" in the "(info)" "table"
And I should see "my long answer" in the "(longertext)" "table"
And I should see "lots of feedbacks" in the "(longertext)" "table"
#And I should see "1 (50.00 %)" in the "option a:" "table_row" // TODO: MDL-46891
#And I should see "1 (50.00 %)" in the "option b:" "table_row" // TODO: MDL-46891
And I should see "2 (100.00 %)" in the "option d:" "table_row"
And I should see "1 (50.00 %)" in the "option e:" "table_row"
And I should see "1 (50.00 %)" in the "option f:" "table_row"
@@ -131,9 +129,12 @@ Feature: Test creating different types of feedback questions
And I should see "Average: 53.00" in the "(numeric)" "table"
And I should see "no way" in the "(shorttext)" "table"
And I should see "hello" in the "(shorttext)" "table"
And I log out
Scenario: Create different types of questions in feedback with javascript disabled
And I log out
@javascript
Scenario: Create different types of questions in feedback with javascript enabled
And I should see "1 (50.00 %)" in the "option a:" "table_row"
And I should see "1 (50.00 %)" in the "option b:" "table_row"
And I log out
@@ -59,6 +59,7 @@ Feature: Settings form fields disabled if not required
| Attempts allowed | 3 |
And I press "Save"
And I navigate to "Edit settings" node in "Quiz administration"
And I expand all fieldsets
And I set the field "Attempts allowed" to "1"
Then the "Grading method" "field" should be enabled
And the "Each attempt builds on the last" "field" should be enabled
@@ -71,6 +72,7 @@ Feature: Settings form fields disabled if not required
And I set the field "Attempts allowed" to "2"
And I press "Save"
And I navigate to "Edit settings" node in "Quiz administration"
And I expand all fieldsets
And I set the field "Attempts allowed" to "1"
Then the "Grading method" "field" should be enabled
And the "Each attempt builds on the last" "field" should be enabled
@@ -85,6 +87,7 @@ Feature: Settings form fields disabled if not required
| Attempts allowed | Unlimited |
And I press "Save"
And I navigate to "Edit settings" node in "Quiz administration"
And I expand all fieldsets
And I set the field "Attempts allowed" to "1"
Then the "Grading method" "field" should be enabled
And the "Each attempt builds on the last" "field" should be enabled
@@ -29,7 +29,8 @@ Feature: Preview a drag-drop onto image question
When I click on "Preview" "link" in the "Drag onto image" "table_row"
And I switch to "questionpreview" window
# Increase window size and wait 2 seconds to ensure elements are placed properly by js.
And I change window size to "medium"
# Keep window large else drag will scroll the window to find element.
And I change window size to "large"
And I wait "2" seconds
# Odd, but the <br>s go to nothing, not a space.
And I drag "mountainbelt" to place "1" in the drag and drop onto image question
@@ -50,7 +51,7 @@ Feature: Preview a drag-drop onto image question
When I click on "Preview" "link" in the "Drag onto image" "table_row"
And I switch to "questionpreview" window
# Increase window size and wait 2 seconds to ensure elements are placed properly by js.
And I change window size to "medium"
And I change window size to "large"
And I wait "2" seconds
And I type " " on place "1" in the drag and drop onto image question
And I type " " on place "2" in the drag and drop onto image question
@@ -72,7 +72,7 @@ class behat_qtype_ddmarker extends behat_base {
// Therefore to make it drag to the specified place, we have to add
// a target div.
$session = $this->getSession();
$session->evaluateScript("
$session->executeScript("
(function() {
if (document.getElementById('target-{$x}-{$y}')) {
return;
@@ -29,7 +29,8 @@ Feature: Preview a drag-drop onto image question
When I click on "Preview" "link" in the "Drag markers" "table_row"
And I switch to "questionpreview" window
# Increase window size and wait 2 seconds to ensure elements are placed properly by js.
And I change window size to "medium"
# Keep window large else drag will scroll the window to find element.
And I change window size to "large"
And I wait "2" seconds
# Odd, but the <br>s go to nothing, not a space.
And I drag "OU" to "342,230" in the drag and drop markers question
@@ -46,7 +47,8 @@ Feature: Preview a drag-drop onto image question
When I click on "Preview" "link" in the "Drag markers" "table_row"
And I switch to "questionpreview" window
# Increase window size and wait 2 seconds to ensure elements are placed properly by js.
And I change window size to "medium"
# Keep window large else drag will scroll the window to find element.
And I change window size to "large"
And I wait "2" seconds
And I type "up" "89" times on marker "Railway station" in the drag and drop markers question
And I type "right" "21" times on marker "Railway station" in the drag and drop markers question
@@ -29,7 +29,8 @@ Feature: Preview a drag-drop into text question
When I click on "Preview" "link" in the "Drag to text" "table_row"
And I switch to "questionpreview" window
# Increase window size and wait 2 seconds to ensure elements are placed properly by js.
And I change window size to "medium"
# Keep window large else drag will scroll the window to find element.
And I change window size to "large"
And I wait "2" seconds
And I drag "quick" to space "1" in the drag and drop into text question
And I drag "fox" to space "2" in the drag and drop into text question
+3 -1
View File
@@ -288,7 +288,9 @@ class behat_filepicker extends behat_files {
$field->set_value($value);
}
$this->find_button(get_string('getfile', 'repository'))->click();
$selectfilebutton = $this->find_button(get_string('getfile', 'repository'));
$this->ensure_node_is_visible($selectfilebutton);
$selectfilebutton->click();
// We wait for all the JS to finish as it is performing an action.
$this->getSession()->wait(self::TIMEOUT, self::PAGE_READY_JS);