From 0c4554f21460d650b53cff26f605264fd42f900e Mon Sep 17 00:00:00 2001
From: Yuriy Maksymets <iurii.maksymets@gmail.com>
Date: Mon, 14 Oct 2019 15:26:34 +0100
Subject: [PATCH] Fixed scripts and test naming

---
 .gitlab-ci.yml                                     |  2 +-
 .../peer1.test.js => __e2e_tests__/peer1.e2e.js    |  0
 .../peer2.test.js => __e2e_tests__/peer2.e2e.js    |  0
 __e2e_tests__/run                                  | 14 ++++++++++++++
 package.json                                       |  4 ++--
 5 files changed, 17 insertions(+), 3 deletions(-)
 rename __tests__/e2e/peer1.test.js => __e2e_tests__/peer1.e2e.js (100%)
 rename __tests__/e2e/peer2.test.js => __e2e_tests__/peer2.e2e.js (100%)
 create mode 100755 __e2e_tests__/run

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 543602e..07e08c9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -84,7 +84,7 @@ chrome_test:
   dependencies:
     - dev_node_install
   script:
-    - npm test-e2e:chrome
+    - npm run test-e2e:chrome
 
 deploy:
   stage: deploy
diff --git a/__tests__/e2e/peer1.test.js b/__e2e_tests__/peer1.e2e.js
similarity index 100%
rename from __tests__/e2e/peer1.test.js
rename to __e2e_tests__/peer1.e2e.js
diff --git a/__tests__/e2e/peer2.test.js b/__e2e_tests__/peer2.e2e.js
similarity index 100%
rename from __tests__/e2e/peer2.test.js
rename to __e2e_tests__/peer2.e2e.js
diff --git a/__e2e_tests__/run b/__e2e_tests__/run
new file mode 100755
index 0000000..3126865
--- /dev/null
+++ b/__e2e_tests__/run
@@ -0,0 +1,14 @@
+#!/bin/bash
+set -e
+
+TEST1="peer1.e2e.js"
+TEST2="peer2.e2e.js"
+
+case "$1" in
+ chrome) BROWSERS=chrome ;;
+ *) BROWSERS=all ;;
+esac
+
+COMMAND="npx testcafe $BROWSERS"
+
+$COMMAND $TEST1 & $COMMAND $TEST2
\ No newline at end of file
diff --git a/package.json b/package.json
index b9a4a6e..1871839 100644
--- a/package.json
+++ b/package.json
@@ -13,8 +13,8 @@
     "test": "jest --testPathIgnorePatterns src/liowebrtc src/rtcpeerconnection src/signalbuddy",
     "test-changed": "jest --only-changed --testPathIgnorePatterns src/liowebrtc src/rtcpeerconnection src/signalbuddy",
     "test-coverage": "jest --coverage --testPathIgnorePatterns src/liowebrtc src/rtcpeerconnection src/signalbuddy",
-    "test-e2e": "npx testcafe all serverIntegration.test.js & npx testcafe all peer.test.js",
-    "test-e2e:chrome": "npx testcafe chrome serverIntegration.test.js & npx testcafe chrome peer.test.js",
+    "test-e2e": "cd __e2e_tests__ ; ./run",
+    "test-e2e:chrome": "cd __e2e_tests__ ; ./run chrome",
     "lint": "jshint .",
     "validate": "npm ls"
   },
-- 
GitLab