MOBILE-4061 behat: Improve included behat tests

main
Pau Ferrer Ocaña 2022-06-13 16:03:34 +02:00
parent fba9238566
commit 473a03d9fa
4 changed files with 155 additions and 212 deletions

View File

@ -23,6 +23,7 @@ Feature: Users can manage entries in database activities
| data | Web links | Useful links | C1 | data1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
# TODO Create and use a generator for database fields.
And I add a "Text input" field to "Web links" database and I fill the form with:
| Field name | URL |
| Field description | URL link |
@ -33,7 +34,7 @@ Feature: Users can manage entries in database activities
Scenario: Create entry
Given I entered the data activity "Web links" on course "Course 1" as "student1" in the app
And I should find "No entries in database" in the app
Then I should find "No entries in database" in the app
When I press "Add entries" in the app
And I set the following fields to these values in the app:
| URL | https://moodle.org/ |
@ -44,6 +45,7 @@ Feature: Users can manage entries in database activities
Scenario: Browse entry
Given I entered the data activity "Web links" on course "Course 1" as "student1" in the app
# TODO Create and use a generator for database entries.
And I press "Add entries" in the app
And I set the following fields to these values in the app:
| URL | https://moodle.org/ |
@ -92,6 +94,8 @@ Feature: Users can manage entries in database activities
| URL | https://moodle.org/ |
| Description | Moodle community site |
And I press "Save" near "Web links" in the app
# Edit the entry from list view.
When I press "Edit" in the app
And I set the following fields to these values in the app:
| URL | https://moodlecloud.com/ |
@ -101,35 +105,43 @@ Feature: Users can manage entries in database activities
And I should not find "Moodle community site" in the app
And I should find "https://moodlecloud.com/" in the app
And I should find "Moodle Cloud" in the app
And I press "Delete" in the app
And I should find "Are you sure you want to delete this entry?" in the app
# Delete the entry from list view.
When I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Cancel" in the app
And I should find "Moodle Cloud" in the app
And I press "Delete" in the app
And I should find "Are you sure you want to delete this entry?" in the app
When I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Delete" in the app
And I should not find "Moodle Cloud" in the app
And I press "Add entries" in the app
# Repeat again with single view.
Given I press "Add entries" in the app
And I set the following fields to these values in the app:
| URL | https://moodle.org/ |
| Description | Moodle community site |
And I press "Save" near "Web links" in the app
And I press "More" in the app
# Edit the entry from single view.
When I press "More" in the app
And I press "Edit" in the app
And I set the following fields to these values in the app:
| URL | https://moodlecloud.com/ |
| Description | Moodle Cloud |
And I press "Save" near "Web links" in the app
And I should not find "https://moodle.org/" in the app
Then I should not find "https://moodle.org/" in the app
And I should not find "Moodle community site" in the app
And I should find "https://moodlecloud.com/" in the app
And I should find "Moodle Cloud" in the app
And I press "Delete" in the app
And I should find "Are you sure you want to delete this entry?" in the app
# Delete the entry from list view.
When I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Cancel" in the app
And I should find "Moodle Cloud" in the app
And I press "Delete" in the app
And I should find "Are you sure you want to delete this entry?" in the app
When I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Delete" in the app
And I should not find "Moodle Cloud" in the app
And I should find "No entries in database" in the app
@ -146,28 +158,35 @@ Feature: Users can manage entries in database activities
| URL | https://telegram.org/ |
| Description | Telegram |
And I press "Save" near "Web links" in the app
And I entered the course "Course 1" as "teacher1" in the app
When I press "Web links" near "General" in the app
Then I should find "https://moodle.org/" in the app
And I should find "Moodle community site" in the app
And I press "Edit" near "Moodle community site" in the app
# Edit the entry from list view.
When I press "Edit" near "Moodle community site" in the app
And I set the following fields to these values in the app:
| URL | https://moodlecloud.com/ |
| Description | Moodle Cloud |
And I press "Save" near "Web links" in the app
And I should not find "https://moodle.org/" in the app
Then I should not find "https://moodle.org/" in the app
And I should not find "Moodle community site" in the app
And I should find "https://moodlecloud.com/" in the app
And I should find "Moodle Cloud" in the app
And I press "Delete" near "Moodle Cloud" in the app
And I should find "Are you sure you want to delete this entry?" in the app
# Delete the entry from list view.
When I press "Delete" near "Moodle Cloud" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Cancel" in the app
And I should find "Moodle Cloud" in the app
And I press "Delete" near "Moodle Cloud" in the app
And I should find "Are you sure you want to delete this entry?" in the app
When I press "Delete" near "Moodle Cloud" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Delete" in the app
And I should not find "Moodle Cloud" in the app
And I press "More" in the app
# Edit the entry from single view.
When I press "More" in the app
And I should find "https://telegram.org/" in the app
And I should find "Telegram" in the app
And I press "Edit" in the app
@ -175,15 +194,17 @@ Feature: Users can manage entries in database activities
| URL | https://moodlecloud.com/ |
| Description | Moodle Cloud |
And I press "Save" near "Web links" in the app
And I should not find "https://telegram.org/" in the app
Then I should not find "https://telegram.org/" in the app
And I should not find "Telegram" in the app
And I should find "https://moodlecloud.com/" in the app
And I should find "Moodle Cloud" in the app
And I press "Delete" in the app
And I should find "Are you sure you want to delete this entry?" in the app
# Delete the entry from single view.
When I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Cancel" in the app
And I should find "Moodle Cloud" in the app
And I press "Delete" in the app
And I should find "Are you sure you want to delete this entry?" in the app
When I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Delete" in the app
And I should not find "Moodle Cloud" in the app

View File

@ -24,142 +24,65 @@ Feature: Test basic usage of glossary in app
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| forum | Test forum name | Test forum | C1 | forum | 0 |
And the following "mod_glossary > categories" exist:
| glossary | name |
| gloss1 | The ones I like |
| gloss1 | All for you |
And the following "mod_glossary > entries" exist:
| glossary | concept | definition | user | categories | usedynalink |
| gloss1 | Eggplant | Sour eggplants | teacher1 | All for you | 0 |
| gloss1 | Cucumber | Sweet cucumber | student1 | The ones I like | 0 |
| gloss1 | Potato | To make chips | student1 | The ones I like | 1 |
| gloss1 | Raddish | Raphanus sativus | student1 | All for you | 1 |
Scenario: View a glossary and its terms
Given I entered the glossary activity "Test glossary" on course "Course 1" as "student1" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | potato |
| Definition | The potato is a root vegetable native to the Americas, a starchy tuber of the plant Solanum tuberosum, and the plant itself, a perennial in the family Solanaceae. |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | car |
| Definition | A car (or automobile) is a wheeled motor vehicle used for transportation. Most definitions of cars say that they run primarily on roads, seat one to eight people, have four tires, and mainly transport people rather than goods. |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | mountain |
| Definition | A mountain is a large landform that rises above the surrounding land in a limited area, usually in the form of a peak. |
And I press "Save" in the app
Then the header should be "Test glossary" in the app
And I should find "car" in the app
And I should find "mountain" in the app
And I should find "potato" in the app
And I should find "Eggplant" in the app
And I should find "Cucumber" in the app
And I should find "Potato" in the app
When I press "car" in the app
Then I should find "car" in the app
And I should find "A car (or automobile) is a wheeled motor vehicle used for transportation. Most definitions of cars say that they run primarily on roads, seat one to eight people, have four tires, and mainly transport people rather than goods." in the app
Scenario: Change filters (include search)
Given I entered the glossary activity "Test glossary" on course "Course 1" as "student1" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | potato |
| Definition | The potato is a root vegetable native to the Americas, a starchy tuber of the plant Solanum tuberosum, and the plant itself, a perennial in the family Solanaceae. |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | car |
| Definition | A car (or automobile) is a wheeled motor vehicle used for transportation. Most definitions of cars say that they run primarily on roads, seat one to eight people, have four tires, and mainly transport people rather than goods. |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | mountain |
| Definition | A mountain is a large landform that rises above the surrounding land in a limited area, usually in the form of a peak. |
And I press "Save" in the app
Then the header should be "Test glossary" in the app
And I should find "car" in the app
And I should find "mountain" in the app
And I should find "potato" in the app
When I press "Search" in the app
And I set the field "Search query" to "something" in the app
And I press enter
Then I should find "No entries were found." in the app
When I set the field "Search query" to "potato" in the app
And I press "Search" near "No entries were found." in the app
And I set the field "Search query" to " " in the app
And I press "Information" in the app
And I press "Refresh" in the app
And I press "potato" in the app
Then I should find "potato" in the app
And I should find "The potato is a root vegetable native to the Americas, a starchy tuber of the plant Solanum tuberosum, and the plant itself, a perennial in the family Solanaceae." in the app
When I press "Potato" in the app
Then I should find "Potato" in the app
And I should find "To make chips" in the app
Scenario: Navigate to glossary terms by link (auto-linking)
Given the "glossary" filter is "on"
And I entered the glossary activity "Test glossary" on course "Course 1" as "student1" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | potato |
| Definition | The potato is a root vegetable native to the Americas, a starchy tuber of the plant Solanum tuberosum, and the plant itself, a perennial in the family Solanaceae. |
And I press "This entry should be automatically linked" in the app
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | car |
| Definition | A car (or automobile) is a wheeled motor vehicle used for transportation. Most definitions of cars say that they run primarily on roads, seat one to eight people, have four tires, and mainly transport people rather than goods. |
And I press "This entry should be automatically linked" in the app
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | mountain |
| Definition | A mountain is a large landform that rises above the surrounding land in a limited area, usually in the form of a peak. |
And I press "This entry should be automatically linked" in the app
And I press "Save" in the app
Then the header should be "Test glossary" in the app
And I should find "car" in the app
And I should find "mountain" in the app
And I should find "potato" in the app
And I should find "Eggplant" in the app
And I should find "Cucumber" in the app
And I should find "Potato" in the app
And I should find "Raddish" in the app
When I press the back button in the app
And I press "Test forum name" in the app
And I press "Add discussion topic" in the app
And I set the field "Subject" to "Testing auto-link glossary"
And I set the field "Message" to "Glossary terms auto-linked: potato car mountain" in the app
And I set the field "Message" to "Glossary terms auto-linked: Raddish Potato" in the app
And I press "Post to forum" in the app
And I press "Testing auto-link glossary" in the app
Then I should find "car" in the app
Then I should find "Raddish" in the app
When I press "car" in the app
Then the header should be "car" in the app
And I should find "is a wheeled motor vehicle used for transportation" in the app
When I press "Raddish" in the app
Then the header should be "Raddish" in the app
And I should find "Raphanus sativus" in the app
When I press the back button in the app
And I press "mountain" in the app
Then the header should be "mountain" in the app
And I should find "landform that rises above the surrounding land in a limited area, usually in the form of a peak." in the app
And I press "Potato" in the app
Then the header should be "Potato" in the app
And I should find "To make chips" in the app
Scenario: See comments
# Create entries as a student
Given I entered the glossary activity "Test glossary" on course "Course 1" as "student1" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | potato |
| Definition | The potato is a root vegetable native to the Americas, a starchy tuber of the plant Solanum tuberosum, and the plant itself, a perennial in the family Solanaceae. |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | car |
| Definition | A car (or automobile) is a wheeled motor vehicle used for transportation. Most definitions of cars say that they run primarily on roads, seat one to eight people, have four tires, and mainly transport people rather than goods. |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | mountain |
| Definition | A mountain is a large landform that rises above the surrounding land in a limited area, usually in the form of a peak. |
And I press "Save" in the app
Then the header should be "Test glossary" in the app
And I should find "car" in the app
And I should find "mountain" in the app
And I should find "potato" in the app
When I press "mountain" in the app
When I press "Eggplant" in the app
Then I should find "Comments (0)" in the app
# Write comments as a teacher
Given I entered the glossary activity "Test glossary" on course "Course 1" as "teacher1" in the app
And I press "mountain" in the app
And I press "Eggplant" in the app
Then I should find "Comments (0)" in the app
When I press "Comments" in the app
@ -176,7 +99,7 @@ Feature: Test basic usage of glossary in app
# View comments as a student
Given I entered the glossary activity "Test glossary" on course "Course 1" as "student1" in the app
And I press "mountain" in the app
And I press "Eggplant" in the app
Then I should find "Comments (2)" in the app
When I press "Comments" in the app
@ -184,112 +107,101 @@ Feature: Test basic usage of glossary in app
And I should find "teacher second comment" in the app
Scenario: Prefetch
Given I entered the glossary activity "Test glossary" on course "Course 1" as "student1" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | potato |
| Definition | The potato is a root vegetable native to the Americas, a starchy tuber of the plant Solanum tuberosum, and the plant itself, a perennial in the family Solanaceae. |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | car |
| Definition | A car (or automobile) is a wheeled motor vehicle used for transportation. Most definitions of cars say that they run primarily on roads, seat one to eight people, have four tires, and mainly transport people rather than goods. |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | mountain |
| Definition | A mountain is a large landform that rises above the surrounding land in a limited area, usually in the form of a peak. |
And I press "Save" in the app
Then the header should be "Test glossary" in the app
And I should find "car" in the app
And I should find "mountain" in the app
And I should find "potato" in the app
When I press "Information" in the app
And I press "Download" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Course downloads" in the app
When I press "Download" within "Test glossary" "ion-item" in the app
And I press the back button in the app
And I press the back button in the app
And I enter the course "Course 1" in the app
And I switch offline mode to "true"
And I press "Test glossary" in the app
Then the header should be "Test glossary" in the app
And I should find "car" in the app
And I should find "mountain" in the app
And I should find "potato" in the app
And I should find "Cucumber" in the app
And I should find "Eggplant" in the app
And I should find "Potato" in the app
When I press "mountain" in the app
Then I should find "mountain" in the app
And I should find "A mountain is a large landform that rises above the surrounding land in a limited area, usually in the form of a peak." in the app
When I press "Eggplant" in the app
Then I should find "Eggplant" in the app
And I should find "Sour eggplants" in the app
And I should not see "Comments cannot be retrieved"
And I should find "Comments (0)" in the app
Scenario: Add entries (basic info)
Given I entered the glossary activity "Test glossary" on course "Course 1" as "student1" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | Broccoli |
| Definition | Brassica oleracea var. italica |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | Cabbage |
| Definition | Brassica oleracea var. capitata |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | Garlic |
| Definition | Allium sativum |
And I press "Save" in the app
Then the header should be "Test glossary" in the app
And I should find "Cucumber" in the app
And I should find "Eggplant" in the app
And I should find "Potato" in the app
And I should find "Broccoli" in the app
And I should find "Cabbage" in the app
And I should find "Garlic" in the app
When I press "Garlic" in the app
Then I should find "Garlic" in the app
And I should find "Allium sativum" in the app
Scenario: Sync
Given I entered the glossary activity "Test glossary" on course "Course 1" as "student1" in the app
And I press "Add a new entry" in the app
And I switch offline mode to "true"
And I set the following fields to these values in the app:
| Concept | potato |
| Definition | The potato is a root vegetable native to the Americas, a starchy tuber of the plant Solanum tuberosum, and the plant itself, a perennial in the family Solanaceae. |
| Concept | Broccoli |
| Definition | Brassica oleracea var. italica |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | car |
| Definition | A car (or automobile) is a wheeled motor vehicle used for transportation. Most definitions of cars say that they run primarily on roads, seat one to eight people, have four tires, and mainly transport people rather than goods. |
| Concept | Cabbage |
| Definition | Brassica oleracea var. capitata |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | mountain |
| Definition | A mountain is a large landform that rises above the surrounding land in a limited area, usually in the form of a peak. |
| Concept | Garlic |
| Definition | Allium sativum |
And I press "Save" in the app
Then the header should be "Test glossary" in the app
And I should find "car" in the app
And I should find "mountain" in the app
And I should find "potato" in the app
And I should find "Cucumber" in the app
And I should find "Eggplant" in the app
And I should find "Potato" in the app
And I should find "Broccoli" in the app
And I should find "Cabbage" in the app
And I should find "Garlic" in the app
And I should find "Entries to be synced" in the app
And I should find "This Glossary has offline data to be synchronised." in the app
When I switch offline mode to "false"
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | testSync |
| Definition | testSync |
And I press "Save" in the app
And I press "Information" in the app
And I press "Synchronise now" in the app
Then the header should be "Test glossary" in the app
And I should find "car" in the app
And I should find "mountain" in the app
And I should find "potato" in the app
And I should find "testSync" in the app
And I should find "Cucumber" in the app
And I should find "Eggplant" in the app
And I should find "Potato" in the app
And I should find "Broccoli" in the app
And I should find "Cabbage" in the app
And I should find "Garlic" in the app
But I should not see "Entries to be synced"
And I should not see "This Glossary has offline data to be synchronised."
Scenario: Add/view ratings
# Create entries as a student
Given I entered the glossary activity "Test glossary" on course "Course 1" as "student1" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | potato |
| Definition | The potato is a root vegetable native to the Americas, a starchy tuber of the plant Solanum tuberosum, and the plant itself, a perennial in the family Solanaceae. |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | car |
| Definition | A car (or automobile) is a wheeled motor vehicle used for transportation. Most definitions of cars say that they run primarily on roads, seat one to eight people, have four tires, and mainly transport people rather than goods. |
And I press "Save" in the app
And I press "Add a new entry" in the app
And I set the following fields to these values in the app:
| Concept | mountain |
| Definition | A mountain is a large landform that rises above the surrounding land in a limited area, usually in the form of a peak. |
And I press "Save" in the app
Then the header should be "Test glossary" in the app
And I should find "car" in the app
And I should find "mountain" in the app
And I should find "potato" in the app
When I press "Garlic" in the app
Then I should find "Garlic" in the app
And I should find "Allium sativum" in the app
Scenario: Add/view ratings
# Rate entries as teacher1
Given I entered the glossary activity "Test glossary" on course "Course 1" as "teacher1" in the app
And I press "mountain" in the app
And I press "Cucumber" in the app
Then I should find "Average of ratings: -" in the app
When I press "None" in the app
@ -298,7 +210,7 @@ Feature: Test basic usage of glossary in app
# Rate entries as teacher2
Given I entered the glossary activity "Test glossary" on course "Course 1" as "teacher2" in the app
And I press "mountain" in the app
And I press "Cucumber" in the app
And I switch offline mode to "true"
And I press "None" in the app
And I press "0" in the app
@ -311,11 +223,11 @@ Feature: Test basic usage of glossary in app
When I press "Information" in the app
And I press "Synchronise now" in the app
And I press "mountain" in the app
And I press "Cucumber" in the app
Then I should find "Average of ratings: 0.5" in the app
# View ratings as a student
Given I entered the glossary activity "Test glossary" on course "Course 1" as "student1" in the app
And I press "mountain" in the app
Then the header should be "mountain" in the app
And I press "Cucumber" in the app
Then the header should be "Cucumber" in the app
But I should not see "Average of ratings: 0.5"

View File

@ -146,8 +146,12 @@ Feature: Test glossary navigation
When I press the back button in the app
And I scroll to "Acerola" in the app
And I press "Search" in the app
And I set the field "Search" to "melon" in the app
And I press "Search" "button" near "Clear search" in the app
And I set the field "Search" to "something" in the app
And I press enter
Then I should find "No entries were found." in the app
When I set the field "Search" to "melon" in the app
And I press enter
Then I should find "Honeydew Melon" in the app
And I should find "Watermelon" in the app
But I should not find "Acerola" in the app
@ -250,8 +254,12 @@ Feature: Test glossary navigation
# Search
When I press "Search" in the app
And I set the field "Search" to "melon" in the app
And I press "Search" "button" near "Clear search" in the app
And I set the field "Search" to "something" in the app
And I press enter
Then I should find "No entries were found." in the app
When I set the field "Search" to "melon" in the app
And I press enter
Then I should find "Honeydew Melon" in the app
And I should find "Watermelon" in the app
And "Honeydew Melon" near "Watermelon" should be selected in the app

View File

@ -27,6 +27,7 @@ Feature: Test basic usage of comments in app
# Create database entry and comment as a teacher
Given I entered the data activity "Data" on course "Course 1" as "teacher1" in the app
And I press "Information" in the app
# TODO Create and use a generator for database fields.
And I press "Open in browser" in the app
And I switch to the browser tab opened by the app
And I log in as "teacher1"
@ -224,6 +225,7 @@ Feature: Test basic usage of comments in app
| blog_menu | Course | C1 | course-view-* | site-pre | |
And I entered the course "Course 1" as "teacher1" in the app
And I press "Course summary" in the app
# TODO Create and use a generator blog entries.
And I press "Open in browser" in the app
And I switch to the browser tab opened by the app
And I log in as "teacher1"