removed old deps + outdated e2e

This commit is contained in:
Wyatt Johnson
2017-08-19 09:59:46 -06:00
parent 6c19b90652
commit a7a80a452b
29 changed files with 151 additions and 2157 deletions
+56 -73
View File
@@ -6,7 +6,7 @@
"scripts": {
"postinstall": "./bin/cli plugins reconcile --skip-remote",
"start": "./bin/cli serve -j -w",
"dev-start": "nodemon -w . -w bin/cli -w bin/cli-serve --config .nodemon.json --exec \"WEBPACK=TRUE NODE_ENV=test ./scripts/generateIntrospectionResult.js && ./bin/cli -c .env serve -j -w\"",
"dev-start": "nodemon -w . -w bin/cli -w bin/cli-serve --config .nodemon.json --exec \"yarn generate-introspection && ./bin/cli -c .env serve -j -w\"",
"prebuild": "yarn generate-introspection",
"build": "WEBPACK=TRUE NODE_ENV=production webpack -p --config webpack.config.js --bail",
"prebuild-watch": "yarn generate-introspection",
@@ -15,10 +15,6 @@
"lint-fix": "eslint bin/* . --fix",
"test": "TEST_MODE=unit NODE_ENV=test mocha -R ${MOCHA_REPORTER:-spec}",
"test-cover": "TEST_MODE=unit NODE_ENV=test istanbul cover _mocha --report text --check-coverage -- -R spec",
"pree2e": "NODE_ENV=test TALK_PORT=3011 scripts/pree2e.sh",
"e2e": "NODE_ENV=test nightwatch",
"poste2e": "NODE_ENV=test scripts/poste2e.sh",
"embed-start": "NODE_ENV=development yarn build && ./bin/cli serve --jobs",
"heroku-postbuild": "./bin/cli plugins reconcile && yarn build",
"generate-introspection": "WEBPACK=TRUE NODE_ENV=test ./scripts/generateIntrospectionResult.js"
},
@@ -59,8 +55,23 @@
"homepage": "https://github.com/coralproject/talk#readme",
"dependencies": {
"accepts": "^1.3.3",
"apollo-client": "^1.9.1",
"app-module-path": "^2.2.0",
"async": "^2.5.0",
"autoprefixer": "^6.5.2",
"babel-cli": "^6.24.0",
"babel-core": "^6.24.0",
"babel-eslint": "^7.2.1",
"babel-loader": "^6.4.1",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-async-to-generator": "^6.16.0",
"babel-plugin-transform-class-properties": "^6.23.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-object-assign": "^6.8.0",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-react-jsx": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-react": "^6.23.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.17.1",
"bowser": "^1.7.0",
@@ -68,39 +79,53 @@
"clipboard": "^1.7.1",
"colors": "^1.1.2",
"commander": "^2.9.0",
"common-tags": "^1.4.0",
"compression": "^1.6.2",
"connect-redis": "^3.1.0",
"compression-webpack-plugin": "^0.4.0",
"cookie-parser": "^1.4.3",
"copy-webpack-plugin": "^4.0.0",
"cross-spawn": "^5.1.0",
"csurf": "^1.9.0",
"css-loader": "^0.27.3",
"dataloader": "^1.3.0",
"debug": "^2.6.3",
"dialog-polyfill": "^0.4.4",
"dotenv": "^4.0.0",
"ejs": "^2.5.6",
"env-rewrite": "^1.0.2",
"eventemitter2": "^4.1.2",
"exports-loader": "^0.6.4",
"express": "^4.15.2",
"express-session": "^1.15.1",
"file-loader": "^0.11.2",
"form-data": "^2.1.2",
"fs-extra": "^3.0.1",
"gql-merge": "^0.0.4",
"graphql": "^0.9.1",
"graphql-docs": "^0.2.0",
"graphql-errors": "^2.1.0",
"graphql-redis-subscriptions": "^1.1.5",
"graphql-server-express": "^0.6.0",
"graphql-subscriptions": "^0.4.3",
"graphql-tag": "^1.2.3",
"graphql-tools": "^0.10.1",
"hammerjs": "^2.0.8",
"helmet": "^3.5.0",
"history": "^3.0.0",
"ignore-styles": "^5.0.1",
"immutability-helper": "^2.2.0",
"imports-loader": "^0.7.1",
"inquirer": "^3.2.1",
"istanbul": "^1.1.0-alpha.1",
"joi": "^10.4.1",
"json-loader": "^0.5.4",
"jsonwebtoken": "^7.3.0",
"jwt-decode": "^2.2.0",
"keymaster": "^1.6.2",
"kue": "^0.11.5",
"license-webpack-plugin": "^0.4.2",
"linkify-it": "^2.0.3",
"lodash": "^4.16.6",
"marked": "^0.3.6",
"material-design-lite": "^1.2.1",
"metascraper": "^1.0.6",
"minimist": "^1.2.0",
"mongoose": "^4.9.8",
@@ -114,55 +139,52 @@
"passport": "^0.3.2",
"passport-jwt": "^2.2.1",
"passport-local": "^1.0.0",
"postcss-loader": "^1.3.3",
"postcss-modules": "^0.5.2",
"postcss-smart-import": "^0.5.1",
"precss": "^1.4.0",
"prop-types": "^15.5.10",
"pym.js": "^1.1.1",
"query-strings": "^0.0.1",
"react": "^15.4.2",
"react-apollo": "^1.4.12",
"react-dom": "^15.4.2",
"react-highlight-words": "^0.6.0",
"react-input-autosize": "^1.1.4",
"react-linkify": "^0.1.3",
"react-mdl": "^1.7.2",
"react-mdl-selectfield": "^0.2.0",
"react-recaptcha": "^2.2.6",
"react-redux": "^4.4.5",
"react-router": "^3.0.0",
"react-tagsinput": "^3.17.0",
"react-toastify": "^1.5.0",
"react-transition-group": "^1.1.3",
"recompose": "^0.23.1",
"redis": "^2.7.1",
"redux": "^3.6.0",
"redux-thunk": "^2.1.0",
"resolve": "^1.3.2",
"semver": "^5.3.0",
"simplemde": "^1.11.2",
"smoothscroll-polyfill": "^0.3.5",
"snake-case": "^2.1.0",
"style-loader": "^0.16.0",
"subscriptions-transport-ws": "^0.7.2",
"timeago.js": "^2.0.3",
"timekeeper": "^1.0.0",
"url-loader": "^0.5.9",
"url-search-params": "^0.9.0",
"uuid": "^3.0.1",
"webpack": "^2.3.1",
"yaml-loader": "^0.4.0",
"yamljs": "^0.2.10"
},
"devDependencies": {
"apollo-client": "^1.9.1",
"autoprefixer": "^6.5.2",
"babel-cli": "^6.24.0",
"babel-core": "^6.24.0",
"babel-eslint": "^7.2.1",
"babel-jest": "^19.0.0",
"babel-loader": "^6.4.1",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-async-to-generator": "^6.16.0",
"babel-plugin-transform-class-properties": "^6.23.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-object-assign": "^6.8.0",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-react-jsx": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-react": "^6.23.0",
"babel-preset-stage-0": "^6.16.0",
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"chai-http": "^3.0.0",
"common-tags": "^1.4.0",
"compression-webpack-plugin": "^0.4.0",
"copy-webpack-plugin": "^4.0.0",
"css-loader": "^0.27.3",
"dialog-polyfill": "^0.4.4",
"enzyme": "^2.6.0",
"enzyme": "^2.9.1",
"eslint": "^3.12.1",
"eslint-config-postcss": "^2.0.2",
"eslint-config-standard": "^6.2.1",
@@ -173,50 +195,11 @@
"eslint-plugin-promise": "^3.3.1",
"eslint-plugin-react": "^6.6.0",
"eslint-plugin-standard": "^2.0.1",
"exports-loader": "^0.6.4",
"fetch-mock": "^5.5.0",
"graphql-docs": "^0.2.0",
"graphql-tag": "^1.2.3",
"hammerjs": "^2.0.8",
"history": "^3.0.0",
"ignore-styles": "^5.0.1",
"imports-loader": "^0.7.1",
"istanbul": "^1.1.0-alpha.1",
"jsdom": "^9.8.3",
"json-loader": "^0.5.4",
"keymaster": "^1.6.2",
"license-webpack-plugin": "^0.4.2",
"material-design-lite": "^1.2.1",
"mocha": "^3.1.2",
"mocha-junit-reporter": "^1.12.1",
"nightwatch": "^0.9.11",
"nodemon": "^1.11.0",
"postcss-loader": "^1.3.3",
"postcss-modules": "^0.5.2",
"postcss-smart-import": "^0.5.1",
"pre-git": "^3.10.0",
"precss": "^1.4.0",
"pym.js": "^1.1.1",
"react": "^15.4.2",
"react-addons-test-utils": "^15.4.2",
"react-dom": "^15.4.2",
"react-highlight-words": "^0.6.0",
"react-linkify": "^0.1.3",
"react-mdl": "^1.7.2",
"react-mdl-selectfield": "^0.2.0",
"react-redux": "^4.4.5",
"react-router": "^3.0.0",
"react-tagsinput": "^3.17.0",
"redux": "^3.6.0",
"redux-mock-store": "^1.2.1",
"redux-thunk": "^2.1.0",
"regenerator": "^0.8.46",
"selenium-standalone": "^5.11.2",
"style-loader": "^0.16.0",
"supertest": "^2.0.1",
"timeago.js": "^2.0.3",
"url-loader": "^0.5.9",
"webpack": "^2.3.1"
"supertest": "^2.0.1"
},
"engines": {
"node": "^8"
-10
View File
@@ -1,10 +0,0 @@
#!/bin/bash
# If there is a PID file from the e2e tests...
if [ -e /tmp/talk-e2e.pid ]
then
# Then kill the running talk server.
kill $(cat /tmp/talk-e2e.pid)
fi
-25
View File
@@ -1,25 +0,0 @@
#!/bin/bash
# fail the e2e if any of these fail
set -e
# install selenium
selenium-standalone install --config=./selenium.config.js
# Clear db
mongo test --eval "db.dropDatabase()"
# Init application
./bin/cli setup --defaults
# Creating Admin Test User
./bin/cli users create --flag_mode --email "admin@test.com" --password "testtest" --name "AdminTestUser" --role "ADMIN"
# Creating Moderator Test User
./bin/cli users create --flag_mode --email "moderator@test.com" --password "testtest" --name "ModeratorTestUser" --role "MODERATOR"
# Creating Commenter Test User
./bin/cli users create --flag_mode --email "commenter@test.com" --password "testtest" --name "CommenterTestUser"
# Start the server and write the PID to a file to be killed later.
./bin/cli --pid /tmp/talk-e2e.pid serve --jobs &
-9
View File
@@ -1,9 +0,0 @@
module.exports = {
drivers: {
chrome: {
version: '2.25',
arch: process.arch,
baseURL: 'https://chromedriver.storage.googleapis.com'
},
},
};
-3
View File
@@ -1,3 +0,0 @@
{
"extends": "../../.babelrc"
}
-23
View File
@@ -1,23 +0,0 @@
{
"env": {
"browser": true,
"es6": true,
"mocha": true
},
"extends": "../.eslintrc.json",
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"parser": "babel-eslint",
"plugins": [
"react"
],
"rules": {
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error"
}
}
-89
View File
@@ -1,89 +0,0 @@
import 'react';
import 'redux';
import {expect} from 'chai';
import fetchMock from 'fetch-mock';
import * as actions from '../../../../client/coral-admin/src/actions/assets';
import {Map} from 'immutable';
import configureStore from 'redux-mock-store';
const mockStore = configureStore();
describe('Asset actions', () => {
let store;
const assets = [
{
url: 'http://test.com',
id: '123',
status: 'closed'
},
{
url: 'http://test.org',
id: '456',
status: 'open'
}
];
beforeEach(() => {
store = mockStore(new Map({}));
fetchMock.restore();
});
describe('FETCH_ASSETS_REQUEST', () => {
it('should fetch a list of assets', () => {
fetchMock.get('*', JSON.stringify({
result: assets,
count: 2
}));
return actions.fetchAssets(2, 20)(store.dispatch)
.then(() => {
expect(store.getActions()[0]).to.have.property('type', 'FETCH_ASSETS_REQUEST');
expect(store.getActions()[1]).to.have.property('type', 'FETCH_ASSETS_SUCCESS');
expect(store.getActions()[1]).to.have.property('count', 2);
expect(store.getActions()[1]).to.have.property('assets').
and.to.deep.equal(assets);
});
});
it('should return an error appropriatly', () => {
fetchMock.get('*', 404);
return actions.fetchAssets(2, 20)(store.dispatch)
.then(() => {
expect(store.getActions()[0]).to.have.property('type', 'FETCH_ASSETS_REQUEST');
expect(store.getActions()[1]).to.have.property('type', 'FETCH_ASSETS_FAILURE');
});
});
});
describe('UPDATE_ASSET_STATE_REQUEST', () => {
it('should update an asset', () => {
fetchMock.put('*', JSON.stringify(assets[0]));
return actions.updateAssetState('123', 'status', 'open')(store.dispatch)
.then(() => {
expect(store.getActions()[0]).to.have.property('type', 'UPDATE_ASSET_STATE_REQUEST');
expect(store.getActions()[1]).to.have.property('type', 'UPDATE_ASSET_STATE_SUCCESS');
});
});
it('should return an error appropriately', () => {
fetchMock.put('*', 404);
return actions.updateAssetState('123', 'status', 'open')(store.dispatch)
.then(() => {
expect(store.getActions()[0]).to.have.property('type', 'UPDATE_ASSET_STATE_REQUEST');
expect(store.getActions()[1]).to.have.property('type', 'UPDATE_ASSET_STATE_FAILURE');
});
});
});
});
@@ -1,64 +0,0 @@
import {Map, fromJS} from 'immutable';
import {expect} from 'chai';
import assetsReducer from '../../../../client/coral-admin/src/reducers/assets';
describe ('assetsReducer', () => {
describe('FETCH_ASSETS_SUCCESS', () => {
it('should replace the existing assets', () => {
const action = {
type: 'FETCH_ASSETS_SUCCESS',
count: 200,
assets: [
{
id: '123',
url: 'http://test.com',
closedAt: 'tomorrow'
},
{
id: '456',
url: 'http://test2.com',
closedAt: 'thursday'
},
]
};
const store = new Map({});
const result = assetsReducer(store, action);
expect(result.getIn(['byId', '123']).toJS()).to.deep.equal({
url: 'http://test.com',
closedAt: 'tomorrow',
id: '123'
});
expect(result.getIn(['ids']).toJS()).to.deep.equal([
'123',
'456'
]);
expect(result.getIn(['count'])).to.equal(200);
});
});
describe('UPDATE_ASSET_STATE_REQUEST', () => {
it('should update the state of a particular asset', () => {
const action = {
type: 'UPDATE_ASSET_STATE_REQUEST',
id: '123',
closedAt: null
};
const store = new fromJS({
byId: {
'123': {
id: '123',
url: 'http://test.com',
closedAt: Date.now()
},
'456': {
id: '456',
url: 'http://test2.com',
closedAt: 'thursday'
}
}
});
const result = assetsReducer(store, action);
expect(result.getIn(['byId', '123', 'closedAt'])).to.equal.null;
});
});
});
@@ -1,19 +0,0 @@
import {Map} from 'immutable';
import {expect} from 'chai';
import assetReducer from '../../../../client/coral-framework/reducers/asset';
import * as actions from '../../../../client/coral-framework/constants/asset';
describe ('coral-embed-stream assetReducer', () => {
describe('UPDATE_COUNT_CACHE', () => {
it('should update the count cache', () => {
const action = {
type: actions.UPDATE_COUNT_CACHE,
id: '123',
count: 456
};
const store = new Map({});
const result = assetReducer(store, action);
expect(result.getIn(['countCache', '123'])).to.equal(456);
});
});
});
-18
View File
@@ -1,18 +0,0 @@
module.exports = {
waitForConditionTimeout: 8000,
baseUrl: 'http://localhost:3011',
users: {
admin: {
email: 'admin@test.com',
pass: 'testtest'
},
moderator: {
email: 'moderator@test.com',
pass: 'testtest'
},
commenter: {
email: 'commenter@test.com',
pass: 'testtest'
}
},
};
-26
View File
@@ -1,26 +0,0 @@
const Comments = require('../../services/comments');
const Users = require('../../services/users');
const Actions = require('../../services/actions');
const Assets = require('../../services/assets');
const Settings = require('../../services/settings');
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.publicCreate(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.update(setting));
-38
View File
@@ -1,38 +0,0 @@
const embedStreamCommands = {
url: function () {
return `${this.api.launchUrl}/admin`;
},
ready() {
return this
.waitForElementVisible('body', 2000);
},
approveComment() {
return this
.waitForElementVisible('@moderateNav')
.click('@moderateNav')
.waitForElementVisible('@moderationList')
.waitForElementVisible('@approveButton')
.click('@approveButton');
}
};
module.exports = {
commands: [embedStreamCommands],
elements: {
moderateNav: {
selector: '#moderateNav'
},
moderationList: {
selector: '#moderationList'
},
banButton: {
selector: '#moderationList .actions:first-child .ban'
},
rejectButton: {
selector: '#moderationList .actions:first-child .reject'
},
approveButton: {
selector: '#moderationList .actions:first-child .approve'
}
}
};
-165
View File
@@ -1,165 +0,0 @@
const embedStreamCommands = {
url: function () {
return this
.api.launchUrl;
},
ready() {
return this
.waitForElementVisible('body', 4000)
.waitForElementVisible('#coralStreamEmbed > iframe')
.api.frame('coralStreamEmbed_iframe');
},
signUp(user) {
return this
.waitForElementVisible('@signInButton', 2000)
.click('@signInButton')
.waitForElementVisible('@signInDialog')
.waitForElementVisible('@registerButton')
.click('@registerButton')
.setValue('@signInDialogEmail', user.email)
.setValue('@signInDialogPassword', user.pass)
.setValue('@signUpDialogConfirmPassword', user.pass)
.setValue('@signUpDialogUsername', user.username)
.waitForElementVisible('@signUpButton')
.click('@signUpButton')
.waitForElementVisible('@signInViewTrigger')
.click('@signInViewTrigger')
.waitForElementVisible('@logInButton')
.click('@logInButton')
.waitForElementVisible('@logoutButton', 5000);
},
login(user) {
return this
.waitForElementVisible('@signInButton', 2000)
.click('@signInButton')
.waitForElementVisible('@signInDialog')
.waitForElementVisible('@signInDialogEmail')
.waitForElementVisible('@signInDialogPassword')
.setValue('@signInDialogEmail', user.email)
.setValue('@signInDialogPassword', user.pass)
.waitForElementVisible('@logInButton')
.click('@logInButton')
.waitForElementVisible('@logoutButton', 5000);
},
logout() {
return this
.waitForElementVisible('@logoutButton', 5000)
.click('@logoutButton')
.waitForElementVisible('@signInButton', 5000);
},
postComment(comment = 'Test Comment') {
return this
.waitForElementVisible('@commentBox', 2000)
.setValue('@commentBox', comment)
.click('@postButton');
},
likeComment() {
return this
.waitForElementVisible('@likeButton')
.click('@likeButton');
},
flagComment() {
return this
.waitForElementVisible('@flagButton')
.click('@flagButton');
},
flagUsername() {
return this
.waitForElementVisible('@flagButton')
.click('@flagButton');
},
getPermalink(fn) {
return this
.waitForElementVisible('@permalinkButton')
.click('@permalinkButton')
.waitForElementVisible('@permalinkPopUp')
.getValue('@permalinkInput', (result) => fn(result.value));
}
};
module.exports = {
commands: [embedStreamCommands],
elements: {
signInButton: {
selector: '#coralSignInButton'
},
signInDialog:{
selector: '#signInDialog'
},
signInDialogEmail: {
selector: '#signInDialog #email'
},
signInDialogPassword: {
selector: '#signInDialog #password'
},
signUpDialogConfirmPassword: {
selector: '#signInDialog #confirmPassword'
},
signUpDialogUsername: {
selector: '#signInDialog #username'
},
logInButton: {
selector: '#coralLogInButton'
},
signUpButton: {
selector: '#coralSignUpButton'
},
signInViewTrigger: {
selector: '#coralSignInViewTrigger'
},
logoutButton: {
selector: '#coralStream #logout'
},
commentBox: {
selector: '.talk-plugin-commentbox-textarea'
},
postButton: {
selector: '#commentBox .talk-plugin-commentbox-button'
},
likeButton: {
selector: '.embed__stream .comment .talk-plugin-likes-container .talk-plugin-likes-button'
},
likeText: {
selector: '.embed__stream .comment .talk-plugin-likes-container .talk-plugin-likes-button .talk-plugin-likes-button-text'
},
likesCount: {
selector: '.embed__stream .comment .talk-plugin-likes-container .talk-plugin-likes-button .talk-plugin-likes-like-count'
},
flagButton: {
selector: '.embed__stream .comment .talk-plugin-flags-container .talk-plugin-flags-button'
},
flagPopUp: {
selector: '.embed__stream .comment .talk-plugin-flags-popup'
},
flagCommentOption: {
selector: '.embed__stream .comment .talk-plugin-flags-popup .talk-plugin-flags-popup-radio-label[for="COMMENTS"]'
},
flagUsernameOption: {
selector: '.embed__stream .comment .talk-plugin-flags-popup .talk-plugin-flags-popup-radio-label[for="USERS"]'
},
flagOtherOption: {
selector: '.embed__stream .comment .talk-plugin-flags-popup .talk-plugin-flags-popup-radio-label[for="other"]'
},
flagHeaderMessage: {
selector: '.embed__stream .comment .talk-plugin-flags-popup .talk-plugin-flags-popup-header'
},
flagButtonText: {
selector: '.embed__stream .comment .talk-plugin-flags-button-text'
},
flagDoneButton: {
selector: '.embed__stream .comment .talk-plugin-flags-popup .talk-plugin-flags-popup-button'
},
permalinkButton: {
selector: '.embed__stream .comment .talk-plugin-permalinks-button'
},
permalinkPopUp: {
selector: '.embed__stream .comment .talk-plugin-permalinks-popover.active'
},
permalinkInput: {
selector: '.embed__stream .comment .talk-plugin-permalinks-popover.active input'
},
registerButton: {
selector: '#signInDialog #coralRegister'
}
}
};
-10
View File
@@ -1,10 +0,0 @@
module.exports = {
'@tags': ['app'],
'Base url and Hostname': (browser) => {
const {baseUrl} = browser.globals;
browser
.url(baseUrl)
.assert.title('Coral Talk')
.waitForElementPresent('body', 1000);
}
};
-52
View File
@@ -1,52 +0,0 @@
const mocks = require('../mocks');
module.exports = {
'@tags': ['embedStream'],
before: (client) => {
client.perform((client, done) => {
mocks.settings({moderation: 'PRE'})
.then(() => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.navigate()
.ready();
done();
});
});
},
'Login as commenter': (client) => {
const embedStreamPage = client.page.embedStreamPage();
const {users} = client.globals;
embedStreamPage
.login(users.commenter);
},
'Add test comment': (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.postComment('Test Comment');
},
'Logout': (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.logout();
},
'Login as admin': (client) => {
const embedStreamPage = client.page.embedStreamPage();
const {users} = client.globals;
embedStreamPage
.login(users.admin);
},
'Approve test comment': (client) => {
const adminPage = client.page.adminPage();
adminPage
.navigate()
.ready();
adminPage
.approveComment();
},
after: (client) => {
client.end();
}
};
-23
View File
@@ -1,23 +0,0 @@
module.exports = {
'@tags': ['login', 'ADMIN'],
before(client) {
const embedStreamPage = client.page.embedStreamPage();
const {launchUrl} = client;
client
.url(launchUrl);
embedStreamPage
.ready();
},
'Admin logs in': (client) => {
const {users} = client.globals;
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.login(users.admin);
},
after: (client) => {
client.end();
}
};
@@ -1,34 +0,0 @@
module.exports = {
'@tags': ['flag', 'comments', 'commenter'],
before: (client) => {
const embedStreamPage = client.page.embedStreamPage();
const {users} = client.globals;
embedStreamPage
.navigate()
.ready();
embedStreamPage
.login(users.commenter);
},
'Commenter flags a comment': (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.flagComment()
.waitForElementVisible('@flagPopUp')
.waitForElementVisible('@flagCommentOption')
.click('@flagCommentOption')
.waitForElementVisible('@flagDoneButton')
.click('@flagDoneButton')
.waitForElementVisible('@flagOtherOption')
.click('@flagOtherOption')
.waitForElementVisible('@flagDoneButton')
.click('@flagDoneButton')
.click('@flagDoneButton')
.expect.element('@flagButtonText').text.to.equal('Reported');
},
after: (client) => {
client.end();
}
};
@@ -1,34 +0,0 @@
module.exports = {
'@tags': ['flag', 'commenter'],
before: (client) => {
const embedStreamPage = client.page.embedStreamPage();
const {users} = client.globals;
embedStreamPage
.navigate()
.ready();
embedStreamPage
.login(users.commenter);
},
'Commenter flags a username': (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.flagUsername()
.click('@flagButton')
.waitForElementVisible('@flagPopUp')
.waitForElementVisible('@flagUsernameOption')
.click('@flagUsernameOption')
.waitForElementVisible('@flagDoneButton')
.click('@flagDoneButton')
.waitForElementVisible('@flagOtherOption')
.click('@flagOtherOption')
.waitForElementVisible('@flagDoneButton')
.click('@flagDoneButton')
.click('@flagDoneButton');
},
after: (client) => {
client.end();
}
};
@@ -1,27 +0,0 @@
module.exports = {
'@tags': ['like', 'comments', 'commenter'],
before: (client) => {
const embedStreamPage = client.page.embedStreamPage();
const {users} = client.globals;
embedStreamPage
.navigate()
.ready();
embedStreamPage
.login(users.commenter);
},
'Commenter likes a comment': (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.postComment(`hi ${Math.random()}`)
.likeComment()
.waitForElementVisible('@likesCount', 2000)
.expect.element('@likeText').text.to.equal('Liked');
},
after: (client) => {
client.end();
}
};
-20
View File
@@ -1,20 +0,0 @@
module.exports = {
'@tags': ['login', 'commenter'],
before: (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.navigate()
.ready();
},
'Commenter logs in': (client) => {
const {users} = client.globals;
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.login(users.commenter);
},
after: (client) => {
client.end();
}
};
-34
View File
@@ -1,34 +0,0 @@
let permalink = '';
module.exports = {
'@tags': ['permalink', 'commenter'],
before: (client) => {
const embedStreamPage = client.page.embedStreamPage();
const {users} = client.globals;
embedStreamPage
.navigate()
.ready();
embedStreamPage
.login(users.commenter);
},
'Commenter gets the permalink of a comment': (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.getPermalink((value) => {
permalink = value;
});
},
'Commenter navigates to the permalink': (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.navigate(permalink);
client.assert.urlContains(permalink);
},
after: (client) => {
client.end();
}
};
-38
View File
@@ -1,38 +0,0 @@
module.exports = {
'@tags': ['write', 'commenter'],
before: (client) => {
const embedStreamPage = client.page.embedStreamPage();
const {users} = client.globals;
embedStreamPage
.navigate()
.ready();
embedStreamPage
.login(users.commenter);
},
'Commenter posts a comment': (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.postComment('I read the comments');
},
after: (client) => {
const adminPage = client.page.adminPage();
const embedStreamPage = client.page.embedStreamPage();
const {users} = client.globals;
embedStreamPage
.logout()
.login(users.admin);
adminPage
.navigate()
.ready();
adminPage
.approveComment();
client.end();
}
};
-182
View File
@@ -1,182 +0,0 @@
const mongoose = require('../../helpers/mongoose');
const mocks = require('../mocks');
const mockComment = 'I read the comments';
const mockReply = 'This is a test reply';
const mockUser = {
email: `${Date.now()}@test.com`,
name: `testuser${Math.random()
.toString()
.slice(-5)}`,
pw: 'testtest'
};
module.exports = {
'@tags': ['embed-stream', 'comment', 'premodoff', 'premodon'],
before: () => {
mongoose.waitTillConnect(function(err) {
if (err) {
console.error(err);
}
});
},
'User registers and posts a comment with premod off': (client) => {
client.perform((client, done) => {
mocks.settings({moderation: 'POST'})
.then(() => {
// Load Page
client.resizeWindow(1200, 800)
.url(client.globals.baseUrl)
.frame('coralStreamEmbed_iframe')
// Register and Log In
.waitForElementVisible('#coralSignInButton', 2000)
.click('#coralSignInButton')
.waitForElementVisible('#coralRegister', 1000)
.click('#coralRegister')
.waitForElementVisible('#email', 1000)
.setValue('#email', mockUser.email)
.setValue('#username', mockUser.name)
.setValue('#password', mockUser.pw)
.setValue('#confirmPassword', mockUser.pw)
.click('#coralSignUpButton')
.waitForElementVisible('#coralLogInButton', 10000)
.click('#coralLogInButton')
.waitForElementVisible('.talk-plugin-commentbox-button', 4000)
// Post a comment
.setValue('.talk-plugin-commentbox-textarea', mockComment)
.click('.talk-plugin-commentbox-button')
.waitForElementVisible('.embed__stream .talk-plugin-commentcontent-text', 1000)
// Verify that it appears
.assert.containsText('.embed__stream .talk-plugin-commentcontent-text', mockComment);
done();
})
.catch((err) => {
console.log(err);
done();
});
});
},
'User posts a comment with premod on': (client) => {
client.perform((client, done) => {
mocks.settings({moderation: 'PRE'})
.then(() => {
// Load Page
client.url(client.globals.baseUrl)
.frame('coralStreamEmbed_iframe');
// Post a comment
client.waitForElementVisible('.talk-plugin-commentbox-button', 2000)
.setValue('.talk-plugin-commentbox-textarea', mockComment)
.click('.talk-plugin-commentbox-button');
done();
})
.catch((err) => {
console.log(err);
done();
});
});
},
'User replies to a comment with premod off': (client) => {
client.perform((client, done) => {
mocks.settings({moderation: 'POST'})
.then(() => {
// Load Page
client.resizeWindow(1200, 800)
.url(client.globals.baseUrl)
.frame('coralStreamEmbed_iframe');
// Post a comment
client.waitForElementVisible('.talk-plugin-commentbox-button', 2000)
.setValue('.talk-plugin-commentbox-textarea', mockComment)
.click('.talk-plugin-commentbox-button')
// Post a reply
.waitForElementVisible('.embed__stream .talk-plugin-replies-reply-button', 5000)
.click('.embed__stream .talk-plugin-replies-reply-button')
.waitForElementVisible('#replyText')
.setValue('#replyText', mockReply)
.click('.embed__stream .talk-plugin-replies-textarea .talk-plugin-commentbox-button')
.waitForElementVisible('.embed__stream .reply', 20000)
// Verify that it appears
.assert.containsText('.embed__stream .reply', mockReply);
done();
})
.catch((err) => {
console.log(err);
done();
});
});
},
// Commenting out this test, it fails if the notification is below the fold, which
// happens if too many previous tests have added comments
// 'User replies to a comment with premod on': client => {
// client.perform((client, done) => {
// mocks.settings({moderation: 'PRE'})
//
// // Add a mock user
// .then(() => mocks.users([{
// username: 'BabyBlue',
// email: 'whale@tale.sea',
// password: 'krillaretasty'
// }]))
//
// // Add a mock preapproved comment by that user
// .then((user) => mocks.comments([{
// body: 'Whales are not fish.',
// status: 'ACCEPTED',
// author_id: user.id
// }]))
// .then(() => {
//
// // Load Page
// client.resizeWindow(1200, 800)
// .url(client.globals.baseUrl)
// .frame('coralStreamEmbed_iframe');
//
// // Post a reply
// client.waitForElementVisible('.talk-plugin-replies-reply-button', 5000)
// .click('.talk-plugin-replies-reply-button')
// .waitForElementVisible('#replyText')
// .setValue('#replyText', mockReply)
// .click('.talk-plugin-replies-textarea button')
// .waitForElementVisible('#coral-notif', 1000)
//
// // Verify that it appears
// .assert.containsText('#coral-notif', 'moderation team');
// done();
// })
// .catch((err) => {
// console.log(err);
// done();
// });
// });
// },
'Total comment count premod on': (client) => {
client.perform((client, done) => {
client.url(client.globals.baseUrl)
.frame('coralStreamEmbed_iframe');
// Verify that comment count is correct
client.waitForElementVisible('.talk-plugin-comment-count-text', 2000)
.assert.containsText('.talk-plugin-comment-count-text', '5 Comments');
done();
});
},
after: (client) => {
mongoose.disconnect(function(err) {
if (err) {
console.error(err);
}
});
client.end();
}
};
-23
View File
@@ -1,23 +0,0 @@
module.exports = {
'@tags': ['login', 'MODERATOR'],
before: (client) => {
const embedStreamPage = client.page.embedStreamPage();
const {launchUrl} = client;
client
.url(launchUrl);
embedStreamPage
.ready();
},
'Moderator logs in': (client) => {
const {users} = client.globals;
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.login(users.moderator);
},
after: (client) => {
client.end();
}
};
-20
View File
@@ -1,20 +0,0 @@
module.exports = {
'@tags': ['flag', 'comments', 'visitor'],
before: (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.navigate()
.ready();
},
'Visitor tries to flag a comment': (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.flagComment()
.waitForElementVisible('@signInDialog', 2000);
},
after: (client) => {
client.end();
}
};
-20
View File
@@ -1,20 +0,0 @@
module.exports = {
'@tags': ['like', 'comments', 'visitor'],
before: (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.navigate()
.ready();
},
'Visitor tries to like a comment': (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.likeComment()
.waitForElementVisible('@signInDialog', 2000);
},
after: (client) => {
client.end();
}
};
-23
View File
@@ -1,23 +0,0 @@
module.exports = {
'@tags': ['signup', 'visitor'],
before: (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.navigate()
.ready();
},
'Visitor signs up': (client) => {
const embedStreamPage = client.page.embedStreamPage();
embedStreamPage
.signUp({
email: `visitor_${Date.now()}@test.com`,
username: `visitor${Date.now()}`,
pass: 'testtest'
});
},
after: (client) => {
client.end();
}
};
-51
View File
@@ -1,51 +0,0 @@
/* eslint-env browser */
const jsdom = require('jsdom').jsdom;
const fs = require('fs');
const path = require('path');
// Storage Mock
function storageMock() {
const storage = {};
return {
setItem: function(key, value) {
storage[key] = value || '';
},
getItem: function(key) {
return storage[key] || null;
},
removeItem: function(key) {
delete storage[key];
},
get length() {
return Object.keys(storage).length;
},
key: function(i) {
const keys = Object.keys(storage);
return keys[i] || null;
}
};
}
global.document = jsdom(fs.readFileSync(path.resolve(__dirname, 'index.test.html')));
global.window = document.defaultView;
// these lines are required for react-mdl
global.window.CustomEvent = undefined;
require('react-mdl/extra/material');
global.Element = global.window.Element;
global.navigator = {
userAgent: 'node.js'
};
global.documentRef = document;
global.localStorage = {};
global.sessionStorage = storageMock();
global.XMLHttpRequest = storageMock();
global.Headers = function(headers) {
return headers;
};
+95 -1004
View File
File diff suppressed because it is too large Load Diff