diff --git a/integration_testing/018-features/README.md b/integration_testing/018-features/README.md new file mode 100644 index 00000000000..a11b168e00f --- /dev/null +++ b/integration_testing/018-features/README.md @@ -0,0 +1,46 @@ + +# Style guide for Kolibri `.feature` files + +The purpose of this document is to compile and keep the record of our internal conventions used to write and format the `.feature` files for testing Kolibri. + +Style guide is a `Work-In-Progress` as we keep adding the testing scenarios and refining our strategies. + +## File naming + +- Use the `role-name-feature-name.feature` naming strategy. +- Feature name part should be expressed as **action** whenever possible, instead of the *need*. Examples: `move-learners-between-groups`, or `modify-facility-settings`. Do not use verbs as *can* or *should* in filenames. +- Separate all filename parts with dashes `-`, not underscores `_`. + +## Feature naming + +Feature name and description (the first part of the content inside the `.feature` file), should express the **need**. Try to formulate the name as: "This `role-name` needs to be able to achieve `feature-name`". Add more detailed background explanation if needed. Most feature descriptions can be expressed in one sentence, but other, more complex ones that include various `Background` settings or `Scenarios` might need more than one sentence. + +## Other recommendations + +- List the `Background` "givens" in order to cover the more general conditions **first** (`there are groups created`, meaning that the groups should be created even before the user arrived to the groups page), and the more specific ones (`I am on *Coach > Groups* page`) +- Keep the *point of view* consistent by writing all the steps as **I**. +- Use present tense and avoid conditionals: *When I scroll... Then I see...* instead of *When I have scrolled... Then I should see...* +- Whenever possible and not too laborious, let's try recording the values in `Examples` table and use the placeholders `<>`in the steps: + + ``` + Examples: + | username | password | + | coach | coach | + ``` + + +## UI elements conventions + +- Enclose strings of **all** the UI elements (buttons, menu options, headings, modal titles, etc.) inside `**` chars. +- Capitalize just the first letter (even when they appear fully capitalized in the UI, for readability purposes). +- Use the `*Plugin name > Tab name*` convention for indicating the current or position or the desired destination of the user in Kolibri. Examples: `*Coach > Groups*`, `*Learn > Recommended*`, `*Facility > Settings*`, `*Device > Info*`, etc. + + +## Some useful BDD resources + +- [How to describe user stories using Gherkin language](https://medium.com/@SteelKiwiDev/how-to-describe-user-stories-using-gherkin-language-8cffc6b888df) +- [Gherkin Syntax](http://docs.behat.org/en/v2.5/guides/1.gherkin.html#gherkin-syntax) +- [Obey the testing goat BDD](https://www.obeythetestinggoat.com/book/appendix_bdd.html#_writing_an_ft_as_a_feature_using_gherkin_syntax) +- [Gherkin Reference](https://docs.cucumber.io/gherkin/reference/) +- [Gherkin: Feature Testing Language](http://behave.readthedocs.io/en/latest/gherkin.html#features) +- [Syntax formatter for Sublime](https://packagecontrol.io/packages/Gherkin%20(Cucumber)%20Formatter) diff --git a/integration_testing/018-features/admin/device/admin-manage-content.feature b/integration_testing/018-features/admin/device/admin-manage-content.feature new file mode 100644 index 00000000000..9f6cab5aa57 --- /dev/null +++ b/integration_testing/018-features/admin/device/admin-manage-content.feature @@ -0,0 +1,21 @@ +Feature: Facility admin device management + Facility admins with device permissions need to see the *Device* dashboard to be able to manage resources + + Background: + Given I am signed into Kolibri as a facility admin user with device permissions for content import + And there are imported channels on the device + + Scenario: View all the options for managing content + When I go to the *Device > Channels* page + Then I see the *Channels* label + And I see the *Options* drop-down and the *Import* button to the right + And I see the list with already imported channels + And I see the *Manage* button for each channel + When I click the *Manage* button for a channel + Then I see the *Manage * modal + And I see all the available channel details + And I see all the imported channel resources + And I see an *Import more* button + And I see that the *Delete* and *Export* buttons are disabled + + # Continue testing content management by using the scenarios for super admins diff --git a/integration_testing/018-features/admin/device/admin-rearrange-channels.feature b/integration_testing/018-features/admin/device/admin-rearrange-channels.feature new file mode 100644 index 00000000000..352637a4f1e --- /dev/null +++ b/integration_testing/018-features/admin/device/admin-rearrange-channels.feature @@ -0,0 +1,21 @@ +Feature: Admin can rearrange channels + Admins need to be able to customize the order in which the channels are displayed for Learners and Coaches + + Background: + Given I am signed in as an Admin or other user with content management permissions + And I am at the *Device > Channels* page + + Scenario: User can move a channel + When I click the *Options drop-down* + And I select the *Edit channel order* option + Then I see the *Edit channel order* modal + When I drag a channel using my mouse or keyboard to a new position + Then I see a *Channel order saved* snackbar notification + When I close the modal + Then I am back at the *Device > Channels* page + And I can see that the order of the channels is changes as intended + + Scenario: The new channel order is reflected in all parts of the app + Given I've already reordered the channels + When I navigate to any of the following locations: *Device > Channels > Export channels*, *Device > Channels > Delete channels*, *Coach > Create new quiz*, *Coach > Manage lesson resources*, *Learn > Home > Explore channels* and *Learn > Library* + Then I see that the channels are ordered as intended diff --git a/integration_testing/018-features/admin/facility/facility-classes/admin-create-class.feature b/integration_testing/018-features/admin/facility/facility-classes/admin-create-class.feature new file mode 100644 index 00000000000..61104983e8f --- /dev/null +++ b/integration_testing/018-features/admin/facility/facility-classes/admin-create-class.feature @@ -0,0 +1,14 @@ +Feature: Admin creates classes + Admin needs to be able create classes for each facility + + Background: + Given I am signed in to Kolibri as facility admin user + And I am on *Facility > Classes* page + + Scenario: Create class + When I click on the *New class* button + Then I see the *Create new class* modal + When I enter a class name + And I click the *Save* button + Then the modal closes + And I see the new class in the *Classes* table diff --git a/integration_testing/018-features/admin/facility/facility-classes/admin-delete-class.feature b/integration_testing/018-features/admin/facility/facility-classes/admin-delete-class.feature new file mode 100644 index 00000000000..fe1eaceb0a4 --- /dev/null +++ b/integration_testing/018-features/admin/facility/facility-classes/admin-delete-class.feature @@ -0,0 +1,15 @@ +Feature: Admin can delete classes + Admin needs to be able to delete classes from the facility + + Background: + Given I am signed in to Kolibri as a facility admin user + And I am on *Facility > Classes* page + And there is a class created in the facility + + Scenario: Delete class + When I click on the *Delete class* button for a class + Then I see the *Delete class* modal + When I click the *Delete* button + Then the modal closes + And I see a *Class deleted* snackbar message + And I see that the deleted class is no longer displayed in the *Classes* table diff --git a/integration_testing/018-features/admin/facility/facility-classes/admin-enroll-assign-users.feature b/integration_testing/018-features/admin/facility/facility-classes/admin-enroll-assign-users.feature new file mode 100644 index 00000000000..881bfc2ebae --- /dev/null +++ b/integration_testing/018-features/admin/facility/facility-classes/admin-enroll-assign-users.feature @@ -0,0 +1,53 @@ +Feature: Admin enrolls learners and assign coaches to classes + Admin needs to be able to enroll learners and assign coaches to classes in the facility + + Background: + Given I am signed in to Kolibri as a facility admin user + And I am on *Facility > Classes* page + And there is a class created in the facility + And there are learner and coach users created in the facility + + Scenario: Enroll learners to a class + When I click on class + Then I see the class page + When I click the *Enroll learners* button + Then I see the *Enroll learners into ''* page + And I see a list with all the learners who are not enrolled in the class yet + When I select a learner or several learners + Then I see that the *Confirm* button is enabled + When I click the *Confirm* button + Then I am back at the class page + And I see a *Learner(s) enrolled* snackbar message + And I see the selected learners listed under *Learners* + + Scenario: Remove a learner from a class + Given a learner is enrolled in the class + And I am at the class page + When I click the *Remove* button to the right of the learner's username + Then I see the *Remove user* modal + When I click the *Remove* button + Then the modal closes + And I see a *Learner removed* snackbar message + And see that the learner is removed from the *Learners* table + + Scenario: Assign coaches to a class + Given I am at the class page + When I click the *Assign coaches* button + Then I see the *Assign a coach to ''* page + And I see the list of all coaches who are not assigned to the class yet + When I select a coach or several coaches + Then I see that the *Confirm* button is enabled + When I click the *Confirm* button + Then I am back at the class page + And I see a *Coach(es) assigned* snackbar message + And I see the selected coaches listed under *Coaches* + + Scenario: Remove a coach from a class + Given a coach is assigned to the class + And I am at the class page + When I click the *Remove* button to the right of the coach's username + Then I see the *Remove user* modal + When I click the *Remove* button + Then the modal closes + And I see a *Coach removed* snackbar message + And see that the learner is removed from the *Learners* table diff --git a/integration_testing/018-features/admin/facility/facility-data/admin-bulk-export-users-classrooms.feature b/integration_testing/018-features/admin/facility/facility-data/admin-bulk-export-users-classrooms.feature new file mode 100644 index 00000000000..5788e750891 --- /dev/null +++ b/integration_testing/018-features/admin/facility/facility-data/admin-bulk-export-users-classrooms.feature @@ -0,0 +1,16 @@ +Feature: Admin bulk export of users and classrooms + Admin needs to be able to export users and their classrooms + + Background: + Given I am signed in to Kolibri as a facility admin user + And I am on *Facility > Data* page + And there are learners enrolled in classrooms and coaches assigned to them + + Scenario: Export a CSV file containing all users in the facility + When I click on *Generate user CSV file* link under the *Import and export users* heading + Then I see the loading indicator + And I see that the *Download CSV* button becomes enabled + When I click on the *Download CSV* button + And I can open or save the file '_users.csv' + When I open the CSV file + Then I see that it contains only users from my facility, even if there are more facilities in the device diff --git a/integration_testing/018-features/admin/facility/facility-data/admin-bulk-import-users-classrooms.feature b/integration_testing/018-features/admin/facility/facility-data/admin-bulk-import-users-classrooms.feature new file mode 100644 index 00000000000..3cc845e0f34 --- /dev/null +++ b/integration_testing/018-features/admin/facility/facility-data/admin-bulk-import-users-classrooms.feature @@ -0,0 +1,36 @@ +Feature: Admin bulk export of users and classrooms + Admin needs to be able to import users and their classrooms + + Background: + Given I am signed in to Kolibri as a facility admin user + And I am at *Facility > Data* page + + Scenario: See the CSV file format requirements + When I click the *Import* button under *Import and export users* heading + Then I see a new window with a text explaining the consequences of importing + When I click on the *View spreadsheet format reference* link + Then I see a new modal window with the CSV file fields formats, requirements and validation rules + + Scenario: Bulk import of users from a CSV file + When I click the *Import* button under *Import and export users* heading + Then I see a new window with a text explaining the consequences of importing + And I see the *Cancel* enabled button + And I see the *Continue* disabled button + When I click the *Choose file* button + And select a CSV file with the right format + Then I see the *Continue* button is now enabled + When I click the *Continue* button + Then I see the loading indicator + When the file is processed + Then I see the *Import users* window + And I see a list of the number of users and classes that are going to be updated or created + And I see the list of errors, if any + And I see the *Back* and *Import* buttons + When I click the *Import* button + Then I see the loading indicator + When the file is processed + Then I see the *The import succeeded* message + And I see a report with the changes made in the database + When I click the top left X button to close the modal + And I go to *Facility > Classes* + Then I see that the classes, enrolled learners and assigned coaches now match what was in the CSV diff --git a/integration_testing/018-features/admin/facility/facility-data/admin-export-data.feature b/integration_testing/018-features/admin/facility/facility-data/admin-export-data.feature new file mode 100644 index 00000000000..aeea9ae8326 --- /dev/null +++ b/integration_testing/018-features/admin/facility/facility-data/admin-export-data.feature @@ -0,0 +1,25 @@ +Feature: Admin exports usage data + Admin needs to be able to export session and summary logs for the facility + + Background: + Given I am signed in to Kolibri as a facility admin user + And I am on *Facility > Data* page + And the learners have had interactions with the content on the device + + Scenario: Export session logs + When I click on the *Generate log* button under *Session logs* heading + Then I see the *Select a date range* modal + When I select a start and an end date + And I click *Generate* + Then I see a *Download* button displayed to the left of the *Generate log* button + When I click on the *Download* button + Then I see the *Open/Save as* window, or the file *_content_session_logs_from__to_.csv* is automatically saved on my local drive, depending on the browser defaults + + Scenario: Export summary logs + When I click on the *Generate log* button under *Summary logs* heading + Then I see the *Select a date range* modal + When I select a start and an end date + And I click *Generate* + Then I see a *Download* button displayed to the left of the *Generate log* button + When I click on the *Download* button + Then I see the *Open/Save as* window, or the file *_content_summary_logs_from__to_.csv* is automatically saved on my local drive, depending on the browser defaults diff --git a/integration_testing/018-features/admin/facility/facility-data/admin-register-facility.feature b/integration_testing/018-features/admin/facility/facility-data/admin-register-facility.feature new file mode 100644 index 00000000000..7fc24c0765d --- /dev/null +++ b/integration_testing/018-features/admin/facility/facility-data/admin-register-facility.feature @@ -0,0 +1,53 @@ +Feature: Admin registers facility + Admin needs to be able to register their facility to Kolibri Data Portal + + Background: + Given I am logged in as a Facility admin + And I have access to a Project token on Kolibri Data Portal + And I am at *Facility > Data* + + Scenario: Register to a Kolibri Data Portal project for the first time + Given my facility has never been registered + When I click *Sync* + Then I see the *Select a source* modal + And I see that *Kolibri Data Portal (online)* is the selected option + When I click the *Continue* button + Then I see the *Register facility* modal + When I enter the project token from Kolibri Data Portal + And I click *Continue* + Then I see a confirmation modal with the project name + When I click *Register* + Then the modal closes + And I see the a spinner icon and *Syncing* under the facility name + When the syncing has finished successfully + Then I see a green checkmark icon next to the facility name + + Scenario: Register to a second Kolibri Data Portal project + Given my facility has been registered before + And I have access to a different Kolibri Data Portal project token + When I click the *Options* button next to the *Sync* button + And I click the *Register* option + Then I see the *Register facility* modal + When I enter the project token from Kolibri Data Portal + And I click *Continue* + Then I see a confirmation modal with the project name + When I click *Register* + Then the modal closes + And I see a green checkmark icon next to the facility name + + Scenario: Registration to a Kolibri Data Portal project failed + Given I have an invalid project token from Kolibri Data Portal + When I click the *Options* button next to the *Sync* button + And I click the *Register* option + Then I see the *Register facility* modal + When I enter the invalid project token from Kolibri Data Portal + And I click *Continue* + Then I see an *Invalid token* error message + + Scenario: Register to a Kolibri Data Portal project, but already registered + Given my facility has been registered before + When I click *Register* + Then the register facility modal should appear + When I enter the same project token that was used to successfully register the facility before + And I click *Continue* + Then I see a modal that says I am already registered to the project diff --git a/integration_testing/018-features/admin/facility/facility-data/admin-sync-facility.feature b/integration_testing/018-features/admin/facility/facility-data/admin-sync-facility.feature new file mode 100644 index 00000000000..4fcf872a80e --- /dev/null +++ b/integration_testing/018-features/admin/facility/facility-data/admin-sync-facility.feature @@ -0,0 +1,63 @@ +Feature: Admin syncs facility + Admin needs to be able to sync their facility data to Kolibri Data Portal or another Kolibri server on their local network or internet + + Background: + Given I am signed in as a Facility admin + And my facility has been registered before + And I want to sync my facility data to Kolibri Data Portal + And I am at *Facility > Data* + And there are other devices with Kolibri on the network + + Scenario: Learn what sync does + When I click on *Usage and privacy* in the description of the *Sync facility data* section + Then I see the *Kolibri data portal* modal with a description of what syncing does + When I click the *Close* button + Then the modal closes + And I am at *Facility > Data* + + Scenario: Successful sync to KDP + When I click the *Sync* button + Then I see the *Select a source* modal window + And I see a *Kolibri Data Portal (online)* radio button (selected by default) + And I see a *Local network or internet* radio button + When I click the *Continue* button + Then I see a *Syncing* message and a spinner icon + And the option to create a sync schedule and the *Sync* button are disabled + When the syncing has completed successfully + Then I see *Last sync: