mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-18 02:21:47 -05:00
Fix up tests post-changes to content and editor screen
No Issue - some tests removed - other tests commented out pending tags adding to psm
This commit is contained in:
parent
5b25dd2929
commit
3f5ac66e47
4 changed files with 40 additions and 93 deletions
|
@ -469,8 +469,9 @@ CasperTest.Routines = (function () {
|
|||
casper.thenOpenAndWaitForPageLoad('editor', function createTestPost() {
|
||||
casper.sendKeys('#entry-title', testPost.title);
|
||||
casper.writeContentToEditor(testPost.html);
|
||||
casper.sendKeys('#entry-tags input.tag-input', 'TestTag');
|
||||
casper.sendKeys('#entry-tags input.tag-input', casper.page.event.key.Enter);
|
||||
// TODO move these into psm tests when tags have been added there
|
||||
// casper.sendKeys('#entry-tags input.tag-input', 'TestTag');
|
||||
// casper.sendKeys('#entry-tags input.tag-input', casper.page.event.key.Enter);
|
||||
});
|
||||
|
||||
casper.waitForSelectorTextChange('.entry-preview .rendered-markdown');
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// # Content Test
|
||||
// Test the content screen, uses the editor to create dummy content
|
||||
|
||||
/*globals CasperTest, casper, testPost, newUser */
|
||||
/*globals CasperTest, casper, testPost */
|
||||
|
||||
CasperTest.begin('Content screen is correct', 17, function suite(test) {
|
||||
CasperTest.begin('Content screen is correct', 15, function suite(test) {
|
||||
// First, create a sample post for testing (this should probably be a routine)
|
||||
CasperTest.Routines.createTestPost.run(false);
|
||||
|
||||
|
@ -29,12 +29,6 @@ CasperTest.begin('Content screen is correct', 17, function suite(test) {
|
|||
'.content-list-content li:first-of-type .entry-meta .status .draft', 'Draft', 'correct status is present'
|
||||
);
|
||||
test.assertExists('.content-preview', 'Content preview is present');
|
||||
test.assertSelectorHasText(
|
||||
'.content-preview header .status', 'Written', 'preview header contains "Written" when post is a draft'
|
||||
);
|
||||
test.assertSelectorHasText(
|
||||
'.content-preview header .author', newUser.name, 'preview header contains author name'
|
||||
);
|
||||
});
|
||||
|
||||
casper.then(function testEditPostButton() {
|
||||
|
@ -52,7 +46,7 @@ CasperTest.begin('Content screen is correct', 17, function suite(test) {
|
|||
});
|
||||
});
|
||||
|
||||
CasperTest.begin('Content list shows correct post status', 5, function testStaticPageStatus(test) {
|
||||
CasperTest.begin('Content list shows correct post status', 3, function testStaticPageStatus(test) {
|
||||
CasperTest.Routines.createTestPost.run(true);
|
||||
|
||||
// Begin test
|
||||
|
@ -70,16 +64,6 @@ CasperTest.begin('Content list shows correct post status', 5, function testStati
|
|||
'status is present and labeled as published');
|
||||
});
|
||||
|
||||
// Test for 'Published' in header
|
||||
casper.then(function testHeader() {
|
||||
test.assertSelectorHasText(
|
||||
'.content-preview header .status', 'Published', 'preview header contains "Published" when post is published'
|
||||
);
|
||||
test.assertSelectorHasText(
|
||||
'.content-preview header .author', newUser.name, 'preview header contains author name'
|
||||
);
|
||||
});
|
||||
|
||||
casper.thenClick('.post-edit');
|
||||
casper.waitForSelector('#entry-title');
|
||||
|
||||
|
@ -108,41 +92,3 @@ CasperTest.begin('Content list shows correct post status', 5, function testStati
|
|||
// test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||
// });
|
||||
// });
|
||||
|
||||
CasperTest.begin('Posts can be marked as featured', 6, function suite(test) {
|
||||
// Create a sample post
|
||||
CasperTest.Routines.createTestPost.run(false);
|
||||
|
||||
// Begin test
|
||||
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
||||
test.assertTitle('Content - Test Blog', 'Title is "Content - Test Blog"');
|
||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||
});
|
||||
|
||||
// Mark as featured
|
||||
casper.waitForSelector('.content-preview .unfeatured', function () {
|
||||
this.click('.content-preview .unfeatured');
|
||||
}, function onTimeOut() {
|
||||
test.assert(false, 'The first post can\'t be marked as featured');
|
||||
});
|
||||
|
||||
casper.waitForResource(/\/posts\/\d+\/\?include=tags/, function (resource) {
|
||||
test.assert(resource.status < 400, 'resource.status < 400');
|
||||
});
|
||||
|
||||
casper.waitForSelector('.content-list-content li.featured:first-of-type', function () {
|
||||
test.assertExists('.content-preview .featured', 'preview pane gets featured class');
|
||||
test.assertExists('.content-list-content li.featured:first-of-type', 'content list got a featured star');
|
||||
}, function onTimeout() {
|
||||
test.assert(false, 'No featured star appeared in the left pane');
|
||||
});
|
||||
|
||||
// Mark as not featured
|
||||
casper.thenClick('.content-preview .featured');
|
||||
|
||||
casper.waitWhileSelector('.content-preview .featured', function onSuccess() {
|
||||
test.assertDoesntExist('.content-list-content li.featured:first-of-type', '.content-list-content li.featured:first-of-type does not exist');
|
||||
}, function onTimeout() {
|
||||
casper.test.fail('Couldn\'t unfeature post.');
|
||||
}, 2000);
|
||||
});
|
||||
|
|
|
@ -249,40 +249,6 @@ CasperTest.begin('Image Uploads', 23, function suite(test) {
|
|||
// }, casper.failOnTimeout(test, 'Editor did not load'));
|
||||
});
|
||||
|
||||
CasperTest.begin('Tag editor', 7, function suite(test) {
|
||||
casper.thenOpenAndWaitForPageLoad('editor', function testTitleAndUrl() {
|
||||
test.assertTitle('Editor - Test Blog', 'Ghost admin has incorrect title');
|
||||
test.assertUrlMatch(/ghost\/editor\/$/, 'Landed on the correct URL');
|
||||
});
|
||||
|
||||
var tagName = 'someTagName',
|
||||
createdTagSelector = '#entry-tags .tags .tag';
|
||||
|
||||
casper.then(function () {
|
||||
test.assertExists('#entry-tags', 'should have tag label area');
|
||||
test.assertExists('#entry-tags .tag-label', 'should have tag label icon');
|
||||
test.assertExists('#entry-tags input.tag-input', 'should have tag input area');
|
||||
});
|
||||
|
||||
casper.thenClick('#entry-tags input.tag-input');
|
||||
casper.then(function () {
|
||||
casper.sendKeys('#entry-tags input.tag-input', tagName, {keepFocus: true});
|
||||
});
|
||||
casper.then(function () {
|
||||
casper.sendKeys('#entry-tags input.tag-input', casper.page.event.key.Enter);
|
||||
});
|
||||
|
||||
casper.waitForSelector(createdTagSelector, function onSuccess() {
|
||||
test.assertSelectorHasText(createdTagSelector, tagName, 'typing enter after tag name should create tag');
|
||||
});
|
||||
|
||||
casper.thenClick(createdTagSelector);
|
||||
|
||||
casper.waitWhileSelector(createdTagSelector, function onSuccess() {
|
||||
test.assert(true, 'clicking the tag should delete the tag');
|
||||
});
|
||||
});
|
||||
|
||||
CasperTest.begin('Publish menu - new post', 10, function suite(test) {
|
||||
casper.thenOpenAndWaitForPageLoad('editor', function testTitleAndUrl() {
|
||||
test.assertTitle('Editor - Test Blog', 'Ghost admin has incorrect title');
|
||||
|
|
|
@ -190,3 +190,37 @@ CasperTest.begin('Post url input is reset from all whitespace back to original v
|
|||
test.assertEquals(slugVal, originalSlug, 'slug gets reset to original value');
|
||||
});
|
||||
});
|
||||
// TODO this test is from editor_test and needs to come back in some form when tags are moved into PSM
|
||||
// CasperTest.begin('Tag editor', 7, function suite(test) {
|
||||
// casper.thenOpenAndWaitForPageLoad('editor', function testTitleAndUrl() {
|
||||
// test.assertTitle('Editor - Test Blog', 'Ghost admin has incorrect title');
|
||||
// test.assertUrlMatch(/ghost\/editor\/$/, 'Landed on the correct URL');
|
||||
// });
|
||||
//
|
||||
// var tagName = 'someTagName',
|
||||
// createdTagSelector = '#entry-tags .tags .tag';
|
||||
//
|
||||
// casper.then(function () {
|
||||
// test.assertExists('#entry-tags', 'should have tag label area');
|
||||
// test.assertExists('#entry-tags .tag-label', 'should have tag label icon');
|
||||
// test.assertExists('#entry-tags input.tag-input', 'should have tag input area');
|
||||
// });
|
||||
//
|
||||
// casper.thenClick('#entry-tags input.tag-input');
|
||||
// casper.then(function () {
|
||||
// casper.sendKeys('#entry-tags input.tag-input', tagName, {keepFocus: true});
|
||||
// });
|
||||
// casper.then(function () {
|
||||
// casper.sendKeys('#entry-tags input.tag-input', casper.page.event.key.Enter);
|
||||
// });
|
||||
//
|
||||
// casper.waitForSelector(createdTagSelector, function onSuccess() {
|
||||
// test.assertSelectorHasText(createdTagSelector, tagName, 'typing enter after tag name should create tag');
|
||||
// });
|
||||
//
|
||||
// casper.thenClick(createdTagSelector);
|
||||
//
|
||||
// casper.waitWhileSelector(createdTagSelector, function onSuccess() {
|
||||
// test.assert(true, 'clicking the tag should delete the tag');
|
||||
// });
|
||||
// });
|
||||
|
|
Loading…
Add table
Reference in a new issue