2013-09-16 13:11:17 +02:00
|
|
|
/**
|
|
|
|
* Tests if RSS exists and is working
|
|
|
|
*/
|
2014-01-01 11:17:35 +00:00
|
|
|
/*globals url, CasperTest, casper */
|
2014-07-10 12:00:51 +02:00
|
|
|
CasperTest.begin('Ensure that RSS is available', 10, function suite(test) {
|
2014-01-03 00:37:21 +00:00
|
|
|
CasperTest.Routines.togglePermalinks.run('off');
|
2013-10-07 20:39:33 -05:00
|
|
|
casper.thenOpen(url + 'rss/', function (response) {
|
2013-12-28 19:15:14 -05:00
|
|
|
var content = this.getPageContent(),
|
2014-06-25 14:12:48 +02:00
|
|
|
siteTitle = '<title><![CDATA[Test Blog]]></title>',
|
|
|
|
siteDescription = '<description><![CDATA[Thoughts, stories and ideas by Test User]]></description>',
|
2014-01-03 00:37:21 +00:00
|
|
|
siteUrl = '<link>http://127.0.0.1:2369/</link>',
|
2013-12-28 19:15:14 -05:00
|
|
|
postTitle = '<![CDATA[Welcome to Ghost]]>',
|
2014-03-20 12:19:52 +00:00
|
|
|
postStart = '<description><![CDATA[<p>You\'re live!',
|
2013-12-28 19:15:14 -05:00
|
|
|
postEnd = 'you think :)</p>]]></description>',
|
|
|
|
postLink = '<link>http://127.0.0.1:2369/welcome-to-ghost/</link>',
|
|
|
|
postCreator = '<dc:creator><![CDATA[Test User]]>';
|
|
|
|
|
2013-09-16 13:11:17 +02:00
|
|
|
test.assertEqual(response.status, 200, 'Response status should be 200.');
|
2013-12-28 19:15:14 -05:00
|
|
|
test.assert(content.indexOf('<rss') >= 0, 'Feed should contain <rss');
|
|
|
|
test.assert(content.indexOf(siteTitle) >= 0, 'Feed should contain blog title.');
|
|
|
|
test.assert(content.indexOf(siteDescription) >= 0, 'Feed should contain blog description.');
|
|
|
|
test.assert(content.indexOf(siteUrl) >= 0, 'Feed should contain link to blog.');
|
|
|
|
test.assert(content.indexOf(postTitle) >= 0, 'Feed should contain welcome post title.');
|
|
|
|
test.assert(content.indexOf(postStart) >= 0, 'Feed should contain start of welcome post content.');
|
|
|
|
test.assert(content.indexOf(postEnd) >= 0, 'Feed should contain end of welcome post content.');
|
|
|
|
test.assert(content.indexOf(postLink) >= 0, 'Feed should have link to the welcome post.');
|
2014-07-10 12:00:51 +02:00
|
|
|
// TODO: Broken while setup doen't take over Owner user, please uncomment when fixed
|
|
|
|
// test.assert(content.indexOf(postCreator) >= 0, 'Welcome post should have Test User as the creator.');
|
2013-12-28 19:15:14 -05:00
|
|
|
test.assert(content.indexOf('</rss>') >= 0, 'Feed should contain </rss>');
|
2013-09-16 13:11:17 +02:00
|
|
|
});
|
2014-01-01 11:17:35 +00:00
|
|
|
}, false);
|
2013-12-28 19:15:14 -05:00
|
|
|
|
2014-07-10 12:00:51 +02:00
|
|
|
CasperTest.begin('Ensure that author element is not included. Only dc:creator', 2, function suite(test) {
|
2014-02-05 13:59:07 +08:00
|
|
|
CasperTest.Routines.togglePermalinks.run('off');
|
2014-03-20 12:19:52 +00:00
|
|
|
casper.thenOpen(url + 'rss/', function (response) {
|
2014-02-05 13:59:07 +08:00
|
|
|
var content = this.getPageContent(),
|
|
|
|
author = '<author>',
|
|
|
|
postCreator = '<dc:creator><![CDATA[Test User]]>';
|
|
|
|
|
|
|
|
test.assertEqual(response.status, 200, 'Response status should be 200.');
|
|
|
|
test.assert(content.indexOf(author) < 0, 'Author element should not be included');
|
2014-07-10 12:00:51 +02:00
|
|
|
// TODO: Broken while setup doen't take over Owner user, please uncomment when fixed
|
|
|
|
// test.assert(content.indexOf(postCreator) >= 0, 'Welcome post should have Test User as the creator.');
|
2014-03-20 12:19:52 +00:00
|
|
|
});
|
2014-02-05 13:59:07 +08:00
|
|
|
}, false);
|
|
|
|
|
2013-12-30 02:03:29 -05:00
|
|
|
CasperTest.begin('Ensures dated permalinks works with RSS', 2, function suite(test) {
|
2014-01-01 11:17:35 +00:00
|
|
|
CasperTest.Routines.togglePermalinks.run('on');
|
|
|
|
casper.thenOpen(url + 'rss/', function (response) {
|
|
|
|
var content = this.getPageContent(),
|
|
|
|
today = new Date(),
|
|
|
|
dd = ("0" + today.getDate()).slice(-2),
|
|
|
|
mm = ("0" + (today.getMonth() + 1)).slice(-2),
|
|
|
|
yyyy = today.getFullYear(),
|
|
|
|
postLink = '/' + yyyy + '/' + mm + '/' + dd + '/welcome-to-ghost/';
|
2013-12-28 19:15:14 -05:00
|
|
|
|
2014-01-01 11:17:35 +00:00
|
|
|
test.assertEqual(response.status, 200, 'Response status should be 200.');
|
|
|
|
test.assert(content.indexOf(postLink) >= 0, 'Feed should have dated permalink.');
|
|
|
|
});
|
2014-01-03 00:37:21 +00:00
|
|
|
CasperTest.Routines.togglePermalinks.run('off');
|
2014-01-01 11:17:35 +00:00
|
|
|
}, false);
|
2014-04-23 10:47:25 +01:00
|
|
|
|
|
|
|
CasperTest.begin('Ensure that character set is UTF-8 for RSS feed', 1, function suite(test) {
|
|
|
|
CasperTest.Routines.togglePermalinks.run('off');
|
|
|
|
casper.thenOpen(url + 'rss/', function (response) {
|
|
|
|
test.assertEqual(response.headers.get('Content-Type'), 'text/xml; charset=UTF-8', 'Content type should include UTF-8 character set encoding.');
|
|
|
|
});
|
|
|
|
}, false);
|
|
|
|
|