mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Merge pull request #1067 from gotdibbs/Issue1064
Clean up test database after tests
This commit is contained in:
commit
0bf5c99f08
3 changed files with 12 additions and 4 deletions
|
@ -300,6 +300,9 @@ var path = require('path'),
|
|||
clean: {
|
||||
build: {
|
||||
src: ['<%= paths.buildBuild %>/**']
|
||||
},
|
||||
test: {
|
||||
src: ['content/data/ghost-test.db']
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -859,10 +862,10 @@ var path = require('path'),
|
|||
grunt.registerTask('init', ['shell:bourbon', 'default']);
|
||||
|
||||
// Run unit tests
|
||||
grunt.registerTask('test-unit', ['setTestEnv', 'loadConfig', 'express:test', 'mochacli:all']);
|
||||
grunt.registerTask('test-unit', ['clean:test', 'setTestEnv', 'loadConfig', 'express:test', 'mochacli:all']);
|
||||
|
||||
// Run casperjs tests only
|
||||
grunt.registerTask('test-functional', ['setTestEnv', 'express:test', 'spawn-casperjs']);
|
||||
grunt.registerTask('test-functional', ['clean:test', 'setTestEnv', 'express:test', 'spawn-casperjs']);
|
||||
|
||||
// Run tests and lint code
|
||||
grunt.registerTask('validate', ['jslint', 'test-unit', 'test-functional']);
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
/*globals casper, __utils__, url, testPost, falseUser, email */
|
||||
CasperTest.begin("Ghost logout works correctly", 2, function suite(test) {
|
||||
CasperTest.Routines.register.run(test);
|
||||
CasperTest.Routines.logout.run(test);
|
||||
CasperTest.Routines.login.run(test);
|
||||
|
||||
casper.thenOpen(url + "ghost/", function then() {
|
||||
|
|
|
@ -109,7 +109,7 @@ var CasperTest = (function() {
|
|||
var runTest = function (test) {
|
||||
test.filename = testName.toLowerCase().replace(/ /g, '-').concat('.png');
|
||||
|
||||
casper.start().viewport(1280, 1024);
|
||||
casper.start('about:blank').viewport(1280, 1024);
|
||||
|
||||
if (!doNotAutoLogin) {
|
||||
// Only call register once for the lifetime of Mindless
|
||||
|
@ -171,7 +171,10 @@ CasperTest.Routines = (function () {
|
|||
});
|
||||
|
||||
casper.waitForSelectorTextChange('.notification-error', function onSuccess() {
|
||||
this.echo('It appears as though a user is already registered.');
|
||||
var errorText = casper.evaluate(function () {
|
||||
return document.querySelector('.notification-error').innerText;
|
||||
});
|
||||
this.echo('It appears as though a user is already registered. Error text: ' + errorText);
|
||||
}, function onTimeout() {
|
||||
this.echo('It appears as though a user was not already registered.');
|
||||
}, 2000);
|
||||
|
|
Loading…
Add table
Reference in a new issue