Skip to content

Commit

Permalink
styles: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed May 6, 2020
1 parent 5e518fb commit bc7557a
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 90 deletions.
18 changes: 12 additions & 6 deletions cypress/integration/profiles/oidc/login/error.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {APP_URL, gen, website} from "../../../../helpers";
import { APP_URL, gen, website } from '../../../../helpers'

context('Login', () => {
beforeEach(() => {
Expand All @@ -10,8 +10,11 @@ context('Login', () => {
const email = gen.email()
cy.get('button[value="hydra"]').click()
cy.get('#reject').click()
cy.location('pathname').should('equal','/auth/login')
cy.get('.form-errors .message').should('contain.text', 'login rejected request')
cy.location('pathname').should('equal', '/auth/login')
cy.get('.form-errors .message').should(
'contain.text',
'login rejected request'
)
cy.noSession()
})

Expand All @@ -21,8 +24,11 @@ context('Login', () => {
cy.get('#username').type(email)
cy.get('#accept').click()
cy.get('#reject').click()
cy.location('pathname').should('equal','/auth/login')
cy.get('.form-errors .message').should('contain.text', 'consent rejected request')
cy.location('pathname').should('equal', '/auth/login')
cy.get('.form-errors .message').should(
'contain.text',
'consent rejected request'
)
cy.noSession()
})

Expand All @@ -33,7 +39,7 @@ context('Login', () => {
cy.get('#accept').click()
cy.get('#website').type(website)
cy.get('#accept').click()
cy.location('pathname').should('equal','/auth/login')
cy.location('pathname').should('equal', '/auth/login')
cy.get('.form-errors .message').should('contain.text', 'no id_token')
})
})
4 changes: 2 additions & 2 deletions cypress/integration/profiles/oidc/login/success.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ context('Login', () => {
it('should be able to sign up, sign out, and then sign in', () => {
const email = gen.email()

cy.registerOidc({email, website})
cy.registerOidc({ email, website })
cy.get('a[href*="logout"]').click()
cy.noSession()
cy.loginOidc({email})
cy.loginOidc({ email })
})
})
2 changes: 1 addition & 1 deletion cypress/integration/profiles/oidc/logout/success.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ context('Login', () => {
const email = gen.email()

before(() => {
cy.registerOidc({email, website})
cy.registerOidc({ email, website })
})

beforeEach(() => {
Expand Down
18 changes: 12 additions & 6 deletions cypress/integration/profiles/oidc/registration/error.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {APP_URL, gen, website} from "../../../../helpers";
import { APP_URL, gen, website } from '../../../../helpers'

context('Register', () => {
beforeEach(() => {
Expand All @@ -10,8 +10,11 @@ context('Register', () => {
const email = gen.email()
cy.get('button[value="hydra"]').click()
cy.get('#reject').click()
cy.location('pathname').should('equal','/auth/registration')
cy.get('.form-errors .message').should('contain.text', 'login rejected request')
cy.location('pathname').should('equal', '/auth/registration')
cy.get('.form-errors .message').should(
'contain.text',
'login rejected request'
)
cy.noSession()
})

Expand All @@ -21,8 +24,11 @@ context('Register', () => {
cy.get('#username').type(email)
cy.get('#accept').click()
cy.get('#reject').click()
cy.location('pathname').should('equal','/auth/registration')
cy.get('.form-errors .message').should('contain.text', 'consent rejected request')
cy.location('pathname').should('equal', '/auth/registration')
cy.get('.form-errors .message').should(
'contain.text',
'consent rejected request'
)
cy.noSession()
})

Expand All @@ -33,7 +39,7 @@ context('Register', () => {
cy.get('#accept').click()
cy.get('#website').type(website)
cy.get('#accept').click()
cy.location('pathname').should('equal','/auth/registration')
cy.location('pathname').should('equal', '/auth/registration')
cy.get('.form-errors .message').should('contain.text', 'no id_token')
})
})
72 changes: 52 additions & 20 deletions cypress/integration/profiles/oidc/registration/success.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {APP_URL, gen, website} from '../../../../helpers'
import { APP_URL, gen, website } from '../../../../helpers'

context('Register', () => {
beforeEach(() => {
Expand All @@ -7,7 +7,7 @@ context('Register', () => {
})

const shouldSession = (email) => (session) => {
const {identity} = session
const { identity } = session
expect(identity.id).to.not.be.empty
expect(identity.traits_schema_id).to.equal('default')
expect(identity.traits_schema_url).to.equal(
Expand All @@ -20,21 +20,44 @@ context('Register', () => {
it('should be able to sign up with incomplete data and finally be signed in', () => {
const email = gen.email()

cy.registerOidc({email, expectSession: false})
cy.registerOidc({ email, expectSession: false })

cy.get('#registration-password').should('not.exist');
cy.get('#registration-oidc input[name="traits.email"]').should('have.value', email)
cy.get('#registration-oidc form > *:last-child').should('have.attr', 'name', 'provider')
cy.get('.form-errors .message').should('contain.text', 'missing properties: "website"')
cy.get('#registration-oidc input[name="traits.website"]').type("http://s")
cy.get('#registration-password').should('not.exist')
cy.get('#registration-oidc input[name="traits.email"]').should(
'have.value',
email
)
cy.get('#registration-oidc form > *:last-child').should(
'have.attr',
'name',
'provider'
)
cy.get('.form-errors .message').should(
'contain.text',
'missing properties: "website"'
)
cy.get('#registration-oidc input[name="traits.website"]').type('http://s')

cy.get('button[value="hydra"]').click()

cy.get('#registration-password').should('not.exist');
cy.get('#registration-oidc input[name="traits.email"]').should('have.value', email)
cy.get('#registration-oidc form > *:last-child').should('have.attr', 'name', 'provider')
cy.get('.form-errors .message').should('contain.text', 'length must be >= 10')
cy.get('#registration-oidc input[name="traits.website"]').should('have.value', 'http://s').clear().type(website)
cy.get('#registration-password').should('not.exist')
cy.get('#registration-oidc input[name="traits.email"]').should(
'have.value',
email
)
cy.get('#registration-oidc form > *:last-child').should(
'have.attr',
'name',
'provider'
)
cy.get('.form-errors .message').should(
'contain.text',
'length must be >= 10'
)
cy.get('#registration-oidc input[name="traits.website"]')
.should('have.value', 'http://s')
.clear()
.type(website)

cy.get('button[value="hydra"]').click()

Expand All @@ -44,13 +67,13 @@ context('Register', () => {
it('should be able to sign up with complete data', () => {
const email = gen.email()

cy.registerOidc({email, website})
cy.registerOidc({ email, website })
cy.session().should(shouldSession(email))
})
it('should be able to convert a sign up flow to a sign in flow', () => {
const email = gen.email()

cy.registerOidc({email, website})
cy.registerOidc({ email, website })
cy.get('a[href*="logout"]').click()
cy.noSession()
cy.visit(APP_URL + '/auth/registration')
Expand All @@ -66,16 +89,25 @@ context('Register', () => {
cy.get('#username').clear().type(email)
cy.get('#remember').click()
cy.get('#accept').click()
cy.get('input[name="scope"]').each($el => cy.wrap($el).click())
cy.get('input[name="scope"]').each(($el) => cy.wrap($el).click())
cy.get('#remember').click()
cy.get('#accept').click()

cy.get('.form-errors .message').should('contain.text', 'missing properties: "website"')
cy.get('#registration-oidc input[name="traits.website"]').type("http://s")
cy.get('.form-errors .message').should(
'contain.text',
'missing properties: "website"'
)
cy.get('#registration-oidc input[name="traits.website"]').type('http://s')
cy.get('button[value="hydra"]').click()

cy.get('.form-errors .message').should('contain.text', 'length must be >= 10')
cy.get('#registration-oidc input[name="traits.website"]').should('have.value', 'http://s').clear().type(website)
cy.get('.form-errors .message').should(
'contain.text',
'length must be >= 10'
)
cy.get('#registration-oidc input[name="traits.website"]')
.should('have.value', 'http://s')
.clear()
.type(website)
cy.get('button[value="hydra"]').click()

cy.session().should(shouldSession(email))
Expand Down
2 changes: 1 addition & 1 deletion cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference types="cypress" />
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
Expand Down

0 comments on commit bc7557a

Please sign in to comment.