diff --git a/nightwatch.conf.js b/nightwatch.conf.js index 831b59701..fb6c5f9c7 100644 --- a/nightwatch.conf.js +++ b/nightwatch.conf.js @@ -47,6 +47,7 @@ module.exports = { } } }; + // "chromeOptions" : { // "args" : ["start-fullscreen"] // } diff --git a/scripts/pree2e.sh b/scripts/pree2e.sh index 405543454..df093945b 100755 --- a/scripts/pree2e.sh +++ b/scripts/pree2e.sh @@ -10,4 +10,4 @@ selenium-standalone install { echo moderator@test.com; echo test; echo test; echo Moderator Test User; echo moderator;} | dotenv ./bin/cli-users create # Creating Commenter Test User -{ echo test@test.com; echo test; echo test; echo Commenter Test User; echo '';} | dotenv ./bin/cli-users create +{ echo commenter@test.com; echo test; echo test; echo Commenter Test User; echo '';} | dotenv ./bin/cli-users create diff --git a/tests/e2e/pages/embedStreamPage.js b/tests/e2e/pages/embedStreamPage.js index d952c782f..5d1b819f1 100644 --- a/tests/e2e/pages/embedStreamPage.js +++ b/tests/e2e/pages/embedStreamPage.js @@ -1,9 +1,13 @@ const embedStreamCommands = { + url: function () { + return this + .api.launchUrl; + }, ready() { return this .waitForElementVisible('body', 2000) .waitForElementVisible('iframe#coralStreamIframe') - api.frame('coralStreamIframe'); + .api.frame('coralStreamIframe'); }, login(user) { return this @@ -16,6 +20,12 @@ const embedStreamCommands = { .setValue('@signInDialogPassword', user.pass) .waitForElementVisible('@logInButton') .click('@logInButton'); + }, + postComment(comment = 'Test Comment') { + return this + .waitForElementVisible('@commentBox', 2000) + .setValue('@commentBox', comment) + .click('@postButton'); } }; @@ -41,7 +51,7 @@ export default { selector: '#commentBox' }, postButton: { - selector: '#commentBox .coral-plugin-commentbox-button' + selector: '#commentBox .coral-plugin-commentbox-button button' } } }; diff --git a/tests/e2e/tests/Admin/LoginTest.js b/tests/e2e/tests/Admin/LoginTest.js index 215e88a5a..4563cb24f 100644 --- a/tests/e2e/tests/Admin/LoginTest.js +++ b/tests/e2e/tests/Admin/LoginTest.js @@ -1,22 +1,21 @@ -module.exports = { - '@tags': ['login'], - before: client => { +export default { + '@tags': ['login', 'admin'], + before(client) { const embedStreamPage = client.page.embedStreamPage(); const {launchUrl} = client; client - .url(launchUrl) + .url(launchUrl); embedStreamPage .ready(); }, - 'Commenter logs in': client => { + 'Admin logs in': client => { const {users} = client.globals; const embedStreamPage = client.page.embedStreamPage(); embedStreamPage - .login(users.commenter); - + .login(users.admin); }, after: client => { client.end(); diff --git a/tests/e2e/tests/Commenter/LoginTest.js b/tests/e2e/tests/Commenter/LoginTest.js index 215e88a5a..15c830c74 100644 --- a/tests/e2e/tests/Commenter/LoginTest.js +++ b/tests/e2e/tests/Commenter/LoginTest.js @@ -1,13 +1,10 @@ module.exports = { - '@tags': ['login'], + '@tags': ['login', 'commenter'], before: client => { const embedStreamPage = client.page.embedStreamPage(); - const {launchUrl} = client; - - client - .url(launchUrl) embedStreamPage + .navigate() .ready(); }, 'Commenter logs in': client => { @@ -16,7 +13,6 @@ module.exports = { embedStreamPage .login(users.commenter); - }, after: client => { client.end(); diff --git a/tests/e2e/tests/Commenter/PostComment.js b/tests/e2e/tests/Commenter/PostComment.js new file mode 100644 index 000000000..3e4bd91a6 --- /dev/null +++ b/tests/e2e/tests/Commenter/PostComment.js @@ -0,0 +1,23 @@ +module.exports = { + '@tags': ['write', 'commenter'], + before: client => { + const embedStreamPage = client.page.embedStreamPage(); + const {users} = client.globals; + + embedStreamPage + .navigate() + .ready(); + + embedStreamPage + .login(users.commenter); + }, + 'Commenter posts a comment': client => { + const embedStreamPage = client.page.embedStreamPage(); + + embedStreamPage + .postComment('I read the comments'); + }, + after: client => { + client.end(); + } +}; diff --git a/tests/e2e/tests/Moderator/LoginTest.js b/tests/e2e/tests/Moderator/LoginTest.js index 215e88a5a..d8f43b6d3 100644 --- a/tests/e2e/tests/Moderator/LoginTest.js +++ b/tests/e2e/tests/Moderator/LoginTest.js @@ -1,22 +1,21 @@ -module.exports = { - '@tags': ['login'], +export default { + '@tags': ['login', 'moderator'], before: client => { const embedStreamPage = client.page.embedStreamPage(); const {launchUrl} = client; client - .url(launchUrl) + .url(launchUrl); embedStreamPage - .ready(); + .ready(); }, - 'Commenter logs in': client => { + 'Moderator logs in': client => { const {users} = client.globals; const embedStreamPage = client.page.embedStreamPage(); embedStreamPage - .login(users.commenter); - + .login(users.moderator); }, after: client => { client.end();