agent_ticket_create_template_test.rb 2.2 KB

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