Skip to content

Commit

Permalink
test(e2e): implement required verification tests for SPA
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Oct 19, 2021
1 parent 3dea57f commit fb55f34
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 57 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { gen } from '../../../../helpers'
import {routes as react} from "../../../../helpers/react";
import {routes as express} from "../../../../helpers/express";

context('Account Verification Login Errors', () => {
[
{
login: react.login,
app: 'react', profile: 'verification'
},
{
login: express.login,
app: 'express', profile: 'verification'
}
].forEach(({profile,login, app}) => {
describe(`for app ${app}`, () => {
before(() => {
cy.deleteMail()
cy.useConfigProfile(profile)
cy.enableLoginForVerifiedAddressOnly()
})

it('is unable to login as long as the email is not verified', () => {
cy.deleteMail()

const identity = gen.identityWithWebsite()
cy.registerApi(identity)
cy.visit(login)

cy.get('[name="password_identifier"]').type(identity.email)
cy.get('[name="password"]').type(identity.password)
cy.get('[value="password"]').click()

cy.get('[data-testid="ui/message/4000010"]').contains('Account not active yet')

cy.noSession()
})
})
})
})

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { APP_URL, gen } from '../../../../helpers'
import {routes as react} from "../../../../helpers/react";
import {routes as express} from "../../../../helpers/express";

context('Account Verification Login Success', () => {
[
{
login: react.login,
app: 'react', profile: 'verification'
},
{
login: express.login,
app: 'express', profile: 'verification'
}
].forEach(({profile,login, app}) => {
describe(`for app ${app}`, () => {
before(() => {
cy.deleteMail()
cy.useConfigProfile(profile)
cy.enableLoginForVerifiedAddressOnly()
})

it('is able to login after successful email verification', () => {
cy.deleteMail()

const identity = gen.identityWithWebsite()
cy.registerApi(identity)
cy.performEmailVerification({ expect: { email: identity.email } })

cy.visit(login)

cy.get('input[name="password_identifier"]').type(identity.email)
cy.get('input[name="password"]').type(identity.password)
cy.get('button[value="password"]').click()

cy.getSession()
})
})
})
})

0 comments on commit fb55f34

Please sign in to comment.