accounts.spec.ts 1008 B

12345678910111213141516171819202122232425262728293031323334
  1. import { createMongoUser, ensureUserExists, login } from './helpers/login'
  2. import { startWith } from './helpers/config'
  3. describe('Accounts', function () {
  4. startWith({})
  5. ensureUserExists({ email: 'user@example.com' })
  6. it('can log in and out', function () {
  7. login('user@example.com')
  8. cy.visit('/project')
  9. cy.findByText('Account').click()
  10. cy.findByText('Log Out').click()
  11. })
  12. it('should render the email on the user activate screen', () => {
  13. const email = 'not-activated-user@example.com'
  14. cy.then(async () => {
  15. const { url } = await createMongoUser({ email })
  16. return url
  17. }).as('url')
  18. cy.get('@url').then(url => {
  19. cy.visit(`${url}`)
  20. cy.url().should('contain', '/user/activate')
  21. cy.findByText('Please set a password')
  22. cy.get('input[autocomplete="username"]').should(
  23. 'have.attr',
  24. 'value',
  25. email
  26. )
  27. cy.get('input[name="password"]')
  28. cy.findByRole('button', { name: 'Activate' })
  29. })
  30. })
  31. })