diff --git a/.rubocop/default.yml b/.rubocop/default.yml index 631c316ee..7f350213f 100644 --- a/.rubocop/default.yml +++ b/.rubocop/default.yml @@ -91,11 +91,6 @@ Layout/LeadingCommentSpace: StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space' Enabled: false -Style/MethodCallWithoutArgsParentheses: - Description: 'Do not use parentheses for method calls with no arguments.' - StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens' - Enabled: false - Layout/SpaceInsideReferenceBrackets: Description: 'Checks the spacing inside referential brackets.' Enabled: false diff --git a/app/controllers/application_controller/renders_models.rb b/app/controllers/application_controller/renders_models.rb index 1b67bc6e2..de39faf33 100644 --- a/app/controllers/application_controller/renders_models.rb +++ b/app/controllers/application_controller/renders_models.rb @@ -75,7 +75,7 @@ module ApplicationController::RendersModels def model_destroy_render(object, params) generic_object = object.find(params[:id]) generic_object.destroy! - model_destroy_render_item() + model_destroy_render_item end def model_destroy_render_item() diff --git a/app/controllers/packages_controller.rb b/app/controllers/packages_controller.rb index ae426b656..b298c695f 100644 --- a/app/controllers/packages_controller.rb +++ b/app/controllers/packages_controller.rb @@ -5,7 +5,7 @@ class PackagesController < ApplicationController # GET /api/v1/packages def index - packages = Package.all().order('name') + packages = Package.all.order('name') render json: { packages: packages } diff --git a/app/jobs/communicate_telegram_job.rb b/app/jobs/communicate_telegram_job.rb index 86ce655f6..81044ff07 100644 --- a/app/jobs/communicate_telegram_job.rb +++ b/app/jobs/communicate_telegram_job.rb @@ -31,7 +31,7 @@ class CommunicateTelegramJob < ApplicationJob api = TelegramAPI.new(channel.options[:api_token]) chat_id = ticket.preferences[:telegram][:chat_id] result = api.sendMessage(chat_id, article.body) - me = api.getMe() + me = api.getMe article.attachments.each do |file| parts = file.filename.split(%r{^(.*)(\..+?)$}) t = Tempfile.new([parts[1], parts[2]]) diff --git a/app/models/channel/driver/imap.rb b/app/models/channel/driver/imap.rb index 999b88c28..174608f55 100644 --- a/app/models/channel/driver/imap.rb +++ b/app/models/channel/driver/imap.rb @@ -118,7 +118,7 @@ example timeout(check_type_timeout) do @imap = ::Net::IMAP.new(options[:host], port, ssl, nil, false) if starttls - @imap.starttls() + @imap.starttls end end @@ -232,7 +232,7 @@ example Rails.logger.info " - verify email #{verify_string} found" timeout(600) do @imap.store(message_id, '+FLAGS', [:Deleted]) - @imap.expunge() + @imap.expunge end disconnect return { @@ -339,7 +339,7 @@ example if !keep_on_server begin timeout(EXPUNGE_TIMEOUT) do - @imap.expunge() + @imap.expunge end rescue Timeout::Error => e Rails.logger.error "Unable to expunge server (#{options[:host]}/#{options[:user]}): #{e.inspect}" @@ -382,7 +382,7 @@ example return if !@imap timeout(1.minute) do - @imap.disconnect() + @imap.disconnect end end diff --git a/app/models/role.rb b/app/models/role.rb index e54a189fd..7cdde514c 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -118,7 +118,7 @@ returns permission_ids = Role.permission_ids_by_name(keys) Role.joins(:permissions_roles).joins(:permissions).where( 'permissions_roles.permission_id IN (?) AND roles.active = ? AND permissions.active = ?', permission_ids, true, true - ).distinct() + ).distinct end =begin @@ -142,7 +142,7 @@ returns permission_ids = Role.permission_ids_by_name(keys) return true if Role.joins(:permissions_roles).joins(:permissions).where( 'roles.id = ? AND permissions_roles.permission_id IN (?) AND permissions.active = ?', id, permission_ids, true - ).distinct().count.nonzero? + ).distinct.count.nonzero? false end @@ -192,7 +192,7 @@ returns def last_admin_check_admin_count admin_role_ids = Role.joins(:permissions).where(permissions: { name: ['admin', 'admin.user'], active: true }, roles: { active: true }).where.not(id: id).pluck(:id) - User.joins(:roles).where(roles: { id: admin_role_ids }, users: { active: true }).distinct().count + User.joins(:roles).where(roles: { id: admin_role_ids }, users: { active: true }).distinct.count end def validate_agent_limit_by_attributes @@ -202,8 +202,8 @@ returns return true if !with_permission?('ticket.agent') ticket_agent_role_ids = Role.joins(:permissions).where(permissions: { name: 'ticket.agent', active: true }, roles: { active: true }).pluck(:id) - currents = User.joins(:roles).where(roles: { id: ticket_agent_role_ids }, users: { active: true }).distinct().pluck(:id) - news = User.joins(:roles).where(roles: { id: id }, users: { active: true }).distinct().pluck(:id) + currents = User.joins(:roles).where(roles: { id: ticket_agent_role_ids }, users: { active: true }).distinct.pluck(:id) + news = User.joins(:roles).where(roles: { id: id }, users: { active: true }).distinct.pluck(:id) count = currents.concat(news).uniq.count raise Exceptions::UnprocessableEntity, 'Agent limit exceeded, please check your account settings.' if count > Setting.get('system_agent_limit').to_i @@ -218,7 +218,7 @@ returns ticket_agent_role_ids = Role.joins(:permissions).where(permissions: { name: 'ticket.agent' }, roles: { active: true }).pluck(:id) ticket_agent_role_ids.push(id) - count = User.joins(:roles).where(roles: { id: ticket_agent_role_ids }, users: { active: true }).distinct().count + count = User.joins(:roles).where(roles: { id: ticket_agent_role_ids }, users: { active: true }).distinct.count raise Exceptions::UnprocessableEntity, 'Agent limit exceeded, please check your account settings.' if count > Setting.get('system_agent_limit').to_i true diff --git a/app/models/scheduler.rb b/app/models/scheduler.rb index eaa43ac0e..283e31602 100644 --- a/app/models/scheduler.rb +++ b/app/models/scheduler.rb @@ -288,7 +288,7 @@ class Scheduler < ApplicationModel ) logger.info "execute #{job.method} (try_count #{try_count})..." - eval job.method() # rubocop:disable Security/Eval + eval job.method # rubocop:disable Security/Eval took = Time.zone.now - started_at logger.info "ended #{job.method} took: #{took} seconds." rescue => e diff --git a/app/models/user.rb b/app/models/user.rb index 641a5fe8c..753439337 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -459,7 +459,7 @@ returns end next if permission_ids.blank? - Role.joins(:permissions_roles).joins(:permissions).where('permissions_roles.permission_id IN (?) AND roles.active = ? AND permissions.active = ?', permission_ids, true, true).distinct().pluck(:id).each do |role_id| + Role.joins(:permissions_roles).joins(:permissions).where('permissions_roles.permission_id IN (?) AND roles.active = ? AND permissions.active = ?', permission_ids, true, true).distinct.pluck(:id).each do |role_id| role_ids.push role_id end total_role_ids.push role_ids @@ -1058,7 +1058,7 @@ raise 'Minimum one user need to have admin permissions' def last_admin_check_admin_count admin_role_ids = Role.joins(:permissions).where(permissions: { name: ['admin', 'admin.user'], active: true }, roles: { active: true }).pluck(:id) - User.joins(:roles).where(roles: { id: admin_role_ids }, users: { active: true }).distinct().count - 1 + User.joins(:roles).where(roles: { id: admin_role_ids }, users: { active: true }).distinct.count - 1 end def validate_agent_limit_by_attributes @@ -1068,7 +1068,7 @@ raise 'Minimum one user need to have admin permissions' return true if !permissions?('ticket.agent') ticket_agent_role_ids = Role.joins(:permissions).where(permissions: { name: 'ticket.agent', active: true }, roles: { active: true }).pluck(:id) - count = User.joins(:roles).where(roles: { id: ticket_agent_role_ids }, users: { active: true }).distinct().count + 1 + count = User.joins(:roles).where(roles: { id: ticket_agent_role_ids }, users: { active: true }).distinct.count + 1 raise Exceptions::UnprocessableEntity, 'Agent limit exceeded, please check your account settings.' if count > Setting.get('system_agent_limit').to_i true @@ -1081,7 +1081,7 @@ raise 'Minimum one user need to have admin permissions' return true if !role.with_permission?('ticket.agent') ticket_agent_role_ids = Role.joins(:permissions).where(permissions: { name: 'ticket.agent', active: true }, roles: { active: true }).pluck(:id) - count = User.joins(:roles).where(roles: { id: ticket_agent_role_ids }, users: { active: true }).distinct().count + count = User.joins(:roles).where(roles: { id: ticket_agent_role_ids }, users: { active: true }).distinct.count # if new added role is a ticket.agent role if ticket_agent_role_ids.include?(role.id) diff --git a/lib/auth/ldap.rb b/lib/auth/ldap.rb index ba5f931c6..330447ed5 100644 --- a/lib/auth/ldap.rb +++ b/lib/auth/ldap.rb @@ -6,7 +6,7 @@ class Auth def valid?(user, password) return false if !Setting.get('ldap_integration') - ldap_user = ::Ldap::User.new() + ldap_user = ::Ldap::User.new # get from config or fallback to login # for a list of user attributes which should diff --git a/lib/ldap.rb b/lib/ldap.rb index 60e3dced7..548bcac84 100644 --- a/lib/ldap.rb +++ b/lib/ldap.rb @@ -64,7 +64,7 @@ class Ldap # @return [true] Returns always true def search(filter, base: nil, scope: nil, attributes: nil, &block) - base ||= base_dn() + base ||= base_dn scope ||= Net::LDAP::SearchScope_WholeSubtree connection.search( diff --git a/lib/telegram.rb b/lib/telegram.rb index 331d0ee22..c89667b8d 100644 --- a/lib/telegram.rb +++ b/lib/telegram.rb @@ -15,7 +15,7 @@ check token and return bot attributes of token def self.check_token(token) api = TelegramAPI.new(token) begin - bot = api.getMe() + bot = api.getMe rescue raise Exceptions::UnprocessableEntity, 'invalid api token' end diff --git a/spec/jobs/migrate_ldap_samaccountname_to_uid_job_spec.rb b/spec/jobs/migrate_ldap_samaccountname_to_uid_job_spec.rb index a60f2278b..7cc2b2809 100644 --- a/spec/jobs/migrate_ldap_samaccountname_to_uid_job_spec.rb +++ b/spec/jobs/migrate_ldap_samaccountname_to_uid_job_spec.rb @@ -22,7 +22,7 @@ RSpec.describe MigrateLdapSamaccountnameToUidJob, type: :job do } allow(Import::Ldap).to receive(:config).and_return(ldap_config) - ldap_user = double() + ldap_user = double allow(ldap_user).to receive(:uid_attribute).and_return('samaccountname') allow(::Ldap::User).to receive(:new).and_return(ldap_user) @@ -49,7 +49,7 @@ RSpec.describe MigrateLdapSamaccountnameToUidJob, type: :job do allow(Import::Ldap).to receive(:config).and_return(ldap_config_obsolete) - ldap_user = double() + ldap_user = double allow(ldap_user).to receive(:uid_attribute).and_return('objectguid') allow(::Ldap::User).to receive(:new).and_return(ldap_user) diff --git a/spec/jobs/trigger_webhook_job/record_payload_spec.rb b/spec/jobs/trigger_webhook_job/record_payload_spec.rb index 130c6c79f..eda182925 100644 --- a/spec/jobs/trigger_webhook_job/record_payload_spec.rb +++ b/spec/jobs/trigger_webhook_job/record_payload_spec.rb @@ -14,7 +14,7 @@ RSpec.describe TriggerWebhookJob::RecordPayload do let(:backend) { TriggerWebhookJob::RecordPayload::Ticket } it 'initializes backend instance and sends generate' do - instance = double() + instance = double allow(instance).to receive(:generate) allow(backend).to receive(:new).and_return(instance) diff --git a/spec/lib/import/base_factory_examples.rb b/spec/lib/import/base_factory_examples.rb index 684041dfd..36bfd0a38 100644 --- a/spec/lib/import/base_factory_examples.rb +++ b/spec/lib/import/base_factory_examples.rb @@ -24,7 +24,7 @@ end RSpec.shared_examples 'Import::BaseFactory extender' do it 'calls new on determined backend object' do - record = double() + record = double allow(described_class).to receive(:backend_class).and_return(Class) allow(Class).to receive(:new) diff --git a/spec/lib/import/base_spec.rb b/spec/lib/import/base_spec.rb index 1c9feef70..2dfea55ed 100644 --- a/spec/lib/import/base_spec.rb +++ b/spec/lib/import/base_spec.rb @@ -38,7 +38,7 @@ RSpec.describe Import::Base do it 'returns false by default' do import_job = create(:import_job) instance = described_class.new(import_job) - delayed_job = double() + delayed_job = double expect(instance.reschedule?(delayed_job)).to be false end diff --git a/spec/lib/import/ldap_spec.rb b/spec/lib/import/ldap_spec.rb index 478d6e126..fbb5ba11e 100644 --- a/spec/lib/import/ldap_spec.rb +++ b/spec/lib/import/ldap_spec.rb @@ -95,7 +95,7 @@ RSpec.describe Import::Ldap, sequencer: :caller do it 'initiates always a rescheduling' do import_job = create(:import_job) instance = described_class.new(import_job) - delayed_job = double() + delayed_job = double expect(instance.reschedule?(delayed_job)).to be true end @@ -103,7 +103,7 @@ RSpec.describe Import::Ldap, sequencer: :caller do it 'updates the result with an info text' do import_job = create(:import_job) instance = described_class.new(import_job) - delayed_job = double() + delayed_job = double expect do instance.reschedule?(delayed_job) diff --git a/spec/lib/import/otrs/article/attachment_factory_spec.rb b/spec/lib/import/otrs/article/attachment_factory_spec.rb index b02d4c275..6d4824605 100644 --- a/spec/lib/import/otrs/article/attachment_factory_spec.rb +++ b/spec/lib/import/otrs/article/attachment_factory_spec.rb @@ -45,7 +45,7 @@ RSpec.describe Import::OTRS::Article::AttachmentFactory do end it 'deletes old and reimports' do - dummy_attachment = double() + dummy_attachment = double expect(dummy_attachment).to receive(:delete) article_attachment_expectations([dummy_attachment]) import_expectations diff --git a/spec/lib/import/otrs/requester_spec.rb b/spec/lib/import/otrs/requester_spec.rb index 0884c309d..044b8b414 100644 --- a/spec/lib/import/otrs/requester_spec.rb +++ b/spec/lib/import/otrs/requester_spec.rb @@ -19,8 +19,8 @@ RSpec.describe Import::OTRS::Requester do context 'caching request results' do let(:response) do - response = double() - response_body = double() + response = double + response_body = double allow(response_body).to receive(:to_s).at_least(:once).and_return('{"Result": {}}') allow(response).to receive('success?').at_least(:once).and_return(true) allow(response).to receive('body').at_least(:once).and_return(response_body) diff --git a/spec/lib/ldap/group_spec.rb b/spec/lib/ldap/group_spec.rb index 3700eab7a..7158ae27b 100644 --- a/spec/lib/ldap/group_spec.rb +++ b/spec/lib/ldap/group_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Ldap::Group do # required as 'let' to perform test based # expectations and reuse it in 'let' instance # as additional parameter - let(:mocked_ldap) { double() } + let(:mocked_ldap) { double } describe '.uid_attribute' do diff --git a/spec/lib/ldap/guid_spec.rb b/spec/lib/ldap/guid_spec.rb index c38e31116..cfdbd5e71 100644 --- a/spec/lib/ldap/guid_spec.rb +++ b/spec/lib/ldap/guid_spec.rb @@ -30,7 +30,7 @@ RSpec.describe Ldap::Guid do end it 'tunnels to instance method' do - instance = double() + instance = double allow(instance).to receive(:hex) allow(described_class).to receive(:new).with(string).and_return(instance) @@ -48,7 +48,7 @@ RSpec.describe Ldap::Guid do it 'tunnels to instance method' do - instance = double() + instance = double allow(instance).to receive(:string) allow(described_class).to receive(:new).with(hex).and_return(instance) diff --git a/spec/lib/ldap/user_spec.rb b/spec/lib/ldap/user_spec.rb index fb2ef8174..06d0d895e 100644 --- a/spec/lib/ldap/user_spec.rb +++ b/spec/lib/ldap/user_spec.rb @@ -8,7 +8,7 @@ require 'tcr/net/ldap' RSpec.describe Ldap::User do - let(:mocked_ldap) { double() } + let(:mocked_ldap) { double } describe '.uid_attribute' do @@ -71,7 +71,7 @@ RSpec.describe Ldap::User do it 'creates own Ldap instance if none given' do expect(Ldap).to receive(:new) - described_class.new() + described_class.new end end @@ -95,7 +95,7 @@ RSpec.describe Ldap::User do end it 'validates username and password' do - connection = double() + connection = double allow(mocked_ldap).to receive(:connection).and_return(connection) build(:ldap_entry) @@ -107,7 +107,7 @@ RSpec.describe Ldap::User do end it 'fails for invalid credentials' do - connection = double() + connection = double allow(mocked_ldap).to receive(:connection).and_return(connection) build(:ldap_entry) diff --git a/spec/lib/sequencer/unit/import/zendesk/ticket/comment/attachment/request_spec.rb b/spec/lib/sequencer/unit/import/zendesk/ticket/comment/attachment/request_spec.rb index 54941fc73..700233b48 100644 --- a/spec/lib/sequencer/unit/import/zendesk/ticket/comment/attachment/request_spec.rb +++ b/spec/lib/sequencer/unit/import/zendesk/ticket/comment/attachment/request_spec.rb @@ -14,7 +14,7 @@ RSpec.describe Sequencer::Unit::Import::Zendesk::Ticket::Comment::Attachment::Re } end - let(:response) { double() } + let(:response) { double } it 'open timeout should be 20s and read timeout should be 240s' do allow(response).to receive(:success?).and_return(true) diff --git a/spec/models/import_job_spec.rb b/spec/models/import_job_spec.rb index 12b86e59c..a68138940 100644 --- a/spec/models/import_job_spec.rb +++ b/spec/models/import_job_spec.rb @@ -248,7 +248,7 @@ RSpec.describe ImportJob do it 'returns false for already finished jobs' do instance = create(:import_job) - delayed_job = double() + delayed_job = double instance.update!(finished_at: Time.zone.now) @@ -257,14 +257,14 @@ RSpec.describe ImportJob do it 'returns false for backends not responding to reschedule?' do instance = create(:import_job) - delayed_job = double() + delayed_job = double expect(instance.reschedule?(delayed_job)).to be false end it 'returns the backend reschedule? value' do instance = create(:import_job, name: 'Import::NoRescheduleMethod') - delayed_job = double() + delayed_job = double expect(instance.reschedule?(delayed_job)).to eq 'invalid_but_checkable_result' end diff --git a/spec/models/session_spec.rb b/spec/models/session_spec.rb index 3b68a3109..e69a3bcb8 100644 --- a/spec/models/session_spec.rb +++ b/spec/models/session_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Session, type: :model do subject(:session) { described_class.create( session_id: SecureRandom.urlsafe_base64(64), data: {} ) } it 'does not set the persistent attribute' do - expect(session.persistent).to be_nil() + expect(session.persistent).to be_nil end end @@ -26,7 +26,7 @@ RSpec.describe Session, type: :model do subject(:session) { described_class.create( session_id: SecureRandom.urlsafe_base64(64), data: { 'persistent' => false }) } it 'does not set the persistent attribute' do - expect(session.persistent).to be_nil() + expect(session.persistent).to be_nil end end end diff --git a/spec/requests/tag_spec.rb b/spec/requests/tag_spec.rb index e61398eb7..9595bf5ef 100644 --- a/spec/requests/tag_spec.rb +++ b/spec/requests/tag_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Tag, type: :request do it "found 0 tags using search term '#{search_term}'" do get '/api/v1/tag_search', params: { term: search_term } expect(response).to have_http_status(:ok) - expect(json_response).to contain_exactly() + expect(json_response).to contain_exactly end end diff --git a/test/browser/abb_one_group_test.rb b/test/browser/abb_one_group_test.rb index a84938f04..17fe8bfd5 100644 --- a/test/browser/abb_one_group_test.rb +++ b/test/browser/abb_one_group_test.rb @@ -13,7 +13,7 @@ class AgentTicketActionLevel0Test < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # create new ticket ticket_create( @@ -35,7 +35,7 @@ class AgentTicketActionLevel0Test < TestCase }, ) - tasks_close_all() + tasks_close_all # invite agent (with one group) click(css: '#navigation a[href="#dashboard"]') @@ -45,7 +45,7 @@ class AgentTicketActionLevel0Test < TestCase value: 'Configuration', ) click(css: '.active.content .js-inviteAgent') - modal_ready() + modal_ready set( css: '.modal [name="firstname"]', value: 'Bob', @@ -85,7 +85,7 @@ class AgentTicketActionLevel0Test < TestCase value: 'Configuration', ) click(css: '.active.content .js-inviteAgent') - modal_ready() + modal_ready set( css: '.modal [name="firstname"]', value: 'Bob2', @@ -138,7 +138,7 @@ class AgentTicketActionLevel0Test < TestCase value: 'Sending', ) - tasks_close_all() + tasks_close_all end @@ -198,7 +198,7 @@ class AgentTicketActionLevel0Test < TestCase value: 'one group - some body 1234 äöüß', ) - tasks_close_all() + tasks_close_all end @@ -210,7 +210,7 @@ class AgentTicketActionLevel0Test < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all group_create( data: { @@ -250,7 +250,7 @@ class AgentTicketActionLevel0Test < TestCase }, ) - tasks_close_all() + tasks_close_all end diff --git a/test/browser/admin_calendar_sla_test.rb b/test/browser/admin_calendar_sla_test.rb index faad719fb..4f893d300 100644 --- a/test/browser/admin_calendar_sla_test.rb +++ b/test/browser/admin_calendar_sla_test.rb @@ -10,7 +10,7 @@ class AdminCalendarSlaTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all calendar_name = "ZZZ some calendar #{rand(99_999_999)}" sla_name = "ZZZ some sla #{rand(99_999_999)}" @@ -41,7 +41,7 @@ class AdminCalendarSlaTest < TestCase timeout: 4, ) - logout() + logout login( username: 'master@example.com', @@ -71,7 +71,7 @@ class AdminCalendarSlaTest < TestCase value: timezone_verify, timeout: 4, ) - modal_close() + modal_close sla_create( data: { diff --git a/test/browser/admin_channel_email_test.rb b/test/browser/admin_channel_email_test.rb index 35ffb539d..53f0b7908 100644 --- a/test/browser/admin_channel_email_test.rb +++ b/test/browser/admin_channel_email_test.rb @@ -19,7 +19,7 @@ class AdminChannelEmailTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#manage"]') click(css: '.content.active a[href="#channels/email"]') @@ -41,7 +41,7 @@ class AdminChannelEmailTest < TestCase click(css: '.content.active a[href="#c-account"]') click(css: '.content.active .js-channelNew') - modal_ready() + modal_ready set( css: '.modal input[name="realname"]', value: 'My System', @@ -82,7 +82,7 @@ class AdminChannelEmailTest < TestCase # re-create click(css: '.content.active .js-channelNew') - modal_ready() + modal_ready set( css: '.modal input[name="realname"]', @@ -111,7 +111,7 @@ class AdminChannelEmailTest < TestCase # set invalid folder click(css: '.content.active .js-editInbound') - modal_ready() + modal_ready set( css: '.modal input[name="options::folder"]', @@ -136,7 +136,7 @@ class AdminChannelEmailTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#manage"]') click(css: '.content.active a[href="#channels/email"]') @@ -146,7 +146,7 @@ class AdminChannelEmailTest < TestCase # create a new email filter click(css: '.content.active a[data-type="new"]') - modal_ready() + modal_ready set( css: '.modal input[name="name"]', value: filter_name, @@ -156,7 +156,7 @@ class AdminChannelEmailTest < TestCase value: 'target', ) click(css: '.modal .js-submit') - modal_disappear() + modal_disappear watch_for( css: '.content.active .table', @@ -167,9 +167,9 @@ class AdminChannelEmailTest < TestCase click(css: '.content.active .table .dropdown .btn--table') click(css: '.content.active .table .dropdown .js-clone') - modal_ready() + modal_ready click(css: '.modal .js-submit') - modal_disappear() + modal_disappear # confirm the clone exists in the table watch_for( diff --git a/test/browser/admin_object_manager_test.rb b/test/browser/admin_object_manager_test.rb index 056c04d7e..f98d7eaf2 100644 --- a/test/browser/admin_object_manager_test.rb +++ b/test/browser/admin_object_manager_test.rb @@ -12,7 +12,7 @@ class AdminObjectManagerTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # already existing object_manager_attribute_create( @@ -165,7 +165,7 @@ class AdminObjectManagerTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all object_manager_attribute_create( data: { @@ -389,7 +389,7 @@ class AdminObjectManagerTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # valid name object_manager_attribute_create( @@ -499,7 +499,7 @@ class AdminObjectManagerTest < TestCase url: browser_url, ) - tasks_close_all() + tasks_close_all # create two new attributes object_manager_attribute_create( @@ -595,7 +595,7 @@ class AdminObjectManagerTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # lexicographically ordered list of option strings options = %w[0 000.000 1 100.100 100.200 2 200.100 200.200 3 ä b n ö p sr ß st t ü v] @@ -684,7 +684,7 @@ class AdminObjectManagerTest < TestCase options_no_dog = options.except('dog') options_no_dog_no_delete = options_no_dog.except('delete') - tasks_close_all() + tasks_close_all object_manager_attribute_create( data: { @@ -788,7 +788,7 @@ class AdminObjectManagerTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all object_manager_attribute_create( data: { @@ -864,7 +864,7 @@ class AdminObjectManagerTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all object_manager_attribute_create( data: { diff --git a/test/browser/admin_object_manager_tree_select_test.rb b/test/browser/admin_object_manager_tree_select_test.rb index 2ca6d905c..12ebab0f2 100644 --- a/test/browser/admin_object_manager_tree_select_test.rb +++ b/test/browser/admin_object_manager_tree_select_test.rb @@ -12,7 +12,7 @@ class AdminObjectManagerTreeSelectTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all object_manager_attribute_create( data: { @@ -126,7 +126,7 @@ class AdminObjectManagerTreeSelectTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all object_manager_attribute_create( data: { diff --git a/test/browser/admin_overview_test.rb b/test/browser/admin_overview_test.rb index c912f1d28..17a8a3864 100644 --- a/test/browser/admin_overview_test.rb +++ b/test/browser/admin_overview_test.rb @@ -12,7 +12,7 @@ class AdminOverviewTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # add new overview overview_create( @@ -49,7 +49,7 @@ class AdminOverviewTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket_create( data: { @@ -135,7 +135,7 @@ class AdminOverviewTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all out_of_office_css = '.content.active .modal select[name="out_of_office"]' first_overview_css = '.content.active tr[data-id="1"] td' diff --git a/test/browser/admin_permissions_granular_vs_full_test.rb b/test/browser/admin_permissions_granular_vs_full_test.rb index a3b442509..2a70e5d68 100644 --- a/test/browser/admin_permissions_granular_vs_full_test.rb +++ b/test/browser/admin_permissions_granular_vs_full_test.rb @@ -11,7 +11,7 @@ class AdminPermissionsGranularVsFullTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#manage"]') click(css: '.content.active a[href="#manage/groups"]') diff --git a/test/browser/admin_role_test.rb b/test/browser/admin_role_test.rb index 3c273ac23..9134587eb 100644 --- a/test/browser/admin_role_test.rb +++ b/test/browser/admin_role_test.rb @@ -10,7 +10,7 @@ class AdminRoleTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all rand = rand(99_999_999).to_s login = "agent-role-#{rand}" @@ -42,14 +42,14 @@ class AdminRoleTest < TestCase } ) - logout() + logout # flanky login( username: email, password: password, url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#current_user"]') click(css: 'a[href="#profile"]') match( @@ -77,7 +77,7 @@ class AdminRoleTest < TestCase value: 'Devices', ) - logout() + logout login( username: 'master@example.com', password: 'test', @@ -90,13 +90,13 @@ class AdminRoleTest < TestCase } ) - logout() + logout login( username: email, password: password, url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#current_user"]') click(css: 'a[href="#profile"]') match( @@ -137,7 +137,7 @@ class AdminRoleTest < TestCase # check if admin exists exists_not(css: '[href="#manage"]') - logout() + logout # add admin.user to agent role login( @@ -145,7 +145,7 @@ class AdminRoleTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all role_edit( data: { @@ -160,7 +160,7 @@ class AdminRoleTest < TestCase }, } ) - logout() + logout # check if admin exists login( @@ -168,7 +168,7 @@ class AdminRoleTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # create user random = rand(999_999_999) @@ -194,13 +194,13 @@ class AdminRoleTest < TestCase ) # revoke admin.user - logout() + logout login( username: 'master@example.com', password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all role_edit( data: { @@ -215,7 +215,7 @@ class AdminRoleTest < TestCase }, } ) - logout() + logout login( username: 'agent1@example.com', @@ -238,7 +238,7 @@ class AdminRoleTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all role_create( data: { diff --git a/test/browser/agent_navigation_and_title_test.rb b/test/browser/agent_navigation_and_title_test.rb index 14a8667f1..ca5a0b3da 100644 --- a/test/browser/agent_navigation_and_title_test.rb +++ b/test/browser/agent_navigation_and_title_test.rb @@ -10,7 +10,7 @@ class AgentNavigationAndTitleTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # since we run the basic functionality tests via Capybara now the clues are shown # and closed after the login. This unfortunately removes the 'is-active' class from the @@ -18,7 +18,7 @@ class AgentNavigationAndTitleTest < TestCase # Because the browser tests are deprecated and there is no easy fix to change the # behavior we refresh the page and wait for it to finish loading the app as a workaround. # This will cause the 'is-active' class to be set on the menu item again - reload() + reload sleep 4 # dashboard after login @@ -32,7 +32,7 @@ class AgentNavigationAndTitleTest < TestCase exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active') exists_not(css: '#navigation .tasks .js-item.is-active') - reload() + reload sleep 2 verify_title(value: 'dashboard') exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active') @@ -67,7 +67,7 @@ class AgentNavigationAndTitleTest < TestCase ) exists_not(css: '#navigation .js-menu .is-active') - reload() + reload sleep 2 verify_title(value: 'Call Inbound') verify_task( @@ -105,7 +105,7 @@ class AgentNavigationAndTitleTest < TestCase ) exists_not(css: '#navigation .js-menu .is-active') - reload() + reload sleep 2 verify_title(value: 'ticket create #2') verify_task( @@ -127,7 +127,7 @@ class AgentNavigationAndTitleTest < TestCase exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active') exists_not(css: '#navigation .tasks .js-item.is-active') - reload() + reload sleep 2 verify_title(value: 'dashboard') exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active') @@ -151,7 +151,7 @@ class AgentNavigationAndTitleTest < TestCase exists_not(css: '#navigation .js-menu .is-active') exists_not(css: '#navigation .tasks .js-item.is-active') - reload() + reload sleep 2 verify_title(value: 'Users') exists_not(css: '#navigation .js-menu .is-active') diff --git a/test/browser/agent_organization_profile_test.rb b/test/browser/agent_organization_profile_test.rb index 6ccce2dda..ed7a6d241 100644 --- a/test/browser/agent_organization_profile_test.rb +++ b/test/browser/agent_organization_profile_test.rb @@ -14,7 +14,7 @@ class AgentOrganizationProfileTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # search and open org organization_open_by_search( @@ -41,14 +41,14 @@ class AgentOrganizationProfileTest < TestCase css: '.active .profile [data-name="note"]', value: note, ) - empty_search() + empty_search sleep 2 # check and change note again in edit screen click(css: '.active .js-action .icon-arrow-down', fast: true) click(css: '.active .js-action [data-type="edit"]') - modal_ready() + modal_ready watch_for( css: '.active .modal', value: note, @@ -63,7 +63,7 @@ class AgentOrganizationProfileTest < TestCase value: 'some note abc', ) click(css: '.active .modal button.js-submit') - modal_disappear() + modal_disappear watch_for( css: '.active .profile-window', @@ -80,13 +80,13 @@ class AgentOrganizationProfileTest < TestCase click(css: '.active .js-action .icon-arrow-down', fast: true) click(css: '.active .js-action [data-type="edit"]') - modal_ready() + modal_ready set( css: '.modal [name="name"]', value: 'Zammad Foundation', ) click(css: '.active .modal button.js-submit') - modal_disappear() + modal_disappear verify_task( data: { @@ -112,7 +112,7 @@ class AgentOrganizationProfileTest < TestCase css: '.active .profile-window', value: "org profile check #{message}", ) - tasks_close_all() + tasks_close_all # work with two browser windows message = "comment 1 #{rand(99_999_999_999_999_999)}" @@ -166,7 +166,7 @@ class AgentOrganizationProfileTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # search and open org organization_open_by_search( @@ -192,7 +192,7 @@ class AgentOrganizationProfileTest < TestCase click( css: '.active .profile-window .dropdown li[data-type="edit"]', ) - modal_ready() + modal_ready select( css: '.active .modal select[name="active"]', @@ -203,7 +203,7 @@ class AgentOrganizationProfileTest < TestCase css: '.modal .js-submit', ) - modal_disappear() + modal_disappear # go back to the org and check for inactive status update click( @@ -224,7 +224,7 @@ class AgentOrganizationProfileTest < TestCase click( css: '.active .profile-window .dropdown li[data-type="edit"]', ) - modal_ready() + modal_ready select( css: '.active .modal select[name="active"]', @@ -235,7 +235,7 @@ class AgentOrganizationProfileTest < TestCase css: '.modal .js-submit', ) - modal_disappear() + modal_disappear # go back to the org and check for active status update click( diff --git a/test/browser/agent_ticket_attachment_test.rb b/test/browser/agent_ticket_attachment_test.rb index b77f56a29..4c8466040 100644 --- a/test/browser/agent_ticket_attachment_test.rb +++ b/test/browser/agent_ticket_attachment_test.rb @@ -11,7 +11,7 @@ class AgentTicketAttachmentTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # # attachment checks - new ticket @@ -147,13 +147,13 @@ class AgentTicketAttachmentTest < TestCase click(css: '.content.active .js-submit') # check warning - modal_ready() + modal_ready match( css: '.content.active .modal', value: 'missing', ) click(css: '.content.active .modal .js-cancel') - modal_disappear() + modal_disappear ticket_update( data: { @@ -298,7 +298,7 @@ class AgentTicketAttachmentTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket_create( data: { diff --git a/test/browser/agent_ticket_create_attachment_missing_after_reload_test.rb b/test/browser/agent_ticket_create_attachment_missing_after_reload_test.rb index 0bd50bd58..aa3e3a0ff 100644 --- a/test/browser/agent_ticket_create_attachment_missing_after_reload_test.rb +++ b/test/browser/agent_ticket_create_attachment_missing_after_reload_test.rb @@ -13,7 +13,7 @@ class AgentticketCreateAttachmentMissingAfterReloadTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # # attachment checks - new ticket diff --git a/test/browser/agent_ticket_create_available_types_test.rb b/test/browser/agent_ticket_create_available_types_test.rb index 05cc0887c..fc08d0f80 100644 --- a/test/browser/agent_ticket_create_available_types_test.rb +++ b/test/browser/agent_ticket_create_available_types_test.rb @@ -13,7 +13,7 @@ class AgentTicketCreateAvailableTypesTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click( css: 'a[href="#ticket/create"]' @@ -31,7 +31,7 @@ class AgentTicketCreateAvailableTypesTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all @browser.execute_script("App.Config.set('ui_ticket_create_default_type', 'email-out')") diff --git a/test/browser/agent_ticket_create_cc_tokenizer_test.rb b/test/browser/agent_ticket_create_cc_tokenizer_test.rb index b8b55fb37..864e4a5de 100644 --- a/test/browser/agent_ticket_create_cc_tokenizer_test.rb +++ b/test/browser/agent_ticket_create_cc_tokenizer_test.rb @@ -16,7 +16,7 @@ class AgentTicketCreateCcTokenizerTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click( css: 'a[href="#ticket/create"]' diff --git a/test/browser/agent_ticket_create_default_type_test.rb b/test/browser/agent_ticket_create_default_type_test.rb index 489b68304..47b2fef30 100644 --- a/test/browser/agent_ticket_create_default_type_test.rb +++ b/test/browser/agent_ticket_create_default_type_test.rb @@ -13,7 +13,7 @@ class AgentTicketCreateDefaultTypeTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click( css: 'a[href="#ticket/create"]' @@ -39,7 +39,7 @@ class AgentTicketCreateDefaultTypeTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all @browser.execute_script("App.Config.set('ui_ticket_create_available_types', ['email-out', 'phone-out'])") @@ -67,7 +67,7 @@ class AgentTicketCreateDefaultTypeTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all @browser.execute_script("App.Config.set('ui_ticket_create_available_types', ['email-out'])") diff --git a/test/browser/agent_ticket_create_reset_customer_selection_test.rb b/test/browser/agent_ticket_create_reset_customer_selection_test.rb index 16a47d0ab..3a653d449 100644 --- a/test/browser/agent_ticket_create_reset_customer_selection_test.rb +++ b/test/browser/agent_ticket_create_reset_customer_selection_test.rb @@ -10,7 +10,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#new"]', only_if_exists: true) click(css: 'a[href="#ticket/create"]') @@ -84,7 +84,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase ) # cleanup - tasks_close_all() + tasks_close_all end def test_clear_customer_use_email @@ -94,7 +94,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#new"]', only_if_exists: true) click(css: 'a[href="#ticket/create"]') @@ -178,7 +178,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions') click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions li[data-type="customer-change"]') - modal_ready() + modal_ready exists_not( css: '.content.active .modal .user_autocompletion.form-group.has-error', @@ -246,6 +246,6 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase ) # cleanup - tasks_close_all() + tasks_close_all end end diff --git a/test/browser/agent_ticket_create_template_test.rb b/test/browser/agent_ticket_create_template_test.rb index c00b39c13..5b1687373 100644 --- a/test/browser/agent_ticket_create_template_test.rb +++ b/test/browser/agent_ticket_create_template_test.rb @@ -15,7 +15,7 @@ class AgentTicketCreateTemplateTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click( css: 'a[href="#ticket/create"]' @@ -74,7 +74,7 @@ class AgentTicketCreateTemplateTest < TestCase ) # apply new tempalte - tasks_close_all() + tasks_close_all click( css: 'a[href="#ticket/create"]' ) diff --git a/test/browser/agent_ticket_email_reply_keep_body_test.rb b/test/browser/agent_ticket_email_reply_keep_body_test.rb index 7eaed3535..a35a0b95c 100644 --- a/test/browser/agent_ticket_email_reply_keep_body_test.rb +++ b/test/browser/agent_ticket_email_reply_keep_body_test.rb @@ -12,7 +12,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # create new ticket ticket_create( @@ -87,7 +87,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase css: '.content.active .js-settingContainer .js-setting', ) click(css: '.content.active .js-settingContainer .js-setting') - modal_ready() + modal_ready select( css: params[:css], value: params[:value] @@ -95,8 +95,8 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase click( css: params[:submit_css], ) - modal_close() - modal_disappear() + modal_close + modal_disappear end def test_full_quote @@ -106,7 +106,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket_open_by_title( title: 'Welcome to Zammad', @@ -141,7 +141,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase assert Time.zone.parse(match[1]) # try again, but with the full quote header disabled - tasks_close_all() + tasks_close_all ticket_open_by_title( title: 'Welcome to Zammad', ) @@ -163,7 +163,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase assert_nil match # after test, turn full quote header back on again - tasks_close_all() + tasks_close_all ticket_open_by_title( title: 'Welcome to Zammad', ) @@ -182,7 +182,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket_open_by_title( title: 'Welcome to Zammad', diff --git a/test/browser/agent_ticket_email_signature_test.rb b/test/browser/agent_ticket_email_signature_test.rb index 4b66b6a28..cc3b48c72 100644 --- a/test/browser/agent_ticket_email_signature_test.rb +++ b/test/browser/agent_ticket_email_signature_test.rb @@ -20,7 +20,7 @@ class AgentTicketEmailSignatureTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # # create groups and signatures @@ -83,7 +83,7 @@ class AgentTicketEmailSignatureTest < TestCase # # reload instances to get new group permissions - reload() + reload # create ticket ticket_create( diff --git a/test/browser/agent_ticket_link_test.rb b/test/browser/agent_ticket_link_test.rb index f792ac196..5748b618a 100644 --- a/test/browser/agent_ticket_link_test.rb +++ b/test/browser/agent_ticket_link_test.rb @@ -11,7 +11,7 @@ class AgentTicketLinkTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket1 = ticket_create( data: { @@ -48,7 +48,7 @@ class AgentTicketLinkTest < TestCase css: '.content.active .js-links .js-add', ) - modal_ready() + modal_ready set( css: '.content.active .modal-body [name="ticket_number"]', @@ -73,7 +73,7 @@ class AgentTicketLinkTest < TestCase value: ticket2[:title], ) - reload() + reload watch_for( css: '.content.active .ticketLinks', @@ -92,7 +92,7 @@ class AgentTicketLinkTest < TestCase value: ticket2[:title], ) - reload() + reload watch_for_disappear( css: '.content.active .ticketLinks', @@ -118,7 +118,7 @@ class AgentTicketLinkTest < TestCase } ) - tasks_close_all() + tasks_close_all ticket_open_by_search( browser: browser2, diff --git a/test/browser/agent_ticket_macro_test.rb b/test/browser/agent_ticket_macro_test.rb index 918f40141..206e3f4f5 100644 --- a/test/browser/agent_ticket_macro_test.rb +++ b/test/browser/agent_ticket_macro_test.rb @@ -11,7 +11,7 @@ class AgentTicketMacroTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket = ticket_create( data: { @@ -49,7 +49,7 @@ class AgentTicketMacroTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ux_flow_next_up = 'Stay on tab' macro_name = "Test #{ux_flow_next_up}" @@ -94,7 +94,7 @@ class AgentTicketMacroTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ux_flow_next_up = 'Close tab' macro_name = "Test #{ux_flow_next_up}" @@ -127,7 +127,7 @@ class AgentTicketMacroTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ux_flow_next_up = 'Advance to next ticket from overview' macro_name = "Test #{ux_flow_next_up}" @@ -158,7 +158,7 @@ class AgentTicketMacroTest < TestCase # we need to close all open ticket tasks because # otherwise the Zoom view won't change in "Overview"-mode # when we re-enter the Zoom view for a ticket via the overview - tasks_close_all() + tasks_close_all overview_open( link: '#ticket/view/all_unassigned', diff --git a/test/browser/agent_ticket_merge_test.rb b/test/browser/agent_ticket_merge_test.rb index 181434749..d04fa5250 100644 --- a/test/browser/agent_ticket_merge_test.rb +++ b/test/browser/agent_ticket_merge_test.rb @@ -12,7 +12,7 @@ class AgentTicketMergeTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # create new ticket ticket1 = ticket_create( @@ -32,7 +32,7 @@ class AgentTicketMergeTest < TestCase }, ) - tasks_close_all() + tasks_close_all # create second ticket to merge ticket_create( @@ -60,7 +60,7 @@ class AgentTicketMergeTest < TestCase click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' ) click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' ) - modal_ready() + modal_ready set( css: '.modal input[name="target_ticket_number"]', value: ticket1[:number], @@ -89,7 +89,7 @@ class AgentTicketMergeTest < TestCase ) # close task/cleanup - tasks_close_all() + tasks_close_all # merge ticket with open tabs ticket3 = ticket_create( @@ -114,7 +114,7 @@ class AgentTicketMergeTest < TestCase click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' ) click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' ) - modal_ready() + modal_ready set( css: '.modal input[name="target_ticket_number"]', value: ticket3[:number], diff --git a/test/browser/agent_ticket_online_notification_test.rb b/test/browser/agent_ticket_online_notification_test.rb index b1a44c218..6a197dede 100644 --- a/test/browser/agent_ticket_online_notification_test.rb +++ b/test/browser/agent_ticket_online_notification_test.rb @@ -12,7 +12,7 @@ class AgentTicketOnlineNotificationTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # create new ticket ticket_create( @@ -246,7 +246,7 @@ class AgentTicketOnlineNotificationTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all browser2 = browser_instance login( diff --git a/test/browser/agent_ticket_overview_group_by_organization_test.rb b/test/browser/agent_ticket_overview_group_by_organization_test.rb index 7d22c54df..b8f74d49f 100644 --- a/test/browser/agent_ticket_overview_group_by_organization_test.rb +++ b/test/browser/agent_ticket_overview_group_by_organization_test.rb @@ -20,7 +20,7 @@ class AgentTicketOverviewGroupByOrganizationTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # 1. Create a new test organization with special characters in its name organization_create( diff --git a/test/browser/agent_ticket_overview_level0_test.rb b/test/browser/agent_ticket_overview_level0_test.rb index 5b288cebe..cd8344869 100644 --- a/test/browser/agent_ticket_overview_level0_test.rb +++ b/test/browser/agent_ticket_overview_level0_test.rb @@ -10,7 +10,7 @@ class AgentTicketOverviewLevel0Test < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # test bulk action @@ -68,7 +68,7 @@ class AgentTicketOverviewLevel0Test < TestCase ) # remember current overview count - overview_counter_before = overview_counter() + overview_counter_before = overview_counter # select close state & submit select( @@ -96,12 +96,12 @@ class AgentTicketOverviewLevel0Test < TestCase # remember current overview count await_overview_counter(view: '#ticket/view/all_unassigned', count: overview_counter_before['#ticket/view/all_unassigned'] - 2) - overview_counter_before = overview_counter() + overview_counter_before = overview_counter # click options and enable number and article count click(css: '.content.active [data-type="settings"]') - modal_ready() + modal_ready check( css: '.modal input[value="number"]', @@ -139,7 +139,7 @@ class AgentTicketOverviewLevel0Test < TestCase ) # reload browser - reload() + reload sleep 4 # check if number and article count is shown @@ -159,7 +159,7 @@ class AgentTicketOverviewLevel0Test < TestCase # disable number and article count click(css: '.content.active [data-type="settings"]') - modal_ready() + modal_ready uncheck( css: '.modal input[value="number"]', @@ -213,7 +213,7 @@ class AgentTicketOverviewLevel0Test < TestCase await_overview_counter(view: '#ticket/view/all_unassigned', count: overview_counter_before['#ticket/view/all_unassigned']) # cleanup - tasks_close_all() + tasks_close_all end def test_bulk_pending @@ -223,7 +223,7 @@ class AgentTicketOverviewLevel0Test < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # test bulk action @@ -259,7 +259,7 @@ class AgentTicketOverviewLevel0Test < TestCase ) # remember current overview count - overview_counter_before = overview_counter() + overview_counter_before = overview_counter # select both via bulk action click( @@ -363,7 +363,7 @@ class AgentTicketOverviewLevel0Test < TestCase ) # cleanup - tasks_close_all() + tasks_close_all end # verify correct behaviour for issue #1864 - Bulk-Action: Not possible to change owner @@ -374,7 +374,7 @@ class AgentTicketOverviewLevel0Test < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # test bulk action @@ -407,7 +407,7 @@ class AgentTicketOverviewLevel0Test < TestCase ) # remember current overview count - overview_counter_before = overview_counter() + overview_counter_before = overview_counter # select both via bulk action click( @@ -465,7 +465,7 @@ class AgentTicketOverviewLevel0Test < TestCase await_overview_counter(view: '#ticket/view/all_unassigned', count: overview_counter_before['#ticket/view/all_unassigned'] - 2) # cleanup - tasks_close_all() + tasks_close_all end # verify fix for issue #2026 - Bulk action should not be shown if user has no change permissions @@ -476,7 +476,7 @@ class AgentTicketOverviewLevel0Test < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # create new group group_create( @@ -531,13 +531,13 @@ class AgentTicketOverviewLevel0Test < TestCase } ) - logout() # logout as master@example.com then login as agent2@example.com + logout # logout as master@example.com then login as agent2@example.com login( username: 'agent2@example.com', password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # open Overview menu tab click( @@ -611,14 +611,14 @@ class AgentTicketOverviewLevel0Test < TestCase ) # cleanup - tasks_close_all() - logout() # logout as agent2@example.com and then login as master@example.com to clean up tickets + tasks_close_all + logout # logout as agent2@example.com and then login as master@example.com to clean up tickets login( username: 'master@example.com', password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # open ticket by search ticket_open_by_search( diff --git a/test/browser/agent_ticket_overview_pending_til_test.rb b/test/browser/agent_ticket_overview_pending_til_test.rb index 036821a38..8d985e972 100644 --- a/test/browser/agent_ticket_overview_pending_til_test.rb +++ b/test/browser/agent_ticket_overview_pending_til_test.rb @@ -14,7 +14,7 @@ class AgentTicketOverviewPendingTil < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # create 4 tickets, 2 with pending til data and 2 without tickets = [] diff --git a/test/browser/agent_ticket_overview_tab_test.rb b/test/browser/agent_ticket_overview_tab_test.rb index b2c084113..a39eb27f7 100644 --- a/test/browser/agent_ticket_overview_tab_test.rb +++ b/test/browser/agent_ticket_overview_tab_test.rb @@ -24,7 +24,7 @@ class AgentTicketOverviewTabTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all title = "test #{rand(9_999_999)}" @@ -53,7 +53,7 @@ class AgentTicketOverviewTabTest < TestCase body: "overview tab test #3 - #{title}", } ) - tasks_close_all() + tasks_close_all #click(text: 'Overviews') # enable full overviews @@ -97,6 +97,6 @@ class AgentTicketOverviewTabTest < TestCase task_count_equals(0) # cleanup - tasks_close_all() + tasks_close_all end end diff --git a/test/browser/agent_ticket_tag_test.rb b/test/browser/agent_ticket_tag_test.rb index e878cb8ec..93ae3c8f7 100644 --- a/test/browser/agent_ticket_tag_test.rb +++ b/test/browser/agent_ticket_tag_test.rb @@ -10,7 +10,7 @@ class AgentTicketTagTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # set tag (by tab) ticket_create( @@ -31,7 +31,7 @@ class AgentTicketTagTest < TestCase # reload browser sleep 6 - reload() + reload sleep 2 click( @@ -188,7 +188,7 @@ class AgentTicketTagTest < TestCase ) # reload browser - reload() + reload sleep 2 # verify tags @@ -369,7 +369,7 @@ class AgentTicketTagTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#manage"]') click(css: '.content.active a[href="#manage/tags"]') @@ -510,7 +510,7 @@ class AgentTicketTagTest < TestCase 'NOT EXISTING' => false, } ) - reload() + reload sleep 2 # verify tags diff --git a/test/browser/agent_ticket_task_changed_test.rb b/test/browser/agent_ticket_task_changed_test.rb index a53843bca..6f29e1525 100644 --- a/test/browser/agent_ticket_task_changed_test.rb +++ b/test/browser/agent_ticket_task_changed_test.rb @@ -12,7 +12,7 @@ class AgentTicketTaskChangedTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket_create( data: { @@ -37,7 +37,7 @@ class AgentTicketTaskChangedTest < TestCase # verify the 'Discard your changes' message does not appear (since there are no changes) assert_nil execute(js: "return $('.content.active .js-attributeBar .js-reset:not(\".hide\")').get(0)") - tasks_close_all() + tasks_close_all sleep 0.5 exists_not( css: '.modal') diff --git a/test/browser/agent_ticket_text_module_test.rb b/test/browser/agent_ticket_text_module_test.rb index 840bf040d..0e071649a 100644 --- a/test/browser/agent_ticket_text_module_test.rb +++ b/test/browser/agent_ticket_text_module_test.rb @@ -13,7 +13,7 @@ class AgentTicketTextModuleTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # create new text modules text_module_create( @@ -54,7 +54,7 @@ class AgentTicketTextModuleTest < TestCase css: '.active div[data-name=body]', value: "some content#{random}", ) - tasks_close_all() + tasks_close_all # test with two browser windows random = "text_II_module_test_#{rand(99_999_999)}" diff --git a/test/browser/agent_ticket_time_accounting_test.rb b/test/browser/agent_ticket_time_accounting_test.rb index e909ce5e2..f39744688 100644 --- a/test/browser/agent_ticket_time_accounting_test.rb +++ b/test/browser/agent_ticket_time_accounting_test.rb @@ -10,7 +10,7 @@ class AgentTicketTimeAccountingTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # enable time accounting click( @@ -42,7 +42,7 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.active .js-submit', ) - modal_ready() + modal_ready set( css: '.content.active .modal [name=time_unit]', value: '4', @@ -50,7 +50,7 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.content.active .modal .js-submit', ) - modal_disappear() + modal_disappear watch_for( css: '.content.active .js-timeUnit', @@ -75,7 +75,7 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.active .js-submit', ) - modal_ready() + modal_ready set( css: '.content.active .modal [name=time_unit]', value: '4,6', @@ -83,7 +83,7 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.content.active .modal .js-submit', ) - modal_disappear() + modal_disappear watch_for( css: '.content.active .js-timeUnit', @@ -100,7 +100,7 @@ class AgentTicketTimeAccountingTest < TestCase css: '.active .js-submit', ) - modal_ready() + modal_ready set( css: '.content.active .modal [name=time_unit]', value: '4abc', @@ -118,7 +118,7 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.content.active .modal .js-submit', ) - modal_disappear() + modal_disappear watch_for( css: '.content.active .js-timeUnit', value: '8.6', @@ -139,7 +139,7 @@ class AgentTicketTimeAccountingTest < TestCase # make sure "off" AJAX request gets completed # otherwise following tests might fail because # off still active timeaccounting - logout() + logout end def test_closing_time_accounting_modal_by_clicking_background @@ -149,7 +149,7 @@ class AgentTicketTimeAccountingTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # enable time accounting click( @@ -181,18 +181,18 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.active .js-submit', ) - modal_ready() + modal_ready # Click outside the modal to make it disappear execute( js: 'document.elementFromPoint(300, 100).click();', ) - modal_disappear() + modal_disappear click( css: '.active .js-submit', ) - modal_ready() + modal_ready set( css: '.content.active .modal [name=time_unit]', value: '4', @@ -200,7 +200,7 @@ class AgentTicketTimeAccountingTest < TestCase click( css: '.content.active .modal .js-submit', ) - modal_disappear() + modal_disappear # disable time accounting click( @@ -217,6 +217,6 @@ class AgentTicketTimeAccountingTest < TestCase # make sure "off" AJAX request gets completed # otherwise following tests might fail because # off still active timeaccounting - logout() + logout end end diff --git a/test/browser/agent_ticket_update1_test.rb b/test/browser/agent_ticket_update1_test.rb index 6baed0cba..51f040ef6 100644 --- a/test/browser/agent_ticket_update1_test.rb +++ b/test/browser/agent_ticket_update1_test.rb @@ -10,7 +10,7 @@ class AgentTicketUpdate1Test < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # confirm on create ticket_create( diff --git a/test/browser/agent_ticket_update4_test.rb b/test/browser/agent_ticket_update4_test.rb index 0dbef8bab..af2e295a5 100644 --- a/test/browser/agent_ticket_update4_test.rb +++ b/test/browser/agent_ticket_update4_test.rb @@ -12,7 +12,7 @@ class AgentTicketUpdate4Test < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # date object object_manager_attribute_create( diff --git a/test/browser/agent_ticket_update_and_reload_test.rb b/test/browser/agent_ticket_update_and_reload_test.rb index 2178489fb..c349d1952 100644 --- a/test/browser/agent_ticket_update_and_reload_test.rb +++ b/test/browser/agent_ticket_update_and_reload_test.rb @@ -11,7 +11,7 @@ class AgentTicketUpdateAndReloadTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # create ticket ticket_create( @@ -45,7 +45,7 @@ class AgentTicketUpdateAndReloadTest < TestCase ) # reload instances, verify autosave - reload() + reload # check if customer is still shown in sidebar click(css: '.active .tabsSidebar-tab[data-tab="customer"]') @@ -95,7 +95,7 @@ class AgentTicketUpdateAndReloadTest < TestCase ) # reload - reload() + reload sleep 4 # check task title @@ -122,7 +122,7 @@ class AgentTicketUpdateAndReloadTest < TestCase ) # reload - reload() + reload sleep 5 # check page title @@ -131,6 +131,6 @@ class AgentTicketUpdateAndReloadTest < TestCase ) # cleanup - tasks_close_all() + tasks_close_all end end diff --git a/test/browser/agent_ticket_zoom_hide_test.rb b/test/browser/agent_ticket_zoom_hide_test.rb index 36c6dee0f..1426624b9 100644 --- a/test/browser/agent_ticket_zoom_hide_test.rb +++ b/test/browser/agent_ticket_zoom_hide_test.rb @@ -54,14 +54,14 @@ class AgentTicketZoomHideTest < TestCase css: '.attachment-icon img', ) - modal_ready() + modal_ready # Now go to a previous ticket and confirm that the modal disappears location( url: "#{browser_url}/#ticket/zoom/1", ) sleep 2 - modal_disappear() + modal_disappear end def teardown diff --git a/test/browser/agent_user_manage_test.rb b/test/browser/agent_user_manage_test.rb index b6a2fc8d1..b281e27e5 100644 --- a/test/browser/agent_user_manage_test.rb +++ b/test/browser/agent_user_manage_test.rb @@ -16,7 +16,7 @@ class AgentUserManageTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # create customer click(css: 'a[href="#new"]', only_if_exists: true) @@ -37,7 +37,7 @@ class AgentUserManageTest < TestCase sleep 0.5 click(css: '.content.active .newTicket .recipientList-entry.js-objectNew') - modal_ready() + modal_ready set( css: '.content.active .modal input[name="firstname"]', value: firstname, @@ -52,7 +52,7 @@ class AgentUserManageTest < TestCase ) click(css: '.content.active .modal button.js-submit') - modal_disappear() + modal_disappear sleep 4 @@ -80,7 +80,7 @@ class AgentUserManageTest < TestCase ) # call new ticket screen again - tasks_close_all() + tasks_close_all # wait for user get indexed in elastic search await_global_search(query: random_number) @@ -146,7 +146,7 @@ class AgentUserManageTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket_create( data: { @@ -172,7 +172,7 @@ class AgentUserManageTest < TestCase click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions') click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions li[data-type="customer-change"]') - modal_ready() + modal_ready click(css: '.content.active .modal [name="customer_id_completion"]') # check if pulldown is open, it's not working stable via selenium @@ -229,7 +229,7 @@ class AgentUserManageTest < TestCase ) click(css: '.content.active .modal button.js-submit') - modal_disappear() + modal_disappear watch_for( css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]', diff --git a/test/browser/agent_user_profile_test.rb b/test/browser/agent_user_profile_test.rb index fb1ea0c8b..e7fb5b5f4 100644 --- a/test/browser/agent_user_profile_test.rb +++ b/test/browser/agent_user_profile_test.rb @@ -12,7 +12,7 @@ class AgentUserProfileTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # search and open user user_open_by_search(value: 'Braun') @@ -37,14 +37,14 @@ class AgentUserProfileTest < TestCase css: '.active [data-name="note"]', value: 'some note 123', ) - empty_search() + empty_search sleep 2 # check and change note again in edit screen click(css: '.active .js-action .icon-arrow-down', fast: true) click(css: '.active .js-action [data-type="edit"]') - modal_ready() + modal_ready watch_for( css: '.active .modal', value: 'some note 123', @@ -59,7 +59,7 @@ class AgentUserProfileTest < TestCase value: 'some note abc', ) click(css: '.active .modal button.js-submit') - modal_disappear() + modal_disappear watch_for( css: '.active .profile-window', @@ -76,13 +76,13 @@ class AgentUserProfileTest < TestCase click(css: '.active .js-action .icon-arrow-down', fast: true) click(css: '.active .js-action [data-type="edit"]') - modal_ready() + modal_ready set( css: '.modal [name="lastname"]', value: 'Braun', ) click(css: '.active .modal button.js-submit') - modal_disappear() + modal_disappear verify_task( data: { @@ -106,7 +106,7 @@ class AgentUserProfileTest < TestCase css: '.active .profile-window', value: "user profile check #{message}", ) - tasks_close_all() + tasks_close_all # work with two browser windows message = "comment 1 #{rand(99_999_999_999_999_999)}" diff --git a/test/browser/auth_test.rb b/test/browser/auth_test.rb index 33f3086a1..27213a1be 100644 --- a/test/browser/auth_test.rb +++ b/test/browser/auth_test.rb @@ -23,10 +23,10 @@ class AuthTest < TestCase username: 'nicole.braun@zammad.org', password: 'test', ) - tasks_close_all() + tasks_close_all # reload page - reload() + reload # check if cookie is temporarily watch_for( @@ -75,7 +75,7 @@ class AuthTest < TestCase expires: '\d{4}-\d{1,2}-\d{1,2}.+?', ) - logout() + logout # verify session cookie sleep 2 diff --git a/test/browser/customer_ticket_create_fields_test.rb b/test/browser/customer_ticket_create_fields_test.rb index 4017bd256..a007e91b1 100644 --- a/test/browser/customer_ticket_create_fields_test.rb +++ b/test/browser/customer_ticket_create_fields_test.rb @@ -13,7 +13,7 @@ class CustomerTicketCreateFieldsTest < TestCase url: browser_url, ) # remove local object attributes bound to the session - logout() + logout # re-create agent session and fetch object attributes login( @@ -24,7 +24,7 @@ class CustomerTicketCreateFieldsTest < TestCase # 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() + logout # create customer session and fetch object attributes login( diff --git a/test/browser/customer_ticket_create_test.rb b/test/browser/customer_ticket_create_test.rb index fc926ff04..10eef04aa 100644 --- a/test/browser/customer_ticket_create_test.rb +++ b/test/browser/customer_ticket_create_test.rb @@ -205,7 +205,7 @@ class CustomerTicketCreateTest < TestCase no_quote: true, ) - logout() + logout # verify if we still can create new tickets as agent login( @@ -213,7 +213,7 @@ class CustomerTicketCreateTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket_create( data: { @@ -244,7 +244,7 @@ class CustomerTicketCreateTest < TestCase sleep(1) - logout() + logout # check if new ticket button is not visible @@ -256,7 +256,7 @@ class CustomerTicketCreateTest < TestCase assert(exists_not(css: 'a[href="#customer_ticket_new"]')) - logout() + logout # enable ticket creation @@ -274,7 +274,7 @@ class CustomerTicketCreateTest < TestCase sleep(1) - logout() + logout # check if new ticket button is visible diff --git a/test/browser/first_steps_test.rb b/test/browser/first_steps_test.rb index 9f28db38a..3283a57ff 100644 --- a/test/browser/first_steps_test.rb +++ b/test/browser/first_steps_test.rb @@ -14,7 +14,7 @@ class FirstStepsTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: '.active.content .tab[data-area="first-steps-widgets"]') watch_for( @@ -25,7 +25,7 @@ class FirstStepsTest < TestCase # invite agent (with more then one group) click(css: '.active.content .js-inviteAgent') - modal_ready() + modal_ready set( css: '.modal [name="firstname"]', @@ -52,11 +52,11 @@ class FirstStepsTest < TestCase css: 'body div.modal', value: 'Sending', ) - modal_disappear() + modal_disappear # invite customer click(css: '.active.content .js-inviteCustomer') - modal_ready() + modal_ready set( css: '.modal [name="firstname"]', value: 'Client', @@ -85,14 +85,14 @@ class FirstStepsTest < TestCase css: 'body div.modal', value: 'Sending', ) - modal_disappear() + modal_disappear # test ticket click( css: '.active.content .js-testTicket', fast: true, ) - modal_ready() + modal_ready watch_for( css: 'body div.modal', value: 'A Test Ticket has been created', @@ -105,7 +105,7 @@ class FirstStepsTest < TestCase css: 'body div.modal', value: 'Test Ticket', ) - modal_disappear() + modal_disappear execute( js: '$(".active.content .sidebar").show()', diff --git a/test/browser/integration_test.rb b/test/browser/integration_test.rb index 4e4b6098d..006c156e1 100644 --- a/test/browser/integration_test.rb +++ b/test/browser/integration_test.rb @@ -11,7 +11,7 @@ class IntegrationTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # change settings click(css: 'a[href="#manage"]') @@ -52,7 +52,7 @@ class IntegrationTest < TestCase css: '.content.active .main .js-inboundBlockCallerId [value="block spam caller id"]', ) - reload() + reload exists( css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]', ) @@ -67,7 +67,7 @@ class IntegrationTest < TestCase type: 'off', ) - reload() + reload exists_not( css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]', ) @@ -83,7 +83,7 @@ class IntegrationTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # change settings click(css: 'a[href="#manage"]') @@ -141,7 +141,7 @@ class IntegrationTest < TestCase value: 'someuser', ) - reload() + reload match( css: '.content.active .main select[name="group_ids"]', @@ -169,7 +169,7 @@ class IntegrationTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # change settings click(css: 'a[href="#manage"]') @@ -211,7 +211,7 @@ class IntegrationTest < TestCase css: '.content.active .main .js-userSync [value="destination1"]', ) - reload() + reload match( css: '.content.active .main input[name="api_key"]', @@ -235,7 +235,7 @@ class IntegrationTest < TestCase ) click(css: '.content.active .main .js-submit') - reload() + reload match_not( css: '.content.active .main input[name="api_key"]', value: 'some_api_key', @@ -259,7 +259,7 @@ class IntegrationTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # change settings click(css: 'a[href="#manage"]') @@ -303,7 +303,7 @@ class IntegrationTest < TestCase value: 'no', ) - reload() + reload match( css: '.content.active .main input[name="icinga_sender"]', diff --git a/test/browser/keyboard_shortcuts_test.rb b/test/browser/keyboard_shortcuts_test.rb index 02635ea4e..efa8c16ac 100644 --- a/test/browser/keyboard_shortcuts_test.rb +++ b/test/browser/keyboard_shortcuts_test.rb @@ -10,7 +10,7 @@ class KeyboardShortcutsTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all sleep 2 # show shortkeys @@ -41,14 +41,14 @@ class KeyboardShortcutsTest < TestCase end end - modal_ready() + modal_ready # hide shortkeys shortcut(key: 'h') - modal_disappear() + modal_disappear # show shortkeys shortcut(key: 'h') - modal_ready() + modal_ready # show notifications shortcut(key: 'a') diff --git a/test/browser/manage_test.rb b/test/browser/manage_test.rb index 0a3a5b305..6dc978247 100644 --- a/test/browser/manage_test.rb +++ b/test/browser/manage_test.rb @@ -30,13 +30,13 @@ class ManageTest < TestCase click(css: '.table-overview tr:last-child td') - modal_ready() + modal_ready set( css: '.modal input[name="lastname"]', value: "2Manage Lastname#{random}", ) click(css: '.modal button.js-submit') - modal_disappear() + modal_disappear watch_for( css: 'body', @@ -58,7 +58,7 @@ class ManageTest < TestCase click(css: '.content:not(.hide) .action:last-child .js-edit') - modal_ready() + modal_ready set( css: '.modal input[name=name]', value: "some sla update #{random}", @@ -68,7 +68,7 @@ class ManageTest < TestCase value: '2:01', ) click(css: '.modal button.js-submit') - modal_disappear() + modal_disappear watch_for( css: 'body', @@ -94,7 +94,7 @@ class ManageTest < TestCase value: "some sla update #{random}", ) - reload() + reload sleep 2 click(css: 'a[href="#manage"]') diff --git a/test/browser/preferences_language_test.rb b/test/browser/preferences_language_test.rb index b61c98c70..4b98f0885 100644 --- a/test/browser/preferences_language_test.rb +++ b/test/browser/preferences_language_test.rb @@ -11,7 +11,7 @@ class PreferencesLanguageTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # start ticket create ticket_create( @@ -289,7 +289,7 @@ class PreferencesLanguageTest < TestCase sleep 6 # check if language is still used after reload - reload() + reload sleep 2 watch_for( diff --git a/test/browser/preferences_token_access_test.rb b/test/browser/preferences_token_access_test.rb index 85e12bbb1..ca0ccb1b4 100644 --- a/test/browser/preferences_token_access_test.rb +++ b/test/browser/preferences_token_access_test.rb @@ -11,14 +11,14 @@ class PreferencesTokenAccessTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#current_user"]') click(css: 'a[href="#profile"]') click(css: 'a[href="#profile/token_access"]') click(css: '.content.active .js-create') - modal_ready() + modal_ready set( css: '.content.active .modal .js-input', value: 'Some App#1', @@ -35,7 +35,7 @@ class PreferencesTokenAccessTest < TestCase value: 'Your New Personal Access Token' ) click(css: '.modal .js-submit') - modal_disappear() + modal_disappear watch_for( css: '.content.active .js-tokenList', @@ -48,7 +48,7 @@ class PreferencesTokenAccessTest < TestCase click(css: '.content.active .js-create') - modal_ready() + modal_ready set( css: '.content.active .modal .js-input', value: 'Some App#2', @@ -61,7 +61,7 @@ class PreferencesTokenAccessTest < TestCase value: 'Your New Personal Access Token' ) click(css: '.modal .js-submit') - modal_disappear() + modal_disappear watch_for( css: '.content.active .js-tokenList', @@ -70,7 +70,7 @@ class PreferencesTokenAccessTest < TestCase click(css: '.content.active .js-tokenList .js-delete') - modal_ready() + modal_ready watch_for( css: '.content.active .modal .modal-header', value: 'confirm', @@ -78,7 +78,7 @@ class PreferencesTokenAccessTest < TestCase click( css: '.content.active .modal .js-submit', ) - modal_disappear() + modal_disappear watch_for_disappear( css: '.content.active .js-tokenList', value: 'Some App#2' diff --git a/test/browser/reporting_test.rb b/test/browser/reporting_test.rb index e3023a483..7cbf86659 100644 --- a/test/browser/reporting_test.rb +++ b/test/browser/reporting_test.rb @@ -11,7 +11,7 @@ class ReportingTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all report_profile_create( data: { diff --git a/test/browser/setting_test.rb b/test/browser/setting_test.rb index debe76f16..27abf1330 100644 --- a/test/browser/setting_test.rb +++ b/test/browser/setting_test.rb @@ -10,7 +10,7 @@ class SettingTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # make sure, that we have english frontend click(css: 'a[href="#current_user"]') @@ -111,7 +111,7 @@ class SettingTest < TestCase value: '---', ) - reload() + reload click(css: 'a[href="#settings/security"]') click(css: 'a[href="#third_party_auth"]') @@ -149,7 +149,7 @@ class SettingTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all verify_title(value: 'Zammad Test System') diff --git a/test/browser/switch_to_user_test.rb b/test/browser/switch_to_user_test.rb index 90435df28..8646a8dc4 100644 --- a/test/browser/switch_to_user_test.rb +++ b/test/browser/switch_to_user_test.rb @@ -10,7 +10,7 @@ class SwitchToUserTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#manage"]') click(css: '.content.active a[href="#manage/users"]') diff --git a/test/browser/taskbar_task_test.rb b/test/browser/taskbar_task_test.rb index 4e716e3e2..187317f48 100644 --- a/test/browser/taskbar_task_test.rb +++ b/test/browser/taskbar_task_test.rb @@ -10,7 +10,7 @@ class TaskbarTaskTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all # persistant task click(css: 'a[href="#new"]', only_if_exists: true) @@ -39,7 +39,7 @@ class TaskbarTaskTest < TestCase value: 'some test AAA', ) - tasks_close_all() + tasks_close_all exists_not(css: '.active .newTicket input[name="title"]') end @@ -51,7 +51,7 @@ class TaskbarTaskTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#new"]', only_if_exists: true) click(css: 'a[href="#ticket/create"]', wait: 0.8) @@ -77,7 +77,7 @@ class TaskbarTaskTest < TestCase ) sleep 3 - logout() + logout sleep 4 # relogin with master - task are not viewable @@ -96,7 +96,7 @@ class TaskbarTaskTest < TestCase css: 'body', value: 'OUTBOUND TEST#1', ) - logout() + logout sleep 2 match_not( diff --git a/test/browser/translation_test.rb b/test/browser/translation_test.rb index bd195c2f1..fd53b964f 100644 --- a/test/browser/translation_test.rb +++ b/test/browser/translation_test.rb @@ -11,7 +11,7 @@ class TranslationTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#current_user"]') click(css: 'a[href="#profile"]') @@ -144,7 +144,7 @@ class TranslationTest < TestCase value: 'Übersichten123', ) - reload() + reload exists_not( css: 'span.translation[title="Overviews"]', ) @@ -260,7 +260,7 @@ class TranslationTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#current_user"]') click(css: 'a[href="#profile"]') @@ -285,7 +285,7 @@ class TranslationTest < TestCase click(css: '.content.active .js-syncChanges') - modal_ready() + modal_ready watch_for( css: '.content.active .modal', value: 'Letzte Übersetzung laden', @@ -327,7 +327,7 @@ class TranslationTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all click(css: 'a[href="#current_user"]') click(css: 'a[href="#profile"]') diff --git a/test/browser/user_access_permissions_test.rb b/test/browser/user_access_permissions_test.rb index 4052e5aac..8d0b3cee4 100644 --- a/test/browser/user_access_permissions_test.rb +++ b/test/browser/user_access_permissions_test.rb @@ -10,7 +10,7 @@ class AgentProfilePermissionsTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all user_open_by_search(value: 'Braun') @@ -34,13 +34,13 @@ class AgentProfilePermissionsTest < TestCase css: '.content.active [data-name="note"]', value: 'some note 123', ) - empty_search() + empty_search # check and change note again in edit screen click(css: '.content.active .js-action .icon-arrow-down', fast: true) click(css: '.content.active .js-action [data-type="edit"]') - modal_ready() + modal_ready watch_for( css: '.content.active .modal', value: 'some note 123', @@ -55,7 +55,7 @@ class AgentProfilePermissionsTest < TestCase value: 'some note abc', ) click(css: '.content.active .modal button.js-submit') - modal_disappear() + modal_disappear watch_for( css: '.content.active .profile-window', @@ -72,13 +72,13 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .js-action .icon-arrow-down', fast: true) click(css: '.content.active .js-action [data-type="edit"]') - modal_ready() + modal_ready set( css: '.modal [name="lastname"]', value: 'Braun', ) click(css: '.content.active .modal button.js-submit') - modal_disappear() + modal_disappear verify_task( data: { @@ -94,7 +94,7 @@ class AgentProfilePermissionsTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all user_open_by_search(value: 'Test Master') @@ -113,7 +113,7 @@ class AgentProfilePermissionsTest < TestCase value: 'email', ) - empty_search() + empty_search sleep 2 click(css: '.content.active .js-action .icon-arrow-down', fast: true) @@ -127,7 +127,7 @@ class AgentProfilePermissionsTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket1 = ticket_create( data: { @@ -138,16 +138,16 @@ class AgentProfilePermissionsTest < TestCase }, ) - tasks_close_all() + tasks_close_all - logout() + logout login( username: 'agent1@example.com', password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket_open_by_search( number: ticket1[:number], @@ -171,7 +171,7 @@ class AgentProfilePermissionsTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket1 = ticket_create( data: { @@ -189,7 +189,7 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') click(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') - modal_ready() + modal_ready set( css: '.modal [name="lastname"]', value: 'B2', @@ -199,7 +199,7 @@ class AgentProfilePermissionsTest < TestCase value: 'some note abc', ) click(css: '.content.active .modal button.js-submit') - modal_disappear() + modal_disappear watch_for( css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]', @@ -215,7 +215,7 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .sidebar[data-tab="customer"] .js-actions') click(css: 'li[data-type="customer-edit"]') - modal_ready() + modal_ready set( css: '.modal [name="lastname"]', value: 'Braun', @@ -225,7 +225,7 @@ class AgentProfilePermissionsTest < TestCase value: 'some note abc', ) click(css: '.content.active .modal button.js-submit') - modal_disappear() + modal_disappear watch_for( css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]', @@ -246,7 +246,7 @@ class AgentProfilePermissionsTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket1 = ticket_create( data: { @@ -278,7 +278,7 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .js-action .dropdown-toggle') click(css: '.content.active .js-action [data-type="edit"]') - modal_ready() + modal_ready set( css: '.modal [name="lastname"]', value: 'B2', @@ -288,7 +288,7 @@ class AgentProfilePermissionsTest < TestCase value: 'some note abc', ) click(css: '.content.active .modal button.js-submit') - modal_disappear() + modal_disappear watch_for( css: '.content.active .profile-window', @@ -305,7 +305,7 @@ class AgentProfilePermissionsTest < TestCase click(css: '.content.active .js-action .dropdown-toggle') click(css: '.content.active .js-action [data-type="edit"]') - modal_ready() + modal_ready set( css: '.modal [name="lastname"]', value: 'Braun', @@ -315,7 +315,7 @@ class AgentProfilePermissionsTest < TestCase value: 'note', ) click(css: '.content.active .modal button.js-submit') - modal_disappear() + modal_disappear verify_task( data: { @@ -332,7 +332,7 @@ class AgentProfilePermissionsTest < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket1 = ticket_create( data: { diff --git a/test/browser/user_switch_cache_test.rb b/test/browser/user_switch_cache_test.rb index 67bfbc82b..e81dc7d58 100644 --- a/test/browser/user_switch_cache_test.rb +++ b/test/browser/user_switch_cache_test.rb @@ -12,7 +12,7 @@ class UserSwitchCache < TestCase password: 'test', url: browser_url, ) - tasks_close_all() + tasks_close_all ticket_create( data: { customer: 'nico', @@ -22,7 +22,7 @@ class UserSwitchCache < TestCase }, ) - logout() + logout # login as customer and verify ticket create screen login( @@ -51,7 +51,7 @@ class UserSwitchCache < TestCase value: 'State', ) - logout() + logout # login again as customer and verify ticket create screen login( diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 83991aca8..9a54d203e 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -3095,7 +3095,7 @@ wait untill text in selector disabppears end raise "Can't find organization #{data[:organization]}" if target.blank? - target.click() + target.click rescue Selenium::WebDriver::Error::StaleElementReferenceError sleep retries retries += 1 @@ -3263,7 +3263,7 @@ wait untill text in selector disabppears sleep 0.5 target = instance.find_elements(css: ".modal li[title='#{data[:organization]}']")[0] end - target.click() + target.click rescue Selenium::WebDriver::Error::StaleElementReferenceError sleep retries retries += 1 @@ -4860,7 +4860,7 @@ wait untill text in selector disabppears tries = 5 begin alert = instance.switch_to.alert - alert.dismiss() + alert.dismiss rescue e tries -= 1 sleep 0.5 diff --git a/test/integration/email_postmaster_to_sender.rb b/test/integration/email_postmaster_to_sender.rb index 60e5f7bbb..71b12c4f3 100644 --- a/test/integration/email_postmaster_to_sender.rb +++ b/test/integration/email_postmaster_to_sender.rb @@ -134,7 +134,7 @@ Oversized Email Message Body #{'#' * 120_000} msg = imap.fetch(imap_message_id, 'RFC822')[0].attr['RFC822'] assert(msg.present?, 'Must have received a reply from the postmaster') imap.store(imap_message_id, '+FLAGS', [:Deleted]) - imap.expunge() + imap.expunge # parse the reply mail and verify the various headers parser = Channel::EmailParser.new @@ -209,7 +209,7 @@ Oversized Email Message Body #{'#' * 120_000} imap_message_id = message_ids.last msg = imap.fetch(imap_message_id, 'RFC822')[0].attr['RFC822'] imap.store(imap_message_id, '+FLAGS', [:Deleted]) - imap.expunge() + imap.expunge assert(msg.present?, 'Oversized Email Message') assert_equal(message_ids.count, 1, 'Original customer mail must be deleted.') diff --git a/test/integration/idoit_browser_test.rb b/test/integration/idoit_browser_test.rb index 2b9de6934..1189365b2 100644 --- a/test/integration/idoit_browser_test.rb +++ b/test/integration/idoit_browser_test.rb @@ -82,7 +82,7 @@ class IntegrationIdoitTest < TestCase # click the check box from the first row and note its entry ID checkbox = @browser.find_elements(css: '.content.active .modal form.js-result tbody :first-child input')[0] entry_id = checkbox.attribute('value') - checkbox.click() + checkbox.click # submit the i-doit object selections click(css: '.content.active .modal form button.js-submit') @@ -113,7 +113,7 @@ class IntegrationIdoitTest < TestCase css: ".content.active .sidebar[data-tab='idoit'] a[href='#{api_endpoint}/?objID=#{entry_id}']", ) - tasks_close_all() + tasks_close_all # new create a new ticket with an i-doit object ticket_create( @@ -142,7 +142,7 @@ class IntegrationIdoitTest < TestCase # click the check box from the first row and note its entry ID checkbox = @browser.find_elements(css: '.content.active .modal form.js-result tbody :first-child input')[0] entry_id = checkbox.attribute('value') - checkbox.click() + checkbox.click # submit the i-doit object selections click(css: '.content.active .modal form button.js-submit') @@ -173,7 +173,7 @@ class IntegrationIdoitTest < TestCase # reload browser and check if it's still removed sleep 3 - reload() + reload watch_for( css: '.content.active .ticketZoom-header .ticket-number', ) @@ -192,7 +192,7 @@ class IntegrationIdoitTest < TestCase # add item again click(css: '.content.active .sidebar[data-tab="idoit"] .js-actions .dropdown-toggle') click(css: '.content.active .sidebar[data-tab="idoit"] .js-actions [data-type="objects-change"]') - modal_ready() + modal_ready # wait for the API call to populate the dropdown menu watch_for(css: '.content.active .modal form input.js-input') @@ -205,7 +205,7 @@ class IntegrationIdoitTest < TestCase # click the check box from the first row and note its entry ID checkbox = @browser.find_elements(css: '.content.active .modal form.js-result tbody :first-child input')[0] entry_id = checkbox.attribute('value') - checkbox.click() + checkbox.click # submit the i-doit object selections click(css: '.content.active .modal form button.js-submit') @@ -217,7 +217,7 @@ class IntegrationIdoitTest < TestCase # reload browser and check if it's still removed sleep 3 - reload() + reload watch_for( css: '.content.active .ticketZoom-header .ticket-number', ) diff --git a/test/integration/package_test.rb b/test/integration/package_test.rb index 93099c998..b29cab7bf 100644 --- a/test/integration/package_test.rb +++ b/test/integration/package_test.rb @@ -361,7 +361,7 @@ class PackageTest < ActiveSupport::TestCase file.close end begin - Package.auto_install() + Package.auto_install rescue false end