mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 04:45:23 +08:00
tests
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
{
|
||||
"sourceMaps": true,
|
||||
"presets": [
|
||||
"stage-0",
|
||||
"es2015"
|
||||
],
|
||||
"plugins": [
|
||||
["transform-decorators-legacy"],
|
||||
["transform-react-jsx"],
|
||||
["transform-object-assign"],
|
||||
["transform-class-properties"],
|
||||
["transform-async-to-generator"],
|
||||
["transform-object-rest-spread"],
|
||||
["transform-class-properties"]
|
||||
"add-module-exports",
|
||||
"transform-async-to-generator",
|
||||
"transform-class-properties",
|
||||
"transform-decorators-legacy",
|
||||
"transform-object-assign",
|
||||
"transform-object-rest-spread",
|
||||
"transform-react-jsx"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -9,10 +9,11 @@ import ForgotContent from './ForgotContent';
|
||||
const SignDialog = ({open, view, handleClose, offset, ...props}) => (
|
||||
<Dialog
|
||||
className={styles.dialog}
|
||||
id="signInDialog"
|
||||
open={open}
|
||||
style={{
|
||||
position: 'relative',
|
||||
top: offset !== 0 && offset
|
||||
top: offset !== 0 && offset
|
||||
}}>
|
||||
<span className={styles.close} onClick={handleClose}>×</span>
|
||||
{view === 'SIGNIN' && <SignInContent {...props} />}
|
||||
|
||||
+4
-4
@@ -20,7 +20,6 @@ module.exports = {
|
||||
'test_settings': {
|
||||
'default': {
|
||||
'launch_url' : 'http://localhost:3000',
|
||||
'globals' : {},
|
||||
'selenium_port': 6666,
|
||||
'selenium_host': 'localhost',
|
||||
'silent': true,
|
||||
@@ -39,11 +38,12 @@ module.exports = {
|
||||
'on_error': true,
|
||||
'path': './tests/e2e/reports'
|
||||
},
|
||||
'exclude': []
|
||||
'exclude': [
|
||||
'./tests/e2e/tests/EmbedStreamTests.js'
|
||||
]
|
||||
},
|
||||
'integration': {
|
||||
'launch_url': 'http://localhost:3000',
|
||||
'globals': {}
|
||||
'launch_url': 'http://localhost:3000'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+4
-3
@@ -11,7 +11,7 @@
|
||||
"lint-fix": "./node_modules/.bin/eslint bin/* . --fix",
|
||||
"test": "NODE_ENV=test ./node_modules/.bin/mocha --compilers js:babel-core/register tests/helpers/*.js --require ignore-styles --recursive tests",
|
||||
"test-watch": "NODE_ENV=test ./node_modules/.bin/mocha --compilers js:babel-core/register --recursive -w tests",
|
||||
"pree2e": "node_modules/selenium-standalone/bin/selenium-standalone install",
|
||||
"pree2e": "scripts/pree2e.sh",
|
||||
"e2e": "NODE_ENV=test nightwatch",
|
||||
"embed-start": "NODE_ENV=development npm run build && ./bin/cli serve --jobs"
|
||||
},
|
||||
@@ -74,10 +74,11 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^6.5.2",
|
||||
"babel-core": "^6.18.2",
|
||||
"babel-core": "^6.21.0",
|
||||
"babel-eslint": "^7.1.0",
|
||||
"babel-jest": "^15.0.0",
|
||||
"babel-loader": "^6.2.7",
|
||||
"babel-plugin-add-module-exports": "^0.2.1",
|
||||
"babel-plugin-transform-async-to-generator": "^6.16.0",
|
||||
"babel-plugin-transform-class-properties": "^6.18.0",
|
||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
||||
@@ -136,7 +137,7 @@
|
||||
"redux-mock-store": "^1.2.1",
|
||||
"redux-thunk": "^2.1.0",
|
||||
"regenerator": "^0.8.46",
|
||||
"selenium-standalone": "^5.8.0",
|
||||
"selenium-standalone": "latest",
|
||||
"style-loader": "^0.13.1",
|
||||
"supertest": "^2.0.1",
|
||||
"timeago.js": "^2.0.3",
|
||||
|
||||
+1
-4
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# install selenium
|
||||
# ../node_modules/selenium-standalone/bin/selenium-standalone install
|
||||
selenium-standalone install
|
||||
|
||||
# Creating Admin Test User
|
||||
{ echo admin@test.com; echo test; echo test; echo Admin Test User; echo admin;} | dotenv ./bin/cli-users create
|
||||
@@ -11,6 +11,3 @@
|
||||
|
||||
# Creating Commenter Test User
|
||||
{ echo test@test.com; echo test; echo test; echo Commenter Test User; echo '';} | dotenv ./bin/cli-users create
|
||||
|
||||
# start the app server
|
||||
# npm start &
|
||||
|
||||
+10
-3
@@ -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'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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'
|
||||
},
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user