2024-06-11 08:02:25 -04:00
|
|
|
import { createMongoUser, ensureUserExists, login } from './helpers/login'
|
2024-05-30 03:12:56 -04:00
|
|
|
import { startWith } from './helpers/config'
|
2023-11-23 05:40:13 -05:00
|
|
|
|
|
|
|
describe('Accounts', function () {
|
2024-05-30 03:12:56 -04:00
|
|
|
startWith({})
|
|
|
|
ensureUserExists({ email: 'user@example.com' })
|
|
|
|
|
2023-11-23 05:40:13 -05:00
|
|
|
it('can log in and out', function () {
|
|
|
|
login('user@example.com')
|
|
|
|
cy.visit('/project')
|
|
|
|
cy.findByText('Account').click()
|
|
|
|
cy.findByText('Log Out').click()
|
|
|
|
})
|
2024-06-11 08:02:25 -04:00
|
|
|
|
|
|
|
it('should render the email on the user activate screen', () => {
|
|
|
|
const email = 'not-activated-user@example.com'
|
|
|
|
cy.then(async () => {
|
|
|
|
const { url } = await createMongoUser({ email })
|
|
|
|
return url
|
|
|
|
}).as('url')
|
|
|
|
cy.get('@url').then(url => {
|
|
|
|
cy.visit(`${url}`)
|
|
|
|
cy.url().should('contain', '/user/activate')
|
|
|
|
cy.findByText('Please set a password')
|
|
|
|
cy.get('input[autocomplete="username"]').should(
|
|
|
|
'have.attr',
|
|
|
|
'value',
|
|
|
|
email
|
|
|
|
)
|
|
|
|
cy.get('input[name="password"]')
|
|
|
|
cy.findByRole('button', { name: 'Activate' })
|
|
|
|
})
|
|
|
|
})
|
2023-11-23 05:40:13 -05:00
|
|
|
})
|