mirror of https://github.com/zulip/zulip.git
tests: Use common.js in 00-login.js
(imported from commit b4f3150ee9bbb2c37c3bd5cb0032d8d210d8e976)
This commit is contained in:
parent
b09c829fd6
commit
8e6587e92f
|
@ -1,33 +1,15 @@
|
|||
// Start of test script.
|
||||
casper.start('http://localhost:9981/', function () {
|
||||
// Fail if we get a JavaScript error in the page's context.
|
||||
// Based on the example at http://phantomjs.org/release-1.5.html
|
||||
//
|
||||
// casper.on('error') doesn't work (it never gets called) so we
|
||||
// set this at the PhantomJS level. We do it inside 'start' so
|
||||
// that we know we have a page object.
|
||||
casper.page.onError = function (msg, trace) {
|
||||
casper.test.error(msg);
|
||||
casper.echo('Traceback:');
|
||||
trace.forEach(function (item) {
|
||||
casper.echo(' ' + item.file + ':' + item.line);
|
||||
});
|
||||
casper.exit(1);
|
||||
};
|
||||
var common = require('../common.js').common;
|
||||
|
||||
// Start of test script.
|
||||
casper.start('http://localhost:9981/', common.initialize_casper);
|
||||
|
||||
casper.then(function () {
|
||||
casper.test.assertHttpStatus(302);
|
||||
casper.test.assertUrlMatch(/^http:\/\/[^\/]+\/accounts\/home/, 'Redirected to /accounts/home');
|
||||
casper.click('a[href^="/accounts/login"]');
|
||||
});
|
||||
|
||||
// casper.then will perform the action after the effects of previous clicks etc. are finished.
|
||||
casper.then(function () {
|
||||
casper.test.info('Logging in');
|
||||
casper.fill('form[action^="/accounts/login"]', {
|
||||
username: 'iago@humbughq.com',
|
||||
password: 'FlokrWdZefyEWkfI'
|
||||
}, true /* submit form */);
|
||||
});
|
||||
common.then_log_in();
|
||||
|
||||
casper.then(function () {
|
||||
casper.test.info('Logging out');
|
||||
|
|
Loading…
Reference in New Issue