mirror of
https://github.com/wassname/talk.git
synced 2026-07-19 11:28:50 +08:00
Adding second test.
This commit is contained in:
@@ -126,8 +126,8 @@ class SignInContainer extends Component {
|
||||
render() {
|
||||
const {auth, showSignInDialog} = this.props;
|
||||
return (
|
||||
<div id='coralSignInButton'>
|
||||
<Button onClick={showSignInDialog}>
|
||||
<div>
|
||||
<Button id='coralSignInButton' onClick={showSignInDialog}>
|
||||
Sign in to comment
|
||||
</Button>
|
||||
<SignDialog
|
||||
|
||||
@@ -3,15 +3,15 @@ const fetch = require('node-fetch');
|
||||
|
||||
const mockComment = 'This is a test comment.';
|
||||
const mockUser = {
|
||||
email: `${new Date().getTime()}@test4.com`,
|
||||
email: `${new Date().getTime()}@test.com`,
|
||||
name: 'Test User',
|
||||
pw: 'testtesttest'
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
'@tags': ['embed-stream', 'post'],
|
||||
beforeEach: client => {
|
||||
return fetch(`${client.globals.baseUrl}/api/v1/settings`, {
|
||||
'User Registers and posts a comment with premod off': client => {
|
||||
fetch(`${client.globals.baseUrl}/api/v1/settings`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -20,30 +20,78 @@ module.exports = {
|
||||
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)
|
||||
|
||||
// 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);
|
||||
});
|
||||
},
|
||||
'User signs in and posts a comment': client => {
|
||||
client.resizeWindow(1200, 800)
|
||||
.url(client.globals.baseUrl)
|
||||
.frame('coralStreamIframe')
|
||||
.waitForElementVisible('#commentBox', 1000)
|
||||
.waitForElementVisible('#coralSignInButton', 2000)
|
||||
.click('#coralSignInButton button')
|
||||
.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)
|
||||
.setValue('#commentBox .coral-plugin-commentbox-textarea', mockComment)
|
||||
.click('#commentBox .coral-plugin-commentbox-button')
|
||||
.waitForElementVisible('.comment', 1000)
|
||||
.assert.containsText('.comment', mockComment);
|
||||
'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')
|
||||
|
||||
//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)
|
||||
|
||||
// Post a comment
|
||||
.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');
|
||||
});
|
||||
},
|
||||
after: client => {
|
||||
utils.after();
|
||||
|
||||
Reference in New Issue
Block a user