e2e tests: profile
This commit is contained in:
parent
fb109ced06
commit
91d04b2170
40
mpwo_client/e2e/profile.text.js
Normal file
40
mpwo_client/e2e/profile.text.js
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import { Selector } from 'testcafe'
|
||||||
|
|
||||||
|
import { TEST_URL } from './utils'
|
||||||
|
|
||||||
|
const randomstring = require('randomstring')
|
||||||
|
|
||||||
|
const username = randomstring.generate(8)
|
||||||
|
const email = `${username}@test.com`
|
||||||
|
const password = 'lentghOk'
|
||||||
|
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
fixture('/profile').page(`${TEST_URL}/profile`)
|
||||||
|
|
||||||
|
test('should be able to access his profile page', async t => {
|
||||||
|
// register user
|
||||||
|
await t
|
||||||
|
.navigateTo(`${TEST_URL}/register`)
|
||||||
|
.typeText('input[name="username"]', username)
|
||||||
|
.typeText('input[name="email"]', email)
|
||||||
|
.typeText('input[name="password"]', password)
|
||||||
|
.typeText('input[name="passwordConf"]', password)
|
||||||
|
.click(Selector('input[type="submit"]'))
|
||||||
|
|
||||||
|
await t
|
||||||
|
.navigateTo(`${TEST_URL}/logout`)
|
||||||
|
.navigateTo(`${TEST_URL}/login`)
|
||||||
|
.expect(Selector('H1').withText('Login').exists).ok()
|
||||||
|
.typeText('input[name="email"]', email)
|
||||||
|
.typeText('input[name="password"]', password)
|
||||||
|
.click(Selector('input[type="submit"]'))
|
||||||
|
|
||||||
|
await t
|
||||||
|
.navigateTo(`${TEST_URL}/profile`)
|
||||||
|
.expect(Selector('H1').withText('Login').exists).notOk()
|
||||||
|
.expect(Selector('H1').withText('Dashboard').exists).notOk()
|
||||||
|
.expect(Selector('H1').withText('Profile').exists).ok()
|
||||||
|
.expect(Selector('.userName').withText(username).exists).ok()
|
||||||
|
|
||||||
|
})
|
@ -19,9 +19,9 @@ function Profile ({ message, onDeletePicture, onUploadPicture, user }) {
|
|||||||
<div className="container">
|
<div className="container">
|
||||||
<h1 className="page-title">Profile</h1>
|
<h1 className="page-title">Profile</h1>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-md-8">
|
<div className="col-md-12">
|
||||||
<div className="card">
|
<div className="card">
|
||||||
<div className="card-header">
|
<div className="card-header userName">
|
||||||
{user.username} {' '}
|
{user.username} {' '}
|
||||||
<Link
|
<Link
|
||||||
to={{
|
to={{
|
||||||
@ -80,14 +80,6 @@ function Profile ({ message, onDeletePicture, onUploadPicture, user }) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-4">
|
|
||||||
<div className="card">
|
|
||||||
<div className="card-header">
|
|
||||||
Last activities
|
|
||||||
</div>
|
|
||||||
<div className="card-body" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user