changeset 116:0139a8c37598

Handle Selenium integration test browser server more reliably Reviewed-by: almac Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-June/023789.html
author Andrew Azores <aazores@redhat.com>
date Wed, 28 Jun 2017 17:22:12 -0400
parents c129f1df628d
children dc096cee71f0
files integration-test/wait-for-selenium.js package.json
diffstat 2 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/integration-test/wait-for-selenium.js	Wed Jun 28 17:22:12 2017 -0400
@@ -0,0 +1,19 @@
+var sock = new require('net').Socket();
+
+sock.on('connect', function () {
+  sock.end();
+});
+
+sock.on('error', function () {
+  scheduleConnect();
+});
+
+function tryConnect () {
+  sock.connect(4444, 'localhost');
+}
+
+function scheduleConnect () {
+  setTimeout(tryConnect, 500);
+}
+
+tryConnect();
--- a/package.json	Tue Jun 27 12:18:40 2017 -0400
+++ b/package.json	Wed Jun 28 17:22:12 2017 -0400
@@ -94,8 +94,10 @@
     "pretest-watch": "npm run pretest",
     "test-watch": "\"$(npm bin)/karma\" start --auto-watch --no-single-run",
     "prestart-integration-test-server": "npm run stop-integration-test-server && \"$(npm bin)\"/webdriver-manager update",
-    "start-integration-test-server": "\"$(npm bin)\"/forever start \"$(npm bin)\"/webdriver-manager start",
-    "stop-integration-test-server": "\"$(npm bin)\"/forever stop --silent \"$(npm bin)\"/webdriver-manager || true",
+    "start-integration-test-server": "\"$(npm bin)\"/forever start -t \"$(npm bin)\"/webdriver-manager start",
+    "poststart-integration-test-server": "node integration-test/wait-for-selenium.js",
+    "stop-integration-test-server": "\"$(npm bin)\"/forever stop -t --silent \"$(npm bin)\"/webdriver-manager || true",
+    "poststop-integration-test-server": "\"$(npm bin)\"/webdriver-manager shutdown",
     "preintegration-test": "npm run lint-itests && npm run start-integration-test-server",
     "integration-test": "protractor integration-test/integration-test.config.js",
     "postintegration-test": "npm run stop-integration-test-server",