From 7f5419862615608e276bbbb5bca2e53a74a8d010 Mon Sep 17 00:00:00 2001 From: Murilo Frade Date: Fri, 24 Nov 2017 10:13:40 +0100 Subject: [PATCH 1/2] feat(record): offline scenarios --- records/record-offline.feature | 109 +++++++++++++++++++++ records/record-permissions-offline.feature | 21 ++++ 2 files changed, 130 insertions(+) create mode 100644 records/record-offline.feature create mode 100644 records/record-permissions-offline.feature diff --git a/records/record-offline.feature b/records/record-offline.feature new file mode 100644 index 0000000..de836d9 --- /dev/null +++ b/records/record-offline.feature @@ -0,0 +1,109 @@ +@records @records-offline +Feature: Record Connectivity + Background: + Given client A connects and logs into server 1 + And client B connects and logs into server 1 + And client C connects and logs into server 2 + And client D connects and logs into server 3 + And a small amount of time passes + And all clients get the record "record" + And client A sets the record "record" with data '{ "user": { "firstname": "John" } }' + + Scenario: Have record, go offline, don't make any updates then come back online and have same data + When client A goes offline + And a small amount of time passes + And client A comes back online + And a small amount of time passes + Then all clients have record "record" with path "user.firstname" and data 'John' + + Scenario: Multiple updates by offline client are received properly by other clients (online has incorrect version) + When client A goes offline + And a small amount of time passes + And client A sets the record "record" and path "user.firstname" with data 'Bob' + And client A sets the record "record" and path "user.firstname" with data 'Alex' + And client A sets the record "record" and path "user.firstname" with data 'Charlie' + When client A comes back online + And a small amount of time passes + Then all clients have record "record" with path "user.firstname" and data 'Charlie' + + Scenario: Multiple updates by clients are received properly by offline client (offline has incorrect version) + When client A goes offline + And client B sets the record "record" and path "user.firstname" with data 'Bob' + And client C sets the record "record" and path "user.firstname" with data 'Alex' + And client D sets the record "record" and path "user.firstname" with data 'Charlie' + And a small amount of time passes + When client A comes back online + And a small amount of time passes + Then all clients have record "record" with path "user.firstname" and data 'Charlie' + + + Scenario: Creating records and updating created records while offline + When client A goes offline + And client A gets the record "record-offline" + And client A sets the record "record-offline" and path "user.firstname" with data 'Murilo' + When client A comes back online + And And all clients get the record "record-offline" + And a small amount of time passes + Then all clients have record "record-offline" with path "user.firstname" and data 'Murilo' + + Scenario: Create record while offline then receive remote updates + When client A goes offline + And client A gets the record "empty-offline" + And client B gets the record "empty-offline" + And client B sets the record "empty-offline" and path "user.firstname" with data 'Srushtika' + And a small amount of time passes + When client A comes back online + And And all clients get the record "empty-offline" + And a small amount of time passes + Then all clients have record "empty-offline" with path "user.firstname" and data 'Srushtika' + + Scenario: Update record while servers are down + When server 1,2,3,4 goes down + And a small amount of time passes + And client A sets the record "record" and path "user.firstname" with data 'Maria' + When server 1 comes back up + And a small amount of time passes + Then all clients have record "record" with path "user.firstname" and data 'Maria' + And all clients receives at least one "CONNECTION" error "CONNECTION_ERROR" + + Scenario: Discarding while offline + When client A goes offline + And a small amount of time passes + And client A sets the record "record" and path "user.firstname" with data 'Joao' + And client A discards record "record" + And a small amount of time passes + And client A comes back online + And a small amount of time passes + Then all clients have record "record" with path "user.firstname" and data 'Joao' + +@ignore + Scenario: Deleting while offline + When client A goes offline + And client A deletes record "record" + And client B sets the record "record" and path "user.firstname" with data 'Bob' + And client C sets the record "record" and path "user.firstname" with data 'Alex' + And client D sets the record "record" and path "user.firstname" with data 'Charlie' + + When client A comes back online + And a small amount of time passes + Then all clients get notified of record "record" getting deleted + +@ignore + Scenario: update and come back online but record has been deleted + When client A goes offline + And client A sets the record "record" with data '{ "hello": "there" }' + And client B deletes record "record" + When client A comes back online + Then client A recieves a "record has been deleted error" + And all clients get notified of record "record" getting deleted + +@ignore + Scenario: Deleting/discarding/creating records (changelog type thing) while offline and come back online + When client A goes offline + And client A deletes record "record" + And client A gets the record "record" + And client A sets the record "record" with data '{ "hello": "there" }' + When client A comes back online + Then all clients get notified of record "record" getting deleted + When all clients get the record "record" + Then all clients have record "record" with data '{ "hello": "there" }' diff --git a/records/record-permissions-offline.feature b/records/record-permissions-offline.feature new file mode 100644 index 0000000..60dd0af --- /dev/null +++ b/records/record-permissions-offline.feature @@ -0,0 +1,21 @@ +@records @records-offline @permissions +Feature: Record Connectivity + + Background: + Given "complex" permissions are used + And client A connects and logs into server 1 + And client B connects and logs into server 1 + And client C connects and logs into server 2 + And client D connects and logs into server 3 + And a small amount of time passes + And all clients get the record "record-offline/A" + And client A sets the record "record-offline/A" with data '{ "user": { "firstname": "John" } }' + + Scenario: go offline and do updates then when back online not permissioned errors + When client B goes offline + And client B sets the record "record-offline/A" and path "user.firstname" with data 'Bob' + And client B sets the record "record-offline/A" and path "user.firstname" with data 'Charlie' + When client B comes back online + And a small amount of time passes + Then client A,C,D have record "record-offline/A" with data '{ "user": { "firstname": "John" } }' + And client B receives a "MESSAGE_DENIED" error on record "record-offline/A" From 177548b5c51c2dab0608117d6db4718dc5ed9db3 Mon Sep 17 00:00:00 2001 From: Murilo Frade Date: Fri, 24 Nov 2017 17:56:10 +0100 Subject: [PATCH 2/2] fix(record): discard while offline scenario --- records/record-offline.feature | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/records/record-offline.feature b/records/record-offline.feature index de836d9..2d6e7f2 100644 --- a/records/record-offline.feature +++ b/records/record-offline.feature @@ -36,7 +36,6 @@ Feature: Record Connectivity And a small amount of time passes Then all clients have record "record" with path "user.firstname" and data 'Charlie' - Scenario: Creating records and updating created records while offline When client A goes offline And client A gets the record "record-offline" @@ -65,7 +64,7 @@ Feature: Record Connectivity And a small amount of time passes Then all clients have record "record" with path "user.firstname" and data 'Maria' And all clients receives at least one "CONNECTION" error "CONNECTION_ERROR" - +@wip Scenario: Discarding while offline When client A goes offline And a small amount of time passes @@ -74,7 +73,7 @@ Feature: Record Connectivity And a small amount of time passes And client A comes back online And a small amount of time passes - Then all clients have record "record" with path "user.firstname" and data 'Joao' + Then client B,C,D have record "record" with path "user.firstname" and data 'John' @ignore Scenario: Deleting while offline