2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2019-01-21 17:17:18 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2021-08-25 12:24:42 +00:00
|
|
|
require 'system/examples/core_workflow_examples'
|
2019-09-02 13:28:39 +00:00
|
|
|
require 'system/examples/text_modules_examples'
|
2019-07-03 16:14:28 +00:00
|
|
|
|
2019-01-21 17:17:18 +00:00
|
|
|
RSpec.describe 'Ticket Create', type: :system do
|
|
|
|
context 'when applying ticket templates' do
|
2020-06-19 09:17:18 +00:00
|
|
|
let(:agent) { create(:agent, groups: [permitted_group]) }
|
2020-04-30 15:38:57 +00:00
|
|
|
let(:permitted_group) { create(:group) }
|
|
|
|
let(:unpermitted_group) { create(:group) }
|
|
|
|
let!(:template) { create(:template, :dummy_data, group: unpermitted_group, owner: agent) }
|
2019-01-21 17:17:18 +00:00
|
|
|
|
2020-04-30 15:38:57 +00:00
|
|
|
# Regression test for issue #2424 - Unavailable ticket template attributes get applied
|
2020-06-18 11:51:25 +00:00
|
|
|
it 'unavailable attributes do not get applied', authenticated_as: :agent do
|
2019-01-21 17:17:18 +00:00
|
|
|
visit 'ticket/create'
|
2019-02-04 06:56:18 +00:00
|
|
|
|
2020-04-30 15:38:57 +00:00
|
|
|
use_template(template)
|
2020-08-26 12:31:33 +00:00
|
|
|
expect(page).to have_no_selector 'select[name="group_id"]'
|
2019-01-21 17:17:18 +00:00
|
|
|
end
|
|
|
|
end
|
2019-07-03 16:14:28 +00:00
|
|
|
|
|
|
|
context 'when using text modules' do
|
2019-09-02 13:28:39 +00:00
|
|
|
include_examples 'text modules', path: 'ticket/create'
|
2019-07-03 16:14:28 +00:00
|
|
|
end
|
2020-06-02 11:01:16 +00:00
|
|
|
|
2020-06-15 22:11:29 +00:00
|
|
|
context 'S/MIME', authenticated_as: :authenticate do
|
|
|
|
def authenticate
|
2020-06-02 11:01:16 +00:00
|
|
|
Setting.set('smime_integration', true)
|
2020-09-11 06:17:27 +00:00
|
|
|
Setting.set('smime_config', smime_config) if defined?(smime_config)
|
|
|
|
|
2020-06-15 22:11:29 +00:00
|
|
|
current_user
|
2020-06-02 11:01:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'no certificate present' do
|
2020-06-15 22:11:29 +00:00
|
|
|
let!(:template) { create(:template, :dummy_data) }
|
|
|
|
let(:current_user) { true }
|
2020-06-02 11:01:16 +00:00
|
|
|
|
|
|
|
it 'has no security selections' do
|
|
|
|
visit 'ticket/create'
|
|
|
|
|
|
|
|
within(:active_content) do
|
|
|
|
use_template(template)
|
|
|
|
|
2020-08-26 12:31:33 +00:00
|
|
|
expect(page).to have_no_css('div.js-securityEncrypt.btn--active')
|
|
|
|
expect(page).to have_no_css('div.js-securitySign.btn--active')
|
2020-06-02 11:01:16 +00:00
|
|
|
click '.js-submit'
|
|
|
|
|
|
|
|
expect(page).to have_css('.ticket-article-item', count: 1)
|
|
|
|
|
|
|
|
open_article_meta
|
|
|
|
|
2020-08-26 12:31:33 +00:00
|
|
|
expect(page).to have_no_css('span', text: 'Signed')
|
|
|
|
expect(page).to have_no_css('span', text: 'Encrypted')
|
2020-06-02 11:01:16 +00:00
|
|
|
|
|
|
|
security_result = Ticket::Article.last.preferences['security']
|
|
|
|
expect(security_result['encryption']['success']).to be nil
|
|
|
|
expect(security_result['sign']['success']).to be nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-06-15 22:11:29 +00:00
|
|
|
context 'private key configured' do
|
|
|
|
let(:current_user) { agent }
|
2020-06-02 11:01:16 +00:00
|
|
|
let!(:template) { create(:template, :dummy_data, group: group, owner: agent, customer: customer) }
|
|
|
|
|
|
|
|
let(:system_email_address) { 'smime1@example.com' }
|
|
|
|
let(:email_address) { create(:email_address, email: system_email_address) }
|
|
|
|
let(:group) { create(:group, email_address: email_address) }
|
|
|
|
let(:agent_groups) { [group] }
|
2020-06-19 09:17:18 +00:00
|
|
|
let(:agent) { create(:agent, groups: agent_groups) }
|
2020-06-02 11:01:16 +00:00
|
|
|
|
|
|
|
before do
|
|
|
|
create(:smime_certificate, :with_private, fixture: system_email_address)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'recipient certificate present' do
|
|
|
|
|
|
|
|
let(:recipient_email_address) { 'smime2@example.com' }
|
2020-06-19 09:17:18 +00:00
|
|
|
let(:customer) { create(:customer, email: recipient_email_address) }
|
2020-06-02 11:01:16 +00:00
|
|
|
|
|
|
|
before do
|
|
|
|
create(:smime_certificate, fixture: recipient_email_address)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'plain' do
|
|
|
|
visit 'ticket/create'
|
|
|
|
|
|
|
|
within(:active_content) do
|
|
|
|
use_template(template)
|
|
|
|
|
|
|
|
# wait till S/MIME check AJAX call is ready
|
|
|
|
expect(page).to have_css('div.js-securityEncrypt.btn--active', wait: 5)
|
|
|
|
expect(page).to have_css('div.js-securitySign.btn--active', wait: 5)
|
|
|
|
|
|
|
|
# deactivate encryption and signing
|
|
|
|
click '.js-securityEncrypt'
|
|
|
|
click '.js-securitySign'
|
|
|
|
|
|
|
|
click '.js-submit'
|
|
|
|
|
|
|
|
expect(page).to have_css('.ticket-article-item', count: 1)
|
|
|
|
|
|
|
|
open_article_meta
|
|
|
|
|
2020-08-26 12:31:33 +00:00
|
|
|
expect(page).to have_no_css('span', text: 'Signed')
|
|
|
|
expect(page).to have_no_css('span', text: 'Encrypted')
|
2020-06-02 11:01:16 +00:00
|
|
|
|
|
|
|
security_result = Ticket::Article.last.preferences['security']
|
|
|
|
expect(security_result['encryption']['success']).to be nil
|
|
|
|
expect(security_result['sign']['success']).to be nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'signed' do
|
|
|
|
visit 'ticket/create'
|
|
|
|
|
|
|
|
within(:active_content) do
|
|
|
|
use_template(template)
|
|
|
|
|
|
|
|
# wait till S/MIME check AJAX call is ready
|
|
|
|
expect(page).to have_css('div.js-securityEncrypt.btn--active', wait: 5)
|
|
|
|
expect(page).to have_css('div.js-securitySign.btn--active', wait: 5)
|
|
|
|
|
|
|
|
# deactivate encryption
|
|
|
|
click '.js-securityEncrypt'
|
|
|
|
|
|
|
|
click '.js-submit'
|
|
|
|
|
|
|
|
expect(page).to have_css('.ticket-article-item', count: 1)
|
|
|
|
|
|
|
|
open_article_meta
|
|
|
|
|
|
|
|
expect(page).to have_css('span', text: 'Signed')
|
2020-08-26 12:31:33 +00:00
|
|
|
expect(page).to have_no_css('span', text: 'Encrypted')
|
2020-06-02 11:01:16 +00:00
|
|
|
|
|
|
|
security_result = Ticket::Article.last.preferences['security']
|
|
|
|
expect(security_result['encryption']['success']).to be nil
|
|
|
|
expect(security_result['sign']['success']).to be true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'encrypted' do
|
|
|
|
visit 'ticket/create'
|
|
|
|
|
|
|
|
within(:active_content) do
|
|
|
|
use_template(template)
|
|
|
|
|
|
|
|
# wait till S/MIME check AJAX call is ready
|
|
|
|
expect(page).to have_css('div.js-securityEncrypt.btn--active', wait: 5)
|
|
|
|
expect(page).to have_css('div.js-securitySign.btn--active', wait: 5)
|
|
|
|
|
|
|
|
# deactivate signing
|
|
|
|
click '.js-securitySign'
|
|
|
|
|
|
|
|
click '.js-submit'
|
|
|
|
|
|
|
|
expect(page).to have_css('.ticket-article-item', count: 1)
|
|
|
|
|
|
|
|
open_article_meta
|
|
|
|
|
2020-08-26 12:31:33 +00:00
|
|
|
expect(page).to have_no_css('span', text: 'Signed')
|
2020-06-02 11:01:16 +00:00
|
|
|
expect(page).to have_css('span', text: 'Encrypted')
|
|
|
|
|
|
|
|
security_result = Ticket::Article.last.preferences['security']
|
|
|
|
expect(security_result['encryption']['success']).to be true
|
|
|
|
expect(security_result['sign']['success']).to be nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'signed and encrypted' do
|
|
|
|
visit 'ticket/create'
|
|
|
|
|
|
|
|
within(:active_content) do
|
|
|
|
use_template(template)
|
|
|
|
|
|
|
|
# wait till S/MIME check AJAX call is ready
|
|
|
|
expect(page).to have_css('div.js-securityEncrypt.btn--active', wait: 5)
|
|
|
|
expect(page).to have_css('div.js-securitySign.btn--active', wait: 5)
|
|
|
|
|
|
|
|
click '.js-submit'
|
|
|
|
|
|
|
|
expect(page).to have_css('.ticket-article-item', count: 1)
|
|
|
|
|
|
|
|
open_article_meta
|
|
|
|
|
|
|
|
expect(page).to have_css('span', text: 'Signed')
|
|
|
|
expect(page).to have_css('span', text: 'Encrypted')
|
|
|
|
|
|
|
|
security_result = Ticket::Article.last.preferences['security']
|
|
|
|
expect(security_result['encryption']['success']).to be true
|
|
|
|
expect(security_result['sign']['success']).to be true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'Group default behavior' do
|
|
|
|
|
|
|
|
let(:smime_config) { {} }
|
|
|
|
|
|
|
|
shared_examples 'security defaults example' do |sign:, encrypt:|
|
|
|
|
|
|
|
|
it "security defaults sign: #{sign}, encrypt: #{encrypt}" do
|
|
|
|
within(:active_content) do
|
|
|
|
encrypt_button = find('.js-securityEncrypt', wait: 5)
|
|
|
|
sign_button = find('.js-securitySign', wait: 5)
|
|
|
|
|
|
|
|
active_button_class = '.btn--active'
|
|
|
|
expect(encrypt_button.matches_css?(active_button_class, wait: 2)).to be(encrypt)
|
|
|
|
expect(sign_button.matches_css?(active_button_class, wait: 2)).to be(sign)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
shared_examples 'security defaults' do |sign:, encrypt:|
|
|
|
|
|
|
|
|
before do
|
|
|
|
visit 'ticket/create'
|
|
|
|
|
|
|
|
within(:active_content) do
|
|
|
|
use_template(template)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
include_examples 'security defaults example', sign: sign, encrypt: encrypt
|
|
|
|
end
|
|
|
|
|
|
|
|
shared_examples 'security defaults group change' do |sign:, encrypt:|
|
|
|
|
|
|
|
|
before do
|
|
|
|
visit 'ticket/create'
|
|
|
|
|
|
|
|
within(:active_content) do
|
|
|
|
use_template(template)
|
|
|
|
|
|
|
|
select new_group.name, from: 'group_id'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
include_examples 'security defaults example', sign: sign, encrypt: encrypt
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'not configured' do
|
|
|
|
it_behaves_like 'security defaults', sign: true, encrypt: true
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'configuration present' do
|
|
|
|
|
|
|
|
let(:smime_config) do
|
|
|
|
{
|
|
|
|
'group_id' => group_defaults
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
let(:group_defaults) do
|
|
|
|
{
|
|
|
|
'default_encryption' => {
|
|
|
|
group.id.to_s => default_encryption,
|
|
|
|
},
|
|
|
|
'default_sign' => {
|
|
|
|
group.id.to_s => default_sign,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
let(:default_sign) { true }
|
|
|
|
let(:default_encryption) { true }
|
|
|
|
|
|
|
|
shared_examples 'sign and encrypt variations' do |check_examples_name|
|
|
|
|
|
|
|
|
it_behaves_like check_examples_name, sign: true, encrypt: true
|
|
|
|
|
|
|
|
context 'no value' do
|
|
|
|
let(:group_defaults) { {} }
|
|
|
|
|
|
|
|
it_behaves_like check_examples_name, sign: true, encrypt: true
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'signing disabled' do
|
|
|
|
let(:default_sign) { false }
|
|
|
|
|
|
|
|
it_behaves_like check_examples_name, sign: false, encrypt: true
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'encryption disabled' do
|
|
|
|
let(:default_encryption) { false }
|
|
|
|
|
|
|
|
it_behaves_like check_examples_name, sign: true, encrypt: false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'same Group' do
|
|
|
|
it_behaves_like 'sign and encrypt variations', 'security defaults'
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'Group change' do
|
|
|
|
let(:new_group) { create(:group, email_address: email_address) }
|
|
|
|
|
|
|
|
let(:agent_groups) { [group, new_group] }
|
|
|
|
|
|
|
|
let(:group_defaults) do
|
|
|
|
{
|
|
|
|
'default_encryption' => {
|
|
|
|
new_group.id.to_s => default_encryption,
|
|
|
|
},
|
|
|
|
'default_sign' => {
|
|
|
|
new_group.id.to_s => default_sign,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'sign and encrypt variations', 'security defaults group change'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-12-11 12:59:40 +00:00
|
|
|
|
|
|
|
describe 'object manager attributes maxlength', authenticated_as: :authenticate, db_strategy: :reset do
|
|
|
|
def authenticate
|
|
|
|
create :object_manager_attribute_text, name: 'maxtest', display: 'maxtest', screens: attributes_for(:required_screen), data_option: {
|
|
|
|
'type' => 'text',
|
|
|
|
'maxlength' => 3,
|
|
|
|
'null' => true,
|
|
|
|
'translate' => false,
|
|
|
|
'default' => '',
|
|
|
|
'options' => {},
|
|
|
|
'relation' => '',
|
|
|
|
}
|
|
|
|
ObjectManager::Attribute.migration_execute
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'checks ticket create' do
|
|
|
|
visit 'ticket/create'
|
|
|
|
within(:active_content) do
|
|
|
|
fill_in 'maxtest', with: 'hellu'
|
|
|
|
expect(page.find_field('maxtest').value).to eq('hel')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-03-10 16:11:14 +00:00
|
|
|
|
2021-06-18 13:06:22 +00:00
|
|
|
describe 'GitLab Integration', :integration, authenticated_as: :authenticate, required_envs: %w[GITLAB_ENDPOINT GITLAB_APITOKEN] do
|
2021-03-10 16:11:14 +00:00
|
|
|
let(:customer) { create(:customer) }
|
|
|
|
let(:agent) { create(:agent, groups: [Group.find_by(name: 'Users')]) }
|
|
|
|
let!(:template) { create(:template, :dummy_data, group: Group.find_by(name: 'Users'), owner: agent, customer: customer) }
|
|
|
|
|
|
|
|
def authenticate
|
|
|
|
Setting.set('gitlab_integration', true)
|
|
|
|
Setting.set('gitlab_config', {
|
|
|
|
api_token: ENV['GITLAB_APITOKEN'],
|
|
|
|
endpoint: ENV['GITLAB_ENDPOINT'],
|
|
|
|
})
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates a ticket with links' do
|
|
|
|
visit 'ticket/create'
|
|
|
|
within(:active_content) do
|
|
|
|
use_template(template)
|
|
|
|
|
|
|
|
# switch to gitlab sidebar
|
|
|
|
click('.tabsSidebar-tab[data-tab=gitlab]')
|
|
|
|
click('.sidebar-header-headline.js-headline')
|
|
|
|
|
|
|
|
# add issue
|
|
|
|
click_on 'Link issue'
|
|
|
|
fill_in 'link', with: ENV['GITLAB_ISSUE_LINK']
|
|
|
|
click_on 'Submit'
|
|
|
|
|
|
|
|
# verify issue
|
|
|
|
content = find('.sidebar-git-issue-content')
|
|
|
|
expect(content).to have_text('#1 Example issue')
|
|
|
|
expect(content).to have_text('critical')
|
|
|
|
expect(content).to have_text('special')
|
|
|
|
expect(content).to have_text('important milestone')
|
|
|
|
expect(content).to have_text('zammad-robot')
|
|
|
|
|
|
|
|
# create Ticket
|
|
|
|
click '.js-submit'
|
|
|
|
|
|
|
|
# check stored data
|
|
|
|
expect(Ticket.last.preferences[:gitlab][:issue_links][0]).to eq(ENV['GITLAB_ISSUE_LINK'])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-03-10 16:25:26 +00:00
|
|
|
|
2021-06-18 13:06:22 +00:00
|
|
|
describe 'GitHub Integration', :integration, authenticated_as: :authenticate, required_envs: %w[GITHUB_ENDPOINT GITHUB_APITOKEN] do
|
2021-03-10 16:25:26 +00:00
|
|
|
let(:customer) { create(:customer) }
|
|
|
|
let(:agent) { create(:agent, groups: [Group.find_by(name: 'Users')]) }
|
|
|
|
let!(:template) { create(:template, :dummy_data, group: Group.find_by(name: 'Users'), owner: agent, customer: customer) }
|
|
|
|
|
|
|
|
def authenticate
|
|
|
|
Setting.set('github_integration', true)
|
|
|
|
Setting.set('github_config', {
|
|
|
|
api_token: ENV['GITHUB_APITOKEN'],
|
|
|
|
endpoint: ENV['GITHUB_ENDPOINT'],
|
|
|
|
})
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates a ticket with links' do
|
|
|
|
visit 'ticket/create'
|
|
|
|
within(:active_content) do
|
|
|
|
use_template(template)
|
|
|
|
|
|
|
|
# switch to github sidebar
|
|
|
|
click('.tabsSidebar-tab[data-tab=github]')
|
|
|
|
click('.sidebar-header-headline.js-headline')
|
|
|
|
|
|
|
|
# add issue
|
|
|
|
click_on 'Link issue'
|
|
|
|
fill_in 'link', with: ENV['GITHUB_ISSUE_LINK']
|
|
|
|
click_on 'Submit'
|
|
|
|
|
|
|
|
# verify issue
|
|
|
|
content = find('.sidebar-git-issue-content')
|
|
|
|
expect(content).to have_text('#1575 GitHub integration')
|
|
|
|
expect(content).to have_text('feature backlog')
|
|
|
|
expect(content).to have_text('integration')
|
|
|
|
expect(content).to have_text('4.0')
|
|
|
|
expect(content).to have_text('Thorsten')
|
|
|
|
|
|
|
|
# create Ticket
|
|
|
|
click '.js-submit'
|
|
|
|
|
|
|
|
# check stored data
|
|
|
|
expect(Ticket.last.preferences[:github][:issue_links][0]).to eq(ENV['GITHUB_ISSUE_LINK'])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-05-17 15:12:45 +00:00
|
|
|
|
2021-08-25 12:24:42 +00:00
|
|
|
describe 'Core Workflow' do
|
|
|
|
include_examples 'core workflow' do
|
|
|
|
let(:object_name) { 'Ticket' }
|
|
|
|
let(:before_it) do
|
|
|
|
lambda {
|
|
|
|
ensure_websocket(check_if_pinged: false) do
|
|
|
|
visit 'ticket/create'
|
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-05-17 15:12:45 +00:00
|
|
|
# https://github.com/zammad/zammad/issues/2669
|
|
|
|
context 'when canceling new ticket creation' do
|
|
|
|
it 'closes the dialog' do
|
|
|
|
visit 'ticket/create'
|
|
|
|
|
|
|
|
task_key = find(:task_active)['data-key']
|
|
|
|
|
|
|
|
expect { click('.js-cancel') }.to change { has_selector?(:task_with, task_key, wait: 0) }.to(false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'asks for confirmation if the dialog was modified' do
|
|
|
|
visit 'ticket/create'
|
|
|
|
|
|
|
|
task_key = find(:task_active)['data-key']
|
|
|
|
|
|
|
|
find('[name=title]').fill_in with: 'Title'
|
|
|
|
|
|
|
|
click '.js-cancel'
|
|
|
|
|
|
|
|
in_modal do
|
|
|
|
click '.js-submit'
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_no_selector(:task_with, task_key)
|
|
|
|
end
|
|
|
|
end
|
2021-07-28 14:21:23 +00:00
|
|
|
|
|
|
|
describe 'customer selection to check the field search' do
|
|
|
|
before do
|
|
|
|
create(:customer, active: true)
|
|
|
|
create(:customer, active: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'check for inactive customer in customer/organization selection' do
|
|
|
|
visit 'ticket/create'
|
|
|
|
|
|
|
|
within(:active_content) do
|
|
|
|
find('[name=customer_id] ~ .user-select.token-input').fill_in with: '**'
|
|
|
|
expect(page).to have_css('ul.recipientList > li.recipientList-entry', minimum: 2)
|
|
|
|
expect(page).to have_css('ul.recipientList > li.recipientList-entry.is-inactive', count: 1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-09-09 12:08:00 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
create :object_manager_attribute_text, name: field_name, display: field_name, screens: {
|
|
|
|
'create_middle' => {
|
|
|
|
'ticket.agent' => {
|
|
|
|
'shown' => false,
|
|
|
|
'required' => false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ObjectManager::Attribute.migration_execute
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
visit 'ticket/create'
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when field visible' do
|
|
|
|
let(:workflow) do
|
|
|
|
create(:core_workflow,
|
|
|
|
object: 'Ticket',
|
|
|
|
perform: { "ticket.#{field_name}" => { 'operator' => 'show', 'show' => 'true' } })
|
|
|
|
end
|
|
|
|
|
|
|
|
def authenticate
|
|
|
|
field
|
|
|
|
workflow
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does show up the field' do
|
|
|
|
expect(page).to have_css("div[data-attribute-name='#{field_name}']")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when field hidden' do
|
|
|
|
def authenticate
|
|
|
|
field
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not show the field' do
|
2021-09-10 09:16:30 +00:00
|
|
|
expect(page).to have_css("div[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden)
|
2021-09-09 12:08:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-01-21 17:17:18 +00:00
|
|
|
end
|