You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by jo...@apache.org on 2017/11/30 13:48:09 UTC

[30/47] tinkerpop git commit: Use cucumber-js

Use cucumber-js


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/5b92fbf9
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/5b92fbf9
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/5b92fbf9

Branch: refs/heads/TINKERPOP-1489
Commit: 5b92fbf91c71afabf53ead7be3df5c8c05f13dcd
Parents: ef8c57d
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Wed Nov 22 17:44:18 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 14:45:01 2017 +0100

----------------------------------------------------------------------
 gremlin-javascript/glv/PackageJson.template     |  4 +-
 gremlin-javascript/pom.xml                      | 16 ++++-
 .../javascript/gremlin-javascript/package.json  |  4 +-
 .../test/cucumber/feature-steps.js              | 69 ++++++++++++++++++++
 .../gremlin-javascript/test/cucumber/world.js   | 33 ++++++++++
 5 files changed, 121 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5b92fbf9/gremlin-javascript/glv/PackageJson.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/PackageJson.template b/gremlin-javascript/glv/PackageJson.template
index f61913f..3ff17af 100644
--- a/gremlin-javascript/glv/PackageJson.template
+++ b/gremlin-javascript/glv/PackageJson.template
@@ -36,7 +36,8 @@
     "ws": "^3.0.0"
   },
   "devDependencies": {
-    "mocha": ">= 1.14.0"
+    "mocha": "~4.0.1",
+    "cucumber": "~3.1.0"
   },
   "repository": {
     "type": "git",
@@ -47,6 +48,7 @@
   },
   "scripts": {
     "test": "./node_modules/.bin/mocha test --recursive -t 5000",
+    "features": "./node_modules/.bin/cucumber.js ../../../../../gremlin-test/features/",
     "unit-test": "./node_modules/.bin/mocha test/unit"
   },
   "engines": {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5b92fbf9/gremlin-javascript/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml
index c08b59b..871fd7a 100644
--- a/gremlin-javascript/pom.xml
+++ b/gremlin-javascript/pom.xml
@@ -269,31 +269,41 @@ server.stop().join()
                 <executions>
                     <execution>
                         <id>install node and npm</id>
+                        <phase>generate-test-resources</phase>
                         <goals>
                             <goal>install-node-and-npm</goal>
                         </goals>
-                        <phase>generate-test-resources</phase>
                     </execution>
                     <execution>
                         <id>npm install</id>
+                        <phase>generate-test-resources</phase>
                         <goals>
                             <goal>npm</goal>
                         </goals>
-                        <phase>generate-test-resources</phase>
                         <configuration>
                             <arguments>install</arguments>
                         </configuration>
                     </execution>
                     <execution>
                         <id>npm test</id>
+                        <phase>integration-test</phase>
                         <goals>
                             <goal>npm</goal>
                         </goals>
-                        <phase>integration-test</phase>
                         <configuration>
                             <arguments>test</arguments>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>npm test gherkin features</id>
+                        <phase>integration-test</phase>
+                        <goals>
+                            <goal>npm</goal>
+                        </goals>
+                        <configuration>
+                            <arguments>run-script features</arguments>
+                        </configuration>
+                    </execution>
                 </executions>
                 <configuration>
                     <skip>${skipIntegrationTests}</skip>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5b92fbf9/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
index 1228dd4..dfbaff2 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
@@ -17,7 +17,8 @@
     "ws": "^3.0.0"
   },
   "devDependencies": {
-    "mocha": ">= 1.14.0"
+    "mocha": "~4.0.1",
+    "cucumber": "~3.1.0"
   },
   "repository": {
     "type": "git",
@@ -28,6 +29,7 @@
   },
   "scripts": {
     "test": "./node_modules/.bin/mocha test --recursive -t 5000",
+    "features": "./node_modules/.bin/cucumber.js ../../../../../gremlin-test/features/",
     "unit-test": "./node_modules/.bin/mocha test/unit"
   },
   "engines": {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5b92fbf9/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
new file mode 100644
index 0000000..10680b7
--- /dev/null
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+/**
+ * @author Jorge Bay Gondra
+ */
+'use strict';
+
+const {defineSupportCode} = require('cucumber');
+const vm = require('vm');
+
+
+defineSupportCode(function({Given, When, Then}) {
+  Given(/^the (.+) graph$/, function (graphName) {
+    //TODO: Set context g
+  });
+  // Given('the graph initializer of');
+  Given('an unsupported test', () => {});
+
+  Given('the traversal of', function (traversalText) {
+    //TODO: make traversal
+  });
+
+  Given(/^$/, function (paramName, stringValue) {
+    //TODO: Add parameter
+  });
+
+  When('iterated to list', function () {
+    //TODO
+  });
+
+  When('iterated next', function () {
+    //TODO
+  });
+
+  Then(/^the result should be (\w+)$/, function (characterizedAs, resultTable) {
+    //TODO
+    //console.log('--resultTable', resultTable.rows());
+    if (typeof resultTable === 'function'){
+      return resultTable();
+    }
+  });
+
+  Then(/^the graph should return (\d+) for count of (.+)$/, function (stringCount, traversalString) {
+
+  });
+
+  Then(/^the result should have a count of (\d+)$/, function (stringCount) {
+
+  });
+
+  Then('nothing should happen because', () => {});
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5b92fbf9/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
new file mode 100644
index 0000000..f1cd7a6
--- /dev/null
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+/**
+ * @author Jorge Bay Gondra
+ */
+'use strict';
+
+const {defineSupportCode} = require('cucumber');
+
+defineSupportCode(function ({setWorldConstructor}) {
+  function TinkerPopWorld(){
+    this.g = null;
+    this.traversal = null;
+  }
+  setWorldConstructor(TinkerPopWorld);
+});
\ No newline at end of file