This commit is contained in:
Belen Curcio
2016-12-18 11:31:27 -03:00
parent 27ffb05454
commit 428a62ffd4
18 changed files with 7402 additions and 81 deletions
+10 -3
View File
@@ -1,8 +1,15 @@
export default {
waitForConditionTimeout: 20000,
baseUrl: 'http://localhost:3000',
testUser: {
user: process.env.CORAL_TEST_USER,
pass: process.env.CORAL_TEST_PASS
users: {
admin: {
email: 'admin@test.com'
},
moderator: {
email: 'moderator@test.com'
},
commenter: {
email: 'commenter@test.com'
}
}
};
-25
View File
@@ -1,25 +0,0 @@
const Comments = require('../../models/comment');
const Users = require('../../models/user');
const Actions = require('../../models/action');
const Assets = require('../../models/asset');
const Settings = require('../../models/setting');
const globals = require('./globals');
/* Create an array of comments */
module.exports.comments = (comments) => Assets.findOrCreateByUrl(globals.baseUrl)
.then((asset) => {
comments = comments.map((comment) => {
comment.asset_id = asset.id;
return comment;
});
return Comments.create(comments);
});
/* Create an array of users */
module.exports.users = (users) => Users.createLocalUsers(users);
/* Create an array of actions */
module.exports.actions = (actions) => Actions.create(actions);
/* Update a setting */
module.exports.settings = (setting) => Settings.init().then(() => Settings.updateSettings(setting));
+15 -3
View File
@@ -1,12 +1,18 @@
const fetch = require('node-fetch');
const embedCommands = {
const embedStreamCommands = {
ready() {
return this.resizeWindow(1200, 800)
.url(client.globals.baseUrl)
.waitForElementVisible('body', 2000)
.frame('coralStreamIframe');
},
login(userData) {
return this
.waitForElementVisible('@signInButton')
.click('@signInButton')
.waitForElementVisible('@signInDialog');
},
setConfig(config, baseUrl) {
return fetch(`${baseUrl}/api/v1/settings`, {
method: 'PUT',
@@ -28,12 +34,18 @@ const embedCommands = {
validateComment(comment) {
return this
.assert.equal(comment, '.comment');
}
},
};
export default {
commands: [embedCommands],
commands: [embedStreamCommands],
elements: {
signInButton: {
selector: '#coralSignInButton'
},
signInDialog:{
selector: '#signInDialog'
},
commentBox: {
selector: '#commentBox'
},
+31
View File
@@ -0,0 +1,31 @@
const embedStreamCommands = {
ready() {
return this
.waitForElementVisible('body', 2000)
;
},
login() {
return this
.waitForElementVisible('@signInButton')
.click('@signInButton')
.waitForElementVisible('@signInDialog');
}
};
export default {
commands: [embedStreamCommands],
elements: {
signInButton: {
selector: '#coralSignInButton'
},
signInDialog:{
selector: '#signInDialog'
},
commentBox: {
selector: '#commentBox'
},
postButton: {
selector: '#commentBox .coral-plugin-commentbox-button'
}
}
};
+20
View File
@@ -0,0 +1,20 @@
module.exports = {
'@tags': ['login'],
before: client => {
const {launchUrl} = client;
client
.url(launchUrl)
.frame('coralStreamIframe');
},
'Commenter logs in': client => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.ready()
.login();
},
after: client => {
client.end();
}
};
+5
View File
@@ -0,0 +1,5 @@
export default {
'@tags': ['sign-up'],
'Commenter Sign Up': () => {
}
};
@@ -1,15 +0,0 @@
export default {
'@tags': ['login'],
'Commenter logs in': client => {
const embedStream = client.page.embedStream();
const { baseUrl, testUser } = client.globals;
// loginPage
// .navigate(baseUrl + '/login')
// .ready()
//
// loginPage.login(testUser)
// client.pause(2000);
}
}
@@ -1,15 +0,0 @@
export default {
'@tags': ['sign-up'],
'Commenter Sign Up': client => {
const embedStream = client.page.embedStream();
const { baseUrl, testUser } = client.globals;
// loginPage
// .navigate(baseUrl + '/login')
// .ready()
//
// loginPage.login(testUser)
// client.pause(2000);
}
}