123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
- import { mockApplicationConfig } from '#tests/support/mock-applicationConfig.ts'
- import { visitView } from '#tests/support/components/visitView.ts'
- import { EnumSystemSetupInfoStatus } from '#shared/graphql/types.ts'
- import { mockAuthentication } from '#tests/support/mock-authentication.ts'
- import { mockPermissions } from '#tests/support/mock-permissions.ts'
- import { mockSystemSetupInfoQuery } from '../graphql/queries/systemSetupInfo.mocks.ts'
- describe('guided setup manual finish', () => {
- describe('when system is not ready', () => {
- beforeEach(() => {
- mockApplicationConfig({
- system_init_done: false,
- })
- })
- it('redirects to guided setup start', async () => {
- mockSystemSetupInfoQuery({
- systemSetupInfo: {
- status: EnumSystemSetupInfoStatus.New,
- type: null,
- },
- })
- const view = await visitView('/guided-setup/manual/finish')
- await vi.waitFor(() => {
- expect(
- view,
- 'correctly redirects to guided setup start screen',
- ).toHaveCurrentUrl('/guided-setup')
- })
- view.getByText('Set up a new system')
- })
- })
- describe('when system is ready for optional steps', () => {
- beforeEach(() => {
- mockApplicationConfig({
- system_init_done: true,
- })
- mockPermissions(['admin'])
- mockAuthentication(true)
- })
- it('redirects to home screen after a timeout', async () => {
- vi.useFakeTimers()
- const view = await visitView('/guided-setup/manual/finish')
- await vi.runAllTimersAsync()
- vi.useRealTimers()
- await vi.waitFor(() => {
- expect(view, 'correctly redirects to home screen').toHaveCurrentUrl('/')
- })
- })
- })
- })
|