MDL-52964 Qtype: Small fixes to behat tests
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 18 Feb 2016 00:42:22 +0000 (01:42 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 18 Feb 2016 00:42:22 +0000 (01:42 +0100)
This applies some small changes to proposed behat tests:

- Geting rid of the @javascript tag when it's not needed.
- Adding some missing @_switch_window tags.
- Fixing some scenario names, previously duplicated.
- Fixing some typos and whitespace.

25 files changed:
question/type/description/tests/behat/add.feature
question/type/description/tests/behat/edit.feature
question/type/description/tests/behat/export.feature
question/type/description/tests/behat/preview.feature
question/type/essay/tests/behat/add.feature
question/type/essay/tests/behat/edit.feature
question/type/essay/tests/behat/export.feature
question/type/essay/tests/behat/preview.feature
question/type/match/tests/behat/add.feature
question/type/match/tests/behat/edit.feature
question/type/match/tests/behat/export.feature
question/type/match/tests/behat/preview.feature
question/type/multichoice/tests/behat/add.feature
question/type/multichoice/tests/behat/edit.feature
question/type/multichoice/tests/behat/export.feature
question/type/multichoice/tests/behat/preview.feature
question/type/shortanswer/tests/behat/add.feature
question/type/shortanswer/tests/behat/backup_and_restore.feature
question/type/shortanswer/tests/behat/edit.feature
question/type/shortanswer/tests/behat/export.feature
question/type/shortanswer/tests/behat/preview.feature
question/type/truefalse/tests/behat/add.feature
question/type/truefalse/tests/behat/edit.feature
question/type/truefalse/tests/behat/export.feature
question/type/truefalse/tests/behat/preview.feature

index 6742f7c..ce3f32f 100644 (file)
@@ -18,7 +18,6 @@ Feature: Test creating a Description question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
   Scenario: Create a Description question with Correct answer as False
     When I add a "Description" question filling the form with:
       | Question name                      | description-001                                                |
index 2ed8a54..0fee2f4 100644 (file)
@@ -24,7 +24,6 @@ Feature: Test editing a Description question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
   Scenario: Edit a Description question
     When I click on "Edit" "link" in the "description-001" "table_row"
     And I set the following fields to these values:
index fdad51e..9fa1a62 100644 (file)
@@ -23,7 +23,6 @@ Feature: Test exporting Description questions
     And I log in as "teacher1"
     And I follow "Course 1"
 
-  @javascript
   Scenario: Export a Description question
     When I navigate to "Export" node in "Course administration > Question bank"
     And I set the field "id_format_xml" to "1"
index f6f4706..4db3353 100644 (file)
@@ -24,8 +24,8 @@ Feature: Preview a Description question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
-  Scenario: Preview a question and submit a correct response.
+  @javascript @_switch_window
+  Scenario: Preview a Description question and submit a correct response.
     When I click on "Preview" "link" in the "description-001" "table_row"
     And I switch to "questionpreview" window
     And I set the field "How questions behave" to "Immediate feedback"
index 152cc06..a0acccc 100644 (file)
@@ -18,7 +18,6 @@ Feature: Test creating an Essay question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
   Scenario: Create an Essay question with Response format set to 'HTML editor'
     When I add a "Essay" question filling the form with:
       | Question name            | essay-001                      |
@@ -27,7 +26,6 @@ Feature: Test creating an Essay question
       | Response format          | HTML editor                    |
     Then I should see "essay-001"
 
- @javascript
   Scenario: Create an Essay question with Response format set to 'HTML editor with the file picker'
     When I add a "Essay" question filling the form with:
       | Question name            | essay-002                      |
index 9f03214..3fcff2f 100644 (file)
@@ -26,7 +26,6 @@ Feature: Test editing an Essay question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
   Scenario: Edit an Essay question
     When I click on "Edit" "link" in the "essay-001" "table_row"
     And I set the following fields to these values:
index 9b5810a..1c56f19 100644 (file)
@@ -25,7 +25,6 @@ Feature: Test exporting Essay questions
    And I log in as "teacher1"
    And I follow "Course 1"
 
-  @javascript
   Scenario: Export 3 Essay questions
     When I navigate to "Export" node in "Course administration > Question bank"
     And I set the field "id_format_xml" to "1"
index dd8ef44..49a4fb0 100644 (file)
@@ -26,8 +26,8 @@ Feature: Preview Essay questions
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
-  Scenario: Preview a question and submit a partially correct response.
+  @javascript @_switch_window
+  Scenario: Preview an Essay question and submit a partially correct response.
     When I click on "Preview" "link" in the "essay-001" "table_row"
     And I switch to "questionpreview" window
     And I set the field "How questions behave" to "Immediate feedback"
@@ -35,8 +35,8 @@ Feature: Preview Essay questions
     And I should see "Please write a story about a frog."
     And I switch to the main window
 
-  @javascript
-  Scenario: Preview a question and submit a partially correct response.
+  @javascript @_switch_window
+  Scenario: Preview an Essay question and submit a partially correct response.
     When I click on "Preview" "link" in the "essay-002" "table_row"
     And I switch to "questionpreview" window
     And I set the field "How questions behave" to "Immediate feedback"
@@ -44,9 +44,9 @@ Feature: Preview Essay questions
     And I should see "Please write a story about a frog."
     And I should see "You can drag and drop files here to add them."
     And I switch to the main window
-    
-  @javascript
-  Scenario: Preview a question and submit a partially correct response.
+
+  @javascript @_switch_window
+  Scenario: Preview an Essay question and submit a partially correct response.
     When I click on "Preview" "link" in the "essay-003" "table_row"
     And I switch to "questionpreview" window
     And I set the field "How questions behave" to "Immediate feedback"
index 9113485..8d8ed5b 100644 (file)
@@ -18,7 +18,6 @@ Feature: Test creating a Matching question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
   Scenario: Create a Matching question with 3 subquestions
     When I add a "Matching" question filling the form with:
       | Question name                      | match-001                                      |
index 40663ae..e052cca 100644 (file)
@@ -24,7 +24,7 @@ Feature: Test editing a Matching question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
+  @javascript @_switch_window
   Scenario: Edit a Matching question
     When I click on "Edit" "link" in the "Matching for editing" "table_row"
     And I set the following fields to these values:
index 6d1420d..ae4a541 100644 (file)
@@ -23,7 +23,6 @@ Feature: Test exporting Matching questions
     And I log in as "teacher1"
     And I follow "Course 1"
 
-  @javascript
   Scenario: Export a Matching question
     When I navigate to "Export" node in "Course administration > Question bank"
     And I set the field "id_format_xml" to "1"
index 2d21910..f2a6754 100644 (file)
@@ -24,8 +24,8 @@ Feature: Preview a Matching question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
-  Scenario: Preview a question and submit a correct response.
+  @javascript @_switch_window
+  Scenario: Preview a Matching question and submit a correct response.
     When I click on "Edit" "link" in the "matching-001" "table_row"
     And I set the following fields to these values:
       | Shuffle    | 0   |
@@ -42,8 +42,8 @@ Feature: Preview a Matching question
     And I should see "General feedback."
     And I switch to the main window
 
-  @javascript
-  Scenario: Preview a question and submit a partially correct response.
+  @javascript @_switch_window
+  Scenario: Preview a Matching question and submit a partially correct response.
     When I click on "Edit" "link" in the "matching-001" "table_row"
     And I set the following fields to these values:
       | Shuffle    | 0   |
@@ -60,8 +60,8 @@ Feature: Preview a Matching question
     And I should see "General feedback."
     And I switch to the main window
 
-  @javascript
-  Scenario: Preview a question and submit an incorrect response.
+  @javascript @_switch_window
+  Scenario: Preview a Matching question and submit an incorrect response.
     When I click on "Edit" "link" in the "matching-001" "table_row"
     And I set the following fields to these values:
       | Shuffle    | 0   |
index a883f28..6151c9e 100644 (file)
@@ -18,7 +18,6 @@ Feature: Test creating a Multiple choice question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
   Scenario: Create a Multiple choice question with multiple response
     When I add a "Multiple choice" question filling the form with:
       | Question name            | Multi-choice-001                   |
@@ -39,7 +38,6 @@ Feature: Test creating a Multiple choice question
       | Hint 2                   | Second hint                        |
     Then I should see "Multi-choice-001"
 
-  @javascript
   Scenario: Create a Multiple choice question with single response
     When I add a "Multiple choice" question filling the form with:
       | Question name            | Multi-choice-002                       |
index be91eda..b906b95 100644 (file)
@@ -25,7 +25,6 @@ Feature: Test editing a Multiple choice question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
   Scenario: Edit a Multiple choice question with multiple response (checkboxes)
     When I click on "Edit" "link" in the "Multiple choice for editing" "table_row"
     And I set the following fields to these values:
@@ -37,7 +36,6 @@ Feature: Test editing a Multiple choice question
     And I press "id_submitbutton"
     Then I should see "Edited Multiple choice name"
 
-  @javascript
   Scenario: Edit a Multiple choice question with single response (radio buttons)
     When I click on "Edit" "link" in the "Single choice for editing" "table_row"
     And I set the following fields to these values:
index 731c7ea..bd3b86b 100644 (file)
@@ -24,7 +24,6 @@ Feature: Test exporting Multiple choice questions
     And I log in as "teacher1"
     And I follow "Course 1"
 
-  @javascript
   Scenario: Export a Multiple choice question
     When I navigate to "Export" node in "Course administration > Question bank"
     And I set the field "id_format_xml" to "1"
index 10563c3..aa7d7cd 100644 (file)
@@ -25,8 +25,8 @@ Feature: Preview a Multiple choice question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
-  Scenario: Preview a question and submit a partially correct response.
+  @javascript @_switch_window
+  Scenario: Preview a Multiple choice question and submit a partially correct response.
     When I click on "Preview" "link" in the "Multi-choice-001" "table_row"
     And I switch to "questionpreview" window
     And I set the field "How questions behave" to "Immediate feedback"
@@ -40,8 +40,8 @@ Feature: Preview a Multiple choice question
     And I should see "Parts, but only parts, of your response are correct."
     And I switch to the main window
 
-  @javascript
-  Scenario: Preview a question and submit a correct response.
+  @javascript @_switch_window
+  Scenario: Preview a Multiple choice question and submit a correct response.
     When I click on "Preview" "link" in the "Multi-choice-001" "table_row"
     And I switch to "questionpreview" window
     And I set the field "How questions behave" to "Immediate feedback"
@@ -57,8 +57,8 @@ Feature: Preview a Multiple choice question
     And I should see "The correct answer is: One, Three"
     And I switch to the main window
 
-  @javascript
-  Scenario: Preview a question and submit a correct response.
+  @javascript @_switch_window
+  Scenario: Preview a Multiple choice question and submit a correct response.
     When I click on "Preview" "link" in the "Multi-choice-002" "table_row"
     And I switch to "questionpreview" window
     And I set the field "How questions behave" to "Immediate feedback"
@@ -69,4 +69,4 @@ Feature: Preview a Multiple choice question
     And I should see "Mark 1.00 out of 1.00"
     And I should see "Well done!"
     And I should see "The correct answer is: One"
-    And I switch to the main window
\ No newline at end of file
+    And I switch to the main window
index a61571d..d5e61b1 100644 (file)
@@ -18,7 +18,6 @@ Feature: Test creating a Short answer question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
   Scenario: Create a Short answer question
     When I add a "Short answer" question filling the form with:
       | Question name        | shortanswer-001                           |
index 11d7fa7..707ca47 100644 (file)
@@ -1,4 +1,4 @@
-@qtype @qtype_short asnswer
+@qtype @qtype_shortanswer
 Feature: Test duplicating a quiz containing a Short answer question
   As a teacher
   In order re-use my courses containing Short answer questions
index 6dd528a..4e30dba 100644 (file)
@@ -24,7 +24,7 @@ Feature: Test editing a Short answer question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
+  @javascript @_switch_window
   Scenario: Edit a Short answer question
     When I click on "Edit" "link" in the "shortanswer-001 for editing" "table_row"
     And I set the following fields to these values:
index 1722cff..d8f1f91 100644 (file)
@@ -23,7 +23,6 @@ Feature: Test exporting Short answer questions
     And I log in as "teacher1"
     And I follow "Course 1"
 
-  @javascript
   Scenario: Export a Short answer question
     When I navigate to "Export" node in "Course administration > Question bank"
     And I set the field "id_format_xml" to "1"
index a9b6ebc..b41bdf1 100644 (file)
@@ -25,7 +25,7 @@ Feature: Preview a Short answer question
     And I navigate to "Question bank" node in "Course administration"
 
 
-  @javascript
+  @javascript @_switch_window
   Scenario: Preview a Short answer question with correct answer
     When I click on "Preview" "link" in the "shortanswer-001" "table_row"
     And I switch to "questionpreview" window
@@ -40,7 +40,7 @@ Feature: Preview a Short answer question
     And I should see "Generalfeedback: frog or toad would have been OK."
     And I should see "The correct answer is: frog"
 
-  @javascript
+  @javascript @_switch_window
   Scenario: Preview a Short answer question with almost correct answer
     When I click on "Preview" "link" in the "shortanswer-001" "table_row"
     And I switch to "questionpreview" window
@@ -55,7 +55,7 @@ Feature: Preview a Short answer question
     And I should see "Generalfeedback: frog or toad would have been OK."
     And I should see "The correct answer is: frog"
 
-  @javascript
+  @javascript @_switch_window
   Scenario: Preview a Short answer question with incorrect answer
     When I click on "Preview" "link" in the "shortanswer-001" "table_row"
     And I switch to "questionpreview" window
index 8e0750b..4c09263 100644 (file)
@@ -18,7 +18,6 @@ Feature: Test creating a True/False question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
   Scenario: Create a True/False question with Correct answer as False
     When I add a "True/False" question filling the form with:
       | Question name                      | true-false-001                             |
@@ -29,8 +28,7 @@ Feature: Test creating a True/False question
       | Feedback for the response 'True'.  | Well done!                                 |
       | Feedback for the response 'False'. | Read more about England.                   |
       Then I should see "true-false-001"
-  @javascript
+
   Scenario: Create a True/False question with Correct answer as True
     When I add a "True/False" question filling the form with:
       | Question name                      | true-false-002                         |
index 7131371..4d9a8c9 100644 (file)
@@ -24,7 +24,6 @@ Feature: Test editing a True/False question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
   Scenario: Edit a True/False question
     When I click on "Edit" "link" in the "true-false-001" "table_row"
     And I set the following fields to these values:
index a80ec25..48d54bc 100644 (file)
@@ -23,7 +23,6 @@ Feature: Test exporting True/False questions
     And I log in as "teacher1"
     And I follow "Course 1"
 
-  @javascript
   Scenario: Export a True/False question
     When I navigate to "Export" node in "Course administration > Question bank"
     And I set the field "id_format_xml" to "1"
index 32190e3..d109a08 100644 (file)
@@ -24,8 +24,8 @@ Feature: Preview a Trtue/False question
     And I follow "Course 1"
     And I navigate to "Question bank" node in "Course administration"
 
-  @javascript
-  Scenario: Preview a question and submit a correct response.
+  @javascript @_switch_window
+  Scenario: Preview a True/False question and submit a correct response.
     When I click on "Preview" "link" in the "true-false-001" "table_row"
     And I switch to "questionpreview" window
     And I set the field "How questions behave" to "Immediate feedback"
@@ -36,8 +36,8 @@ Feature: Preview a Trtue/False question
     And I should see "The correct answer is 'True'."
     And I switch to the main window
 
-  @javascript
-  Scenario: Preview a question and submit an incorrect response.
+  @javascript @_switch_window
+  Scenario: Preview a True/False question and submit an incorrect response.
     When I click on "Preview" "link" in the "true-false-001" "table_row"
     And I switch to "questionpreview" window
     And I set the field "How questions behave" to "Immediate feedback"