123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380 |
- // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
- import { axe } from 'vitest-axe'
- import '#tests/graphql/builders/mocks.ts'
- 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 { mockFormUpdaterQuery } from '#shared/components/Form/graphql/queries/formUpdater.mocks.ts'
- import {
- EnumFormUpdaterId,
- EnumSystemSetupInfoStatus,
- EnumSystemSetupInfoType,
- } from '#shared/graphql/types.ts'
- import { mockChannelEmailSetNotificationConfigurationMutation } from '#desktop/entities/channel-email/graphql/mutations/channelEmailSetNotificationConfiguration.mocks.ts'
- import { mockChannelEmailValidateConfigurationOutboundMutation } from '#desktop/entities/channel-email/graphql/mutations/channelEmailValidateConfigurationOutbound.mocks.ts'
- import { mockEmailAddressesQuery } from '#desktop/entities/email-addresses/graphql/queries/emailAddresses.mocks.ts'
- import { mockSystemImportStartMutation } from '../graphql/mutations/systemImportStart.mocks.ts'
- import { mockSystemImportStateQuery } from '../graphql/queries/systemImportState.mocks.ts'
- import { mockSystemSetupInfoQuery } from '../graphql/queries/systemSetupInfo.mocks.ts'
- import { mockSystemSetupInfo } from './mocks/mock-systemSetupInfo.ts'
- describe('testing admin password request a11y', () => {
- beforeEach(() => {
- mockApplicationConfig({
- system_init_done: false,
- })
- })
- it('has no accessibility violations in the info screen', async () => {
- mockSystemSetupInfoQuery({
- systemSetupInfo: {
- status: EnumSystemSetupInfoStatus.New,
- type: null,
- },
- })
- const view = await visitView('/guided-setup')
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- it('has no accessibility violations in the import selection screen', async () => {
- mockSystemSetupInfoQuery({
- systemSetupInfo: {
- status: EnumSystemSetupInfoStatus.InProgress,
- type: EnumSystemSetupInfoType.Import,
- },
- })
- const view = await visitView('/guided-setup/import')
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- it('has no accessibility violations in the import source screen', async () => {
- mockSystemSetupInfo({
- status: EnumSystemSetupInfoStatus.InProgress,
- type: EnumSystemSetupInfoType.Import,
- lockValue: 'random-uuid-lock',
- importSource: 'freshdesk',
- })
- const view = await visitView('/guided-setup/import/freshdesk')
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- beforeEach(() => {
- mockApplicationConfig({
- system_init_done: false,
- import_mode: false,
- import_backend: 'freshdesk',
- })
- })
- it('has no accessibility violations in the import source start screen', async () => {
- mockSystemSetupInfo({
- status: EnumSystemSetupInfoStatus.InProgress,
- type: EnumSystemSetupInfoType.Import,
- lockValue: 'random-uuid-lock',
- importSource: 'freshdesk',
- })
- mockSystemSetupInfoQuery({
- systemSetupInfo: {
- status: EnumSystemSetupInfoStatus.InProgress,
- type: EnumSystemSetupInfoType.Import,
- },
- })
- mockSystemImportStartMutation({
- systemImportStart: {
- success: true,
- },
- })
- mockSystemImportStateQuery({
- systemImportState: {
- finishedAt: null,
- startedAt: null,
- },
- })
- const view = await visitView('/guided-setup/import/freshdesk/start')
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- it('has no accessibility violations in the import source status screen', async () => {
- mockSystemImportStateQuery({
- systemImportState: {
- result: null,
- finishedAt: null,
- startedAt: null,
- },
- })
- const view = await visitView('/guided-setup/import/freshdesk/status')
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- it('has no accessibility violations in the admin screen', async () => {
- mockSystemSetupInfoQuery({
- systemSetupInfo: {
- status: EnumSystemSetupInfoStatus.New,
- type: null,
- },
- })
- const view = await visitView('/guided-setup/manual/admin')
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- it('has no accessibility violations in the system information screen', async () => {
- mockApplicationConfig({
- system_init_done: true,
- })
- mockPermissions(['admin'])
- mockAuthentication(true)
- const view = await visitView('/guided-setup/manual/system-information')
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- it('has no accessibility violations in the email notification screen', async () => {
- mockApplicationConfig({
- system_init_done: true,
- })
- mockPermissions(['admin'])
- mockAuthentication(true)
- mockFormUpdaterQuery({
- formUpdater: {
- fields: {
- adapter: {
- initialValue: 'sendmail',
- options: [
- {
- value: 'smtp',
- label: 'SMTP - configure your own outgoing SMTP settings',
- },
- {
- value: 'sendmail',
- label:
- 'Local MTA (Sendmail/Postfix/Exim/â\u0080¦) - use server setup',
- },
- ],
- },
- notification_sender: {
- initialValue: 'Zammad Helpdesk <noreply@zammad.example.com>',
- },
- },
- },
- })
- mockChannelEmailValidateConfigurationOutboundMutation({
- channelEmailValidateConfigurationOutbound: {
- success: true,
- errors: null,
- },
- })
- mockChannelEmailSetNotificationConfigurationMutation({
- channelEmailSetNotificationConfiguration: {
- success: true,
- },
- })
- const view = await visitView('/guided-setup/manual/email-notification')
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- it('has no accessibility violations in the channels screen', async () => {
- mockApplicationConfig({
- system_init_done: true,
- })
- mockPermissions(['admin'])
- mockAuthentication(true)
- const view = await visitView('/guided-setup/manual/channels')
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- it('has no accessibility violations in the email channel screen', async () => {
- mockApplicationConfig({
- system_init_done: true,
- })
- mockPermissions(['admin'])
- mockAuthentication(true)
- mockFormUpdaterQuery((variables) => {
- switch (variables.formUpdaterId) {
- case EnumFormUpdaterId.FormUpdaterUpdaterGuidedSetupEmailOutbound:
- return {
- formUpdater: {
- fields: {
- adapter: {
- initialValue: 'smtp',
- options: [
- {
- value: 'smtp',
- label: 'SMTP - configure your own outgoing SMTP settings',
- },
- {
- value: 'sendmail',
- label:
- 'Local MTA (Sendmail/Postfix/Exim/â\u0080¦) - use server setup',
- },
- ],
- },
- },
- },
- }
- case EnumFormUpdaterId.FormUpdaterUpdaterGuidedSetupEmailInbound:
- default:
- return {
- formUpdater: {
- fields: {
- adapter: {
- initialValue: 'imap',
- options: [
- {
- value: 'imap',
- label: 'IMAP',
- },
- {
- value: 'pop3',
- label: 'POP3',
- },
- ],
- },
- },
- },
- }
- }
- })
- const view = await visitView('/guided-setup/manual/channels/email')
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- it('has no accessibility violations in the pre-configured email address screen', async () => {
- mockApplicationConfig({
- system_init_done: true,
- system_online_service: true,
- })
- mockPermissions(['admin'])
- mockAuthentication(true)
- 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',
- )
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- it('has no accessibility violations in the invite screen', async () => {
- mockApplicationConfig({
- system_init_done: true,
- })
- mockPermissions(['admin'])
- mockAuthentication(true)
- mockFormUpdaterQuery({
- formUpdater: {
- fields: {
- role_ids: {
- initialValue: [2],
- options: [
- {
- value: 1,
- label: 'Admin',
- description: 'To configure your system.',
- },
- {
- value: 2,
- label: 'Agent',
- description: 'To work on Tickets.',
- },
- {
- value: 3,
- label: 'Customer',
- description: 'People who create Tickets ask for help.',
- },
- ],
- },
- group_ids: {
- options: [
- {
- value: 1,
- label: 'Users',
- },
- {
- value: 2,
- label: 'some group1',
- },
- ],
- },
- },
- },
- })
- const view = await visitView('/guided-setup/manual/invite')
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- it('has no accessibility violations in the finish screen', async () => {
- mockApplicationConfig({
- system_init_done: true,
- })
- mockPermissions(['admin'])
- mockAuthentication(true)
- const view = await visitView('/guided-setup/manual/finish')
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- })
|