-
-
Notifications
You must be signed in to change notification settings - Fork 931
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
210 additions
and
1 deletion.
There are no files selected for viewing
136 changes: 136 additions & 0 deletions
136
test/e2e/cypress/integration/profiles/mfa/settings/success.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
import {APP_URL, gen, website} from '../../../../helpers' | ||
|
||
context('Email Profile', () => { | ||
describe('Settings Flow Success', () => { | ||
before(() => { | ||
cy.useConfigProfile('mfa') | ||
}) | ||
|
||
const email = gen.email() | ||
const password = gen.password() | ||
|
||
before(() => { | ||
cy.register({email, password, fields: {'traits.website': website}}) | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.clearCookies() | ||
cy.login({email, password}) | ||
cy.visit(APP_URL + '/settings') | ||
}) | ||
|
||
it('shows all settings forms', () => { | ||
cy.get('p').should('contain.text', 'Profile') | ||
cy.get('input[name="traits.email"]').should('contain.value', email) | ||
cy.get('input[name="traits.website"]').should('contain.value', website) | ||
|
||
cy.get('p').should('contain.text', 'Password') | ||
cy.get('input[name="password"]').should('be.empty') | ||
}) | ||
|
||
// describe('password', () => { | ||
// it('modifies the password with privileged session', () => { | ||
// // Once input weak password to test which error message is cleared after updating successfully | ||
// cy.get('input[name="password"]').clear().type('123') | ||
// cy.get('button[value="password"]').click() | ||
// cy.get('.container').should( | ||
// 'not.contain.text', | ||
// 'Your changes have been saved!' | ||
// ) | ||
// cy.get('.container').should( | ||
// 'contain.text', | ||
// 'The password can not be used' | ||
// ) | ||
// cy.get('input[name="password"]').should('be.empty') | ||
// | ||
// password = up(password) | ||
// cy.get('input[name="password"]').clear().type(password) | ||
// cy.get('button[value="password"]').click() | ||
// cy.get('.container').should( | ||
// 'contain.text', | ||
// 'Your changes have been saved!' | ||
// ) | ||
// cy.get('.container').should( | ||
// 'not.contain.text', | ||
// 'The password can not be used' | ||
// ) | ||
// cy.get('input[name="password"]').should('be.empty') | ||
// }) | ||
// | ||
// it('is unable to log in with the old password', () => { | ||
// cy.clearCookies() | ||
// cy.login({ | ||
// email: email, | ||
// password: down(password), | ||
// expectSession: false | ||
// }) | ||
// }) | ||
// | ||
// it('modifies the password with an unprivileged session', () => { | ||
// password = up(password) | ||
// cy.get('input[name="password"]').clear().type(password) | ||
// cy.shortPrivilegedSessionTime() // wait for the privileged session to time out | ||
// cy.get('button[value="password"]').click() | ||
// | ||
// cy.reauth({ expect: { email }, type: { password: down(password) } }) | ||
// | ||
// cy.url().should('include', '/settings') | ||
// cy.get('.container').should( | ||
// 'contain.text', | ||
// 'Your changes have been saved!' | ||
// ) | ||
// cy.get('input[name="password"]').should('be.empty') | ||
// }) | ||
// }) | ||
// | ||
// describe('profile', () => { | ||
// it('modifies an unprotected trait', () => { | ||
// cy.get('input[name="traits.website"]') | ||
// .clear() | ||
// .type('https://github.com/ory') | ||
// cy.get('button[value="profile"]').click() | ||
// cy.get('.container').should( | ||
// 'contain.text', | ||
// 'Your changes have been saved!' | ||
// ) | ||
// cy.get('input[name="traits.website"]').should( | ||
// 'contain.value', | ||
// 'https://github.com/ory' | ||
// ) | ||
// }) | ||
// | ||
// it('modifies a protected trait with privileged session', () => { | ||
// email = up(email) | ||
// cy.get('input[name="traits.email"]').clear().type(email) | ||
// cy.get('button[value="profile"]').click() | ||
// cy.get('.container').should( | ||
// 'contain.text', | ||
// 'Your changes have been saved!' | ||
// ) | ||
// cy.get('input[name="traits.email"]').should('contain.value', email) | ||
// }) | ||
// | ||
// it('is unable to log in with the old email', () => { | ||
// cy.clearCookies() | ||
// cy.visit(APP_URL + '/auth/login') | ||
// cy.login({ email: down(email), password, expectSession: false }) | ||
// }) | ||
// | ||
// it('modifies a protected trait with unprivileged session', () => { | ||
// email = up(email) | ||
// cy.get('input[name="traits.email"]').clear().type(email) | ||
// cy.shortPrivilegedSessionTime() // wait for the privileged session to time out | ||
// cy.get('button[value="profile"]').click() | ||
// | ||
// cy.reauth({ expect: { email: down(email) }, type: { password } }) | ||
// | ||
// cy.url().should('include', '/settings') | ||
// cy.get('.container').should( | ||
// 'contain.text', | ||
// 'Your changes have been saved!' | ||
// ) | ||
// cy.get('input[name="traits.email"]').should('contain.value', email) | ||
// }) | ||
// }) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
selfservice: | ||
flows: | ||
settings: | ||
privileged_session_max_age: 5m | ||
|
||
logout: | ||
after: | ||
default_browser_return_url: http://localhost:4455/auth/login | ||
|
||
registration: | ||
after: | ||
password: | ||
hooks: | ||
- hook: session | ||
|
||
methods: | ||
totp: | ||
enabled: true | ||
config: | ||
issuer: issuer.ory.sh | ||
lookup_secret: | ||
enabled: true | ||
webauthn: | ||
enabled: true | ||
config: | ||
rp: | ||
id: localhost | ||
origin: http://localhost:4455 | ||
display_name: Ory | ||
|
||
identity: | ||
default_schema_url: file://test/e2e/profiles/email/identity.traits.schema.json | ||
|
||
#session: | ||
# whoami: | ||
# authenticated_if: aal1 | aal2 | highest_available_aal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"$id": "https://schemas.ory.sh/presets/kratos/quickstart/email-password/identity.schema.json", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Person", | ||
"type": "object", | ||
"properties": { | ||
"traits": { | ||
"type": "object", | ||
"properties": { | ||
"email": { | ||
"type": "string", | ||
"format": "email", | ||
"title": "Your E-Mail", | ||
"minLength": 3, | ||
"ory.sh/kratos": { | ||
"credentials": { | ||
"password": { | ||
"identifier": true | ||
} | ||
} | ||
} | ||
}, | ||
"website": { | ||
"title": "Your website", | ||
"type": "string", | ||
"format": "uri", | ||
"minLength": 10 | ||
} | ||
}, | ||
"required": [ | ||
"email", | ||
"website" | ||
], | ||
"additionalProperties": false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters