diff --git a/tests/e2e/pages/embedStream.js b/tests/e2e/pages/embedStream.js index db8f441f7..605b42d74 100644 --- a/tests/e2e/pages/embedStream.js +++ b/tests/e2e/pages/embedStream.js @@ -1,7 +1,9 @@ const embedCommands = { ready() { - return this - .waitForElementVisible('body', 1000); + return this.resizeWindow(1200, 800) + .url(client.globals.baseUrl) + .waitForElementVisible('body', 2000) + .frame('coralStreamIframe'); }, enterComment() { const comment = 'This is a test comment'; diff --git a/tests/e2e/tests/EmbedStreamTests.js b/tests/e2e/tests/EmbedStreamTests.js index d9f892b5a..3396f473d 100644 --- a/tests/e2e/tests/EmbedStreamTests.js +++ b/tests/e2e/tests/EmbedStreamTests.js @@ -11,86 +11,85 @@ const mockUser = { module.exports = { '@tags': ['embed-stream', 'post'], 'User Registers and posts a comment with premod off': client => { - fetch(`${client.globals.baseUrl}/api/v1/settings`, { - method: 'PUT', - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }, - body: JSON.stringify({ - moderation: 'post' - }) - }).then(() => { - //Load Page - client.resizeWindow(1200, 800) - .url(client.globals.baseUrl) - .frame('coralStreamIframe') + client.perform((client, done) => { + return fetch(`${client.globals.baseUrl}/api/v1/settings`, { + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json' + }, + body: JSON.stringify({ + moderation: 'post' + }) + }).then(() => { + //Load Page + client.resizeWindow(1200, 800) + .url(client.globals.baseUrl) + .frame('coralStreamIframe') - //Register and Log In - .waitForElementVisible('#commentBox', 1000) - .waitForElementVisible('#coralSignInButton', 2000) - .click('#coralSignInButton') - .waitForElementVisible('#coralRegister', 1000) - .click('#coralRegister') - .waitForElementVisible('#email', 1000) - .setValue('#email', mockUser.email) - .setValue('#displayName', mockUser.name) - .setValue('#password', mockUser.pw) - .setValue('#confirmPassword', mockUser.pw) - .click('#coralSignUpButton') - .waitForElementVisible('#coralLogInButton', 10000) - .click('#coralLogInButton') - .waitForElementVisible('#commentBox', 3000) + //Register and Log In + .waitForElementVisible('#commentBox', 1000) + .waitForElementVisible('#coralSignInButton', 2000) + .click('#coralSignInButton') + .waitForElementVisible('#coralRegister', 1000) + .click('#coralRegister') + .waitForElementVisible('#email', 1000) + .setValue('#email', mockUser.email) + .setValue('#displayName', mockUser.name) + .setValue('#password', mockUser.pw) + .setValue('#confirmPassword', mockUser.pw) + .click('#coralSignUpButton') + .waitForElementVisible('#coralLogInButton', 10000) + .click('#coralLogInButton') + .waitForElementVisible('#commentBox .coral-plugin-commentbox-button', 3000) - // Post a comment - .setValue('#commentBox .coral-plugin-commentbox-textarea', mockComment) - .click('#commentBox .coral-plugin-commentbox-button') - .waitForElementVisible('.comment', 1000) + // Post a comment + .setValue('#commentBox .coral-plugin-commentbox-textarea', mockComment) + .click('#commentBox .coral-plugin-commentbox-button') + .waitForElementVisible('.comment', 1000) - //Verify that it appears - .assert.containsText('.comment', mockComment); + //Verify that it appears + .assert.containsText('.comment', mockComment); + done(); + }); }); }, 'User Registers and posts a comment with premod on': client => { - fetch(`${client.globals.baseUrl}/api/v1/settings`, { - method: 'PUT', - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }, - body: JSON.stringify({ - moderation: 'pre' - }) - }).then(() => { - //Load Page - client.resizeWindow(1200, 800) - .url(client.globals.baseUrl) - .waitForElementVisible('body', 2000) - .frame('coralStreamIframe') + client.perform((client, done) => { + fetch(`${client.globals.baseUrl}/api/v1/settings`, { + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json' + }, + body: JSON.stringify({ + moderation: 'pre' + }) + }).then(() => { + //Load Page + client.resizeWindow(1200, 800) + .url(client.globals.baseUrl) + .frame('coralStreamIframe'); - //Register and Log In - .waitForElementVisible('#commentBox', 10000) - .waitForElementVisible('#coralSignInButton', 2000) - .click('#coralSignInButton') - .waitForElementVisible('#coralRegister', 1000) - .click('#coralRegister') - .waitForElementVisible('#email', 1000) - .setValue('#email', mockUser.email) - .setValue('#displayName', mockUser.name) - .setValue('#password', mockUser.pw) - .setValue('#confirmPassword', mockUser.pw) - .click('#coralSignUpButton') - .waitForElementVisible('#coralLogInButton', 10000) - .click('#coralLogInButton') - .waitForElementVisible('#commentBox', 3000) + //Log In + client.waitForElementVisible('#commentBox', 10000) + .waitForElementVisible('#coralSignInButton', 2000) + .click('#coralSignInButton') + .waitForElementVisible('#coralLogInButton', 1000) + .setValue('#email', mockUser.email) + .setValue('#password', mockUser.pw) + .click('#coralLogInButton'); - // Post a comment - .setValue('#commentBox .coral-plugin-commentbox-textarea', mockComment) - .click('#commentBox .coral-plugin-commentbox-button') - .waitForElementVisible('#coral-notif', 1000) + // Post a comment + client.waitForElementVisible('#commentBox .coral-plugin-commentbox-button', 2000) + .setValue('#commentBox .coral-plugin-commentbox-textarea', mockComment) + .click('#commentBox .coral-plugin-commentbox-button') + .waitForElementVisible('#coral-notif', 1000) - //Verify that it appears - .assert.containsText('#coral-notif', 'moderation team'); + //Verify that it appears + .assert.containsText('#coral-notif', 'moderation team'); + done(); + }); }); }, after: client => {