File tree Expand file tree Collapse file tree 6 files changed +353
-8
lines changed Expand file tree Collapse file tree 6 files changed +353
-8
lines changed Original file line number Diff line number Diff line change
1
+ const { AfterAll, BeforeAll} = require ( 'cucumber' ) ;
2
+ const { spawn } = require ( 'child_process' ) ;
3
+ const waitOn = require ( 'wait-on' ) ;
4
+
5
+ let hcApi ;
6
+
7
+ // Asynchronous Callback
8
+ BeforeAll ( { timeout : 30 * 1000 } , function ( callback ) {
9
+ hcApi = spawn ( 'node' , [ 'server/' ] , {
10
+ cwd : './human-connection-api/' ,
11
+ env : {
12
+ 'NODE_ENV' : 'test'
13
+ }
14
+ } ) ;
15
+
16
+ hcApi . stdout . on ( 'data' , ( data ) => {
17
+ console . log ( `stdout: ${ data } ` ) ;
18
+ } ) ;
19
+
20
+ hcApi . stderr . on ( 'data' , ( data ) => {
21
+ console . log ( `stderr: ${ data } ` ) ;
22
+ } ) ;
23
+
24
+ waitOn ( { resources : [ 'tcp:3030' ] , timeout : 30000 } , function ( err ) {
25
+ if ( err ) { return handleError ( err ) ; }
26
+ callback ( ) ;
27
+ } ) ;
28
+ } ) ;
29
+
30
+ // Asynchronous Promise
31
+ AfterAll ( function ( ) {
32
+ // perform some shared teardown
33
+ hcApi . kill ( ) ;
34
+ return Promise . resolve ( )
35
+ } ) ;
Original file line number Diff line number Diff line change @@ -5,7 +5,9 @@ Feature: Import a post from an organization and publish it in Human Connection
5
5
6
6
7
7
Background :
8
- Given there is an organization in Human Connection with these credentials:
8
+ Given the Human Connection API is up and running
9
+ And there is a 3rd party application running, e.g. 'Democracy'
10
+ And there is an organization in Human Connection with these credentials:
9
11
| Email | Password |
10
12
| organization @example .com | 1234 |
11
13
Original file line number Diff line number Diff line change 1
1
const { Given, When, Then } = require ( 'cucumber' ) ;
2
2
3
+ Given ( 'the Human Connection API is up and running' , function ( ) {
4
+ // Write code here that turns the phrase above into concrete actions
5
+ console . log ( 'skipping over starting the Human Connection API' ) ;
6
+ } ) ;
7
+
8
+ Given ( "there is a 3rd party application running, e.g. 'Democracy'" , function ( ) {
9
+ // Write code here that turns the phrase above into concrete actions
10
+ console . log ( 'skipping over starting the 3rd party API' ) ;
11
+ // return 'pending';
12
+ } ) ;
13
+
3
14
Given ( 'there is an organization in Human Connection with these credentials:' , function ( dataTable ) {
4
15
// Write code here that turns the phrase above into concrete actions
5
16
return 'pending' ;
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ async function main() {
76
76
77
77
main ( ) . catch ( ( err ) => {
78
78
console . log ( err ) ;
79
- if ( err . code === 'ECONNREFUSED' ) {
79
+ if ( err . code === 'ECONNREFUSED' ) {
80
80
console . log ( '\nProbably a service is not running?\n' ) ;
81
81
}
82
82
process . exit ( - 100 ) ;
Original file line number Diff line number Diff line change 3
3
"cucumber" : " ^4.2.1" ,
4
4
"eslint-plugin-you-dont-need-lodash-underscore" : " ^6.3.1" ,
5
5
"lodash" : " ^4.17.5" ,
6
- "node-fetch" : " ^2.1.2"
6
+ "node-fetch" : " ^2.1.2" ,
7
+ "wait-on" : " ^2.1.0"
7
8
},
8
9
"name" : " human-connection-api-nodejs-client" ,
9
10
"version" : " 1.0.0" ,
You can’t perform that action at this time.
0 commit comments