Maintenance: Port customer ticket create fields test to capybara.

This commit is contained in:
Dominik Klein 2021-09-29 17:17:21 +02:00 committed by Thorsten Eckel
parent 23c8db7e58
commit 35f45f690f
3 changed files with 33 additions and 53 deletions

View file

@ -46,7 +46,6 @@ if [ "$LEVEL" == '1' ]; then
rm test/browser/agent_user_manage_test.rb
rm test/browser/agent_user_profile_test.rb
# test/browser/auth_test.rb
rm test/browser/customer_ticket_create_fields_test.rb
rm test/browser/customer_ticket_create_test.rb
rm test/browser/first_steps_test.rb
rm test/browser/integration_test.rb
@ -105,7 +104,6 @@ elif [ "$LEVEL" == '2' ]; then
rm test/browser/agent_user_manage_test.rb
rm test/browser/agent_user_profile_test.rb
rm test/browser/auth_test.rb
rm test/browser/customer_ticket_create_fields_test.rb
rm test/browser/customer_ticket_create_test.rb
rm test/browser/first_steps_test.rb
rm test/browser/integration_test.rb
@ -164,7 +162,6 @@ elif [ "$LEVEL" == '3' ]; then
rm test/browser/agent_user_manage_test.rb
rm test/browser/agent_user_profile_test.rb
rm test/browser/auth_test.rb
rm test/browser/customer_ticket_create_fields_test.rb
rm test/browser/customer_ticket_create_test.rb
rm test/browser/first_steps_test.rb
rm test/browser/integration_test.rb
@ -223,7 +220,6 @@ elif [ "$LEVEL" == '4' ]; then
rm test/browser/agent_user_manage_test.rb
rm test/browser/agent_user_profile_test.rb
rm test/browser/auth_test.rb
# test/browser/customer_ticket_create_fields_test.rb
# test/browser/customer_ticket_create_test.rb
rm test/browser/first_steps_test.rb
rm test/browser/integration_test.rb
@ -281,7 +277,6 @@ elif [ "$LEVEL" == '5' ]; then
# test/browser/agent_user_manage_test.rb
# test/browser/agent_user_profile_test.rb
rm test/browser/auth_test.rb
rm test/browser/customer_ticket_create_fields_test.rb
rm test/browser/customer_ticket_create_test.rb
rm test/browser/first_steps_test.rb
rm test/browser/integration_test.rb
@ -342,7 +337,6 @@ elif [ "$LEVEL" == '6' ]; then
rm test/browser/agent_user_manage_test.rb
rm test/browser/agent_user_profile_test.rb
rm test/browser/auth_test.rb
rm test/browser/customer_ticket_create_fields_test.rb
rm test/browser/customer_ticket_create_test.rb
# test/browser/first_steps_test.rb
# test/browser/integration_test.rb

View file

@ -500,6 +500,39 @@ RSpec.describe 'Ticket Create', type: :system do
end
end
context 'when agent and customer user login after another' do
let(:agent) { create(:agent, password: 'test') }
let(:customer) { create(:customer, password: 'test') }
it 'customer user should not have agent object attributes', authenticated_as: :agent do
visit 'ticket/create'
logout
# Re-create agent session and fetch object attributes.
login(
username: agent.login,
password: 'test'
)
visit 'ticket/create'
# Re-remove local object attributes bound to the session
# there was an issue (#1856) where the old attribute values
# persisted and were stored as the original attributes.
logout
# Create customer session and fetch object attributes.
login(
username: customer.login,
password: 'test'
)
visit 'customer_ticket_new'
expect(page).to have_no_css('.newTicket input[name="customer_id"]')
end
end
describe 'It should be possible to show attributes which are configured shown false #3726', authenticated_as: :authenticate, db_strategy: :reset do
let(:field_name) { SecureRandom.uuid }
let(:field) do

View file

@ -1,47 +0,0 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'browser_test_helper'
class CustomerTicketCreateFieldsTest < TestCase
def test_customer_ticket_create_fields
@browser = browser_instance
# create agent session and fetch object attributes
login(
username: 'admin@example.com',
password: 'test',
url: browser_url,
)
# remove local object attributes bound to the session
logout
# re-create agent session and fetch object attributes
login(
username: 'admin@example.com',
password: 'test',
url: browser_url,
)
# re-remove local object attributes bound to the session
# there was an issue (#1856) where the old attribute values
# persisted and were stored as the original attributes
logout
# create customer session and fetch object attributes
login(
username: 'nicole.braun@zammad.org',
password: 'test',
url: browser_url,
)
# customer ticket create
click(css: 'a[href="#new"]', only_if_exists: true)
click(css: 'a[href="#customer_ticket_new"]')
sleep 2
# ensure that the object attributes of the agent session
# were removed properly and won't get displayed in the form
exists_not(
css: '.newTicket input[name="customer_id"]',
)
end
end