123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
- require 'browser_test_helper'
- class AgentTicketEmailSignatureTest < TestCase
- def test_agent_signature_check
- suffix = SecureRandom.uuid
- signature_name1 = "sig name 1 äöüß #{suffix}"
- signature_body1 = "--\nsig body 1 äöüß #{suffix}"
- signature_name2 = "sig name 2 äöüß #{suffix}"
- signature_body2 = "--\nsig body 2 äöüß #{suffix}"
- group_name1 = "group name 1 #{suffix}"
- group_name2 = "group name 2 #{suffix}"
- group_name3 = "group name 3 #{suffix}"
- @browser = browser_instance
- login(
- username: 'admin@example.com',
- password: 'test',
- url: browser_url,
- )
- tasks_close_all
- #
- # create groups and signatures
- #
- # create signatures
- signature_create(
- data: {
- name: signature_name1,
- body: signature_body1,
- },
- )
- signature_create(
- data: {
- name: signature_name2,
- body: signature_body2,
- },
- )
- # create groups
- group_create(
- data: {
- name: group_name1,
- signature: signature_name1,
- member: [
- {
- login: 'admin@example.com',
- access: 'full',
- },
- ],
- }
- )
- group_create(
- data: {
- name: group_name2,
- signature: signature_name2,
- member: [
- {
- login: 'admin@example.com',
- access: 'full',
- },
- ],
- }
- )
- group_create(
- data: {
- name: group_name3,
- member: [
- {
- login: 'admin@example.com',
- access: 'full',
- },
- ],
- }
- )
- sleep 10 # wait until background job is processed
- #
- # check signature in new ticket
- #
- # reload instances to get new group permissions
- reload
- # create ticket
- ticket_create(
- data: {
- customer: 'nicole',
- group: 'Users',
- title: 'some subject 5 - 123äöü',
- body: 'some body 5 - 123äöü',
- },
- do_not_submit: true,
- )
- # select group
- select(
- css: '.active [name="group_id"]',
- value: group_name1,
- )
- # check content
- match(
- css: '.active [data-name="body"]',
- value: 'some body 5',
- )
- # check signature
- match_not(
- css: '.active [data-name="body"]',
- value: signature_body1,
- no_quote: true,
- )
- match_not(
- css: '.active [data-name="body"]',
- value: signature_body2,
- no_quote: true,
- )
- # select create channel
- click(
- css: '.active [data-type="email-out"]',
- )
- # group 1 is still selected
- # check content
- match(
- css: '.active [data-name="body"]',
- value: 'some body 5',
- )
- # check signature
- match(
- css: '.active [data-name="body"]',
- value: signature_body1,
- no_quote: true,
- )
- match_not(
- css: '.active [data-name="body"]',
- value: signature_body2,
- no_quote: true,
- )
- # select group
- select(
- css: '.active [name="group_id"]',
- value: group_name2,
- )
- # check content
- match(
- css: '.active [data-name="body"]',
- value: 'some body 5',
- )
- # check signature
- match_not(
- css: '.active [data-name="body"]',
- value: signature_body1,
- no_quote: true,
- )
- match(
- css: '.active [data-name="body"]',
- value: signature_body2,
- no_quote: true,
- )
- # select group
- select(
- css: '.active [name="group_id"]',
- value: group_name3,
- )
- # check content
- match(
- css: '.active [data-name="body"]',
- value: 'some body 5',
- )
- # check signature
- match_not(
- css: '.active [data-name="body"]',
- value: signature_body1,
- no_quote: true,
- )
- match_not(
- css: '.active [data-name="body"]',
- value: signature_body2,
- no_quote: true,
- )
- # select group
- select(
- css: '.active [name="group_id"]',
- value: group_name1,
- )
- # check content
- match(
- css: '.active [data-name="body"]',
- value: 'some body 5',
- )
- # check signature
- match(
- css: '.active [data-name="body"]',
- value: signature_body1,
- no_quote: true,
- )
- match_not(
- css: '.active [data-name="body"]',
- value: signature_body2,
- no_quote: true,
- )
- # select create channel
- click(
- css: '.active [data-type="phone-out"]',
- )
- # check content
- match(
- css: '.active [data-name="body"]',
- value: 'some body 5',
- )
- # check signature
- match_not(
- css: '.active [data-name="body"]',
- value: signature_body1,
- no_quote: true,
- )
- match_not(
- css: '.active [data-name="body"]',
- value: signature_body2,
- no_quote: true,
- )
- #
- # check signature in zoom ticket
- #
- ticket_create(
- data: {
- customer: 'nicole',
- group: group_name1,
- title: 'some subject 5/2 - 123äöü',
- body: 'some body 5/2 - 123äöü',
- },
- )
- # execute reply
- click(
- css: '.active [data-type="emailReply"]',
- )
- # check if signature exists
- match(
- css: '.active [data-name="body"]',
- value: signature_body1,
- no_quote: true,
- )
- match_not(
- css: '.active [data-name="body"]',
- value: signature_body2,
- no_quote: true,
- )
- # update group2
- select(
- css: '.active [name="group_id"]',
- value: group_name2,
- )
- # execute reply
- sleep 5 # time to recognice form changes
- scroll_to(
- position: 'botton',
- css: '.active [data-type="emailReply"]',
- )
- click(
- css: '.active [data-type="emailReply"]',
- )
- # check if signature exists
- match_not(
- css: '.active [data-name="body"]',
- value: signature_body1,
- no_quote: true,
- )
- match(
- css: '.active [data-name="body"]',
- value: signature_body2,
- no_quote: true,
- )
- # discard changes
- sleep 2
- click(
- css: '.active .js-reset',
- )
- sleep 3
- # check if signature exists
- match_not(
- css: '.active [data-name="body"]',
- value: signature_body1,
- no_quote: true,
- )
- match_not(
- css: '.active [data-name="body"]',
- value: signature_body2,
- no_quote: true,
- )
- end
- end
|