ticket-article-context.spec.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { visitView } from '#tests/support/components/visitView.ts'
  3. import { mockPermissions } from '#tests/support/mock-permissions.ts'
  4. import { mockTicketDetailViewGql } from './mocks/detail-view.ts'
  5. beforeAll(async () => {
  6. await import('../components/TicketDetailView/ArticleMetadataDialog.vue')
  7. })
  8. describe('actions inside article context', () => {
  9. beforeEach(() => {
  10. mockPermissions(['ticket.agent'])
  11. })
  12. test('opens metadata', async () => {
  13. const { waitUntilTicketLoaded } = mockTicketDetailViewGql()
  14. const view = await visitView('/tickets/1', {
  15. global: {
  16. stubs: {
  17. transition: false,
  18. },
  19. },
  20. })
  21. await waitUntilTicketLoaded()
  22. const contextTriggers = view.getAllByRole('button', {
  23. name: 'Article actions',
  24. })
  25. await view.events.click(contextTriggers[0])
  26. await view.events.click(view.getByText('Show meta data'))
  27. expect(view.getByText('Meta Data')).toBeInTheDocument()
  28. expect(view.getByRole('region', { name: 'Created' })).toHaveTextContent(
  29. /2022-01-29 00:00/,
  30. )
  31. // content is tested inside unit test
  32. })
  33. })