auto
      …ˆ¾‘äÇò 8àd~G@Û��ÏÖƒh¹Õ¿Ó      …auto
     ‡ˆÒ�þ\�¥œlN�Bpƒ’ÿ?Öƒ¡sÕÑ¿Ó ´    ‡ELF                      „      4     (   U‰åVSƒì‰ÆÆ     �Eðèüÿÿÿ…Àuk1Û‹�   ‹èüÿÿÿ…ÀuQƒûw+ÿ$�    ·Eðë(¶Eòë"¶Eóë¶Eôë¶Eõë¶Eöë
�Eðèüÿÿÿë"Ph    jh    èüÿÿÿƒÄëCƒûu—¸    �eø[^]ÃU‰åVS1Û‹4�   1Éº    ‰ðèüÿÿÿ‰ðèüÿÿÿCƒûuÞ[^]ÃU‰åVS1Û‹4�   1É1Ò‰ðèüÿÿÿ‰ðèüÿÿÿCƒûuá[^]Ã =   C   I   O   U   [                     %   %d YEAR MONTH DAY HOUR MINUTE SECOND WEEKDAY    LICENSE=GPLv3+  datetime datehook                                                                              ”   -        Á   *                   /              ?              M              c                            ‹               grub_mod_init grub_mod_fini grub_get_datetime grub_env_export grub_snprintf grub_get_weekday_name grub_register_variable_hook grub_strcmp grub_env_unset             "     )     9     e   
  m     t     y   	  ‰     ž     ¥     ¬     ³     Ë     Ö     Ý                                                    $     (     ,     0      .symtab .strtab .shstrtab .rel.text .rel.rodata .rodata.str1.1 .data .module_license .bss .moddeps .modname                                                         4   ë                     	   @       $  ˆ               )                4                  %   	   @       ¬  h               1      2       T  -                 @             �                     F             „                    V             ”                    [              ”  	                  d              �  	                                ¨  à               	              ˆ  š                                  m                    E   ‰ˆl–Ü4ý('ÜZÔâ€vàZ¸ÓJbÑ¿�þBØÊ³�‘¹q±ÊGÙþ×ƒm¶ÁÖ_�uÐb&=LyZËcõÁÕ ®    ‰# Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/

require 'rails_helper'

# Ported from test/browser/agent_ticket_text_module_test.rb as end-to-end scenarios:
#   admin UI creation of text modules, live propagation of new modules into an already
#   open second session, customer placeholder resolution in the create mask and the
#   placeholder following a customer change in the zoom. The basic ::shortcut insert
#   mechanics are covered by spec/system/examples/text_modules_examples.rb.
RSpec.describe 'Scenario > Text modules', authenticated_as: :authenticate, sessions_jobs: true, type: :system do
  let(:group)          { Group.find_by(name: 'Users') }
  let(:agent)          { create(:agent, password: 'test', groups: [group]) }
  let(:customer)       { create(:customer, firstname: 'Nicole', lastname: 'Braun') }
  let(:other_customer) { create(:customer, firstname: 'Manfred', lastname: 'Mustermann') }
  let(:keyword)        { 'lastnamemodule' }

  def authenticate
    agent
  end

  it 'creates a text module in the admin UI, propagates it live and resolves the customer placeholder' do
    # The agent already has the ticket create mask open...
    visit 'ticket/create'

    within(:active_content) do
      find('[name=customer_id_completion]').fill_in with: customer.email

      expect(page).to have_css('.recipientList-entry.js-object')
      first('.recipientList-entry.js-object').click
    end

    # ...while an admin creates a new text module in a second session.
    using_session(:admin) do
      login(username: 'admin@example.com', password: 'test')

      visit 'manage/text_modules'

      within(:active_content) do
        click '[data-type="new"]'
      end

      in_modal do
        fill_in 'name',     with: 'Lastname module'
        fill_in 'keywords', with: keyword

        find('[data-name="content"]').send_keys "some content \#{ticket.customer.lastname}"

        click_on 'Submit'
      end

      within(:active_content) do
        expect(page).to have_text('Lastname module')
      end
    end

    # The new module is available to the agent, and the placeholder resolves to the
    #   selected customer. NOTE: 