accounts.spec.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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.findByText('Account').click()
  11. cy.findByText('Log Out').click()
  12. })
  13. it('should render the email on the user activate screen', () => {
  14. const email = 'not-activated-user@example.com'
  15. cy.then(async () => {
  16. const { url } = await createMongoUser({ email })
  17. return url
  18. }).as('url')
  19. cy.get('@url').then(url => {
  20. cy.visit(`${url}`)
  21. cy.url().should('contain', '/user/activate')
  22. cy.findByText('Please set a password')
  23. cy.get('input[autocomplete="username"]').should(
  24. 'have.attr',
  25. 'value',
  26. email
  27. )
  28. cy.get('input[name="password"]')
  29. cy.findByRole('button', { name: 'Activate' })
  30. })
  31. })
  32. })