Commit ffc23acf authored by Jure's avatar Jure

test: fix integration tests

parent 08df10ea
Pipeline #9068 failed with stages
in 6 minutes and 50 seconds
......@@ -4,6 +4,7 @@ import { Route, Switch } from 'react-router-dom'
// Manage
import PostsManager from 'pubsweet-component-posts-manager/PostsManagerContainer'
import UsersManager from 'pubsweet-component-users-manager/src/UsersManagerContainer'
import TeamsManager from 'pubsweet-component-teams-manager/src/TeamsManagerContainer'
// Public
import Blog from 'pubsweet-component-blog/BlogContainer'
......@@ -34,7 +35,7 @@ export default (
<Switch>
<PrivateRoute component={UsersManager} path="/manage/users" />
<PrivateRoute component={PostsManager} path="/manage/posts" />
<PrivateRoute component={TeamsManager} path="/manage/teams" />
<Route component={Blog} exact path="/" />
<Route component={Login} path="/login" />
<Route component={Signup} path="/signup" />
......
......@@ -5,27 +5,27 @@
"files": ["app", "config", "static", "webpack"],
"main": "app.js",
"dependencies": {
"@pubsweet/coko-theme": "^1.0.0",
"@pubsweet/db-manager": "^1.0.0",
"@pubsweet/default-theme": "*",
"@pubsweet/logger": "^0.2.2",
"@pubsweet/ui": "^4.0.0",
"@pubsweet/coko-theme": "^4.1.0",
"@pubsweet/db-manager": "^2.0.0",
"@pubsweet/default-theme": "3.0.0",
"@pubsweet/logger": "^0.2.6",
"@pubsweet/ui": "^8.6.2",
"authsome": "^0.1.0",
"pubsweet": "^2.2.2",
"pubsweet-client": "^2.5.0",
"pubsweet-component-blog": "^1.0.4",
"pubsweet-component-form-group": "1.1.10",
"pubsweet": "^3.0.0",
"pubsweet-client": "^5.0.0",
"pubsweet-component-blog": "^1.0.5",
"pubsweet-component-form-group": "1.1.20",
"pubsweet-component-html": "^0.2.5",
"pubsweet-component-login": "1.1.1",
"pubsweet-component-manage": "^0.2.3",
"pubsweet-component-login": "1.1.16",
"pubsweet-component-manage": "^1.0.0",
"pubsweet-component-medium-draft": "^0.2.3",
"pubsweet-component-navigation": "^1.0.1",
"pubsweet-component-password-reset-backend": "^1.0.0",
"pubsweet-component-password-reset-frontend": "^1.0.1",
"pubsweet-component-password-reset-frontend": "^2.0.14",
"pubsweet-component-pepper-theme": "^0.0.5",
"pubsweet-component-posts-manager": "1.0.14",
"pubsweet-component-signup": "^1.0.1",
"pubsweet-component-teams-manager": "^1.0.1",
"pubsweet-component-posts-manager": "1.0.35",
"pubsweet-component-signup": "^1.0.30",
"pubsweet-component-teams-manager": "^1.1.22",
"pubsweet-component-users-manager": "^2.0.1",
"pubsweet-server": "^9.0.0",
"pubsweet-theme-plugin": "^0.0.3",
......@@ -67,6 +67,7 @@
"json-loader": "^0.5.4",
"lint-staged": "^6.1.0",
"node-sass": "^4.5.2",
"objection": "^1.3.0",
"prettier": "^1.10.2",
"react-hot-loader": "^4.1.2",
"regenerator-runtime": "^0.11.0",
......@@ -75,8 +76,8 @@
"smtp-server": "^3.3.0",
"string-replace-loader": "^1.2.0",
"style-loader": "^0.21.0",
"testcafe": "^0.19.2",
"testcafe-react-selectors": "^1.0.5",
"testcafe": "^0.22.0",
"testcafe-react-selectors": "^3.0.0",
"url-loader": "^0.6.2",
"webpack": "^3.11.0",
"webpack-hot-middleware": "^2.22.1"
......
......@@ -34,7 +34,7 @@ test('Manage posts journey', async t => {
.typeText(managePosts.newPostInput, postTitle)
.click(managePosts.newPostButton)
.expect(managePosts.postTitle(0).innerText)
.eql(postTitle)
.eql(`${postTitle}\n`)
// publish it
await t
......@@ -71,9 +71,6 @@ test('Manage teams journey', async t => {
// delete it
await t
.click(manageTeams.teamDelete(0))
// TODO remove reload workaround once reducer bug fix is published
// https://gitlab.coko.foundation/pubsweet/pubsweet-client/merge_requests/127
.navigateTo(manageTeams.url)
.expect(manageTeams.team(0).exists)
.notOk()
})
......@@ -101,7 +98,7 @@ test('Password reset journey', async t => {
// extract reset URL from email content
const mail = await mailHelper.nextEmail()
console.log(mail)
const matchResult = mail
.replace(/=3D/g, '=')
.replace(/=\r?\n/g, '')
......
import config from 'config'
import { Selector, t } from 'testcafe'
import ReactSelector from 'testcafe-react-selectors'
import { ReactSelector } from 'testcafe-react-selectors'
const login = {
url: `${config.get('pubsweet-server.baseUrl')}/login`,
......@@ -8,7 +8,7 @@ const login = {
username: Selector('form input[type=text]'),
password: Selector('form input[type=password]'),
submit: Selector('form button'),
signUp: ReactSelector('Login Link').nth(0),
signUp: ReactSelector('Login Styled(Link)').nth(0),
resetPassword: ReactSelector('Login Link').nth(1),
alert: Selector(() => document.querySelector('form').previousSibling),
......
import config from 'config'
import ReactSelector from 'testcafe-react-selectors'
import { ReactSelector } from 'testcafe-react-selectors'
const managePosts = {
url: `${config.get('pubsweet-server.baseUrl')}/manage/posts`,
......@@ -7,14 +7,30 @@ const managePosts = {
title: ReactSelector('PostsManager').find('h2'),
post: n => ReactSelector('Post').nth(n),
postTitle: n => managePosts.post(n).find('label'),
postEdit: n => managePosts.post(n).find('button[title=Edit]'),
postPublish: n => managePosts.post(n).find('button[title=Publish]'),
postUnpublish: n => managePosts.post(n).find('button[title=Unpublish]'),
postDelete: n => managePosts.post(n).find('button[title=Delete]'),
postTitle: n => managePosts.post(n).findReact('EditableValue'),
postEdit: n =>
managePosts
.post(n)
.find('button')
.withText(/^Edit/i),
postPublish: n =>
managePosts
.post(n)
.find('button')
.withText(/^Publish/i),
postUnpublish: n =>
managePosts
.post(n)
.find('button')
.withText(/^Unpublish/i),
postDelete: n =>
managePosts
.post(n)
.find('button')
.withText(/^Delete/i),
newPostInput: ReactSelector('PostCreator FormControl'),
newPostButton: ReactSelector('PostCreator Button'),
newPostInput: ReactSelector('PostCreator TextField'),
newPostButton: ReactSelector('PostCreator styled.button'),
}
export default managePosts
import config from 'config'
import ReactSelector from 'testcafe-react-selectors'
import { ReactSelector } from 'testcafe-react-selectors'
const manageTeams = {
url: `${config.get('pubsweet-server.baseUrl')}/manage/teams`,
......@@ -12,13 +12,19 @@ const manageTeams = {
.team(n)
.find('td')
.nth(1),
teamDelete: n => manageTeams.team(n).find('button'),
teamDelete: n =>
manageTeams
.team(n)
.find('button')
.withText(/^Delete/i),
teamName: ReactSelector('TeamCreator FormControl'),
teamType: ReactSelector('TeamCreator Select').nth(0),
collection: ReactSelector('TeamCreator Select').nth(1),
option: ReactSelector('TeamCreator Select Option'),
create: ReactSelector('TeamCreator Button'),
teamName: ReactSelector('TeamCreator TextField'),
teamType: ReactSelector('TeamCreator Menu').nth(0),
collection: ReactSelector('TeamCreator Menu').nth(1),
option: ReactSelector('TeamCreator Menu DefaultMenuOption'),
create: ReactSelector('TeamCreator')
.find('button')
.withText(/^Create/i),
}
export default manageTeams
import config from 'config'
import ReactSelector from 'testcafe-react-selectors'
import { ReactSelector } from 'testcafe-react-selectors'
const manageUsers = {
url: `${config.get('pubsweet-server.baseUrl')}/manage/users`,
......
import config from 'config'
import { Selector } from 'testcafe'
import { ReactSelector } from 'testcafe-react-selectors'
const passwordReset = {
url: `${config.get('pubsweet-server.baseUrl')}/password-reset`,
......@@ -10,7 +11,7 @@ const passwordReset = {
password: Selector('form input[type=password]'),
submit: Selector('form button'),
alert: Selector('.alert'),
alert: ReactSelector('PasswordReset styled.div'),
}
export default passwordReset
......@@ -4,7 +4,7 @@ import { Selector } from 'testcafe'
const signup = {
url: `${config.get('pubsweet-server.baseUrl')}/signup`,
title: Selector('div[class^=Signup-local_title]'),
title: Selector(() => document.querySelector('form').previousSibling),
username: Selector('form input[type=text]'),
email: Selector('form input[type=email]'),
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment