This repository has been archived by the owner on Oct 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #401 from aldryn/feature/plugin-test
Add more integration tests
- Loading branch information
Showing
6 changed files
with
219 additions
and
443 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 0 additions & 109 deletions
109
aldryn_newsblog/tests/frontend/integration/pages/page.newsblog.crud.js
This file was deleted.
Oops, something went wrong.
93 changes: 93 additions & 0 deletions
93
aldryn_newsblog/tests/frontend/integration/related-articles.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
'use strict'; | ||
|
||
var helpers = require('djangocms-casper-helpers'); | ||
var globals = helpers.settings; | ||
var casperjs = require('casper'); | ||
var cms = helpers(casperjs); | ||
var xPath = casperjs.selectXPath; | ||
|
||
casper.test.setUp(function (done) { | ||
casper.start() | ||
.then(cms.login()) | ||
.run(done); | ||
}); | ||
|
||
casper.test.tearDown(function (done) { | ||
casper.start() | ||
.then(cms.logout()) | ||
.run(done); | ||
}); | ||
|
||
casper.test.begin('Related articles', function (test) { | ||
casper | ||
.then(cms.addPage({ title: 'Home' })) | ||
.thenOpen(globals.editUrl) | ||
.then(cms.openSideframe()) | ||
// add articles | ||
.withFrame(0, function () { | ||
this.waitForSelector('.cms-pagetree-breadcrumbs') | ||
.then(function () { | ||
this.click('.cms-pagetree-breadcrumbs a:first-child'); | ||
}) | ||
.waitForUrl(/admin/) | ||
.waitForSelector('.dashboard', function () { | ||
this.click(xPath(cms.getXPathForAdminSection({ | ||
section: 'Aldryn News & Blog', | ||
row: 'Articles', | ||
link: 'Add' | ||
}))); | ||
}) | ||
.waitForSelector('#article_form', function () { | ||
test.assertDoesntExist('.field-related .add-related', 'Related articles "Add" are not shown'); | ||
|
||
this.fill('#article_form', { | ||
title: 'First article' | ||
}, false); | ||
|
||
}) | ||
// wait 3 seconds so the second article is definitely | ||
// created after the first one :) | ||
.wait(3000, function () { | ||
this.click('input[value="Save and add another"]'); | ||
}) | ||
.waitForSelector('.success', function () { | ||
test.assertSelectorHasText( | ||
'.success', | ||
'The article "First article" was added successfully. You may add another article below.', | ||
'First article added' | ||
); | ||
|
||
test.assertDoesntExist('.field-related .add-related', 'Related articles "Add" are not shown'); | ||
test.assertSelectorHasText( | ||
'.sortedm2m', | ||
'First article', | ||
'Correct related articles possibilities are shown' | ||
); | ||
|
||
this.fill('#article_form', { | ||
title: 'Second article' | ||
}, true); | ||
}) | ||
.waitForSelector('#changelist-form', function () { | ||
this.click('th input[type="checkbox"]'); | ||
this.fill('#changelist-form', { | ||
action: 'delete_selected' | ||
}, true); | ||
|
||
}) | ||
.waitForSelector('.delete-confirmation', function () { | ||
this.click('input[value="Yes, I\'m sure"]'); | ||
}) | ||
.waitForSelector('.success', function () { | ||
test.assertSelectorHasText( | ||
'.success', | ||
'Successfully deleted 2 articles.', | ||
'Articles deleted' | ||
); | ||
}); | ||
}) | ||
.then(cms.removePage()) | ||
.run(function () { | ||
test.done(); | ||
}); | ||
}); |
Oops, something went wrong.