1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
- import { axe } from 'vitest-axe'
- import { visitView } from '#tests/support/components/visitView.ts'
- import { mockPermissions } from '#tests/support/mock-permissions.ts'
- import { mockUserCurrent } from '#tests/support/mock-userCurrent.ts'
- import { mockUserCurrentDeviceListQuery } from '../graphql/queries/userCurrentDeviceList.mocks.ts'
- const generateFingerprintSpy = vi.fn()
- vi.mock('#shared/utils/browser.ts', () => {
- return {
- generateFingerprint: () => {
- generateFingerprintSpy()
- return 'dummy'
- },
- }
- })
- const userCurrentDeviceList = [
- {
- id: '1',
- name: 'Chrome on Mac',
- fingerprint: 'dummy',
- location: 'Germany, Berlin',
- updatedAt: '2024-02-01T12:00:00Z',
- },
- {
- id: '2',
- name: 'Firefox on Mac',
- fingerprint: 'random',
- location: 'Germany, Frankfurt',
- updatedAt: '2024-01-01T12:00:00Z',
- },
- ]
- describe('testing devices a11y view', async () => {
- beforeEach(() => {
- mockUserCurrent({
- firstname: 'John',
- lastname: 'Doe',
- })
- mockPermissions(['user_preferences.device'])
- mockUserCurrentDeviceListQuery({ userCurrentDeviceList })
- })
- it('has no accessibility violations', async () => {
- const view = await visitView('/personal-setting/devices')
- const results = await axe(view.html())
- expect(results).toHaveNoViolations()
- })
- })
|