guided-setup-automated-info.spec.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { visitView } from '#tests/support/components/visitView.ts'
  3. import { mockApplicationConfig } from '#tests/support/mock-applicationConfig.ts'
  4. import { mockAuthentication } from '#tests/support/mock-authentication.ts'
  5. import { EnumSystemSetupInfoStatus } from '#shared/graphql/types.ts'
  6. import { mockSystemSetupInfoQuery } from '../graphql/queries/systemSetupInfo.mocks.ts'
  7. describe('guided setup automated info', () => {
  8. describe('when system is not ready', () => {
  9. beforeEach(() => {
  10. mockApplicationConfig({
  11. system_init_done: false,
  12. })
  13. mockSystemSetupInfoQuery({
  14. systemSetupInfo: {
  15. status: EnumSystemSetupInfoStatus.Automated,
  16. type: null,
  17. },
  18. })
  19. })
  20. it('shows info screen', async () => {
  21. const view = await visitView('/guided-setup/automated')
  22. expect(view.getByText('Automated Setup')).toBeInTheDocument()
  23. expect(view.queryByIconName('spinner')).not.toBeInTheDocument()
  24. expect(
  25. view.getByText('This system is configured for automated setup.'),
  26. ).toBeInTheDocument()
  27. expect(view.getByText('Please use the provided URL.')).toBeInTheDocument()
  28. })
  29. it('redirects to info screen first', async () => {
  30. const view = await visitView('/guided-setup')
  31. await vi.waitFor(() => {
  32. expect(
  33. view,
  34. 'correctly redirects to guided setup automated info screen',
  35. ).toHaveCurrentUrl('/guided-setup/automated')
  36. })
  37. })
  38. })
  39. describe('when system is ready', () => {
  40. beforeEach(() => {
  41. mockApplicationConfig({
  42. system_init_done: true,
  43. })
  44. mockAuthentication(true)
  45. })
  46. it('redirects to home screen', async () => {
  47. const view = await visitView('/guided-setup/automated')
  48. await vi.waitFor(() => {
  49. expect(view, 'correctly redirects to home screen').toHaveCurrentUrl('/')
  50. })
  51. })
  52. })
  53. })