|
@@ -1,5 +1,6 @@
|
|
|
// Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
|
|
|
|
|
|
+import { getTestRouter } from '#tests/support/components/renderComponent.ts'
|
|
|
import { visitView } from '#tests/support/components/visitView.ts'
|
|
|
import { mockApplicationConfig } from '#tests/support/mock-applicationConfig.ts'
|
|
|
|
|
@@ -10,6 +11,7 @@ import {
|
|
|
|
|
|
import { mockSystemSetupLockMutation } from '../graphql/mutations/systemSetupLock.mocks.ts'
|
|
|
import { mockSystemSetupInfoQuery } from '../graphql/queries/systemSetupInfo.mocks.ts'
|
|
|
+import { useSystemSetupInfoStore } from '../stores/systemSetupInfo.ts'
|
|
|
|
|
|
import { mockSystemSetupInfo } from './mocks/mock-systemSetupInfo.ts'
|
|
|
|
|
@@ -145,5 +147,44 @@ describe('guided setup start', () => {
|
|
|
expect(view.getByRole('button', { name: 'Go Back' })).toBeInTheDocument()
|
|
|
expect(view.getByText('Create Administrator Account')).toBeInTheDocument()
|
|
|
})
|
|
|
+
|
|
|
+ it('redirects to home screen on back navigation, if the setup was completed', async () => {
|
|
|
+ mockSystemSetupInfoQuery({
|
|
|
+ systemSetupInfo: {
|
|
|
+ status: EnumSystemSetupInfoStatus.New,
|
|
|
+ type: null,
|
|
|
+ },
|
|
|
+ })
|
|
|
+
|
|
|
+ const view = await visitView('/guided-setup')
|
|
|
+
|
|
|
+ await view.events.click(view.getByText('Set up a new system'))
|
|
|
+
|
|
|
+ await vi.waitFor(() => {
|
|
|
+ expect(
|
|
|
+ view,
|
|
|
+ 'correctly redirects to guided setup manual',
|
|
|
+ ).toHaveCurrentUrl('/guided-setup/manual')
|
|
|
+ })
|
|
|
+
|
|
|
+ mockSystemSetupInfoQuery({
|
|
|
+ systemSetupInfo: {
|
|
|
+ status: EnumSystemSetupInfoStatus.Done,
|
|
|
+ type: null,
|
|
|
+ },
|
|
|
+ })
|
|
|
+
|
|
|
+ const { setSystemSetupInfo } = useSystemSetupInfoStore()
|
|
|
+
|
|
|
+ await setSystemSetupInfo()
|
|
|
+
|
|
|
+ const router = getTestRouter()
|
|
|
+
|
|
|
+ router.back()
|
|
|
+
|
|
|
+ await vi.waitFor(() => {
|
|
|
+ expect(view, 'correctly redirects to home screen').toHaveCurrentUrl('/')
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
})
|