Skip to content

Commit

Permalink
Merge pull request #8300 from pcenov/new-sync-and-import-scenarios
Browse files Browse the repository at this point in the history
Additional Gherkin scenarios for syncing and importing of facility after Wi-Fi network change
  • Loading branch information
radinamatic authored Aug 17, 2021
2 parents e0c8fbe + 4426aad commit fb44c4e
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 107 deletions.
Original file line number Diff line number Diff line change
@@ -1,55 +1,77 @@
Feature: Import facility from a peer (post-setup)
Super admin is able to import another facility to their device at any time after device setup
Super admin is able to import another facility to their device at any time after device setup

Background:
Given I am signed in as a super admin
And I am in *Device > Facilities*
Background:
Given I am signed in as a super admin
And I am in *Device > Facilities*

Scenario: Select peer device
When I click the *Import facility* button
Then I see the *Select network address* modal
And I see a list of peer devices
And I see the network address of each device
When I select a <peer> device
And I click *Continue*
Then I see the *Select facility* modal
And I see one or more facilities on that device
Scenario: Select peer device
When I click the *Import facility* button
Then I see the *Select network address* modal
And I see a list of peer devices
And I see the network address of each device
When I select a <peer> device
And I click *Continue*
Then I see the *Select facility* modal
And I see one or more facilities on that device

Scenario: Import facility from a peer with a single facility
Given there is only the <facility> facility on the <peer> device
And I am on the *Enter admin credentials* modal
When I enter the <username> and <password> of a facility admin for the <facility> or a super admin for the <peer>
And I click *Continue*
Then I see the <facility> appear in my *Facilities* list
And I see an indeterminate spinner
And I see the status message *Syncing*
And I see the *task manager* has a new task
When the <facility> is done syncing
Then I see a message under the new facility name *Last synced: just now*
Scenario: Import facility from a peer with a single facility
Given there is only the <facility> facility on the <peer> device
And I am on the *Enter admin credentials* modal
When I enter the <username> and <password> of a facility admin for the <facility> or a super admin for the <peer>
And I click *Continue*
Then I see the <facility> appear in my *Facilities* list
And I see an indeterminate spinner
And I see the status message *Syncing*
And I see the *task manager* has a new task
When the <facility> is done syncing
Then I see a message under the new facility name *Last synced: just now*

Scenario: Import facility from a peer with multiple facilities
Given there is more than one facility on the <peer> device
And I am on *Select facility* modal
And I see two or more facilities on that device
When I select the facility I want to import
And I click *Continue*
Then I am on the *Enter admin credentials* modal
When I enter the <username> and <password> of a facility admin for the <facility> or a super admin for the <peer>
And I click *Continue*
Then I see the *Tasks* page
And I see the status message *Syncing '<facility>'*
And I see an indeterminate spinner
When the <facility> import is finished
And I click *Back to facilities*
Then I see the <facility> appear in my *Facilities* list
And I see a message under the new <facility> *Last synced: just now*
Scenario: Import facility from a peer with multiple facilities
Given there is more than one facility on the <peer> device
And I am on *Select facility* modal
And I see two or more facilities on that device
When I select the facility I want to import
And I click *Continue*
Then I am on the *Enter admin credentials* modal
When I enter the <username> and <password> of a facility admin for the <facility> or a super admin for the <peer>
And I click *Continue*
Then I see the *Tasks* page
And I see the status message *Syncing '<facility>'*
And I see an indeterminate spinner
When the <facility> import is finished
And I click *Back to facilities*
Then I see the <facility> appear in my *Facilities* list
And I see a message under the new <facility> *Last synced: just now*

Scenario: Import facility from a peer failed
Given a sync task is running
When the sync fails for a <facility>
Then I see *Failed sync: just now* under the <facility> name
And I see *Last successful sync: <X> <time> ago under the failed sync message
Scenario: Import facility from a peer failed
Given a sync task is running
When the sync fails for a <facility>
Then I see *Failed sync: just now* under the <facility> name
And I see *Last successful sync: <X> <time> ago under the failed sync message

Scenario: Ensure you can import a facility after Wi-Fi network change
Given there are at least two Kolibri instances running in the same network
When I connect both devices to a different Wi-Fi network #check in the logs that you see a log entry for zerocnf network registration for example: Registering ourselves to zeroconf network with id 'f770b209237d550fb8cc34ee00d93719' and port '8080'
And as a Super Admin I go to Device>Facilities
And I click the *Import facility* button
Then I see the *Select network address* modal
And I see the peer device name and network address
When I select the peer device
And I click *Continue*
Then I see the *Select facility* modal
When I select a facility
And I click *Continue*
Then I see the *Enter admin credentials* modal
When I enter a *Username* and a *Password*
And I click *Continue*
Then I see the *Tasks* page
And I can see that the import has finished
When I click the *Back to facilities* link
Then I see the list with facilities
And I can see the newly imported facility
And I can see a message stating when it was last synced

Examples:
| facility | peer |
| facility | peer |
| MySchool | MyPeer |
Original file line number Diff line number Diff line change
@@ -1,70 +1,85 @@
Feature: Sync facility with a peer device
Super admin can sync facility data between Kolibri devices that each have the same facility
Super admin can sync facility data between Kolibri devices that each have the same facility

Background:
Given I am signed in as a super admin
And I am on *Device > Facilities*
And I see the list of facilities on my device
And there are other devices that have Kolibri installed
And those devices have the same <facility> as my server
And those devices are connected to my local network
And those devices are currently running Kolibri
Background:
Given I am signed in as a super admin
And I am on *Device > Facilities*
And I see the list of facilities on my device
And there are other devices that have Kolibri installed
And those devices have the same <facility> as my server
And those devices are connected to my local network
And those devices are currently running Kolibri

Scenario: Sync with peer is successful
When I click the *Sync* button for a <facility>
Then I see the *Select a source* modal
When I select *Local network*
And I click *Continue*
Then I see the *Select network address* modal
And I see a list of devices that also have my <facility>
When I select a device
And I click *Continue*
Then I see the list of facilities
And I see a *Syncing* message under my <facility>
And I see an indeterminate spinner
And I see the *task manager* has a new task
When the <facility> is done syncing
Then I see a message under the <facility> *Last synced: just now*
Scenario: Sync with peer is successful
When I click the *Sync* button for a <facility>
Then I see the *Select a source* modal
When I select *Local network*
And I click *Continue*
Then I see the *Select network address* modal
And I see a list of devices that also have my <facility>
When I select a device
And I click *Continue*
Then I see the list of facilities
And I see a *Syncing* message under my <facility>
And I see an indeterminate spinner
And I see the *task manager* has a new task
When the <facility> is done syncing
Then I see a message under the <facility> *Last synced: just now*

Scenario: Sync fails
Given a sync task is running
When the sync fails for a <facility>
Then I see *Failed sync: just now* under the <facility> name
And I see *Last successfully synced: <X> <time> ago under the failed sync message
Scenario: Sync fails
Given a sync task is running
When the sync fails for a <facility>
Then I see *Failed sync: just now* under the <facility> name
And I see *Last successfully synced: <X> <time> ago under the failed sync message

Scenario: Add new device manually is successful
Given there is another Kolibri device that cannot be autodiscovered
And that device shares my facility
And that device is connected to my local network
And that device is currently running Kolibri
When I click the *Sync* button on a <facility>
Then I see the *Select a network* modal
When I select *Local network*
And I click *Continue*
Then I see the *Select device* modal
And I see a list of devices that also have my <facility>
When I click *Add new device*
Then I see the *New device* modal
When I enter the IP address of the undiscoverable device
And I click *Add*
Then I see the *Select device* modal
And I see that device's name
And I see that device's network
And I see a *Forget* link for that device
Scenario: Add new device manually is successful
Given there is another Kolibri device that cannot be autodiscovered
And that device shares my facility
And that device is connected to my local network
And that device is currently running Kolibri
When I click the *Sync* button on a <facility>
Then I see the *Select a network* modal
When I select *Local network*
And I click *Continue*
Then I see the *Select device* modal
And I see a list of devices that also have my <facility>
When I click *Add new device*
Then I see the *New device* modal
When I enter the IP address of the undiscoverable device
And I click *Add*
Then I see the *Select device* modal
And I see that device's name
And I see that device's network
And I see a *Forget* link for that device

Scenario: Add new device manually fails
Given I have a nonexistent IP address
When I click the *Sync* button on a <facility>
Then I see the *Select a network* modal
When I select *Local network*
And I click *Continue*
Then I see the *Select device* modal
And I see a list of devices that also have my <facility>
When I click *Add new device*
Then I see the *New device* modal
When I enter the nonexistent IP address
And I click *Add*
Then I see the error message *Could not connect to this network address*
Scenario: Add new device manually fails
Given I have a nonexistent IP address
When I click the *Sync* button on a <facility>
Then I see the *Select a network* modal
When I select *Local network*
And I click *Continue*
Then I see the *Select device* modal
And I see a list of devices that also have my <facility>
When I click *Add new device*
Then I see the *New device* modal
When I enter the nonexistent IP address
And I click *Add*
Then I see the error message *Could not connect to this network address*

Scenario: Ensure you can sync facilities after Wi-Fi network change
Given there are at least two Kolibri instances running in the same network
And one of the facilities is imported from the other
When I connect both devices to a different Wi-Fi network #check in the logs that you see a log entry for zerocnf network registration for example: Registering ourselves to zeroconf network with id 'f770b209237d550fb8cc34ee00d93719' and port '8080'
And as a Super Admin I go to Device>Facilities
And I select the *Sync* option for the imported facility
Then I see the *Select network address* modal
And I see the peer device name and network address
When I select the peer device
And I click *Continue*
Then I see the list of facilities
And I see a progress bar indicating that a task is in progress
When the <facility> is done syncing
Then I see a message under the <facility> *Last synced: just now*

Examples:
| facility |
Expand Down

0 comments on commit fb44c4e

Please sign in to comment.