Skip to content

Commit 0db1b3d

Browse files
authored
E2e test (#505)
* Add e2e test * revert config * Remove extra deps
1 parent ef1cf9a commit 0db1b3d

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"react-dnd-html5-backend": "~2.0.0",
6464
"react-dom": "^15.0.1",
6565
"react-router": "^2.6.0",
66+
"request-promise": "^4.1.1",
6667
"sass-loader": "~3.1.2",
6768
"style-loader": "~0.12.3",
6869
"svg-prep": "~1.0.0",

src/lib/tests/e2e.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2016-present, Parse, LLC
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the license found in the LICENSE file in
6+
* the root directory of this source tree.
7+
*/
8+
9+
jest.disableAutomock();
10+
11+
var express = require('express');
12+
var app = express();
13+
var rp = require('request-promise');
14+
var ParseDashboard = require('../../../Parse-Dashboard/app');
15+
16+
var dashboard = ParseDashboard({
17+
"apps": [
18+
{
19+
"serverURL": "http://localhost:5051/parse",
20+
"appId": "appId",
21+
"masterKey": "masterKey",
22+
"appName": "MyApp"
23+
}
24+
]
25+
});
26+
27+
app.use('/dashboard', dashboard);
28+
29+
var p = new Promise(resolve => {
30+
app.listen(5051, resolve);
31+
});
32+
33+
describe('e2e', () => {
34+
it('loads the dashboard', () => {
35+
return p.then(() => {
36+
return rp('http://localhost:5051/dashboard');
37+
})
38+
.then(result => {
39+
let bundleLocation = result.match(/<script src=\"([^\"]*)\">/)[1]
40+
return rp('http://localhost:5051' + bundleLocation);
41+
})
42+
.then(bundleText => {
43+
expect(bundleText.length).toBeGreaterThan(1000000);
44+
});
45+
});
46+
});

0 commit comments

Comments
 (0)