Applying client.perform consistently.

This commit is contained in:
David Jay
2016-11-22 14:29:11 -05:00
parent 654e3580e7
commit 25c40fc212
2 changed files with 74 additions and 73 deletions
+4 -2
View File
@@ -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';
+70 -71
View File
@@ -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 => {