From 7ff388270e3be9a08f7f44b9b3bc4dc289cfc9bd Mon Sep 17 00:00:00 2001 From: Markus Tacker Date: Fri, 8 Jan 2021 17:50:26 +0100 Subject: [PATCH] test(e2e): set random data only once So retries eventually pick up the right data --- features/DeviceBatchData.feature | 30 +++++++++++++++++------------- features/DeviceMessages.feature | 12 ++++++++---- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/features/DeviceBatchData.feature b/features/DeviceBatchData.feature index c63ae2f6..84bfcdc1 100644 --- a/features/DeviceBatchData.feature +++ b/features/DeviceBatchData.feature @@ -6,29 +6,31 @@ Feature: Device: Batch Data Background: Given I am run after the "Device: Update Shadow" feature + Given I store "$millis()" into "ts1" + And I store "$millis()+(120*1000)" into "ts2" + And I store "$random() * 180" into "lng1" + And I store "$random() * 180" into "lng2" Scenario: Devices can publish batch data - Given I store "$millis()" into "ts" - And I store "$millis()+(120*1000)" into "ts2" - Then the cat tracker publishes this message to the topic {cat:id}/batch + Given the cat tracker publishes this message to the topic {cat:id}/batch """ { "gps": [ { "v": { - "lng": 8.669555, + "lng": {lng1}, "lat": 50.109177, "acc": 28.032738, "alt": 204.623276, "spd": 0.698944, "hdg": 0 }, - "ts": {ts} + "ts": {ts1} }, { "v": { - "lng": 10.424793, + "lng": {lng2}, "lat": 63.422975, "acc": 12.276645, "alt": 137.319351, @@ -40,8 +42,7 @@ Feature: Device: Batch Data ] } """ - - Given I am authenticated with Cognito + And I am authenticated with Cognito When I run this Timestream query """ SELECT measure_value::double AS value @@ -50,17 +51,20 @@ Feature: Device: Batch Data AND measure_name='gps.lng' AND measure_value::double IS NOT NULL ORDER BY time DESC - LIMIT 2 """ Then "timestreamQueryResult" should match this JSON - # The values are string because they have not yet run through the formatter """ [ { - "value": 8.669555 - }, + "value": {lng1} + } + ] + """ + And "timestreamQueryResult" should match this JSON + """ + [ { - "value": 10.424793 + "value": {lng2} } ] """ diff --git a/features/DeviceMessages.feature b/features/DeviceMessages.feature index 38bb0913..55f9e456 100644 --- a/features/DeviceMessages.feature +++ b/features/DeviceMessages.feature @@ -5,12 +5,12 @@ Feature: Device: Messages Background: Given I am run after the "Device: Update Shadow" feature + And I store "$floor($random() * 1024)" into "button1" + And I store "$floor($random() * 1024)" into "button2" Scenario: Devices publishes that a button was pressed Given I store "$millis()" into "ts" - And I store "$floor($random() * 1024)" into "button1" - And I store "$floor($random() * 1024)" into "button2" Then the cat tracker publishes this message to the topic {cat:id}/messages """ { @@ -37,14 +37,18 @@ Feature: Device: Messages FROM "{historicaldataDatabaseName}"."{historicaldataTableName}" WHERE deviceId='{cat:id}' AND measure_name='btn' AND measure_value::double IS NOT NULL ORDER BY time DESC - LIMIT 2 """ Then "timestreamQueryResult" should match this JSON """ [ { "value": {button1} - }, + } + ] + """ + Then "timestreamQueryResult" should match this JSON + """ + [ { "value": {button2} }