mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
1e62400465
closes #2609 - added include parameter to api.posts.* - changed toJSON to omit objects that are not included - added include parameter to admin - added include parameter to frontend.js - updated tests - removed duplicate code from posts model **Known Issue:** It is not possible to attach a tag using an ID.
60 lines
No EOL
2.2 KiB
JavaScript
60 lines
No EOL
2.2 KiB
JavaScript
/**
|
|
* Tests the flow of creating, editing and publishing tests
|
|
*/
|
|
|
|
/*globals casper, __utils__, url, testPost */
|
|
CasperTest.begin("Ghost edit draft flow works correctly", 8, function suite(test) {
|
|
casper.thenOpen(url + "ghost/editor/", function then() {
|
|
test.assertUrlMatch(/ghost\/editor\/$/, "Ghost doesn't require login this time");
|
|
});
|
|
|
|
casper.then(function createTestPost() {
|
|
casper.sendKeys('#entry-title', testPost.title);
|
|
casper.writeContentToCodeMirror(testPost.html);
|
|
});
|
|
|
|
casper.waitForSelectorTextChange('.entry-preview .rendered-markdown', function onSuccess() {
|
|
test.assertSelectorHasText('.entry-preview .rendered-markdown', 'test', 'Editor value is correct');
|
|
});
|
|
|
|
casper.thenClick('.js-publish-button');
|
|
casper.waitForResource(/posts\/\?include=tags$/);
|
|
|
|
casper.waitForSelector('.notification-success', function onSuccess() {
|
|
test.assert(true, 'Got success notification');
|
|
}, function onTimeout() {
|
|
test.assert(false, 'No success notification :(');
|
|
});
|
|
|
|
casper.thenOpen(url + 'ghost/content/', function then() {
|
|
test.assertUrlMatch(/ghost\/content\//, "Ghost successfully loaded the content page");
|
|
});
|
|
|
|
casper.then(function then() {
|
|
test.assertEvalEquals(function () {
|
|
return document.querySelector('.content-list-content li').className;
|
|
}, "active", "first item is active");
|
|
|
|
test.assertSelectorHasText(".content-list-content li:first-child h3", testPost.title, "first item is the post we created");
|
|
});
|
|
|
|
casper.thenClick('.post-edit').waitForResource(/editor/, function then() {
|
|
test.assertUrlMatch(/editor/, "Ghost successfully loaded the editor page again");
|
|
});
|
|
|
|
casper.thenClick('.js-publish-button');
|
|
casper.waitForResource(/posts\/[0-9]+\/\?include=tags$/);
|
|
|
|
casper.waitForSelector('.notification-success', function onSuccess() {
|
|
test.assert(true, 'Got success notification');
|
|
}, function onTimeout() {
|
|
test.assert(false, 'No success notification :(');
|
|
});
|
|
});
|
|
|
|
// TODO: test publishing, editing, republishing, unpublishing etc
|
|
//CasperTest.begin("Ghost edit published flow works correctly", 6, function suite(test) {
|
|
//
|
|
//
|
|
//
|
|
//});
|