test: no need to stub fileserver. start it locally

pull/1137/head
Audric Ackermann 6 years ago
parent 308e06b2cd
commit a5ff0f0c08
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -562,12 +562,20 @@ module.exports = {
} }
response.end(); response.end();
}); });
this.startLocalFileServer();
this.stubSnode.listen(STUB_SNODE_SERVER_PORT); this.stubSnode.listen(STUB_SNODE_SERVER_PORT);
} else { } else {
this.messages = {}; this.messages = {};
} }
}, },
async startLocalFileServer() {
if (!this.fileServer) {
// eslint-disable-next-line global-require
this.fileServer = require('../loki-file-server/app');
}
},
async joinOpenGroup(app, openGroupUrl, name) { async joinOpenGroup(app, openGroupUrl, name) {
await app.client.element(ConversationPage.globeButtonSection).click(); await app.client.element(ConversationPage.globeButtonSection).click();
await app.client.element(ConversationPage.joinOpenGroupButton).click(); await app.client.element(ConversationPage.joinOpenGroupButton).click();

@ -58,13 +58,8 @@ class LokiFileServerInstance {
// LokiAppDotNetAPI (base) should not know about LokiFileServer. // LokiAppDotNetAPI (base) should not know about LokiFileServer.
async establishConnection(serverUrl, options) { async establishConnection(serverUrl, options) {
// why don't we extend this? // why don't we extend this?
if (process.env.USE_STUBBED_NETWORK) {
// eslint-disable-next-line global-require
const StubAppDotNetAPI = require('../../integration_test/stubs/stub_app_dot_net_api.js');
this._server = new StubAppDotNetAPI(this.ourKey, serverUrl);
} else {
this._server = new LokiAppDotNetAPI(this.ourKey, serverUrl); this._server = new LokiAppDotNetAPI(this.ourKey, serverUrl);
}
// configure proxy // configure proxy
this._server.pubKey = this.pubKey; this._server.pubKey = this.pubKey;

@ -56,6 +56,8 @@ if (
process.env.NODE_ENV.includes('test-integration') process.env.NODE_ENV.includes('test-integration')
) { ) {
window.electronRequire = require; window.electronRequire = require;
// during test-integration, file server is started on localhost
window.getDefaultFileServer = () => 'http://127.0.0.1:7070';
} }
window.isBeforeVersion = (toCheck, baseVersion) => { window.isBeforeVersion = (toCheck, baseVersion) => {

Loading…
Cancel
Save