agent_ticket_create_template_test.rb 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'browser_test_helper'
  3. # Regression test for UI bugfix
  4. # https://github.com/zammad/zammad/issues/1669
  5. #
  6. # After creating a new ticket template, logging out, and logging back in,
  7. # ensure that the template selection menu still contains the new entry.
  8. class AgentTicketCreateTemplateTest < TestCase
  9. def test_ticket_template_creation
  10. @browser = browser_instance
  11. login(
  12. username: 'agent1@example.com',
  13. password: 'test',
  14. url: browser_url,
  15. )
  16. tasks_close_all
  17. click(
  18. css: 'a[href="#ticket/create"]'
  19. )
  20. watch_for(
  21. css: '.active .templates-welcome',
  22. displayed: true
  23. )
  24. set(
  25. css: 'input[name="title"]',
  26. value: 'my first ticket'
  27. )
  28. click(
  29. css: '.active .templates-welcome .js-create'
  30. )
  31. watch_for(
  32. css: '.active .templates-manage',
  33. displayed: true,
  34. timeout: 3,
  35. )
  36. exists_not(
  37. css: '.active .templates-manage select[name="id"] > option:not([value=""])'
  38. )
  39. # save new template
  40. set(
  41. css: '.active .templates-manage .js-name',
  42. value: 'test template'
  43. )
  44. click(
  45. css: '.active .templates-manage .js-save'
  46. )
  47. exists(
  48. css: '.active .templates-manage select[name="id"] > option:not([value=""])',
  49. displayed: true
  50. )
  51. # check if relogin temlates are still available
  52. logout
  53. login(
  54. username: 'agent1@example.com',
  55. password: 'test',
  56. )
  57. click(
  58. css: '.navigation > .tasks > a.task'
  59. )
  60. exists(
  61. css: '.active .templates-manage',
  62. displayed: true
  63. )
  64. exists(
  65. css: '.active .templates-manage select[name="id"] > option:not([value=""])',
  66. displayed: true
  67. )
  68. # apply new tempalte
  69. tasks_close_all
  70. click(
  71. css: 'a[href="#ticket/create"]'
  72. )
  73. watch_for(
  74. css: '.active .templates-manage',
  75. displayed: true,
  76. timeout: 3,
  77. )
  78. select(
  79. css: '.active .templates-manage select[name="id"]',
  80. value: 'test template',
  81. )
  82. click(
  83. css: '.active .templates-manage .js-apply'
  84. )
  85. exists(
  86. css: '.active .newTicket input[name="title"]',
  87. value: 'my first ticket'
  88. )
  89. end
  90. end