@live-change/user-frontend 0.9.196 → 0.9.198
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/e2e/connectEmailCode.test.ts +65 -0
- package/e2e/connectEmailLink.test.ts +62 -0
- package/e2e/delete.test.ts +52 -0
- package/e2e/disconnectEmail.test.ts +43 -0
- package/e2e/env.ts +130 -0
- package/e2e/resetPasswordWithEmailCode.test.ts +60 -0
- package/e2e/resetPasswordWithEmailLink.test.ts +60 -0
- package/e2e/setPassword.test.ts +70 -0
- package/e2e/signInEmailCode.test.ts +58 -0
- package/e2e/signInEmailLink.test.ts +58 -0
- package/e2e/signInEmailPassword.test.ts +51 -0
- package/e2e/signOut.test.ts +45 -0
- package/e2e/signUpEmailCode.test.ts +46 -0
- package/e2e/signUpEmailLink.test.ts +46 -0
- package/e2e/steps.ts +179 -0
- package/e2e/withBrowser.ts +19 -0
- package/front/src/nav/UserIcon.vue +1 -1
- package/package.json +29 -28
- package/server/app.config.js +33 -2
- package/tsconfig.json +36 -0
- package/e2e/codecept.conf.js +0 -60
- package/e2e/connectEmailCode.test.js +0 -61
- package/e2e/connectEmailLink.test.js +0 -60
- package/e2e/delete.test.js +0 -44
- package/e2e/disconnectEmail.test.js +0 -42
- package/e2e/resetPasswordWithEmailCode.test.js +0 -62
- package/e2e/resetPasswordWithEmailLink.test.js +0 -62
- package/e2e/setPassword.test.js +0 -70
- package/e2e/signInEmailCode.test.js +0 -52
- package/e2e/signInEmailLink.test.js +0 -52
- package/e2e/signInEmailPassword.test.js +0 -47
- package/e2e/signOut.test.js +0 -41
- package/e2e/signUpEmailCode.test.js +0 -41
- package/e2e/signUpEmailLink.test.js +0 -42
- package/e2e/steps.d.ts +0 -12
- package/e2e/steps_file.js +0 -156
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
const app = require('@live-change/framework').app()
|
|
2
|
-
const randomProfile = require('random-profile-generator')
|
|
3
|
-
|
|
4
|
-
const email = randomProfile.profile().firstName.toLowerCase() + '@test.com' // test domain - emails not sent
|
|
5
|
-
const email2 = randomProfile.profile().firstName.toLowerCase() + '2@test.com' // test domain - emails not sent
|
|
6
|
-
|
|
7
|
-
const happyPath = false
|
|
8
|
-
|
|
9
|
-
Feature('user')
|
|
10
|
-
|
|
11
|
-
Scenario('connect email with code', async ({ I }) => {
|
|
12
|
-
|
|
13
|
-
const user = app.generateUid()
|
|
14
|
-
|
|
15
|
-
const User = await I.haveModel('user', 'User')
|
|
16
|
-
const Email = await I.haveModel('email', 'Email')
|
|
17
|
-
const AuthenticatedUser = await I.haveModel('user', 'AuthenticatedUser')
|
|
18
|
-
|
|
19
|
-
await User.create({ id: user, roles: [] })
|
|
20
|
-
await Email.create({ id: email, email, user })
|
|
21
|
-
I.amOnPage('/')
|
|
22
|
-
const session = await I.executeScript(() => api.client.value.session)
|
|
23
|
-
await AuthenticatedUser.create({ id: session, user, session })
|
|
24
|
-
|
|
25
|
-
I.amOnPage('/connected')
|
|
26
|
-
I.see(email)
|
|
27
|
-
I.dontSee(email2)
|
|
28
|
-
|
|
29
|
-
I.click('button#connect')
|
|
30
|
-
|
|
31
|
-
I.seeInCurrentUrl('/connect')
|
|
32
|
-
|
|
33
|
-
if(!happyPath) {
|
|
34
|
-
I.fillField('input#email', email)
|
|
35
|
-
I.click('button[type=submit]')
|
|
36
|
-
I.seeInCurrentUrl('/connect')
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
I.fillField('input#email', email2)
|
|
40
|
-
I.click('button[type=submit]')
|
|
41
|
-
|
|
42
|
-
I.seeInCurrentUrl('/sent/')
|
|
43
|
-
|
|
44
|
-
const url = await I.grabCurrentUrl()
|
|
45
|
-
const authentication = url.split('/').pop()
|
|
46
|
-
|
|
47
|
-
const authenticationData = await I.grabObject('messageAuthentication', 'Authentication', authentication)
|
|
48
|
-
console.log("AUTHENTICATION DATA", authenticationData)
|
|
49
|
-
I.assert(!!authenticationData, true, 'authentication created')
|
|
50
|
-
I.assert(authenticationData?.messageData?.user, user, 'authentication contains user')
|
|
51
|
-
|
|
52
|
-
await I.useSecretCode(authentication, happyPath)
|
|
53
|
-
|
|
54
|
-
I.seeInCurrentUrl('/connect-finished')
|
|
55
|
-
|
|
56
|
-
if(!happyPath) {
|
|
57
|
-
I.amOnPage(url)
|
|
58
|
-
I.seeInCurrentUrl('/connect-finished')
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
})
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const app = require('@live-change/framework').app()
|
|
2
|
-
const randomProfile = require('random-profile-generator')
|
|
3
|
-
|
|
4
|
-
const email = randomProfile.profile().firstName.toLowerCase() + '@test.com' // test domain - emails not sent
|
|
5
|
-
const email2 = randomProfile.profile().firstName.toLowerCase() + '2@test.com' // test domain - emails not sent
|
|
6
|
-
|
|
7
|
-
const happyPath = false
|
|
8
|
-
|
|
9
|
-
Feature('user')
|
|
10
|
-
|
|
11
|
-
Scenario('sign in with email link', async ({ I }) => {
|
|
12
|
-
|
|
13
|
-
const user = app.generateUid()
|
|
14
|
-
|
|
15
|
-
const User = await I.haveModel('user', 'User')
|
|
16
|
-
const Email = await I.haveModel('email', 'Email')
|
|
17
|
-
const AuthenticatedUser = await I.haveModel('user', 'AuthenticatedUser')
|
|
18
|
-
|
|
19
|
-
await User.create({ id: user, roles: [] })
|
|
20
|
-
await Email.create({ id: email, email, user })
|
|
21
|
-
I.amOnPage('/')
|
|
22
|
-
const session = await I.executeScript(() => api.client.value.session)
|
|
23
|
-
await AuthenticatedUser.create({ id: session, user, session })
|
|
24
|
-
|
|
25
|
-
I.amOnPage('/connected')
|
|
26
|
-
I.see(email)
|
|
27
|
-
I.dontSee(email2)
|
|
28
|
-
|
|
29
|
-
I.click('button#connect')
|
|
30
|
-
|
|
31
|
-
I.seeInCurrentUrl('/connect')
|
|
32
|
-
|
|
33
|
-
if(!happyPath) {
|
|
34
|
-
I.fillField('input#email', email)
|
|
35
|
-
I.click('button[type=submit]')
|
|
36
|
-
I.see('')
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
I.fillField('input#email', email2)
|
|
40
|
-
I.click('button[type=submit]')
|
|
41
|
-
|
|
42
|
-
I.seeInCurrentUrl('/sent/')
|
|
43
|
-
const url = await I.grabCurrentUrl()
|
|
44
|
-
const authentication = url.split('/').pop()
|
|
45
|
-
|
|
46
|
-
const authenticationData = await I.grabObject('messageAuthentication', 'Authentication', authentication)
|
|
47
|
-
console.log("AUTHENTICATION DATA", authenticationData)
|
|
48
|
-
I.assert(!!authenticationData, true, 'authentication created')
|
|
49
|
-
I.assert(authenticationData?.messageData?.user, user, 'authentication contains user')
|
|
50
|
-
|
|
51
|
-
const linkData = await I.useSecretLink(authentication, happyPath)
|
|
52
|
-
|
|
53
|
-
I.seeInCurrentUrl('/connect-finished')
|
|
54
|
-
|
|
55
|
-
if(!happyPath) {
|
|
56
|
-
I.amOnPage('/link/' + linkData.secretCode)
|
|
57
|
-
I.see('Link used')
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
})
|
package/e2e/delete.test.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const app = require('@live-change/framework').app()
|
|
2
|
-
const randomProfile = require('random-profile-generator')
|
|
3
|
-
|
|
4
|
-
const name = randomProfile.profile().firstName.toLowerCase()
|
|
5
|
-
const email = name + '@test.com' // test domain - emails not sent
|
|
6
|
-
|
|
7
|
-
const happyPath = false
|
|
8
|
-
|
|
9
|
-
Feature('user')
|
|
10
|
-
|
|
11
|
-
Scenario('delete account', async ({ I }) => {
|
|
12
|
-
|
|
13
|
-
const user = app.generateUid()
|
|
14
|
-
|
|
15
|
-
const User = await I.haveModel('user', 'User')
|
|
16
|
-
const Email = await I.haveModel('email', 'Email')
|
|
17
|
-
const AuthenticatedUser = await I.haveModel('user', 'AuthenticatedUser')
|
|
18
|
-
|
|
19
|
-
await User.create({ id: user, roles: [] })
|
|
20
|
-
await Email.create({ id: email, email, user })
|
|
21
|
-
I.amOnPage('/')
|
|
22
|
-
const session = await I.executeScript(() => api.client.value.session)
|
|
23
|
-
await AuthenticatedUser.create({ id: session, user, session })
|
|
24
|
-
|
|
25
|
-
await I.wait(0.2)
|
|
26
|
-
const clientUser = await I.executeScript(() => api.client.value.user)
|
|
27
|
-
I.assert(user, clientUser, 'client logged in')
|
|
28
|
-
|
|
29
|
-
I.amOnPage('/delete')
|
|
30
|
-
I.click('.p-checkbox-box')
|
|
31
|
-
I.click('button#delete')
|
|
32
|
-
|
|
33
|
-
I.seeInCurrentUrl('/delete-finished')
|
|
34
|
-
|
|
35
|
-
await I.wait(0.3)
|
|
36
|
-
const clientUserAfterDelete = await I.executeScript(() => api.client.value.user)
|
|
37
|
-
I.assert(!!clientUserAfterDelete, false, 'user logged out')
|
|
38
|
-
|
|
39
|
-
const deletedUser = await User.get(user)
|
|
40
|
-
I.assert(!!deletedUser, false, 'user deleted')
|
|
41
|
-
|
|
42
|
-
const deletedEmail = await Email.get(email)
|
|
43
|
-
I.assert(!!deletedEmail, false, 'email deleted')
|
|
44
|
-
})
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const app = require('@live-change/framework').app()
|
|
2
|
-
const randomProfile = require('random-profile-generator')
|
|
3
|
-
|
|
4
|
-
const name = randomProfile.profile().firstName.toLowerCase()
|
|
5
|
-
const email = name + '@test.com' // test domain - emails not sent
|
|
6
|
-
const email2 = name + '2@test.com' // test domain - emails not sent
|
|
7
|
-
|
|
8
|
-
const happyPath = false
|
|
9
|
-
|
|
10
|
-
Feature('user')
|
|
11
|
-
|
|
12
|
-
Scenario('disconnect email', async ({ I }) => {
|
|
13
|
-
|
|
14
|
-
const user = app.generateUid()
|
|
15
|
-
|
|
16
|
-
const User = await I.haveModel('user', 'User')
|
|
17
|
-
const Email = await I.haveModel('email', 'Email')
|
|
18
|
-
const AuthenticatedUser = await I.haveModel('user', 'AuthenticatedUser')
|
|
19
|
-
|
|
20
|
-
await User.create({ id: user, roles: [] })
|
|
21
|
-
await Email.create({ id: email, email, user })
|
|
22
|
-
await Email.create({ id: email2, email: email2, user })
|
|
23
|
-
I.amOnPage('/')
|
|
24
|
-
const session = await I.executeScript(() => api.client.value.session)
|
|
25
|
-
await AuthenticatedUser.create({ id: session, user, session })
|
|
26
|
-
|
|
27
|
-
I.amOnPage('/connected')
|
|
28
|
-
I.see(email)
|
|
29
|
-
I.see(email2)
|
|
30
|
-
|
|
31
|
-
I.click('span.pi-times') // delete button
|
|
32
|
-
I.click('Yes')
|
|
33
|
-
|
|
34
|
-
I.dontSee(email2)
|
|
35
|
-
|
|
36
|
-
if(!happyPath) {
|
|
37
|
-
I.dontSeeElement('span.pi-times') // delete button
|
|
38
|
-
//I.click('Yes')
|
|
39
|
-
//I.see(email)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
})
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
const app = require('@live-change/framework').app()
|
|
2
|
-
const randomProfile = require('random-profile-generator')
|
|
3
|
-
const passwordGenerator = require('generate-password')
|
|
4
|
-
|
|
5
|
-
const email = randomProfile.profile().firstName.toLowerCase() + '@test.com' // test domain - emails not sent
|
|
6
|
-
const email2 = randomProfile.profile().firstName.toLowerCase() + '2@test.com' // test domain - emails not sent
|
|
7
|
-
|
|
8
|
-
const happyPath = false
|
|
9
|
-
|
|
10
|
-
Feature('user')
|
|
11
|
-
|
|
12
|
-
Scenario('reset password with email code', async ({ I }) => {
|
|
13
|
-
|
|
14
|
-
const user = app.generateUid()
|
|
15
|
-
|
|
16
|
-
const User = await I.haveModel('user', 'User')
|
|
17
|
-
const Email = await I.haveModel('email', 'Email')
|
|
18
|
-
|
|
19
|
-
await User.create({ id: user, roles: [] })
|
|
20
|
-
await Email.create({ id: email, email, user })
|
|
21
|
-
I.amOnPage('/')
|
|
22
|
-
const session = await I.executeScript(() => api.client.value.session)
|
|
23
|
-
|
|
24
|
-
I.amOnPage('/reset-password')
|
|
25
|
-
I.fillField('input#email', email)
|
|
26
|
-
|
|
27
|
-
I.click('button[type=submit]')
|
|
28
|
-
|
|
29
|
-
I.seeInCurrentUrl('/sent')
|
|
30
|
-
let url = await I.grabCurrentUrl()
|
|
31
|
-
const authentication = url.split('/').pop()
|
|
32
|
-
|
|
33
|
-
const authenticationData = await I.grabObject('messageAuthentication', 'Authentication', authentication)
|
|
34
|
-
console.log("AUTHENTICATION DATA", authenticationData)
|
|
35
|
-
I.assert(!!authenticationData, true, 'authentication created')
|
|
36
|
-
I.assert(authenticationData?.messageData?.user, user, 'authentication message data contains user')
|
|
37
|
-
I.assert(authenticationData?.actionProperties?.user, user, 'authentication action properties contains user')
|
|
38
|
-
|
|
39
|
-
await I.useSecretCode(authentication, happyPath)
|
|
40
|
-
|
|
41
|
-
I.seeInCurrentUrl('/set-new-password/')
|
|
42
|
-
url = await I.grabCurrentUrl()
|
|
43
|
-
const resetPasswordAuthentication = url.split('/').pop()
|
|
44
|
-
await I.wait(0.1)
|
|
45
|
-
const ResetPasswordAuthentication = await I.haveModel('passwordAuthentication', 'ResetPasswordAuthentication')
|
|
46
|
-
const resetPasswordAuthenticationData =
|
|
47
|
-
await ResetPasswordAuthentication.indexObjectGet('byKey', resetPasswordAuthentication)
|
|
48
|
-
I.assert(!!resetPasswordAuthenticationData, true, 'reset password authentication created')
|
|
49
|
-
|
|
50
|
-
I.see('Reset password')
|
|
51
|
-
|
|
52
|
-
const password = passwordGenerator.generate({
|
|
53
|
-
length: 10,
|
|
54
|
-
numbers: true
|
|
55
|
-
})+(Math.random()*10).toFixed()
|
|
56
|
-
I.fillField('input#newPassword', password)
|
|
57
|
-
I.fillField('input#reenterPassword', password)
|
|
58
|
-
|
|
59
|
-
I.click('button[type=submit]')
|
|
60
|
-
I.seeInCurrentUrl('/reset-password-finished')
|
|
61
|
-
|
|
62
|
-
})
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
const app = require('@live-change/framework').app()
|
|
2
|
-
const randomProfile = require('random-profile-generator')
|
|
3
|
-
const passwordGenerator = require('generate-password')
|
|
4
|
-
|
|
5
|
-
const email = randomProfile.profile().firstName.toLowerCase() + '@test.com' // test domain - emails not sent
|
|
6
|
-
const email2 = randomProfile.profile().firstName.toLowerCase() + '2@test.com' // test domain - emails not sent
|
|
7
|
-
|
|
8
|
-
const happyPath = false
|
|
9
|
-
|
|
10
|
-
Feature('user')
|
|
11
|
-
|
|
12
|
-
Scenario('reset password with email code', async ({ I }) => {
|
|
13
|
-
|
|
14
|
-
const user = app.generateUid()
|
|
15
|
-
|
|
16
|
-
const User = await I.haveModel('user', 'User')
|
|
17
|
-
const Email = await I.haveModel('email', 'Email')
|
|
18
|
-
|
|
19
|
-
await User.create({ id: user, roles: [] })
|
|
20
|
-
await Email.create({ id: email, email, user })
|
|
21
|
-
I.amOnPage('/')
|
|
22
|
-
const session = await I.executeScript(() => api.client.value.session)
|
|
23
|
-
|
|
24
|
-
I.amOnPage('/reset-password')
|
|
25
|
-
I.fillField('input#email', email)
|
|
26
|
-
|
|
27
|
-
I.click('button[type=submit]')
|
|
28
|
-
|
|
29
|
-
I.seeInCurrentUrl('/sent')
|
|
30
|
-
let url = await I.grabCurrentUrl()
|
|
31
|
-
const authentication = url.split('/').pop()
|
|
32
|
-
|
|
33
|
-
const authenticationData = await I.grabObject('messageAuthentication', 'Authentication', authentication)
|
|
34
|
-
console.log("AUTHENTICATION DATA", authenticationData)
|
|
35
|
-
I.assert(!!authenticationData, true, 'authentication created')
|
|
36
|
-
I.assert(authenticationData?.messageData?.user, user, 'authentication message data contains user')
|
|
37
|
-
I.assert(authenticationData?.actionProperties?.user, user, 'authentication action properties contains user')
|
|
38
|
-
|
|
39
|
-
await I.useSecretLink(authentication, happyPath)
|
|
40
|
-
|
|
41
|
-
I.seeInCurrentUrl('/set-new-password/')
|
|
42
|
-
url = await I.grabCurrentUrl()
|
|
43
|
-
const resetPasswordAuthentication = url.split('/').pop()
|
|
44
|
-
await I.wait(0.1)
|
|
45
|
-
const ResetPasswordAuthentication = await I.haveModel('passwordAuthentication', 'ResetPasswordAuthentication')
|
|
46
|
-
const resetPasswordAuthenticationData =
|
|
47
|
-
await ResetPasswordAuthentication.indexObjectGet('byKey', resetPasswordAuthentication)
|
|
48
|
-
I.assert(!!resetPasswordAuthenticationData, true, 'reset password authentication created')
|
|
49
|
-
|
|
50
|
-
I.see('Reset password')
|
|
51
|
-
|
|
52
|
-
const password = passwordGenerator.generate({
|
|
53
|
-
length: 10,
|
|
54
|
-
numbers: true
|
|
55
|
-
})+(Math.random()*10).toFixed()
|
|
56
|
-
I.fillField('input#newPassword', password)
|
|
57
|
-
I.fillField('input#reenterPassword', password)
|
|
58
|
-
I.click('button[type=submit]')
|
|
59
|
-
|
|
60
|
-
I.seeInCurrentUrl('/reset-password-finished')
|
|
61
|
-
|
|
62
|
-
})
|
package/e2e/setPassword.test.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
const app = require('@live-change/framework').app()
|
|
2
|
-
const randomProfile = require('random-profile-generator')
|
|
3
|
-
const passwordGenerator = require('generate-password')
|
|
4
|
-
|
|
5
|
-
const name = randomProfile.profile().firstName.toLowerCase()
|
|
6
|
-
const email = name + '@test.com' // test domain - emails not sent
|
|
7
|
-
|
|
8
|
-
const happyPath = false
|
|
9
|
-
|
|
10
|
-
Feature('user')
|
|
11
|
-
|
|
12
|
-
Scenario('setPassword', async ({ I }) => {
|
|
13
|
-
|
|
14
|
-
const user = app.generateUid()
|
|
15
|
-
|
|
16
|
-
const User = await I.haveModel('user', 'User')
|
|
17
|
-
const Email = await I.haveModel('email', 'Email')
|
|
18
|
-
const AuthenticatedUser = await I.haveModel('user', 'AuthenticatedUser')
|
|
19
|
-
const PasswordAuthentication = await I.haveModel('passwordAuthentication', 'PasswordAuthentication')
|
|
20
|
-
|
|
21
|
-
await User.create({ id: user, roles: [] })
|
|
22
|
-
await Email.create({ id: email, email, user })
|
|
23
|
-
I.amOnPage('/')
|
|
24
|
-
const session = await I.executeScript(() => api.client.value.session)
|
|
25
|
-
await AuthenticatedUser.create({ id: session, user, session })
|
|
26
|
-
|
|
27
|
-
await I.wait(0.2)
|
|
28
|
-
const clientUser = await I.executeScript(() => api.client.value.user)
|
|
29
|
-
I.assert(user, clientUser, 'client logged in')
|
|
30
|
-
|
|
31
|
-
const emptyPasswordAuthenticationData = await PasswordAuthentication.get(user)
|
|
32
|
-
I.assert(emptyPasswordAuthenticationData, null, 'password not set')
|
|
33
|
-
|
|
34
|
-
I.amOnPage('/settings/change-password')
|
|
35
|
-
I.see('Set password')
|
|
36
|
-
|
|
37
|
-
const firstPassword = passwordGenerator.generate({
|
|
38
|
-
length: 10,
|
|
39
|
-
numbers: true
|
|
40
|
-
})+(Math.random()*10).toFixed()
|
|
41
|
-
I.fillField('input#newPassword', firstPassword)
|
|
42
|
-
I.fillField('input#reenterPassword', firstPassword)
|
|
43
|
-
I.click('button[type=submit]')
|
|
44
|
-
|
|
45
|
-
I.seeInCurrentUrl('/settings/change-password-finished')
|
|
46
|
-
|
|
47
|
-
await I.wait(0.2)
|
|
48
|
-
const firstPasswordAuthenticationData = await PasswordAuthentication.get(user)
|
|
49
|
-
I.assert(!!firstPasswordAuthenticationData, true, 'password set')
|
|
50
|
-
|
|
51
|
-
I.amOnPage('/settings/change-password')
|
|
52
|
-
I.see('Change password')
|
|
53
|
-
|
|
54
|
-
const secondPassword = passwordGenerator.generate({
|
|
55
|
-
length: 10,
|
|
56
|
-
numbers: true
|
|
57
|
-
})+(Math.random()*10).toFixed()
|
|
58
|
-
|
|
59
|
-
I.fillField('input#currentPassword', firstPassword)
|
|
60
|
-
I.fillField('input#newPassword', secondPassword)
|
|
61
|
-
I.fillField('input#reenterPassword', secondPassword)
|
|
62
|
-
I.click('button[type=submit]')
|
|
63
|
-
|
|
64
|
-
await I.wait(0.2)
|
|
65
|
-
const secondPasswordAuthenticationData = await PasswordAuthentication.get(user)
|
|
66
|
-
I.assert(!!secondPasswordAuthenticationData, true, 'password set')
|
|
67
|
-
I.assertNotEqual(secondPasswordAuthenticationData.passwordHash, firstPasswordAuthenticationData.passwordHash,
|
|
68
|
-
'password changed')
|
|
69
|
-
|
|
70
|
-
})
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const app = require('@live-change/framework').app()
|
|
2
|
-
const randomProfile = require('random-profile-generator')
|
|
3
|
-
|
|
4
|
-
const randomUserData = randomProfile.profile()
|
|
5
|
-
randomUserData.email = randomUserData.firstName.toLowerCase() + '@test.com' // test domain - emails not sent
|
|
6
|
-
|
|
7
|
-
const happyPath = false
|
|
8
|
-
|
|
9
|
-
Feature('user')
|
|
10
|
-
|
|
11
|
-
Scenario('sign in with email code', async ({ I }) => {
|
|
12
|
-
|
|
13
|
-
const user = app.generateUid()
|
|
14
|
-
const email = randomUserData.email
|
|
15
|
-
|
|
16
|
-
const User = await I.haveModel('user', 'User')
|
|
17
|
-
const Email = await I.haveModel('email', 'Email')
|
|
18
|
-
|
|
19
|
-
await User.create({ id: user, roles: [] })
|
|
20
|
-
await Email.create({ id: email, email, user })
|
|
21
|
-
|
|
22
|
-
I.amOnPage('/sign-in')
|
|
23
|
-
I.fillField('input#email', email)
|
|
24
|
-
I.click('button[type=submit]')
|
|
25
|
-
|
|
26
|
-
I.seeInCurrentUrl('/sent/')
|
|
27
|
-
const url = await I.grabCurrentUrl()
|
|
28
|
-
const authentication = url.split('/').pop()
|
|
29
|
-
|
|
30
|
-
const authenticationData = await I.grabObject('messageAuthentication', 'Authentication', authentication)
|
|
31
|
-
console.log("AUTHENTICATION DATA", authenticationData)
|
|
32
|
-
I.assert(!!authenticationData, true, 'authentication created')
|
|
33
|
-
I.assert(authenticationData?.messageData?.user, user, 'authentication contains user')
|
|
34
|
-
|
|
35
|
-
await I.useSecretCode(authentication, happyPath)
|
|
36
|
-
|
|
37
|
-
I.seeInCurrentUrl('/sign-in-finished')
|
|
38
|
-
const clientSession = await I.executeScript(() => api.client.value.session)
|
|
39
|
-
const AuthenticatedUser = await I.haveModel('user', 'AuthenticatedUser')
|
|
40
|
-
const authenticatedUserData = await AuthenticatedUser.get(clientSession)
|
|
41
|
-
I.assert(!!authenticatedUserData, true, 'user authenticated server-side')
|
|
42
|
-
const clientUser = await I.executeScript(() => api.client.value.user)
|
|
43
|
-
console.log("CLIENT USER", clientUser)
|
|
44
|
-
console.log("SERVER AUTHENTICATION", authenticatedUserData)
|
|
45
|
-
I.assert(clientUser, authenticatedUserData.user, 'user authenticated')
|
|
46
|
-
|
|
47
|
-
if(!happyPath) {
|
|
48
|
-
I.amOnPage(url)
|
|
49
|
-
I.seeInCurrentUrl('/sign-in-finished')
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
})
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const app = require('@live-change/framework').app()
|
|
2
|
-
const randomProfile = require('random-profile-generator')
|
|
3
|
-
|
|
4
|
-
const randomUserData = randomProfile.profile()
|
|
5
|
-
randomUserData.email = randomUserData.firstName.toLowerCase() + '@test.com' // test domain - emails not sent
|
|
6
|
-
|
|
7
|
-
const happyPath = false
|
|
8
|
-
|
|
9
|
-
Feature('user')
|
|
10
|
-
|
|
11
|
-
Scenario('sign in with email link', async ({ I }) => {
|
|
12
|
-
|
|
13
|
-
const user = app.generateUid()
|
|
14
|
-
const email = randomUserData.email
|
|
15
|
-
|
|
16
|
-
const User = await I.haveModel('user', 'User')
|
|
17
|
-
const Email = await I.haveModel('email', 'Email')
|
|
18
|
-
|
|
19
|
-
await User.create({ id: user, roles: [] })
|
|
20
|
-
await Email.create({ id: email, email, user })
|
|
21
|
-
|
|
22
|
-
I.amOnPage('/sign-in')
|
|
23
|
-
I.fillField('input#email', email)
|
|
24
|
-
I.click('button[type=submit]')
|
|
25
|
-
|
|
26
|
-
I.seeInCurrentUrl('/sent/')
|
|
27
|
-
const url = await I.grabCurrentUrl()
|
|
28
|
-
const authentication = url.split('/').pop()
|
|
29
|
-
|
|
30
|
-
const authenticationData = await I.grabObject('messageAuthentication', 'Authentication', authentication)
|
|
31
|
-
console.log("AUTHENTICATION DATA", authenticationData)
|
|
32
|
-
I.assert(!!authenticationData, true, 'authentication created')
|
|
33
|
-
I.assert(authenticationData?.messageData?.user, user, 'authentication contains user')
|
|
34
|
-
|
|
35
|
-
const linkData = await I.useSecretLink(authentication, happyPath)
|
|
36
|
-
|
|
37
|
-
I.seeInCurrentUrl('/sign-in-finished')
|
|
38
|
-
const clientSession = await I.executeScript(() => api.client.value.session)
|
|
39
|
-
const AuthenticatedUser = await I.haveModel('user', 'AuthenticatedUser')
|
|
40
|
-
const authenticatedUserData = await AuthenticatedUser.get(clientSession)
|
|
41
|
-
I.assert(!!authenticatedUserData, true, 'user authenticated server-side')
|
|
42
|
-
const clientUser = await I.executeScript(() => api.client.value.user)
|
|
43
|
-
console.log("CLIENT USER", clientUser)
|
|
44
|
-
console.log("SERVER AUTHENTICATION", authenticatedUserData)
|
|
45
|
-
I.assert(clientUser, authenticatedUserData.user, 'user authenticated')
|
|
46
|
-
|
|
47
|
-
if(!happyPath) {
|
|
48
|
-
I.amOnPage('/link/' + linkData.secretCode)
|
|
49
|
-
I.see('Link used')
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
})
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const app = require('@live-change/framework').app()
|
|
2
|
-
const randomProfile = require('random-profile-generator')
|
|
3
|
-
const crypto = require('crypto')
|
|
4
|
-
const passwordGenerator = require('generate-password')
|
|
5
|
-
|
|
6
|
-
const randomUserData = randomProfile.profile()
|
|
7
|
-
randomUserData.email = randomUserData.firstName.toLowerCase() + '@test.com' // test domain - emails not sent
|
|
8
|
-
|
|
9
|
-
const happyPath = false
|
|
10
|
-
|
|
11
|
-
Feature('user')
|
|
12
|
-
|
|
13
|
-
Scenario('sign in with email and password', async ({ I }) => {
|
|
14
|
-
|
|
15
|
-
const user = app.generateUid()
|
|
16
|
-
const email = randomUserData.email
|
|
17
|
-
const password = passwordGenerator.generate({
|
|
18
|
-
length: 10,
|
|
19
|
-
numbers: true
|
|
20
|
-
})+(Math.random()*10).toFixed()
|
|
21
|
-
const passwordHash = crypto.createHash('sha256').update(password).digest('hex')
|
|
22
|
-
|
|
23
|
-
const User = await I.haveModel('user', 'User')
|
|
24
|
-
const Email = await I.haveModel('email', 'Email')
|
|
25
|
-
const PasswordAuthentication = await I.haveModel('passwordAuthentication', 'PasswordAuthentication')
|
|
26
|
-
|
|
27
|
-
await User.create({ id: user, roles: [] })
|
|
28
|
-
await Email.create({ id: email, email, user })
|
|
29
|
-
await PasswordAuthentication.create({ id: user, user, passwordHash })
|
|
30
|
-
|
|
31
|
-
I.amOnPage('/sign-in')
|
|
32
|
-
I.fillField('input#email', email)
|
|
33
|
-
I.fillField('input#password', password)
|
|
34
|
-
I.click('button[type=submit]')
|
|
35
|
-
|
|
36
|
-
I.seeInCurrentUrl('/sign-in-finished')
|
|
37
|
-
await I.wait(0.2)
|
|
38
|
-
const clientSession = await I.executeScript(() => api.client.value.session)
|
|
39
|
-
const AuthenticatedUser = await I.haveModel('user', 'AuthenticatedUser')
|
|
40
|
-
const authenticatedUserData = await AuthenticatedUser.get(clientSession)
|
|
41
|
-
I.assert(!!authenticatedUserData, true, 'user authenticated server-side')
|
|
42
|
-
const clientUser = await I.executeScript(() => api.client.value.user)
|
|
43
|
-
console.log("CLIENT USER", clientUser)
|
|
44
|
-
console.log("SERVER AUTHENTICATION", authenticatedUserData)
|
|
45
|
-
I.assert(clientUser, authenticatedUserData.user, 'user authenticated')
|
|
46
|
-
|
|
47
|
-
})
|
package/e2e/signOut.test.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const app = require('@live-change/framework').app()
|
|
2
|
-
const randomProfile = require('random-profile-generator')
|
|
3
|
-
|
|
4
|
-
const name = randomProfile.profile().firstName.toLowerCase()
|
|
5
|
-
const email = name + '@test.com' // test domain - emails not sent
|
|
6
|
-
|
|
7
|
-
const happyPath = false
|
|
8
|
-
|
|
9
|
-
Feature('user')
|
|
10
|
-
|
|
11
|
-
Scenario('sign out', async ({ I }) => {
|
|
12
|
-
|
|
13
|
-
const user = app.generateUid()
|
|
14
|
-
|
|
15
|
-
const User = await I.haveModel('user', 'User')
|
|
16
|
-
const Email = await I.haveModel('email', 'Email')
|
|
17
|
-
const AuthenticatedUser = await I.haveModel('user', 'AuthenticatedUser')
|
|
18
|
-
|
|
19
|
-
await User.create({ id: user, roles: [] })
|
|
20
|
-
await Email.create({ id: email, email, user })
|
|
21
|
-
I.amOnPage('/')
|
|
22
|
-
const session = await I.executeScript(() => api.client.value.session)
|
|
23
|
-
await AuthenticatedUser.create({ id: session, user, session })
|
|
24
|
-
|
|
25
|
-
await I.wait(0.2)
|
|
26
|
-
const clientUser = await I.executeScript(() => api.client.value.user)
|
|
27
|
-
I.assert(user, clientUser, 'client logged in')
|
|
28
|
-
|
|
29
|
-
I.amOnPage('/sign-out')
|
|
30
|
-
I.seeInCurrentUrl('/sign-out-finished')
|
|
31
|
-
|
|
32
|
-
await I.wait(1.0)
|
|
33
|
-
const clientUser2 = await I.executeScript(() => api.client.value.user)
|
|
34
|
-
console.log("CLIENT USER2", clientUser2)
|
|
35
|
-
const authenticatedUserData = await AuthenticatedUser.get(session)
|
|
36
|
-
console.log("AUTHENTICATED USER", authenticatedUserData)
|
|
37
|
-
|
|
38
|
-
I.assert(!!authenticatedUserData, false, 'no server user')
|
|
39
|
-
I.assert(!!clientUser2, false, 'no client user')
|
|
40
|
-
|
|
41
|
-
})
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const randomProfile = require('random-profile-generator')
|
|
2
|
-
|
|
3
|
-
const user = randomProfile.profile()
|
|
4
|
-
user.email = user.firstName.toLowerCase() + '@test.com' // test domain - emails not sent
|
|
5
|
-
|
|
6
|
-
const happyPath = false
|
|
7
|
-
|
|
8
|
-
Feature('user')
|
|
9
|
-
|
|
10
|
-
Scenario('sign up with email code', async ({ I }) => {
|
|
11
|
-
|
|
12
|
-
I.amOnPage('/sign-up')
|
|
13
|
-
I.fillField('input#email', user.email)
|
|
14
|
-
I.click('button[type=submit]')
|
|
15
|
-
|
|
16
|
-
I.seeInCurrentUrl('/sent/')
|
|
17
|
-
const url = await I.grabCurrentUrl()
|
|
18
|
-
const authentication = url.split('/').pop()
|
|
19
|
-
|
|
20
|
-
const authenticationData = await I.grabObject('messageAuthentication', 'Authentication', authentication)
|
|
21
|
-
console.log("AUTHENTICATION DATA", authenticationData)
|
|
22
|
-
I.assert(!!authenticationData, true, 'authentication created')
|
|
23
|
-
|
|
24
|
-
await I.useSecretCode(authentication, happyPath)
|
|
25
|
-
|
|
26
|
-
I.seeInCurrentUrl('/sign-up-finished')
|
|
27
|
-
const clientSession = await I.executeScript(() => api.client.value.session)
|
|
28
|
-
const AuthenticatedUser = await I.haveModel('user', 'AuthenticatedUser')
|
|
29
|
-
const authenticatedUserData = await AuthenticatedUser.get(clientSession)
|
|
30
|
-
I.assert(!!authenticatedUserData, true, 'user authenticated server-side')
|
|
31
|
-
const clientUser = await I.executeScript(() => api.client.value.user)
|
|
32
|
-
console.log("CLIENT USER", clientUser)
|
|
33
|
-
console.log("SERVER AUTHENTICATION", authenticatedUserData)
|
|
34
|
-
I.assert(clientUser, authenticatedUserData.user, 'user authenticated')
|
|
35
|
-
|
|
36
|
-
if(!happyPath) {
|
|
37
|
-
I.amOnPage(url)
|
|
38
|
-
I.seeInCurrentUrl('/sign-up-finished')
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
})
|