From 29a60c124174708c68005394c721ab17cac3bb47 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Wed, 20 Dec 2017 17:41:55 +0100 Subject: [PATCH 1/6] Use local IP instead of localhost --- config.js | 10 ++++++---- nightwatch-browserstack.conf.js | 4 +--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config.js b/config.js index 9637611fc..1379a0be5 100644 --- a/config.js +++ b/config.js @@ -11,6 +11,8 @@ const uniq = require('lodash/uniq'); const ms = require('ms'); const debug = require('debug')('talk:config'); +const localAddress = require('ip').address(); + //============================================================================== // CONFIG INITIALIZATION //============================================================================== @@ -204,10 +206,10 @@ const CONFIG = { if (process.env.NODE_ENV === 'test') { if (!CONFIG.ROOT_URL) { - CONFIG.ROOT_URL = 'http://localhost:3001'; + CONFIG.ROOT_URL = `http://${localAddress}:3001`; } if (!CONFIG.STATIC_URL) { - CONFIG.STATIC_URI = 'http://localhost:3001'; + CONFIG.STATIC_URI = `http://${localAddress}:3001`; } } else if (!CONFIG.ROOT_URL) { throw new Error('TALK_ROOT_URL must be provided'); @@ -261,13 +263,13 @@ CONFIG.JWT_COOKIE_NAMES = uniq(CONFIG.JWT_COOKIE_NAMES.concat([CONFIG.JWT_COOKIE // testing environment. Every new mongo instance comes with a test database by // default, this is consistent with common testing and use case practices. if (process.env.NODE_ENV === 'test' && !CONFIG.MONGO_URL) { - CONFIG.MONGO_URL = 'mongodb://localhost/test'; + CONFIG.MONGO_URL = `mongodb://${localAddress}/test`; } // Reset the redis url in the event it hasn't been overridden and we are in a // testing environment. if (process.env.NODE_ENV === 'test' && !CONFIG.REDIS_URL) { - CONFIG.REDIS_URL = 'redis://localhost/1'; + CONFIG.REDIS_URL = `redis://${localAddress}/1`; } // REDIS_CLUSTER_CONFIGURATION should be parsed when the cluster mode !== none. diff --git a/nightwatch-browserstack.conf.js b/nightwatch-browserstack.conf.js index f31580988..a08bec2b3 100644 --- a/nightwatch-browserstack.conf.js +++ b/nightwatch-browserstack.conf.js @@ -54,10 +54,8 @@ const nightwatch_config = { }, safari: { desiredCapabilities: { - - // Safari since 8 seems to have troubles with the browserstack-local tunnel (10.18.17) browser: 'safari', - browser_version: '10', + browser_version: '11', }, }, ie: { From 7d71452ab56ca9686dca886d10a501c678f5fe7a Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Wed, 20 Dec 2017 17:45:03 +0100 Subject: [PATCH 2/6] Add ip package --- package.json | 1 + yarn.lock | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c46a4caaa..86164f2d4 100644 --- a/package.json +++ b/package.json @@ -205,6 +205,7 @@ "eslint": "^4.5.0", "eslint-plugin-mocha": "^4.11.0", "identity-obj-proxy": "^3.0.0", + "ip": "^1.1.5", "jest": "^21.2.1", "mocha": "^3.1.2", "mocha-junit-reporter": "^1.12.1", diff --git a/yarn.lock b/yarn.lock index c380bcd3a..b9ef3f31e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4186,7 +4186,7 @@ ip@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/ip/-/ip-1.0.1.tgz#c7e356cdea225ae71b36d70f2e71a92ba4e42590" -ip@^1.1.2, ip@^1.1.4: +ip@^1.1.2, ip@^1.1.4, ip@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" From 3776c4d0504216f575184ddf61941c28f5654346 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 21 Dec 2017 12:31:36 +0100 Subject: [PATCH 3/6] Use private ip --- config.js | 2 +- test/e2e/specs/01_install.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config.js b/config.js index 1379a0be5..578f2d5b8 100644 --- a/config.js +++ b/config.js @@ -11,7 +11,7 @@ const uniq = require('lodash/uniq'); const ms = require('ms'); const debug = require('debug')('talk:config'); -const localAddress = require('ip').address(); +const localAddress = require('ip').address('private'); //============================================================================== // CONFIG INITIALIZATION diff --git a/test/e2e/specs/01_install.js b/test/e2e/specs/01_install.js index 078a22e50..9bee6deac 100644 --- a/test/e2e/specs/01_install.js +++ b/test/e2e/specs/01_install.js @@ -2,6 +2,7 @@ module.exports = { '@tags': ['install'], before: (client) => { + client.setWindowPosition(0, 0); client.resizeWindow(1600, 1200); }, From 2e726c9d6af31decd97937fca6c37b4db7a44d87 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 21 Dec 2017 14:10:28 +0100 Subject: [PATCH 4/6] Set window position --- test/e2e/specs/01_install.js | 2 +- test/e2e/specs/02_admin.js | 3 ++- test/e2e/specs/03_embedStream.js | 3 ++- test/e2e/specs/04_userStatus.js | 3 ++- test/e2e/specs/05_banUser.js | 3 ++- test/e2e/specs/06_suspendUser.js | 5 +++-- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/test/e2e/specs/01_install.js b/test/e2e/specs/01_install.js index 9bee6deac..e0734a2a6 100644 --- a/test/e2e/specs/01_install.js +++ b/test/e2e/specs/01_install.js @@ -1,7 +1,7 @@ module.exports = { '@tags': ['install'], - before: (client) => { + before: (client) => { client.setWindowPosition(0, 0); client.resizeWindow(1600, 1200); }, diff --git a/test/e2e/specs/02_admin.js b/test/e2e/specs/02_admin.js index 29957e487..d04f918bd 100644 --- a/test/e2e/specs/02_admin.js +++ b/test/e2e/specs/02_admin.js @@ -1,7 +1,8 @@ module.exports = { '@tags': ['admin', 'login'], - before: (client) => { + before: (client) => { + client.setWindowPosition(0, 0); client.resizeWindow(1024, 800); }, diff --git a/test/e2e/specs/03_embedStream.js b/test/e2e/specs/03_embedStream.js index 567596dd2..56f267375 100644 --- a/test/e2e/specs/03_embedStream.js +++ b/test/e2e/specs/03_embedStream.js @@ -1,7 +1,8 @@ module.exports = { '@tags': ['embedStream', 'login'], - before: (client) => { + before: (client) => { + client.setWindowPosition(0, 0); client.resizeWindow(1600, 1200); }, diff --git a/test/e2e/specs/04_userStatus.js b/test/e2e/specs/04_userStatus.js index 011f59056..74f7e07b6 100644 --- a/test/e2e/specs/04_userStatus.js +++ b/test/e2e/specs/04_userStatus.js @@ -1,6 +1,7 @@ module.exports = { - before: (client) => { + before: (client) => { + client.setWindowPosition(0, 0); client.resizeWindow(1600, 1200); }, diff --git a/test/e2e/specs/05_banUser.js b/test/e2e/specs/05_banUser.js index da0d11e7a..41a0784ae 100644 --- a/test/e2e/specs/05_banUser.js +++ b/test/e2e/specs/05_banUser.js @@ -1,6 +1,7 @@ module.exports = { - before: (client) => { + before: (client) => { + client.setWindowPosition(0, 0); client.resizeWindow(1600, 1200); }, diff --git a/test/e2e/specs/06_suspendUser.js b/test/e2e/specs/06_suspendUser.js index 20f38c2c2..7da11d0dd 100644 --- a/test/e2e/specs/06_suspendUser.js +++ b/test/e2e/specs/06_suspendUser.js @@ -1,6 +1,7 @@ module.exports = { before: (client) => { + client.setWindowPosition(0, 0); client.resizeWindow(1600, 1200); }, @@ -83,7 +84,7 @@ module.exports = { 'admin suspends user': (client) => { const adminPage = client.page.admin(); const moderate = adminPage.section.moderate; - + adminPage .navigate() .ready() @@ -97,7 +98,7 @@ module.exports = { .waitForElementVisible('@actionItemSuspendUser') .click('@actionItemSuspendUser'); - adminPage + adminPage .waitForElementVisible('@suspendUserDialog') .waitForElementVisible('@suspendUserConfirmButton') .click('@suspendUserConfirmButton') From f8c1733e14f211a7614fd32f9541f860571d1b4f Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 21 Dec 2017 14:11:16 +0100 Subject: [PATCH 5/6] Remove sendKey hack --- nightwatch-browserstack.conf.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nightwatch-browserstack.conf.js b/nightwatch-browserstack.conf.js index a08bec2b3..567d5e1f4 100644 --- a/nightwatch-browserstack.conf.js +++ b/nightwatch-browserstack.conf.js @@ -58,17 +58,15 @@ const nightwatch_config = { browser_version: '11', }, }, + + // The x64 bit IEDriver that is used by IE 11 has a known issue with sendKeys where + // it may enter incorrect keys (shift + key). ie: { desiredCapabilities: { browser: 'internet explorer', os: 'Windows', os_version: '10', browser_version: '11', - - // The x64 bit IEDriver that is used by IE 11 has a known issue with sendKeys where - // it may enter incorrect keys (shift + key). - // This adds a delay for each character as temporary fix as advised from the browserstack support. - 'browserstack.customSendKeys': 800, }, }, edge: { From d5bf44ada8f9df5e0f8895bdeb0f38e7615b7e29 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 4 Jan 2018 18:41:31 +0100 Subject: [PATCH 6/6] Keep localhost for mongodb and redis --- config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.js b/config.js index 578f2d5b8..47b232c3f 100644 --- a/config.js +++ b/config.js @@ -263,13 +263,13 @@ CONFIG.JWT_COOKIE_NAMES = uniq(CONFIG.JWT_COOKIE_NAMES.concat([CONFIG.JWT_COOKIE // testing environment. Every new mongo instance comes with a test database by // default, this is consistent with common testing and use case practices. if (process.env.NODE_ENV === 'test' && !CONFIG.MONGO_URL) { - CONFIG.MONGO_URL = `mongodb://${localAddress}/test`; + CONFIG.MONGO_URL = 'mongodb://localhost/test'; } // Reset the redis url in the event it hasn't been overridden and we are in a // testing environment. if (process.env.NODE_ENV === 'test' && !CONFIG.REDIS_URL) { - CONFIG.REDIS_URL = `redis://${localAddress}/1`; + CONFIG.REDIS_URL = 'redis://localhost/1'; } // REDIS_CLUSTER_CONFIGURATION should be parsed when the cluster mode !== none.