accounts.spec.ts 1.2 KB

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