diff --git a/config/default.json b/config/default.json index bc80b74af..244243b9c 100644 --- a/config/default.json +++ b/config/default.json @@ -1,4 +1,5 @@ { + "serverUrl": "https://textsecure-service-staging.whispersystems.org", "disableAutoUpdate": false, "openDevTools": false, "buildExpiration": 0 diff --git a/config/development.json b/config/development.json index 4024e4f0d..f0324abfe 100644 --- a/config/development.json +++ b/config/development.json @@ -1,5 +1,4 @@ { - "serverUrl": "https://textsecure-service-staging.whispersystems.org", "storageProfile": "development", "disableAutoUpdate": true, "openDevTools": true diff --git a/config/staging.json b/config/staging.json index a4f990b35..acc5ac72d 100644 --- a/config/staging.json +++ b/config/staging.json @@ -1,5 +1,4 @@ { - "serverUrl": "https://textsecure-service-staging.whispersystems.org", "storageProfile": "staging", "disableAutoUpdate": true, "openDevTools": true diff --git a/config/test.json b/config/test.json new file mode 100644 index 000000000..6d19ca42e --- /dev/null +++ b/config/test.json @@ -0,0 +1,5 @@ +{ + "storageProfile": "test", + "disableAutoUpdate": true, + "openDevTools": true +} diff --git a/main.js b/main.js index 55b64c304..748e4ac5b 100644 --- a/main.js +++ b/main.js @@ -96,20 +96,27 @@ function createWindow () { event.returnValue = localeData; }); - // and load the index.html of the app. - mainWindow.loadURL(url.format({ - pathname: path.join(__dirname, 'background.html'), - protocol: 'file:', - slashes: true, - query: { - locale: locale, - version: package_json.version, - buildExpiration: config.get('buildExpiration'), - serverUrl: config.get('serverUrl'), - environment: environment, - node_version: process.versions.node - } - })) + function prepareURL(pathSegments) { + return url.format({ + pathname: path.join.apply(null, pathSegments), + protocol: 'file:', + slashes: true, + query: { + locale: locale, + version: package_json.version, + buildExpiration: config.get('buildExpiration'), + serverUrl: config.get('serverUrl'), + environment: environment, + node_version: process.versions.node + } + }) + } + + if (process.env.NODE_ENV === 'test') { + mainWindow.loadURL(prepareURL([__dirname, 'test', 'index.html'])); + } else { + mainWindow.loadURL(prepareURL([__dirname, 'background.html'])); + } if (config.get('openDevTools')) { // Open the DevTools.