Commit 6618f3fa authored by MrMan's avatar MrMan

Add nightmare, initial login page e2e test

parent 8eeb9e4a
......@@ -55,7 +55,7 @@ class LoginPage extends React.Component {
<div className="row">
<h1 className="slim-text no-top-margin">{this.i18n`app.name`}</h1>
<h2 className="slim-text">{this.i18n`app.subtitle`}</h2>
<button onClick={this.doLogin.bind(this)} className="pure-button button-fb">
<button id="login-button" onClick={this.doLogin.bind(this)} className="pure-button button-fb">
<i className="fa fa-facebook-square"></i> {this.i18n`pages.login.login`}
</button>
</div>
......
import { Promise } from 'q';
import Static from 'node-static';
import Http from 'http';
import NM from 'nightmare';
import "should";
import _ from "lodash";
// Test constants
let SERVER_PORT = 8080;
let BASE_URL = `http://localhost:${SERVER_PORT}`;
let STATIC_SERVER;
let NODE_SERVER;
const DEFAULT_TIMEOUT = 10000;
const PUBLIC_DIR_PATH = `${__dirname}/../../dist`;
// Page constants
const LOGIN_BUTTON_ID = "#login-button";
describe("Login page", function() {
this.timeout(DEFAULT_TIMEOUT);
before(() => {
// Create static server
STATIC_SERVER = new Static.Server(PUBLIC_DIR_PATH);
NODE_SERVER = Http.createServer((req, resp) => {
req.addListener('end', () => {
console.log("SERVE?");
STATIC_SERVER.serve(req, resp);
}).resume();
}).listen(SERVER_PORT);
console.log("http server:", NODE_SERVER);
});
it("Should have the appropriate title", (done) => {
let nm = NM();
Promise.resolve(
nm.goto(BASE_URL).title()
).then(title => {
console.log("WAT");
title.should.match(/Kindling/);
done();
});
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment