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
-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;
};