Applied required changes to install and use PHP 5.6 for testing the Zammad PHP API client - until @jepf adds PHP 7 support (for tests).

This commit is contained in:
Thorsten Eckel 2019-06-27 20:26:28 +02:00
parent 29f96527a7
commit 83c77a4a35
26 changed files with 264 additions and 265 deletions

View file

@ -11,7 +11,7 @@ jobs:
install-mysql:
docker:
- image: circleci/ruby:2.4.4
- image: circleci/ruby:2.5.5
- image: circleci/mysql:5.7-ram
command: --max_allowed_packet=64MB
environment:
@ -28,7 +28,7 @@ jobs:
install-postgresql:
docker:
- image: circleci/ruby:2.4.4
- image: circleci/ruby:2.5.5
- image: circleci/postgres:11-ram
environment:
POSTGRES_DB: zammad_test

View file

@ -1,4 +1,4 @@
image: registry.znuny.com/docker/zammad-ruby:2.4.4
image: registry.znuny.com/docker/zammad-ruby:2.5.5
# Global variables added to the ENV of each job
variables:
@ -61,7 +61,7 @@ variables:
# Cache gems in between jobs and pipelines
cache:
key: "ruby24"
key: "ruby25"
paths:
- vendor/ruby

View file

@ -1 +1 @@
2.4.4
2.5.5

View file

@ -1,7 +1,7 @@
source 'https://rubygems.org'
# core - base
ruby '2.4.4'
ruby '2.5.5'
gem 'rails', '5.1.7'
# core - rails additions

View file

@ -641,7 +641,7 @@ DEPENDENCIES
zendesk_api
RUBY VERSION
ruby 2.4.4p296
ruby 2.5.5p157
BUNDLED WITH
1.17.3

View file

@ -10,19 +10,19 @@ class Integration::LdapController < ApplicationController
def discover
answer_with do
begin
ldap = ::Ldap.new(params)
{
attributes: ldap.preferences
}
rescue => e
# workaround for issue #1114
raise if !e.message.end_with?(', 48, Inappropriate Authentication')
ldap = ::Ldap.new(params)
{
attributes: ldap.preferences
}
rescue => e
# workaround for issue #1114
raise if !e.message.end_with?(', 48, Inappropriate Authentication')
# return empty result
{}
# return empty result
{}
end
end
end

View file

@ -250,52 +250,52 @@ class ReportsController < ApplicationController
row = 2
result[:ticket_ids].each do |ticket_id|
begin
ticket = Ticket.lookup(id: ticket_id)
row += 1
worksheet.write_string(row, 0, ticket.number)
worksheet.write_string(row, 1, ticket.title)
worksheet.write_string(row, 2, ticket.state.name)
worksheet.write_string(row, 3, ticket.priority.name)
worksheet.write_string(row, 4, ticket.group.name)
worksheet.write_string(row, 5, ticket.owner.fullname)
worksheet.write_string(row, 6, ticket.customer.fullname)
worksheet.write_string(row, 7, ticket.try(:organization).try(:name))
worksheet.write_string(row, 8, ticket.create_article_type.name)
worksheet.write_string(row, 9, ticket.create_article_sender.name)
worksheet.write_string(row, 10, ticket.tag_list.join(','))
worksheet.write_date_time(row, 11, time_in_localtime_for_excel(ticket.created_at, params[:timezone]), format_time)
worksheet.write_date_time(row, 12, time_in_localtime_for_excel(ticket.updated_at, params[:timezone]), format_time)
worksheet.write_date_time(row, 13, time_in_localtime_for_excel(ticket.close_at, params[:timezone]), format_time) if ticket.close_at.present?
ticket = Ticket.lookup(id: ticket_id)
row += 1
worksheet.write_string(row, 0, ticket.number)
worksheet.write_string(row, 1, ticket.title)
worksheet.write_string(row, 2, ticket.state.name)
worksheet.write_string(row, 3, ticket.priority.name)
worksheet.write_string(row, 4, ticket.group.name)
worksheet.write_string(row, 5, ticket.owner.fullname)
worksheet.write_string(row, 6, ticket.customer.fullname)
worksheet.write_string(row, 7, ticket.try(:organization).try(:name))
worksheet.write_string(row, 8, ticket.create_article_type.name)
worksheet.write_string(row, 9, ticket.create_article_sender.name)
worksheet.write_string(row, 10, ticket.tag_list.join(','))
# Object Manager attributes
column = 14
# We already queried ObjectManager::Attributes, so we just use objects
objects.each do |object|
key = object[:name]
case object[:data_type]
when 'boolean', 'select'
value = ticket.send(key.to_sym)
if object[:data_option] && object[:data_option]['options'] && object[:data_option]['options'][ticket.send(key.to_sym)]
value = object[:data_option]['options'][ticket.send(key.to_sym)]
end
worksheet.write_string(row, column, value)
when 'datetime'
worksheet.write_date_time(row, column, time_in_localtime_for_excel(ticket.send(key.to_sym), params[:timezone]), format_time) if ticket.send(key.to_sym).present?
when 'date'
worksheet.write_date_time(row, column, ticket.send(key.to_sym).to_s, format_date) if ticket.send(key.to_sym).present?
when 'integer'
worksheet.write_number(row, column, ticket.send(key.to_sym))
else
# for text, integer and tree select
worksheet.write_string(row, column, ticket.send(key.to_sym).to_s)
worksheet.write_date_time(row, 11, time_in_localtime_for_excel(ticket.created_at, params[:timezone]), format_time)
worksheet.write_date_time(row, 12, time_in_localtime_for_excel(ticket.updated_at, params[:timezone]), format_time)
worksheet.write_date_time(row, 13, time_in_localtime_for_excel(ticket.close_at, params[:timezone]), format_time) if ticket.close_at.present?
# Object Manager attributes
column = 14
# We already queried ObjectManager::Attributes, so we just use objects
objects.each do |object|
key = object[:name]
case object[:data_type]
when 'boolean', 'select'
value = ticket.send(key.to_sym)
if object[:data_option] && object[:data_option]['options'] && object[:data_option]['options'][ticket.send(key.to_sym)]
value = object[:data_option]['options'][ticket.send(key.to_sym)]
end
column += 1
worksheet.write_string(row, column, value)
when 'datetime'
worksheet.write_date_time(row, column, time_in_localtime_for_excel(ticket.send(key.to_sym), params[:timezone]), format_time) if ticket.send(key.to_sym).present?
when 'date'
worksheet.write_date_time(row, column, ticket.send(key.to_sym).to_s, format_date) if ticket.send(key.to_sym).present?
when 'integer'
worksheet.write_number(row, column, ticket.send(key.to_sym))
else
# for text, integer and tree select
worksheet.write_string(row, column, ticket.send(key.to_sym).to_s)
end
rescue => e
Rails.logger.error "SKIP: #{e.message}"
column += 1
end
rescue => e
Rails.logger.error "SKIP: #{e.message}"
end
row += 2

View file

@ -188,29 +188,29 @@ stream all accounts
# start threads for each channel
@@channel_stream[channel_id][:thread] = Thread.new do
begin
logger.info "Started stream channel for '#{channel.id}' (#{channel.area})..."
channel.status_in = 'ok'
channel.last_log_in = ''
channel.save!
@@channel_stream_started_till_at[channel_id] = Time.zone.now
@@channel_stream[channel_id] ||= {}
@@channel_stream[channel_id][:stream_instance] = channel.stream_instance
@@channel_stream[channel_id][:stream_instance].stream
@@channel_stream[channel_id][:stream_instance].disconnect
@@channel_stream.delete(channel_id)
@@channel_stream_started_till_at[channel_id] = Time.zone.now
logger.info " ...stopped stream thread for '#{channel.id}'"
rescue => e
error = "Can't use stream for channel (#{channel.id}): #{e.inspect}"
logger.error error
logger.error e
channel.status_in = 'error'
channel.last_log_in = error
channel.save!
@@channel_stream.delete(channel_id)
@@channel_stream_started_till_at[channel_id] = Time.zone.now
end
logger.info "Started stream channel for '#{channel.id}' (#{channel.area})..."
channel.status_in = 'ok'
channel.last_log_in = ''
channel.save!
@@channel_stream_started_till_at[channel_id] = Time.zone.now
@@channel_stream[channel_id] ||= {}
@@channel_stream[channel_id][:stream_instance] = channel.stream_instance
@@channel_stream[channel_id][:stream_instance].stream
@@channel_stream[channel_id][:stream_instance].disconnect
@@channel_stream.delete(channel_id)
@@channel_stream_started_till_at[channel_id] = Time.zone.now
logger.info " ...stopped stream thread for '#{channel.id}'"
rescue => e
error = "Can't use stream for channel (#{channel.id}): #{e.inspect}"
logger.error error
logger.error e
channel.status_in = 'error'
channel.last_log_in = error
channel.save!
@@channel_stream.delete(channel_id)
@@channel_stream_started_till_at[channel_id] = Time.zone.now
end
end

View file

@ -127,11 +127,11 @@ example
message_ids = nil
timeout(6.minutes) do
begin
message_ids = @imap.sort(['DATE'], filter, 'US-ASCII')
rescue
message_ids = @imap.search(filter)
end
message_ids = @imap.sort(['DATE'], filter, 'US-ASCII')
rescue
message_ids = @imap.search(filter)
end
# check mode only

View file

@ -586,14 +586,14 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
end
mail.parts.each do |part|
begin
new_attachments = get_attachments(part, attachments, mail).flatten.compact
attachments.push(*new_attachments)
rescue => e # Protect process to work with spam emails (see test/fixtures/mail15.box)
raise e if (fail_count ||= 0).positive?
(fail_count += 1) && retry
end
new_attachments = get_attachments(part, attachments, mail).flatten.compact
attachments.push(*new_attachments)
rescue => e # Protect process to work with spam emails (see test/fixtures/mail15.box)
raise e if (fail_count ||= 0).positive?
(fail_count += 1) && retry
end
attachments
@ -608,15 +608,15 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
file.header.fields.each do |field|
# full line, encode, ready for storage
begin
value = field.to_utf8
if value.blank?
value = field.raw_value
end
headers_store[field.name.to_s] = value
rescue => e
headers_store[field.name.to_s] = field.raw_value
value = field.to_utf8
if value.blank?
value = field.raw_value
end
headers_store[field.name.to_s] = value
rescue => e
headers_store[field.name.to_s] = field.raw_value
end
# cleanup content id, <> will be added automatically later

View file

@ -12,32 +12,32 @@ module Channel::Filter::Database
all_matches_ok = true
min_one_rule_exists = false
filter[:match].each do |key, meta|
begin
next if meta.blank? || meta['value'].blank?
value = mail[ key.downcase.to_sym ]
match_rule = meta['value']
min_one_rule_exists = true
if meta[:operator] == 'contains not'
if value.present? && Channel::Filter::Match::EmailRegex.match(value: value, match_rule: match_rule)
all_matches_ok = false
Rails.logger.info " matching #{key.downcase}:'#{value}' on #{match_rule}, but shoud not"
end
elsif meta[:operator] == 'contains'
if value.blank? || !Channel::Filter::Match::EmailRegex.match(value: value, match_rule: match_rule)
all_matches_ok = false
Rails.logger.info " not matching #{key.downcase}:'#{value}' on #{match_rule}, but should"
end
else
next if meta.blank? || meta['value'].blank?
value = mail[ key.downcase.to_sym ]
match_rule = meta['value']
min_one_rule_exists = true
if meta[:operator] == 'contains not'
if value.present? && Channel::Filter::Match::EmailRegex.match(value: value, match_rule: match_rule)
all_matches_ok = false
Rails.logger.info " Invalid operator in match #{meta.inspect}"
Rails.logger.info " matching #{key.downcase}:'#{value}' on #{match_rule}, but shoud not"
end
break if !all_matches_ok
rescue => e
elsif meta[:operator] == 'contains'
if value.blank? || !Channel::Filter::Match::EmailRegex.match(value: value, match_rule: match_rule)
all_matches_ok = false
Rails.logger.info " not matching #{key.downcase}:'#{value}' on #{match_rule}, but should"
end
else
all_matches_ok = false
Rails.logger.error "can't use match rule #{match_rule} on #{value}"
Rails.logger.error e.inspect
Rails.logger.info " Invalid operator in match #{meta.inspect}"
end
break if !all_matches_ok
rescue => e
all_matches_ok = false
Rails.logger.error "can't use match rule #{match_rule} on #{value}"
Rails.logger.error e.inspect
end
next if !min_one_rule_exists

View file

@ -69,6 +69,7 @@ class Store::Provider::File
local_location = locations[0, count].join('/')
break if local_location.match?(%r{storage/fs/{0,4}$})
break if Dir["#{local_location}/*"].present?
next if !Dir.exist?(local_location)
FileUtils.rmdir(local_location)
end

View file

@ -444,22 +444,22 @@ get count of tickets and tickets which match on selector
return [] if !query
ActiveRecord::Base.transaction(requires_new: true) do
begin
if !current_user
ticket_count = Ticket.distinct.where(query, *bind_params).joins(tables).count
tickets = Ticket.distinct.where(query, *bind_params).joins(tables).limit(limit)
return [ticket_count, tickets]
end
access_condition = Ticket.access_condition(current_user, access)
ticket_count = Ticket.distinct.where(access_condition).where(query, *bind_params).joins(tables).count
tickets = Ticket.distinct.where(access_condition).where(query, *bind_params).joins(tables).limit(limit)
if !current_user
ticket_count = Ticket.distinct.where(query, *bind_params).joins(tables).count
tickets = Ticket.distinct.where(query, *bind_params).joins(tables).limit(limit)
return [ticket_count, tickets]
rescue ActiveRecord::StatementInvalid => e
Rails.logger.error e
raise ActiveRecord::Rollback
end
access_condition = Ticket.access_condition(current_user, access)
ticket_count = Ticket.distinct.where(access_condition).where(query, *bind_params).joins(tables).count
tickets = Ticket.distinct.where(access_condition).where(query, *bind_params).joins(tables).limit(limit)
return [ticket_count, tickets]
rescue ActiveRecord::StatementInvalid => e
Rails.logger.error e
raise ActiveRecord::Rollback
end
[]
end

View file

@ -5,19 +5,19 @@ class TriggerRecipientUpdate < ActiveRecord::Migration[4.2]
return if !Setting.find_by(name: 'system_init_done')
['auto reply (on new tickets)', 'auto reply (on follow up of tickets)'].each do |name|
begin
trigger = Trigger.find_by(name: name)
next if trigger.blank?
next if trigger.perform.blank?
next if trigger.perform['notification.email'].blank?
next if trigger.perform['notification.email']['recipient'].blank?
next if trigger.perform['notification.email']['recipient'] != 'ticket_customer'
trigger.perform['notification.email']['recipient'] = 'article_last_sender'
trigger.save!
rescue => e
Rails.logger.error "Unable to update Trigger.find(#{trigger.id}) '#{trigger.inspect}': #{e.message}"
end
trigger = Trigger.find_by(name: name)
next if trigger.blank?
next if trigger.perform.blank?
next if trigger.perform['notification.email'].blank?
next if trigger.perform['notification.email']['recipient'].blank?
next if trigger.perform['notification.email']['recipient'] != 'ticket_customer'
trigger.perform['notification.email']['recipient'] = 'article_last_sender'
trigger.save!
rescue => e
Rails.logger.error "Unable to update Trigger.find(#{trigger.id}) '#{trigger.inspect}': #{e.message}"
end
end

View file

@ -220,11 +220,11 @@ class ForeignKeys < ActiveRecord::Migration[4.2]
foreign_keys.each do |foreign_key|
ActiveRecord::Base.transaction do
begin
add_foreign_key(*foreign_key)
rescue => e
Rails.logger.error "Inconsistent data status detected while adding foreign key '#{foreign_key.inspect}': #{e.message}"
end
add_foreign_key(*foreign_key)
rescue => e
Rails.logger.error "Inconsistent data status detected while adding foreign key '#{foreign_key.inspect}': #{e.message}"
end
end
end

View file

@ -5,11 +5,11 @@ class AgendBasedSenderIssue1351 < ActiveRecord::Migration[4.2]
return if !Setting.find_by(name: 'system_init_done')
EmailAddress.all.each do |email_address|
begin
email_address.save!
rescue => e
Rails.logger.error "Unable to update EmailAddress.find(#{email_address.id}) '#{email_address.inspect}': #{e.message}"
end
email_address.save!
rescue => e
Rails.logger.error "Unable to update EmailAddress.find(#{email_address.id}) '#{email_address.inspect}': #{e.message}"
end
end
end

View file

@ -7,11 +7,11 @@ class FixedStoreUpgradeRor45 < ActiveRecord::Migration[5.0]
Cache.clear
[Macro, Taskbar, Calendar, Trigger, Channel, Job, PostmasterFilter, Report::Profile, Setting, Sla, Template].each do |class_name|
class_name.all.each do |record|
begin
record.save!
rescue => e
Rails.logger.error "Unable to save/update #{class_name}.find(#{record.id}): #{e.message}"
end
record.save!
rescue => e
Rails.logger.error "Unable to save/update #{class_name}.find(#{record.id}): #{e.message}"
end
end

View file

@ -24,13 +24,13 @@ class Issue1977RemoveInvalidUserForeignKeys < ActiveRecord::Migration[5.1]
]
foreign_keys.each do |args|
begin
add_foreign_key(*args)
rescue ActiveRecord::StatementInvalid => e
Rails.logger.info "Can't add foreign_keys '#{args.inspect}'"
Rails.logger.info e
ActiveRecord::Base.connection.reconnect!
end
add_foreign_key(*args)
rescue ActiveRecord::StatementInvalid => e
Rails.logger.info "Can't add foreign_keys '#{args.inspect}'"
Rails.logger.info e
ActiveRecord::Base.connection.reconnect!
end
end
end

View file

@ -444,14 +444,14 @@ class String
#map['word-en-de'] = "[^#{marker}].{1,250}\s(wrote|schrieb):"
map.each_value do |regexp|
begin
string.sub!(/#{regexp}/) do |placeholder|
placeholder = "#{marker}#{placeholder}"
end
rescue
# regexp was not possible because of some string encoding issue, use next
Rails.logger.debug { "Invalid string/charset combination with regexp #{regexp} in string" }
string.sub!(/#{regexp}/) do |placeholder|
placeholder = "#{marker}#{placeholder}"
end
rescue
# regexp was not possible because of some string encoding issue, use next
Rails.logger.debug { "Invalid string/charset combination with regexp #{regexp} in string" }
end
string
@ -494,11 +494,11 @@ class String
# try to find valid encodings of string
viable_encodings.each do |enc|
begin
return encode!('utf-8', enc)
rescue EncodingError => e
Rails.logger.error { e.inspect }
end
return encode!('utf-8', enc)
rescue EncodingError => e
Rails.logger.error { e.inspect }
end
case options[:fallback]

View file

@ -14,18 +14,17 @@ class Sequencer
ews_folder_ids.collect do |folder_id|
begin
ews_folder.find(folder_id).items.each do |resource|
attributes = ::Import::Exchange::ItemAttributes.extract(resource)
extractor.extract(attributes)
break if extractor.enough
end
rescue NoMethodError => e
raise if e.message !~ /Viewpoint::EWS::/
logger.error e
logger.error "Skipping folder_id '#{folder_id}' due to unsupported entries."
ews_folder.find(folder_id).items.each do |resource|
attributes = ::Import::Exchange::ItemAttributes.extract(resource)
extractor.extract(attributes)
break if extractor.enough
end
rescue NoMethodError => e
raise if e.message !~ /Viewpoint::EWS::/
logger.error e
logger.error "Skipping folder_id '#{folder_id}' due to unsupported entries."
end
end.examples
end

View file

@ -10,14 +10,13 @@ namespace :zammad do
# there is no way in rake to achive that
%w[db:drop:_unsafe db:create db:schema:load db:seed].each do |task|
begin
$stdout = StringIO.new if task == 'db:schema:load'.freeze
$stdout = StringIO.new if task == 'db:schema:load'.freeze
Rake::Task[task].reenable
Rake::Task[task].invoke
ensure
$stdout = STDOUT
Rake::Task[task].reenable
Rake::Task[task].invoke
ensure
$stdout = STDOUT
end
end
ActiveRecord::Base.connection.reconnect!

View file

@ -294,17 +294,17 @@ returns
end
if title == '-'
%i[sticker photo document voice].each do |area|
begin
next if !params[:message]
next if !params[:message][area]
next if !params[:message][area][:emoji]
title = params[:message][area][:emoji]
break
rescue
# just go ahead
title
end
next if !params[:message]
next if !params[:message][area]
next if !params[:message][area][:emoji]
title = params[:message][area][:emoji]
break
rescue
# just go ahead
title
end
end
if title.length > 60

View file

@ -25,14 +25,14 @@ RSpec.describe NotificationFactory do
let(:template_path) { Rails.root.to_s + "/app/views/mailer/signup/#{rendered_locale}.html.erb.custom" }
it 'uses that file' do
begin
File.write(template_path, "Subject\nBody\nbody\n")
expect(described_class.template_read(read_params))
.to eq({ subject: "Subject\n", body: "Body\nbody\n" })
ensure
File.delete(template_path)
end
File.write(template_path, "Subject\nBody\nbody\n")
expect(described_class.template_read(read_params))
.to eq({ subject: "Subject\n", body: "Body\nbody\n" })
ensure
File.delete(template_path)
end
end

View file

@ -27,18 +27,18 @@ describe 'websocket-server', type: :script do
end
it 'starts up successfully' do
begin
system("RAILS_ENV=test #{ws_server} start -db #{ipv6_addr} -p #{port} >/dev/null 2>&1")
# Wait for daemon to start
Timeout.timeout(20, Timeout::Error, 'WebSocket Server startup timed out') do
loop { break if File.size(output_log) + File.size(error_log) > 0 }
end
system("RAILS_ENV=test #{ws_server} start -db #{ipv6_addr} -p #{port} >/dev/null 2>&1")
expect(File.read(error_log)).not_to include(error_msg)
ensure
system("#{ws_server} stop >/dev/null 2>&1") if File.exist?(pidfile)
# Wait for daemon to start
Timeout.timeout(20, Timeout::Error, 'WebSocket Server startup timed out') do
loop { break if File.size(output_log) + File.size(error_log) > 0 }
end
expect(File.read(error_log)).not_to include(error_msg)
ensure
system("#{ws_server} stop >/dev/null 2>&1") if File.exist?(pidfile)
end
end
end

View file

@ -38,10 +38,10 @@ module BrowserTestHelper
#
def until_exists
self.until do
begin
yield
rescue Capybara::ElementNotFound # rubocop:disable Lint/HandleExceptions
end
yield
rescue Capybara::ElementNotFound # rubocop:disable Lint/HandleExceptions
end
rescue Selenium::WebDriver::Error::TimeOutError => e
# cleanup backtrace

View file

@ -105,14 +105,14 @@ class TestCase < ActiveSupport::TestCase
# avoid "Cannot read property 'get_Current' of undefined" issues
(1..5).each do |count|
begin
local_browser = browser_instance_remote
break
rescue => e
wait_until_ready = rand(5..13)
log('browser_instance', { rescure: true, count: count, sleep: wait_until_ready, exception: e })
sleep wait_until_ready
end
local_browser = browser_instance_remote
break
rescue => e
wait_until_ready = rand(5..13)
log('browser_instance', { rescure: true, count: count, sleep: wait_until_ready, exception: e })
sleep wait_until_ready
end
local_browser
@ -1579,25 +1579,25 @@ wait untill text in selector disabppears
99.times do
#sleep 0.5
begin
if instance.find_elements(css: '#navigation .tasks .task:first-child')[0]
instance.action.move_to(instance.find_elements(css: '#navigation .tasks .task:first-child')[0]).release.perform
click_element = instance.find_elements(css: '#navigation .tasks .task:first-child .js-close')[0]
if click_element
click_element.click
# accept task close warning
if instance.find_elements(css: '.modal button.js-submit')[0]
sleep 0.4
instance.find_elements(css: '.modal button.js-submit')[0].click
end
if instance.find_elements(css: '#navigation .tasks .task:first-child')[0]
instance.action.move_to(instance.find_elements(css: '#navigation .tasks .task:first-child')[0]).release.perform
click_element = instance.find_elements(css: '#navigation .tasks .task:first-child .js-close')[0]
if click_element
click_element.click
# accept task close warning
if instance.find_elements(css: '.modal button.js-submit')[0]
sleep 0.4
instance.find_elements(css: '.modal button.js-submit')[0].click
end
else
break
end
rescue
# try again
else
break
end
rescue
# try again
end
assert(true, 'all tasks closed')
end
@ -1790,13 +1790,13 @@ wait untill text in selector disabppears
if data[:roles]
99.times do
begin
element = instance.find_elements(css: '.modal .js-selected[data-name=role_ids] .js-option:not(.is-hidden)')[0]
break if !element
element.click
sleep 0.1
end
element = instance.find_elements(css: '.modal .js-selected[data-name=role_ids] .js-option:not(.is-hidden)')[0]
break if !element
element.click
sleep 0.1
end
data[:roles].each do |role|
instance.execute_script("$(\".modal [data-name=role_ids] .js-pool .js-option:not(.is-hidden):contains('#{role}')\").first().click()")
@ -1945,13 +1945,13 @@ wait untill text in selector disabppears
end
if data[:roles]
99.times do
begin
element = instance.find_elements(css: '.modal .js-selected[data-name=role_ids] .js-option:not(.is-hidden)')[0]
break if !element
element.click
sleep 0.1
end
element = instance.find_elements(css: '.modal .js-selected[data-name=role_ids] .js-option:not(.is-hidden)')[0]
break if !element
element.click
sleep 0.1
end
data[:roles].each do |role|
instance.execute_script("$(\".modal [data-name=role_ids] .js-pool .js-option:not(.is-hidden):contains('#{role}')\").first().click()")