From d25a5309424c64139fd8285f1e7718a92da283de Mon Sep 17 00:00:00 2001 From: Denis Chaplygin Date: Mon, 23 Sep 2019 11:38:33 +0300 Subject: [PATCH] Added cucumber test for skip_waypoint feature --- features/step_definitions/routing.js | 5 +++++ features/support/shared_steps.js | 7 +++++++ features/testbot/basic.feature | 23 ++++++++++++++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/features/step_definitions/routing.js b/features/step_definitions/routing.js index c3e679aa5..136add5ef 100644 --- a/features/step_definitions/routing.js +++ b/features/step_definitions/routing.js @@ -12,4 +12,9 @@ module.exports = function () { q.awaitAll(callback); }); + + this.Given(/^skip waypoints$/, (callback) => { + this.queryParams['skip_waypoints'] = true; + callback(); + }); }; diff --git a/features/support/shared_steps.js b/features/support/shared_steps.js index 20fc0cf71..0eeda2790 100644 --- a/features/support/shared_steps.js +++ b/features/support/shared_steps.js @@ -155,6 +155,13 @@ module.exports = function () { if (headers.has('locations')){ got.locations = (locations || '').trim(); } + if (headers.has('waypoints_count')) { + if ('waypoints' in json) { + got.waypoints_count = json.waypoints.length; + } else{ + got.waypoints_count = 0; + } + } /* if (headers.has('approaches')){ got.approaches = (approaches || '').trim(); diff --git a/features/testbot/basic.feature b/features/testbot/basic.feature index 0041a133e..9224cd469 100644 --- a/features/testbot/basic.feature +++ b/features/testbot/basic.feature @@ -17,9 +17,9 @@ Feature: Basic Routing | ab | When I route I should get - | from | to | route | data_version | - | a | b | ab,ab | | - | b | a | ab,ab | | + | from | to | route | data_version | waypoints_count | + | a | b | ab,ab | | 2 | + | b | a | ab,ab | | 2 | Scenario: Data_version test Given the node map @@ -38,6 +38,23 @@ Feature: Basic Routing | a | b | ab,ab | cucumber_data_version | | b | a | ab,ab | cucumber_data_version | + Scenario: Skip_waypoints test + Given the node map + """ + a b + """ + + And skip waypoints + + And the ways + | nodes | + | ab | + + When I route I should get + | from | to | route | waypoints_count | + | a | b | ab,ab | 0 | + | b | a | ab,ab | 0 | + Scenario: Routing in between two nodes of way Given the node map """