Skip to content

Commit 241a4f2

Browse files
durranrueckstiess
authored andcommitted
Run functional tests on travis (#611)
1 parent 7d71eb5 commit 241a4f2

File tree

4 files changed

+33
-32
lines changed

4 files changed

+33
-32
lines changed

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ addons:
1414
- g++-4.8
1515
- libkrb5-dev
1616
- libgnome-keyring-dev
17-
script: npm run ci
17+
before_script:
18+
- export DISPLAY=:99.0
19+
- sh -e /etc/init.d/xvfb start
20+
- npm run check
21+
script: npm run test
22+
after_script:
23+
- ps -ax
1824
cache:
1925
directories:
2026
- node_modules

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@
5353
},
5454
"scripts": {
5555
"start": "hadron-build develop",
56-
"pretest": "mongodb-runner install",
57-
"test": "xvfb-maybe hadron-build test",
56+
"pretest": "mongodb-runner install && mongodb-runner start --topology=standalone --port 27018",
57+
"test": "hadron-build test",
58+
"posttest": "mongodb-runner stop --topology=standalone --port 27018",
5859
"check": "mongodb-js-precommit ./src/app/*.js ./src/app/**/**/*.js ./src/{app/**/*.js,main/**/*.js} ./test/*.js ./src/internal-packages/**/*.js ./src/internal-packages/**/**/*{.js,.jsx} ./src/internal-packages/**/**/**/*{.js,.jsx} ./src/internal-packages/**/**/**/**/*{.js,.jsx}",
59-
"ci": "npm run check && npm run test-unit",
60+
"ci": "npm run check && npm run test",
6061
"clean": "hadron-build clean",
6162
"compile-ui": "hadron-build ui",
6263
"fmt": "mongodb-js-fmt ./*.js src/{**/*.js,*.js} test/{**/*.js,*.js}",
@@ -103,16 +104,16 @@
103104
"font-awesome": "https://github.com/FortAwesome/Font-Awesome/archive/v4.4.0.tar.gz",
104105
"get-object-path": "azer/get-object-path#74eb42de0cfd02c14ffdd18552f295aba723d394",
105106
"hadron-action": "^0.1.0",
106-
"hadron-app-registry": "^3.2.0",
107+
"hadron-app-registry": "^3.3.0",
107108
"hadron-auto-update-manager": "^0.0.12",
108109
"hadron-compile-cache": "^0.3.0",
109-
"hadron-document": "^0.28.0",
110+
"hadron-document": "^0.29.0",
110111
"hadron-ipc": "^0.0.7",
111112
"hadron-module-cache": "^0.0.3",
112113
"hadron-package-manager": "0.2.0",
113114
"hadron-reflux-store": "^0.0.2",
114115
"hadron-style-manager": "0.0.1",
115-
"hadron-type-checker": "^0.13.0",
116+
"hadron-type-checker": "^0.15.0",
116117
"highlight.js": "^8.9.1",
117118
"jquery": "^2.1.4",
118119
"keytar": "3.0.2",
@@ -170,9 +171,9 @@
170171
"eslint-config-mongodb-js": "^2.2.0",
171172
"hadron-build": "^2.0.1",
172173
"jsdom": "^9.8.3",
173-
"mocha": "^2.3.4",
174+
"mocha": "^3.1.2",
174175
"mongodb-js-precommit": "^0.2.9",
175-
"mongodb-runner": "^3.2.0",
176+
"mongodb-runner": "^3.4.0",
176177
"react-addons-test-utils": "^15.2.1",
177178
"sinon": "^1.17.6",
178179
"spectron": "^3.2.6",

test/compass-functional.test.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,24 @@ describe('Compass #spectron', function() {
2424
var app = null;
2525
var client = null;
2626

27-
before(function(done) {
28-
SpectronSupport.startApplication().then(function(application) {
29-
app = application;
30-
client = application.client;
31-
done();
32-
});
33-
});
34-
35-
after(function(done) {
36-
SpectronSupport.stopApplication(app);
37-
done();
38-
});
39-
4027
context('when working with the application', function() {
41-
before(require('mongodb-runner/mocha/before')({ port: 27018 }));
42-
4328
before(function(done) {
44-
CrudSupport.insertMany(CONNECTION, COLLECTION, DOCUMENTS, done);
29+
SpectronSupport.startApplication().then(function(application) {
30+
app = application;
31+
client = application.client;
32+
done();
33+
});
4534
});
4635

47-
after(require('mongodb-runner/mocha/after')());
36+
after(function() {
37+
SpectronSupport.stopApplication(app);
38+
});
4839

4940
context('when opening the application', function() {
41+
before(function(done) {
42+
CrudSupport.insertMany(CONNECTION, COLLECTION, DOCUMENTS, done);
43+
});
44+
5045
it('renders the connect window', function() {
5146
return client.
5247
waitForVisible('select[name=authentication]', 60000).

test/support/spectron-support.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const format = require('util').format;
88
const path = require('path');
99
const electronPrebuilt = require('electron-prebuilt');
1010
const Application = require('spectron').Application;
11-
const debug = require('debug')('mongodb-test-utils:spectron-support');
1211

1312
chai.use(chaiAsPromised);
1413

@@ -64,10 +63,10 @@ function startApplication(distDir) {
6463
* afterEach(helpers.startApplication);
6564
*/
6665
function stopApplication(app) {
67-
if (app && app.isRunning()) {
68-
debug('Stopping Spectron Application');
69-
return app.stop();
70-
} else return;
66+
if (!app || !app.isRunning()) return;
67+
return app.stop().then(function() {
68+
assert.equal(app.isRunning(), false);
69+
})
7170
};
7271

7372
/**
@@ -162,7 +161,7 @@ function addCommands(client) {
162161
* Wait for the connect window to redirect after successful connection.
163162
*/
164163
client.addCommand('waitForSchemaWindow', function() {
165-
return this.waitForVisible('.compass-sidebar-container');
164+
return this.waitForVisible('.compass-sidebar-container', 30000);
166165
});
167166

168167
/**

0 commit comments

Comments
 (0)