Merge pull request #3 from aanabit/app_behat_tests

Adding new behat tests for quiz and data for Moodle app
main
Juan Leyva 2019-08-05 11:23:01 +02:00 committed by GitHub
commit a1bb5b879e
3 changed files with 444 additions and 0 deletions

View File

@ -0,0 +1,199 @@
@mod @mod_data @app @javascript
Feature: Users can manage entries in database activities
In order to populate databases
As a user
I need to add and manage entries to databases
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| data | Web links | Useful links | C1 | data1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I add a "Text input" field to "Web links" database and I fill the form with:
| Field name | URL |
| Field description | URL link |
And I add a "Text input" field to "Web links" database and I fill the form with:
| Field name | Description |
| Field description | Link description |
And I log out
Scenario: Students can add entries to a database in the app
Given I enter the app
And I log in as "student1"
And I press "Course 1" near "Course overview" in the app
And I press "Web links" near "General" in the app
And I should see "No entries in database"
When I press "Add entries" in the app
And I set the field "URL" to "https://moodle.org/" in the app
And I set the field "Description" to "Moodle community site" in the app
And I press "Save" near "Web links" in the app
Then I should see "https://moodle.org/"
And I should see "Moodle community site"
Scenario: Students can navigate along single entries in the app
Given I enter the app
And I log in as "student1"
And I press "Course 1" near "Course overview" in the app
And I press "Web links" near "General" in the app
And I press "Add entries" in the app
And I set the field "URL" to "https://moodle.org/" in the app
And I set the field "Description" to "Moodle community site" in the app
And I press "Save" near "Web links" in the app
When I enter the app
And I log in as "student2"
And I press "Course 1" near "Course overview" in the app
And I press "Web links" near "General" in the app
And I press "Add entries" in the app
And I set the field "URL" to "https://moodlecloud.com/" in the app
And I set the field "Description" to "Moodle Cloud" in the app
And I press "Save" near "Web links" in the app
And I press "More" near "Moodle community site" in the app
Then I should see "Moodle community site"
And I should not see "Next"
And I should see "Previous"
And I press "Previous" in the app
And I should see "Moodle Cloud"
And I should see "Next"
And I should not see "Previous"
And I press "Next" in the app
And I should see "Moodle community site"
And I should not see "Moodle Cloud"
And I press "back" near "Web links" in the app
And I should see "Moodle community site"
And I should see "Moodle Cloud"
Scenario: Students can not edit or delete other user's entries from list and single view in the app
Given I enter the app
And I log in as "student1"
And I press "Course 1" near "Course overview" in the app
And I press "Web links" near "General" in the app
And I press "Add entries" in the app
And I set the field "URL" to "https://moodle.org/" in the app
And I set the field "Description" to "Moodle community site" in the app
And I press "Save" near "Web links" in the app
When I enter the app
And I log in as "student2"
And I press "Course 1" near "Course overview" in the app
And I press "Web links" near "General" in the app
Then "Edit" "link" should not exist
And "Delete" "link" should not exist
And I press "More" in the app
And "Edit" "link" should not exist
And "Delete" "link" should not exist
Scenario: Students can edit and delete their own entries from list and single view in the app
Given I enter the app
And I log in as "student1"
And I press "Course 1" near "Course overview" in the app
And I press "Web links" near "General" in the app
And I press "Add entries" in the app
And I set the field "URL" to "https://moodle.org/" in the app
And I set the field "Description" to "Moodle community site" in the app
And I press "Save" near "Web links" in the app
When I press "Edit" in the app
And I set the field "URL" to "https://moodlecloud.com/" in the app
And I set the field "Description" to "Moodle Cloud" in the app
And I press "Save" near "Web links" in the app
Then I should not see "https://moodle.org/"
And I should not see "Moodle community site"
And I should see "https://moodlecloud.com/"
And I should see "Moodle Cloud"
And I press "Delete" in the app
And I should see "Are you sure you want to delete this entry?"
And I press "Cancel" in the app
And I should see "Moodle Cloud"
And I press "Delete" in the app
And I should see "Are you sure you want to delete this entry?"
And I press "OK" in the app
And I should not see "Moodle Cloud"
And I press "Add entries" in the app
And I set the field "URL" to "https://moodle.org/" in the app
And I set the field "Description" to "Moodle community site" in the app
And I press "Save" near "Web links" in the app
And I press "More" in the app
And I press "Edit" in the app
And I set the field "URL" to "https://moodlecloud.com/" in the app
And I set the field "Description" to "Moodle Cloud" in the app
And I press "Save" near "Web links" in the app
And I should not see "https://moodle.org/"
And I should not see "Moodle community site"
And I should see "https://moodlecloud.com/"
And I should see "Moodle Cloud"
And I press "Delete" in the app
And I should see "Are you sure you want to delete this entry?"
And I press "Cancel" in the app
And I should see "Moodle Cloud"
And I press "Delete" in the app
And I should see "Are you sure you want to delete this entry?"
And I press "OK" in the app
And I should not see "Moodle Cloud"
And I should see "No entries in database"
Scenario: Teachers can edit and delete students' entries from list view in the app
Given I enter the app
And I log in as "student1"
And I press "Course 1" near "Course overview" in the app
And I press "Web links" near "General" in the app
And I press "Add entries" in the app
And I set the field "URL" to "https://moodle.org/" in the app
And I set the field "Description" to "Moodle community site" in the app
And I press "Save" near "Web links" in the app
And I press "Add entries" in the app
And I set the field "URL" to "https://telegram.org/" in the app
And I set the field "Description" to "Telegram" in the app
And I press "Save" near "Web links" in the app
When I enter the app
And I log in as "teacher1"
And I press "Course 1" near "Course overview" in the app
And I press "Web links" near "General" in the app
Then I should see "https://moodle.org/"
And I should see "Moodle community site"
And I press "Edit" near "Moodle community site" in the app
And I set the field "URL" to "https://moodlecloud.com/" in the app
And I set the field "Description" to "Moodle Cloud" in the app
And I press "Save" near "Web links" in the app
And I should not see "https://moodle.org/"
And I should not see "Moodle community site"
And I should see "https://moodlecloud.com/"
And I should see "Moodle Cloud"
And I press "Delete" near "Moodle Cloud" in the app
And I should see "Are you sure you want to delete this entry?"
And I press "Cancel" in the app
And I should see "Moodle Cloud"
And I press "Delete" near "Moodle Cloud" in the app
And I should see "Are you sure you want to delete this entry?"
And I press "OK" in the app
And I should not see "Moodle Cloud"
And I press "More" in the app
And I should see "https://telegram.org/"
And I should see "Telegram"
And I press "Edit" in the app
And I set the field "URL" to "https://moodlecloud.com/" in the app
And I set the field "Description" to "Moodle Cloud" in the app
And I press "Save" near "Web links" in the app
And I should not see "https://telegram.org/"
And I should not see "Telegram"
And I should see "https://moodlecloud.com/"
And I should see "Moodle Cloud"
And I press "Delete" in the app
And I should see "Are you sure you want to delete this entry?"
And I press "Cancel" in the app
And I should see "Moodle Cloud"
And I press "Delete" in the app
And I should see "Are you sure you want to delete this entry?"
And I press "OK" in the app
And I should not see "Moodle Cloud"

View File

@ -0,0 +1,136 @@
@mod @mod_data @app @javascript
Feature: Users can store entries in database activities when offline and sync when online
In order to populate databases while offline
As a user
I need to add and manage entries to databases and sync then when online
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| data | Web links | Useful links | C1 | data1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I add a "Text input" field to "Web links" database and I fill the form with:
| Field name | URL |
| Field description | URL link |
And I add a "Text input" field to "Web links" database and I fill the form with:
| Field name | Description |
| Field description | Link description |
And I log out
@app_from3.7
Scenario: Students can add entries to a database in the app while offline
Given I enter the app
And I log in as "student1"
And I press "Course 1" near "Course overview" in the app
And I press "Web links" near "General" in the app
And I switch offline mode to "true"
And I should see "No entries in database"
When I press "Add entries" in the app
And I set the field "URL" to "https://moodle.org/" in the app
And I set the field "Description" to "Moodle community site" in the app
And I press "Save" near "Web links" in the app
Then I should see "https://moodle.org/"
And I should see "Moodle community site"
And I should see "This Database has offline data to be synchronised"
And I press "back" near "Web links" in the app
And I switch offline mode to "false"
And I press "Web links" near "General" in the app
And I should see "https://moodle.org/"
And I should see "Moodle community site"
And I should not see "This Database has offline data to be synchronised"
@app_from3.7
Scenario: Students can edit and delete entries to a database in the app while offline
Given I enter the app
And I log in as "student1"
And I press "Course 1" near "Course overview" in the app
And I press "Web links" near "General" in the app
And I should see "No entries in database"
And I press "Add entries" in the app
And I set the field "URL" to "https://moodle.org/" in the app
And I set the field "Description" to "Moodle community site" in the app
And I press "Save" near "Web links" in the app
And I should see "https://moodle.org/"
And I should see "Moodle community site"
And I press "Information" in the app
And I press "Download" in the app
And I wait until the page is ready
And I switch offline mode to "true"
When I press "Edit" in the app
And I set the field "URL" to "https://moodlecloud.com/" in the app
And I set the field "Description" to "Moodle Cloud" in the app
And I press "Save" near "Web links" in the app
Then I should not see "https://moodle.org/"
And I should not see "Moodle community site"
And I should see "https://moodlecloud.com/"
And I should see "Moodle Cloud"
And I should see "This Database has offline data to be synchronised"
And I press "back" near "Web links" in the app
And I switch offline mode to "false"
And I press "Web links" near "General" in the app
And I should not see "https://moodle.org/"
And I should not see "Moodle community site"
And I should see "https://moodlecloud.com/"
And I should see "Moodle Cloud"
And I should not see "This Database has offline data to be synchronised"
And I press "Information" in the app
And I press "Refresh" in the app
And I wait until the page is ready
And I switch offline mode to "true"
And I press "Delete" in the app
And I should see "Are you sure you want to delete this entry?"
And I press "OK" in the app
And I should see "https://moodlecloud.com/"
And I should see "Moodle Cloud"
And I should see "This Database has offline data to be synchronised"
And I press "back" near "Web links" in the app
And I switch offline mode to "false"
And I press "Web links" near "General" in the app
And I should not see "https://moodlecloud.com/"
And I should not see "Moodle Cloud"
And I should not see "This Database has offline data to be synchronised"
@app_from3.7
Scenario: Students can undo deleting entries to a database in the app while offline
Given I enter the app
And I log in as "student1"
And I press "Course 1" near "Course overview" in the app
And I press "Web links" near "General" in the app
And I should see "No entries in database"
And I press "Add entries" in the app
And I set the field "URL" to "https://moodle.org/" in the app
And I set the field "Description" to "Moodle community site" in the app
And I press "Save" near "Web links" in the app
And I should see "https://moodle.org/"
And I should see "Moodle community site"
And I press "Information" in the app
And I press "Download" in the app
And I wait until the page is ready
When I switch offline mode to "true"
And I press "Delete" in the app
And I should see "Are you sure you want to delete this entry?"
And I press "OK" in the app
And I should see "https://moodle.org/"
And I should see "Moodle community site"
And I should see "This Database has offline data to be synchronised"
And I press "Restore" in the app
And I press "back" near "Web links" in the app
And I switch offline mode to "false"
And I press "Web links" near "General" in the app
Then I should see "https://moodle.org/"
And I should see "Moodle community site"
And I should not see "This Database has offline data to be synchronised"

View File

@ -0,0 +1,109 @@
@mod @mod_quiz @app @javascript
Feature: Attempt a quiz in app
As a student
In order to demonstrate what I know
I need to be able to attempt quizzes
Background:
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "users" exist:
| username |
| student1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | questiontext |
| Test questions | truefalse | TF1 | Text of the first question |
| Test questions | truefalse | TF2 | Text of the second question |
And quiz "Quiz 1" contains the following questions:
| question | page |
| TF1 | 1 |
| TF2 | 2 |
@app_upto3.7.0
Scenario: Next and previous navigation in the 3.6 app
Given I enter the app
And I log in as "student1"
When I press "Course 1" near "Course overview" in the app
And I press "Quiz 1" in the app
And I press "Attempt quiz now" in the app
Then I should see "Text of the first question"
And I should not see "Text of the second question"
And I press "Next" near "Question 1" in the app
And I should see "Text of the second question"
And I should not see "Text of the first question"
And I press "Previous" near "Question 2" in the app
And I should not see "Text of the second question"
And I should see "Text of the first question"
And I press "Next" near "Quiz 1" in the app
And I should see "Text of the second question"
And I should not see "Text of the first question"
And I press "Previous" near "Quiz 1" in the app
And I should not see "Text of the second question"
And I should see "Text of the first question"
And I press "Next" near "Question 1" in the app
And I press "Next" near "Quiz 1" in the app
And I should see "Summary of attempt"
And I press "Return to attempt" in the app
And I should see "Text of the second question"
And I should not see "Text of the first question"
And I press "Next" in the app
And I press "Submit all and finish" in the app
And I should see "Once you submit"
And I press "Cancel" near "Once you submit" in the app
And I should see "Summary of attempt"
And I press "Submit all and finish" in the app
And I press "OK" near "Once you submit" in the app
And I should see "Review"
And I press "home" in the app
And I should see "Acceptance test site"
@app_from3.7.1
Scenario: Next and previous navigation in the 3.7 app
Given I enter the app
And I log in as "student1"
When I press "Course 1" near "Course overview" in the app
And I press "Quiz 1" in the app
And I press "Attempt quiz now" in the app
Then I should see "Text of the first question"
And I should not see "Text of the second question"
And I press "Next" near "Question 1" in the app
And I should see "Text of the second question"
And I should not see "Text of the first question"
And I press "Previous" near "Question 2" in the app
And I should not see "Text of the second question"
And I should see "Text of the first question"
And I press "Next" near "Quiz 1" in the app
And I should see "Text of the second question"
And I should not see "Text of the first question"
And I press "Previous" near "Quiz 1" in the app
And I should not see "Text of the second question"
And I should see "Text of the first question"
And I press "Next" near "Question 1" in the app
And I press "Next" near "Quiz 1" in the app
And I should see "Summary of attempt"
And I press "Return to attempt" in the app
And I should see "Text of the second question"
And I should not see "Text of the first question"
And I press "Next" in the app
And I press "Submit all and finish" in the app
And I should see "Once you submit"
And I press "Cancel" near "Once you submit" in the app
And I should see "Summary of attempt"
And I press "Submit all and finish" in the app
And I press "OK" near "Once you submit" in the app
And I should see "Review"
And I press "home" in the app
And I should see "Are you sure"
And I should see "OK"
And I press "OK" in the app
And I should see "Acceptance test site"