accounts.spec.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  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', function () {
  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.findByRole('heading', { name: 'Please set a password' })
  26. cy.findByLabelText('Email').should('be.visible')
  27. cy.findByLabelText('Password').should('be.visible')
  28. cy.findByRole('button', { name: 'Activate' })
  29. })
  30. })
  31. })