0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-18 02:21:47 -05:00

Improving regexes in functional tests

- being more explicit about what resources we expect to load after saving
  a post
- should prevent #1839 from failing tests
This commit is contained in:
Hannah Wolfe 2014-01-05 20:54:01 +00:00
parent 28f7a7d12d
commit 05dd48feb7
4 changed files with 8 additions and 7 deletions

View file

@ -17,7 +17,7 @@ CasperTest.begin("Content screen is correct", 20, function suite(test) {
casper.thenClick('.js-publish-button');
casper.waitForResource(/posts/, function checkPostWasCreated() {
casper.waitForResource(/posts\/$/, function checkPostWasCreated() {
test.assertExists('.notification-success', 'got success notification');
});

View file

@ -33,7 +33,7 @@ CasperTest.begin("Ghost editor is correct", 10, function suite(test) {
casper.thenClick('.js-publish-button');
casper.waitForResource(/posts/, function checkPostWasCreated() {
casper.waitForResource(/\/posts\/$/, function checkPostWasCreated() {
var urlRegExp = new RegExp("^" + escapedUrl + "ghost\/editor\/[0-9]*");
test.assertUrlMatch(urlRegExp, 'got an id on our URL');
test.assertExists('.notification-success', 'got success notification');
@ -164,7 +164,7 @@ CasperTest.begin('Publish menu - existing post', 22, function suite(test) {
// Create a post in draft status
casper.thenClick('.js-publish-button');
casper.waitForResource(/posts/, function checkPostWasCreated() {
casper.waitForResource(/posts\/$/, function checkPostWasCreated() {
var urlRegExp = new RegExp("^" + escapedUrl + "ghost\/editor\/[0-9]*");
test.assertUrlMatch(urlRegExp, 'got an id on our URL');
});
@ -201,7 +201,7 @@ CasperTest.begin('Publish menu - existing post', 22, function suite(test) {
// Publish the post
casper.thenClick('.js-publish-button');
casper.waitForResource(/posts/, function checkPostWasCreated() {
casper.waitForResource(/posts\/$/, function checkPostWasCreated() {
var urlRegExp = new RegExp("^" + escapedUrl + "ghost\/editor\/[0-9]*");
test.assertUrlMatch(urlRegExp, 'got an id on our URL');
});

View file

@ -18,7 +18,7 @@ CasperTest.begin("Ghost edit draft flow works correctly", 8, function suite(test
});
casper.thenClick('.js-publish-button');
casper.waitForResource(/posts/);
casper.waitForResource(/posts\/$/);
casper.waitForSelector('.notification-success', function onSuccess() {
test.assert(true, 'Got success notification');
@ -43,7 +43,7 @@ CasperTest.begin("Ghost edit draft flow works correctly", 8, function suite(test
});
casper.thenClick('.js-publish-button');
casper.waitForResource(/posts/);
casper.waitForResource(/posts\/[0-9]+\/$/);
casper.waitForSelector('.notification-success', function onSuccess() {
test.assert(true, 'Got success notification');

View file

@ -20,8 +20,9 @@ CasperTest.begin("Ghost logout works correctly", 2, function suite(test) {
});
});
casper.waitForSelector('.usermenu-signout a');
casper.thenClick('.usermenu-signout a');
casper.waitForResource(/signin/);
casper.waitForResource(/ghost\/signin/);
casper.waitForSelector('.notification-success', function onSuccess() {
test.assert(true, 'Got success notification');