123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
- import { visitView } from '#tests/support/components/visitView.ts'
- import { mockApplicationConfig } from '#tests/support/mock-applicationConfig.ts'
- import { mockAuthentication } from '#tests/support/mock-authentication.ts'
- import { mockPermissions } from '#tests/support/mock-permissions.ts'
- import {
- EnumSystemSetupInfoStatus,
- EnumSystemSetupInfoType,
- } from '#shared/graphql/types.ts'
- import { mockEmailAddressesQuery } from '#desktop/entities/email-addresses/graphql/queries/emailAddresses.mocks.ts'
- import { mockSystemSetupInfoQuery } from '../graphql/queries/systemSetupInfo.mocks.ts'
- describe('guided setup manual email notification', () => {
- describe('when system is ready for optional steps and system_online_service is false', () => {
- beforeEach(() => {
- mockApplicationConfig({
- system_init_done: true,
- system_online_service: false,
- })
- mockPermissions(['admin'])
- mockAuthentication(true)
- })
- it('redirects to guided setup channels email step', async () => {
- mockSystemSetupInfoQuery({
- systemSetupInfo: {
- status: EnumSystemSetupInfoStatus.InProgress,
- type: EnumSystemSetupInfoType.Manual,
- },
- })
- const view = await visitView(
- '/guided-setup/manual/channels/email-pre-configured',
- )
- await vi.waitFor(() => {
- expect(
- view,
- 'correctly redirects to guided setup channels email screen',
- ).toHaveCurrentUrl('/guided-setup/manual/channels/email')
- })
- expect(view.getByText('Email Account')).toBeInTheDocument()
- expect(view.getByText('Email address')).toBeInTheDocument()
- })
- })
- describe('when system is ready for optional steps and system_online_service is true', () => {
- beforeEach(() => {
- mockApplicationConfig({
- system_init_done: true,
- system_online_service: true,
- })
- mockPermissions(['admin'])
- mockAuthentication(true)
- })
- it('shows information about pre-configured email addresses', async () => {
- mockSystemSetupInfoQuery({
- systemSetupInfo: {
- status: EnumSystemSetupInfoStatus.InProgress,
- type: EnumSystemSetupInfoType.Manual,
- },
- })
- mockEmailAddressesQuery({
- emailAddresses: [
- {
- name: 'Example Corporation',
- email: 'example@zammad.com',
- },
- ],
- })
- const view = await visitView(
- '/guided-setup/manual/channels/email-pre-configured',
- )
- await vi.waitFor(() => {
- expect(
- view,
- 'correctly shows information about pre-configured email addresses',
- ).toHaveCurrentUrl('/guided-setup/manual/channels/email-pre-configured')
- })
- const labels = view.getAllByTestId('common-label')
- expect(labels[0]).toBeInTheDocument()
- expect(labels[0]).toHaveTextContent(
- 'Your Zammad has the following email address',
- )
- expect(
- view.getByText('Example Corporation <example@zammad.com>'),
- ).toBeInTheDocument()
- expect(labels[1]).toBeInTheDocument()
- expect(labels[1]).toHaveTextContent(
- 'If you want to use additional email addresses, you can configure them later',
- )
- })
- })
- })
|