Keyboard shortcut improvements and browser tests.

This commit is contained in:
Martin Edenhofer 2016-02-25 13:45:46 +01:00
parent 17b171496c
commit 38317bbe8b
10 changed files with 452 additions and 215 deletions

View file

@ -205,7 +205,7 @@ class App.Controller extends Spine.Controller
# remember requested url
if !checkOnly
location = window.location.hash
if location isnt '#login' && location isnt '#logout'
if location isnt '#login' && location isnt '#logout' && location isnt '#keyboard_shortcuts'
@Config.set( 'requested_url', location)
return false if checkOnly
@ -612,6 +612,7 @@ class App.ControllerContent extends App.Controller
@navShow()
class App.ControllerModal extends App.Controller
authenticateRequired: false
backdrop: true
keyboard: true
large: false
@ -638,6 +639,9 @@ class App.ControllerModal extends App.Controller
constructor: ->
super
if @authenticateRequired
return if !@authenticate()
# rerender view, e. g. on langauge change
@bind('ui:rerender', =>
@update()

View file

@ -1,32 +1,6 @@
class Index extends App.ControllerModal
large: true
head: 'Keyboard Shortcuts'
buttonClose: true
buttonCancel: false
buttonSubmit: false
constructor: (params = {}) ->
delete params.el # do attache to body
super(params)
return if !@authenticate()
@bind('keyboard_shortcuts_close', @close)
content: ->
App.view('keyboard_shortcuts')(
areas: App.Config.get('keyboard_shortcuts')
)
onClosed: ->
window.history.go(-1)
onSubmit: ->
window.history.go(-1)
onCancel: ->
window.history.go(-1)
class Index
constructor: ->
new App.KeyboardShortcutModal()
App.Config.set('keyboard_shortcuts', Index, 'Routes')
App.Config.set('KeyboardShortcuts', { prio: 1700, parent: '#current_user', name: 'Keyboard Shortcuts', translate: true, target: '#keyboard_shortcuts', role: [ 'Admin', 'Agent' ] }, 'NavBarRight')

View file

@ -1,3 +1,24 @@
class App.KeyboardShortcutModal extends App.ControllerModal
authenticateRequired: true
large: true
head: 'Keyboard Shortcuts'
buttonClose: true
buttonCancel: false
buttonSubmit: false
constructor: ->
super
@bind('keyboard_shortcuts_close', @close)
content: ->
App.view('keyboard_shortcuts')(
areas: App.Config.get('keyboard_shortcuts')
)
exists: =>
return true if @el.parents('html').length > 0
false
class App.KeyboardShortcutWidget extends Spine.Module
@include App.LogInclude
@ -5,7 +26,6 @@ class App.KeyboardShortcutWidget extends Spine.Module
@observerKeys()
observerKeys: =>
#jQuery.hotkeys.options.filterInputAcceptingElements = false
navigationHotkeys = 'alt+ctrl'
areas = App.Config.get('keyboard_shortcuts')
for area in areas
@ -37,59 +57,75 @@ App.Config.set(
key: 'd'
hotkeys: true
description: 'Dashboard'
callback: ->
callback: (e) ->
e.preventDefault()
App.Event.trigger('keyboard_shortcuts_close')
window.location.hash = '#dashboard'
}
{
key: 'o'
hotkeys: true
description: 'Overviews'
callback: ->
callback: (e) ->
e.preventDefault()
App.Event.trigger('keyboard_shortcuts_close')
window.location.hash = '#ticket/view'
}
{
key: 's'
hotkeys: true
description: 'Search'
callback: ->
callback: (e) ->
e.preventDefault()
App.Event.trigger('keyboard_shortcuts_close')
$('#global-search').focus()
}
{
key: 'n'
hotkeys: true
description: 'New Ticket'
callback: ->
callback: (e) ->
e.preventDefault()
App.Event.trigger('keyboard_shortcuts_close')
window.location.hash = '#ticket/create'
}
{
key: 'e'
hotkeys: true
description: 'Logout'
callback: ->
callback: (e) ->
e.preventDefault()
App.Event.trigger('keyboard_shortcuts_close')
window.location.hash = '#logout'
}
{
key: 'h'
hotkeys: true
description: 'List of shortcuts'
callback: ->
if window.location.hash is '#keyboard_shortcuts'
App.Event.trigger('keyboard_shortcuts_close')
callback: (e) =>
e.preventDefault()
if @dialog && @dialog.exists()
@dialog.close()
@dialog = false
return
window.location.hash = '#keyboard_shortcuts'
@dialog = new App.KeyboardShortcutModal()
}
{
key: 'x'
hotkeys: true
description: 'Close current tab'
callback: ->
callback: (e) ->
e.preventDefault()
App.Event.trigger('keyboard_shortcuts_close')
$('#navigation .tasks .is-active .js-close').click()
}
{
key: 'tab'
hotkeys: true
description: 'Next in tab'
callback: ->
callback: (e) ->
e.preventDefault()
App.Event.trigger('keyboard_shortcuts_close')
if $('#navigation .tasks .is-active').get(0)
if $('#navigation .tasks .is-active').next().get(0)
$('#navigation .tasks .is-active').next().find('div').first().click()
@ -100,7 +136,9 @@ App.Config.set(
key: 'shift+tab'
hotkeys: true
description: 'Previous tab'
callback: ->
callback: (e) ->
e.preventDefault()
App.Event.trigger('keyboard_shortcuts_close')
if $('#navigation .tasks .is-active').get(0)
if $('#navigation .tasks .is-active').prev().get(0)
$('#navigation .tasks .is-active').prev().find('div').first().click()
@ -111,7 +149,9 @@ App.Config.set(
key: 'return'
hotkeys: true
description: 'Confirm/submit dialog'
callback: ->
callback: (e) ->
e.preventDefault()
App.Event.trigger('keyboard_shortcuts_close')
# check of primary modal exists
dialog = $('body > div.modal')
@ -185,14 +225,19 @@ App.Config.set(
key: 'm'
hotkeys: true
description: 'Open note box'
callback: ->
callback: (e) ->
e.preventDefault()
App.Event.trigger('keyboard_shortcuts_close')
$('.active.content .editControls .js-articleTypes [data-value="note"]').click()
$('.active.content .article-new .articleNewEdit-body').first().focus()
}
{
key: 'r'
key: 'g'
hotkeys: true
description: 'Reply to last article'
callback: ->
callback: (e) ->
e.preventDefault()
App.Event.trigger('keyboard_shortcuts_close')
lastArticleWithReply = $('.active.content .ticket-article .icon-reply').last()
lastArticleWithReplyAll = lastArticleWithReply.parent().find('.icon-reply-all')
if lastArticleWithReplyAll.get(0)
@ -200,18 +245,30 @@ App.Config.set(
return
lastArticleWithReply.click()
}
{
key: 'j'
hotkeys: true
description: 'Set article to internal/public'
callback: (e) ->
e.preventDefault()
App.Event.trigger('keyboard_shortcuts_close')
$('.active.content .editControls .js-selectInternalPublic').click()
}
#{
# key: 'm'
# hotkeys: true
# description: 'Open macro selection'
# callback: ->
# callback: (e) ->
# e.preventDefault()
# window.location.hash = '#ticket/create'
#}
{
key: 'c'
hotkeys: true
description: 'Update as closed'
callback: ->
callback: (e) ->
e.preventDefault()
App.Event.trigger('keyboard_shortcuts_close')
return if !$('.active.content .edit').get(0)
$('.active.content .edit [name="state_id"]').val(4)
$('.active.content .js-attributeBar .js-submit').first().click()

View file

@ -127,6 +127,12 @@
|| e.keyCode == 79
|| e.keyCode == 87)) {
e.preventDefault()
// disable rich text b/u/i
if ( _this.options.mode === 'textonly' ) {
return
}
if (e.keyCode == 66) {
document.execCommand('Bold')
}
@ -234,15 +240,6 @@
document.execCommand('insertHTML', false, text)
return true
})
// disable rich text b/u/i
if ( this.options.mode === 'textonly' ) {
this.$element.on('keydown', function (e) {
if ( _this.richTextKey(e) ) {
e.preventDefault()
}
})
}
}
// check if key is allowed, even if length limit is reached

View file

@ -121,9 +121,12 @@
textInputTypes: /textarea|input|select/i,
options: {
filterInputAcceptingElements: true,
filterTextInputs: true,
filterContentEditable: true
//filterInputAcceptingElements: true,
//filterTextInputs: true,
//filterContentEditable: true
filterInputAcceptingElements: false,
filterTextInputs: false,
filterContentEditable: false
}
};

View file

@ -59,10 +59,10 @@ var originalShow = $.fn.popover.Constructor.prototype.show;
$.fn.popover.Constructor.prototype.show = function(){
originalShow.call(this);
var maxHeight = $(this.options.viewport.selector).height() - 2 * this.options.viewport.padding;
// improved error handling - no exeption if no $tip exists
if (!this.$tip) {
return
}
var maxHeight = $(this.options.viewport.selector).height() - 2 * this.options.viewport.padding;
this.$tip.find('.popover-body').css('maxHeight', maxHeight);
}

View file

@ -21,7 +21,7 @@
<% end %>
</div>
</div>
<div class="editControls-item is-hidden js-toggleVisibility">
<div class="editControls-item is-hidden js-toggleVisibility js-selectInternalPublic">
<div class="editControls-iconHolder">
<div class="editControls-icon icon-internal" title="<%- @Ti("set to public") %>">
<%- @Icon('lock') %>

View file

@ -9,6 +9,7 @@ if [ "$LEVEL" == '1' ]; then
rm test/browser/agent_organization_profile_test.rb
rm test/browser/agent_ticket_*.rb
rm test/browser/chat_test.rb
rm test/browser/keyboard_shortcuts_test.rb
rm test/browser/prefereces_test.rb
rm test/browser/setting_test.rb
@ -25,6 +26,7 @@ elif [ "$LEVEL" == '2' ]; then
rm test/browser/chat_test.rb
rm test/browser/customer_ticket_create_test.rb
rm test/browser/form_test.rb
rm test/browser/keyboard_shortcuts_test.rb
rm test/browser/maintenance_*.rb
rm test/browser/manage_test.rb
rm test/browser/prefereces_test.rb

View file

@ -0,0 +1,163 @@
# encoding: utf-8
require 'browser_test_helper'
class KeyboardShortcutsTest < TestCase
def test_navigation
@browser = browser_instance
login(
username: 'master@example.com',
password: 'test',
url: browser_url,
)
tasks_close_all()
# show shortkeys
shortcut(key: 'h')
watch_for(
css: '.modal',
value: 'Keyboard Shortcuts',
timeout: 2,
)
# hide shortkeys
shortcut(key: 'h')
watch_for_disappear(
css: '.modal',
value: 'Keyboard Shortcuts',
timeout: 2,
)
# show shortkeys
shortcut(key: 'h')
watch_for(
css: '.modal',
value: 'Keyboard Shortcuts',
timeout: 2,
)
# go to overviews
shortcut(key: 'o')
watch_for(
css: '.active.content',
value: 'My assigned Tickets',
timeout: 2,
)
# go to dashboard
shortcut(key: 'd')
watch_for(
css: '.active.content',
value: 'My Stats',
timeout: 2,
)
# go to new ticket
shortcut(key: 'n')
watch_for(
css: '.active.content',
value: 'New Ticket',
timeout: 2,
)
# close again
shortcut(key: 'x')
watch_for_disappear(
css: '.active.content',
value: 'New Ticket',
timeout: 2,
)
ticket1 = ticket_create(
data: {
customer: 'nico',
group: 'Users',
title: 'Test Ticket for Shortcuts - ABC123',
body: 'Test Ticket Body for Shortcuts - ABC123',
},
)
sleep 5
# close again
shortcut(key: 'x')
watch_for_disappear(
css: '.active.content',
value: ticket1[:number],
timeout: 2,
)
# search it
shortcut(key: 's')
window_keys(value: ticket1[:number])
exists(css: '#navigation .search.open')
sleep 2
window_keys(value: :arrow_down)
window_keys(value: :enter)
watch_for(
css: '.active.content',
value: ticket1[:number],
timeout: 2,
)
exists_not(css: '#navigation .search.open')
# open ticket
shortcut(key: 's')
window_keys(value: ticket1[:number])
sleep 2
window_keys(value: :arrow_down)
window_keys(value: :enter)
# open new ticket
shortcut(key: 'n')
watch_for(
css: '.active.content',
value: 'New Ticket',
timeout: 2,
)
tab_count = @browser.find_elements(css: '#navigation .tasks .task').count
assert_equal(2, tab_count)
# tab is tab
shortcut(key: :tab)
watch_for(
css: '.active.content',
value: ticket1[:number],
timeout: 2,
)
shortcut(key: 'm')
shortcut(key: 'j')
window_keys(value: 'some note')
shortcut(key: :enter)
watch_for(
css: '.active.content .ticket-article',
value: 'some note',
timeout: 6,
)
exists(css: '.active.content .ticket-article .internal-border')
shortcut(key: 'g')
window_keys(value: 'some reply')
shortcut(key: :enter)
watch_for(
css: '.active.content .ticket-article',
value: 'some reply',
timeout: 6,
)
shortcut(key: 'c')
watch_for(
css: '.active.content .sidebar-content .edit',
value: 'closed',
timeout: 6,
)
shortcut(key: 'e')
watch_for(
css: 'body',
value: 'login',
timeout: 4,
)
end
end

View file

@ -138,7 +138,7 @@ class TestCase < Test::Unit::TestCase
instance.get(params[:url])
end
element = instance.find_elements({ css: '#login input[name="username"]' })[0]
element = instance.find_elements(css: '#login input[name="username"]')[0]
if !element
if params[:auto_wizard]
@ -150,7 +150,7 @@ class TestCase < Test::Unit::TestCase
)
location( url: "#{browser_url}/#getting_started/auto_wizard" )
sleep 10
login = instance.find_elements({ css: '.user-menu .user a' })[0].attribute('title')
login = instance.find_elements(css: '.user-menu .user a')[0].attribute('title')
if login != params[:username]
screenshot(browser: instance, comment: 'auto wizard login failed')
fail 'auto wizard login failed'
@ -173,17 +173,17 @@ class TestCase < Test::Unit::TestCase
element.clear
element.send_keys(params[:username])
element = instance.find_elements({ css: '#login input[name="password"]' })[0]
element = instance.find_elements(css: '#login input[name="password"]')[0]
element.clear
element.send_keys(params[:password])
if params[:remember_me]
instance.find_elements({ css: '#login .checkbox-replacement' })[0].click
instance.find_elements(css: '#login .checkbox-replacement')[0].click
end
instance.find_elements({ css: '#login button' })[0].click
instance.find_elements(css: '#login button')[0].click
sleep 5
login = instance.find_elements({ css: '.user-menu .user a' })[0].attribute('title')
login = instance.find_elements(css: '.user-menu .user a')[0].attribute('title')
if login != params[:username]
screenshot(browser: instance, comment: 'login_failed')
fail 'login failed'
@ -213,12 +213,12 @@ class TestCase < Test::Unit::TestCase
instance = params[:browser] || @browser
instance.find_elements({ css: 'a[href="#current_user"]' })[0].click
instance.find_elements(css: 'a[href="#current_user"]')[0].click
sleep 0.1
instance.find_elements({ css: 'a[href="#logout"]' })[0].click
instance.find_elements(css: 'a[href="#logout"]')[0].click
(1..6).each {
sleep 1
login = instance.find_elements({ css: '#login' })[0]
login = instance.find_elements(css: '#login')[0]
next if !login
screenshot(browser: instance, comment: 'logout_ok')
@ -244,7 +244,7 @@ class TestCase < Test::Unit::TestCase
instance = params[:browser] || @browser
clues = instance.find_elements({ css: '.js-modal--clue .js-close' })[0]
clues = instance.find_elements(css: '.js-modal--clue .js-close')[0]
if !params[:optional] && !clues
screenshot(browser: instance, comment: 'no_clues')
fail 'Unable to closes clues, no clues found!'
@ -316,7 +316,7 @@ class TestCase < Test::Unit::TestCase
instance.navigate.refresh
# check if reload was successfull
if !instance.find_elements({ css: 'body' })[0] || instance.find_elements({ css: 'body' })[0].text =~ /unavailable or too busy/i
if !instance.find_elements(css: 'body')[0] || instance.find_elements(css: 'body')[0].text =~ /unavailable or too busy/i
instance.navigate.refresh
end
screenshot(browser: instance, comment: 'reload_after')
@ -347,7 +347,7 @@ class TestCase < Test::Unit::TestCase
instance = params[:browser] || @browser
if params[:css]
element = instance.find_elements({ css: params[:css] })[0]
element = instance.find_elements(css: params[:css])[0]
#instance.mouse.move_to(element)
#sleep 0.2
element.click
@ -358,7 +358,7 @@ class TestCase < Test::Unit::TestCase
# sleep 0.2
#end
else
instance.find_elements({ partial_link_text: params[:text] })[0].click
instance.find_elements(partial_link_text: params[:text])[0].click
end
sleep 0.4 if !params[:fast]
sleep params[:wait] if params[:wait]
@ -427,7 +427,7 @@ class TestCase < Test::Unit::TestCase
log('exists', params)
instance = params[:browser] || @browser
if !instance.find_elements({ css: params[:css] } )[0]
if !instance.find_elements(css: params[:css])[0]
screenshot(browser: instance, comment: 'exists_failed')
fail "#{params[:css]} dosn't exist, but should"
end
@ -448,7 +448,7 @@ class TestCase < Test::Unit::TestCase
log('exists_not', params)
instance = params[:browser] || @browser
if instance.find_elements({ css: params[:css] } )[0]
if instance.find_elements(css: params[:css])[0]
screenshot(browser: instance, comment: 'exists_not_failed')
fail "#{params[:css]} exists but should not"
end
@ -475,7 +475,7 @@ class TestCase < Test::Unit::TestCase
instance = params[:browser] || @browser
element = instance.find_elements({ css: params[:css] })[0]
element = instance.find_elements(css: params[:css])[0]
if !params[:no_click]
element.click
end
@ -515,9 +515,9 @@ class TestCase < Test::Unit::TestCase
instance = params[:browser] || @browser
# searchable select
element = instance.find_elements({ css: "#{params[:css]}.js-shadow" })[0]
element = instance.find_elements(css: "#{params[:css]}.js-shadow")[0]
if element
element = instance.find_elements({ css: "#{params[:css]}.js-shadow + .js-input" })[0]
element = instance.find_elements(css: "#{params[:css]}.js-shadow + .js-input")[0]
element.click
element.clear
sleep 1
@ -530,13 +530,13 @@ class TestCase < Test::Unit::TestCase
# native select
begin
element = instance.find_elements({ css: params[:css] })[0]
element = instance.find_elements(css: params[:css])[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:text, params[:value])
puts "select - #{params.inspect}"
rescue
# just try again
element = instance.find_elements({ css: params[:css] })[0]
element = instance.find_elements(css: params[:css])[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:text, params[:value])
puts "select2 - #{params.inspect}"
@ -559,14 +559,14 @@ class TestCase < Test::Unit::TestCase
instance = params[:browser] || @browser
element = instance.find_elements({ css: "#{params[:css]} input[type=checkbox]" })[0]
element = instance.find_elements(css: "#{params[:css]} input[type=checkbox]")[0]
checked = element.attribute('checked')
if !checked
if params[:type] == 'on'
instance.find_elements({ css: "#{params[:css]} label" })[0].click
instance.find_elements(css: "#{params[:css]} label")[0].click
end
elsif params[:type] == 'off'
instance.find_elements({ css: "#{params[:css]} label" })[0].click
instance.find_elements(css: "#{params[:css]} label")[0].click
end
end
@ -585,7 +585,7 @@ class TestCase < Test::Unit::TestCase
instance = params[:browser] || @browser
element = instance.find_elements({ css: params[:css] })[0]
element = instance.find_elements(css: params[:css])[0]
checked = element.attribute('checked')
element.click if !checked
end
@ -605,7 +605,7 @@ class TestCase < Test::Unit::TestCase
instance = params[:browser] || @browser
element = instance.find_elements({ css: params[:css] })[0]
element = instance.find_elements(css: params[:css])[0]
checked = element.attribute('checked')
element.click if checked
end
@ -657,7 +657,7 @@ class TestCase < Test::Unit::TestCase
log('match', params)
instance = params[:browser] || @browser
element = instance.find_elements({ css: params[:css] })[0]
element = instance.find_elements(css: params[:css])[0]
if params[:css] =~ /select/
dropdown = Selenium::WebDriver::Support::Select.new(element)
@ -763,8 +763,8 @@ class TestCase < Test::Unit::TestCase
instance = params[:browser] || @browser
if params[:type]
instance.find_elements({ css: '.content.active .js-secondaryActionButtonLabel' })[0].click
instance.find_elements({ css: ".content.active .js-secondaryActionLabel[data-type=#{params[:type]}]" })[0].click
instance.find_elements(css: '.content.active .js-secondaryActionButtonLabel')[0].click
instance.find_elements(css: ".content.active .js-secondaryActionLabel[data-type=#{params[:type]}]")[0].click
return
end
fail "Unknown params for task_type: #{params.inspect}"
@ -874,7 +874,7 @@ class TestCase < Test::Unit::TestCase
# verify title
if data[:title]
title = instance.find_elements({ css: '.tasks .is-active' })[0].text.strip
title = instance.find_elements(css: '.tasks .is-active')[0].text.strip
if title =~ /#{data[:title]}/i
assert(true, "matching '#{data[:title]}' in title '#{title}'")
else
@ -884,8 +884,8 @@ class TestCase < Test::Unit::TestCase
puts "tv #{params.inspect}"
# verify modified
if data.key?(:modified)
exists = instance.find_elements({ css: '.tasks .is-active' })[0]
is_modified = instance.find_elements({ css: '.tasks .is-modified' })[0]
exists = instance.find_elements(css: '.tasks .is-active')[0]
is_modified = instance.find_elements(css: '.tasks .is-modified')[0]
puts "m #{data[:modified].inspect}"
if exists
puts ' exists'
@ -938,7 +938,7 @@ class TestCase < Test::Unit::TestCase
instance = params[:browser] || @browser
data = params[:data]
element = instance.find_elements({ partial_link_text: data[:title] })[0]
element = instance.find_elements(partial_link_text: data[:title])[0]
if !element
screenshot(browser: instance, comment: 'open_task_failed')
fail "no task with title '#{data[:title]}' found"
@ -964,7 +964,7 @@ class TestCase < Test::Unit::TestCase
instance = params[:browser] || @browser
params[:files].each {|file|
instance.find_elements({ css: params[:css] })[0].send_keys "#{Rails.root}/#{file}"
instance.find_elements(css: params[:css])[0].send_keys "#{Rails.root}/#{file}"
}
sleep 2 * params[:files].count
end
@ -994,7 +994,7 @@ class TestCase < Test::Unit::TestCase
loops = timeout.to_i * 2
text = ''
(1..loops).each {
element = instance.find_elements({ css: params[:css] })[0]
element = instance.find_elements(css: params[:css])[0]
if element #&& element.displayed?
begin
@ -1055,7 +1055,7 @@ wait untill text in selector disabppears
loops = timeout.to_i
text = ''
(1..loops).each {
element = instance.find_elements({ css: params[:css] })[0]
element = instance.find_elements(css: params[:css])[0]
if !element #|| element.displayed?
assert(true, 'not found')
sleep 1
@ -1063,7 +1063,7 @@ wait untill text in selector disabppears
end
if params[:value]
begin
text = instance.find_elements({ css: params[:css] })[0].text
text = instance.find_elements(css: params[:css])[0].text
if text !~ /#{params[:value]}/i
assert(true, "not matching '#{params[:value]}' in text '#{text}'")
sleep 1
@ -1079,6 +1079,43 @@ wait untill text in selector disabppears
fail "#{params[:css]}) still exsists"
end
=begin
shortcut(
browser: browser1,
key: 'x',
)
=end
def shortcut(params = {})
switch_window_focus(params)
log('shortcut', params)
instance = params[:browser] || @browser
instance.action.key_down(:control)
.key_down(:alt)
.send_keys(params[:key])
.key_up(:alt)
.key_up(:control)
.perform
end
=begin
window_keys(
browser: browser1,
value: 'x',
)
=end
def window_keys(params = {})
switch_window_focus(params)
log('window_keys', params)
instance = params[:browser] || @browser
instance.action.send_keys(params[:value]).perform
end
=begin
tasks_close_all(
@ -1097,17 +1134,17 @@ wait untill text in selector disabppears
(1..100).each do
sleep 1
begin
if instance.find_elements({ css: '.navigation .tasks .task:first-child' })[0]
instance.mouse.move_to(instance.find_elements({ css: '.navigation .tasks .task:first-child' })[0])
if instance.find_elements(css: '.navigation .tasks .task:first-child')[0]
instance.mouse.move_to(instance.find_elements(css: '.navigation .tasks .task:first-child')[0])
sleep 0.1
click_element = instance.find_elements({ css: '.navigation .tasks .task:first-child .js-close' })[0]
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 params[:discard_changes]
sleep 1
instance.find_elements({ css: '.modal button.js-submit' })[0].click
instance.find_elements(css: '.modal button.js-submit')[0].click
end
end
else
@ -1137,7 +1174,7 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
element = instance.find_elements({ css: params[:css] + ' input[name="customer_id_completion"]' })[0]
element = instance.find_elements(css: params[:css] + ' input[name="customer_id_completion"]')[0]
element.click
element.clear
@ -1151,7 +1188,7 @@ wait untill text in selector disabppears
element.send_keys(:arrow_down)
sleep 0.3
element.send_keys(:enter)
#instance.find_elements({ css: params[:css] + ' .recipientList-entry.js-user.is-active' })[0].click
#instance.find_elements(css: params[:css] + ' .recipientList-entry.js-user.is-active')[0].click
sleep 0.6
assert(true, 'ticket_customer_select')
end
@ -1180,29 +1217,29 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
data = params[:data]
instance.find_elements({ css: 'a[href="#manage"]' })[0].click
instance.find_elements({ css: 'a[href="#manage/overviews"]' })[0].click
instance.find_elements(css: 'a[href="#manage"]')[0].click
instance.find_elements(css: 'a[href="#manage/overviews"]')[0].click
sleep 0.2
instance.find_elements({ css: '#content a[data-type="new"]' })[0].click
instance.find_elements(css: '#content a[data-type="new"]')[0].click
sleep 2
if data[:name]
element = instance.find_elements({ css: '.modal input[name=name]' })[0]
element = instance.find_elements(css: '.modal input[name=name]')[0]
element.clear
element.send_keys(data[:name])
end
if data[:role]
element = instance.find_elements({ css: '.modal select[name="role_id"]' })[0]
element = instance.find_elements(css: '.modal select[name="role_id"]')[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:text, data[:role])
end
if data[:selector]
data[:selector].each {|key, value|
element = instance.find_elements({ css: '.modal .ticket_selector .js-attributeSelector select' })[0]
element = instance.find_elements(css: '.modal .ticket_selector .js-attributeSelector select')[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:text, key)
element = instance.find_elements({ css: '.modal .ticket_selector .js-value select' })[0]
element = instance.find_elements(css: '.modal .ticket_selector .js-value select')[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.deselect_all
dropdown.select_by(:text, value)
@ -1210,19 +1247,19 @@ wait untill text in selector disabppears
end
if data[:prio]
element = instance.find_elements({ css: '.modal input[name=prio]' })[0]
element = instance.find_elements(css: '.modal input[name=prio]')[0]
element.clear
element.send_keys(data[:prio])
end
if data['order::direction']
element = instance.find_elements({ css: '.modal select[name="order::direction"]' })[0]
element = instance.find_elements(css: '.modal select[name="order::direction"]')[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:text, data['order::direction'])
end
instance.find_elements({ css: '.modal button.js-submit' })[0].click
instance.find_elements(css: '.modal button.js-submit')[0].click
(1..12).each {
element = instance.find_elements({ css: 'body' })[0]
element = instance.find_elements(css: 'body')[0]
text = element.text
if text =~ /#{Regexp.quote(data[:name])}/
assert(true, 'overview created')
@ -1267,9 +1304,9 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
data = params[:data]
instance.find_elements({ css: 'a[href="#new"]' })[0].click
instance.find_elements({ css: 'a[href="#ticket/create"]' })[0].click
element = instance.find_elements({ css: '.active .newTicket' })[0]
instance.find_elements(css: 'a[href="#new"]')[0].click
instance.find_elements(css: 'a[href="#ticket/create"]')[0].click
element = instance.find_elements(css: '.active .newTicket')[0]
if !element
screenshot(browser: instance, comment: 'ticket_create_failed')
fail 'no ticket create screen found!'
@ -1277,23 +1314,23 @@ wait untill text in selector disabppears
sleep 1
# check count of agents, should be only 1 / - selection on init screen
count = instance.find_elements({ css: '.active .newTicket select[name="owner_id"] option' }).count
count = instance.find_elements(css: '.active .newTicket select[name="owner_id"] option').count
assert_equal(1, count, 'check if owner selection is empty per default' )
if data[:group]
element = instance.find_elements({ css: '.active .newTicket select[name="group_id"]' })[0]
element = instance.find_elements(css: '.active .newTicket select[name="group_id"]')[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:text, data[:group])
sleep 0.2
end
if data[:priority]
element = instance.find_elements({ css: '.active .newTicket select[name="priority_id"]' })[0]
element = instance.find_elements(css: '.active .newTicket select[name="priority_id"]')[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:text, data[:priority])
sleep 0.2
end
if data[:title]
element = instance.find_elements({ css: '.active .newTicket input[name="title"]' })[0]
element = instance.find_elements(css: '.active .newTicket input[name="title"]')[0]
element.clear
element.send_keys(data[:title])
sleep 0.2
@ -1301,12 +1338,12 @@ wait untill text in selector disabppears
if data[:body]
#instance.execute_script('$(".active .newTicket div[data-name=body]").focus()')
sleep 0.5
element = instance.find_elements({ css: '.active .newTicket div[data-name=body]' })[0]
element = instance.find_elements(css: '.active .newTicket div[data-name=body]')[0]
element.clear
element.send_keys(data[:body])
# it's not working stable via selenium, use js
value = instance.find_elements({ css: '.content .newTicket div[data-name=body]' })[0].text
value = instance.find_elements(css: '.content .newTicket div[data-name=body]')[0].text
#puts "V #{value.inspect}"
if value != data[:body]
body_quoted = quote(data[:body])
@ -1314,7 +1351,7 @@ wait untill text in selector disabppears
end
end
if data[:customer]
element = instance.find_elements({ css: '.active .newTicket input[name="customer_id_completion"]' })[0]
element = instance.find_elements(css: '.active .newTicket input[name="customer_id_completion"]')[0]
element.click
element.clear
@ -1328,7 +1365,7 @@ wait untill text in selector disabppears
element.send_keys(:arrow_down)
sleep 0.3
element.send_keys(:enter)
#instance.find_elements({ css: '.active .newTicket .recipientList-entry.js-user.is-active' })[0].click
#instance.find_elements(css: '.active .newTicket .recipientList-entry.js-user.is-active')[0].click
sleep 0.6
end
@ -1346,7 +1383,7 @@ wait untill text in selector disabppears
end
sleep 0.8
#instance.execute_script('$(".content.active .newTicket form").submit();')
instance.find_elements({ css: '.active .newTicket button.js-submit' })[0].click
instance.find_elements(css: '.active .newTicket button.js-submit')[0].click
sleep 1
(1..10).each {
if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/
@ -1356,7 +1393,7 @@ wait untill text in selector disabppears
id.gsub!(//,)
id.gsub!(%r{^.+?/(\d+)$}, '\\1')
element = instance.find_elements({ css: '.active .ticketZoom-header .ticket-number' })[0]
element = instance.find_elements(css: '.active .ticketZoom-header .ticket-number')[0]
if element
number = element.text
ticket = {
@ -1400,10 +1437,10 @@ wait untill text in selector disabppears
data = params[:data]
if data[:title]
#element = instance.find_elements({ :css => '.content.active .ticketZoom-header .ticket-title-update' })[0]
#element = instance.find_elements(:css => '.content.active .ticketZoom-header .ticket-title-update')[0]
#element.clear
#sleep 0.5
#element = instance.find_elements({ :css => '.content.active .ticketZoom-header .ticket-title-update' })[0]
#element = instance.find_elements(:css => '.content.active .ticketZoom-header .ticket-title-update')[0]
#element.send_keys(data[:title])
#sleep 0.5
#element.send_keys(:tab)
@ -1438,7 +1475,7 @@ wait untill text in selector disabppears
value: 'change',
)
element = instance.find_elements({ css: '.modal input[name="customer_id_completion"]' })[0]
element = instance.find_elements(css: '.modal input[name="customer_id_completion"]')[0]
element.click
element.clear
@ -1452,7 +1489,7 @@ wait untill text in selector disabppears
element.send_keys(:arrow_down)
sleep 0.6
element.send_keys(:enter)
#instance.find_elements({ css: '.modal .user_autocompletion .recipientList-entry.js-user.is-active' })[0].click
#instance.find_elements(css: '.modal .user_autocompletion .recipientList-entry.js-user.is-active')[0].click
sleep 0.3
click(browser: instance, css: '.modal .js-submit')
@ -1475,12 +1512,12 @@ wait untill text in selector disabppears
if data[:body]
#instance.execute_script('$(".content.active div[data-name=body]").focus()')
sleep 0.5
element = instance.find_elements({ css: '.content.active div[data-name=body]' })[0]
element = instance.find_elements(css: '.content.active div[data-name=body]')[0]
element.clear
element.send_keys(data[:body])
# it's not working stable via selenium, use js
value = instance.find_elements({ css: '.content.active div[data-name=body]' })[0].text
value = instance.find_elements(css: '.content.active div[data-name=body]')[0].text
if value != data[:body]
body_quoted = quote(data[:body])
instance.execute_script("$('.content.active div[data-name=body]').html('#{body_quoted}').trigger('focusout')")
@ -1489,21 +1526,21 @@ wait untill text in selector disabppears
end
if data[:group]
element = instance.find_elements({ css: '.active .sidebar select[name="group_id"]' })[0]
element = instance.find_elements(css: '.active .sidebar select[name="group_id"]')[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:text, data[:group])
sleep 0.2
end
if data[:priority]
element = instance.find_elements({ css: '.active .sidebar select[name="priority_id"]' })[0]
element = instance.find_elements(css: '.active .sidebar select[name="priority_id"]')[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:text, data[:priority])
sleep 0.2
end
if data[:state]
element = instance.find_elements({ css: '.active .sidebar select[name="state_id"]' })[0]
element = instance.find_elements(css: '.active .sidebar select[name="state_id"]')[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:text, data[:state])
sleep 0.2
@ -1516,7 +1553,7 @@ wait untill text in selector disabppears
break if found
begin
text = instance.find_elements({ css: '.content.active .js-reset' })[0].text
text = instance.find_elements(css: '.content.active .js-reset')[0].text
if text =~ /(Discard your unsaved changes.|Verwerfen der)/
found = true
end
@ -1542,11 +1579,11 @@ wait untill text in selector disabppears
return true
end
instance.find_elements({ css: '.content.active .js-submit' })[0].click
instance.find_elements(css: '.content.active .js-submit')[0].click
(1..10).each {
begin
text = instance.find_elements({ css: '.content.active .js-reset' })[0].text
text = instance.find_elements(css: '.content.active .js-reset')[0].text
if !text || text.empty?
screenshot(browser: instance, comment: 'ticket_update_ok')
return true
@ -1582,7 +1619,7 @@ wait untill text in selector disabppears
data = params[:data]
if data[:title]
title = instance.find_elements({ css: '.content.active .ticketZoom-header .ticket-title-update' })[0].text.strip
title = instance.find_elements(css: '.content.active .ticketZoom-header .ticket-title-update')[0].text.strip
if title =~ /#{data[:title]}/i
assert(true, "matching '#{data[:title]}' in title '#{title}'")
else
@ -1591,7 +1628,7 @@ wait untill text in selector disabppears
end
if data[:body]
body = instance.find_elements({ css: '.content.active [data-name="body"]' })[0].text.strip
body = instance.find_elements(css: '.content.active [data-name="body"]')[0].text.strip
if body =~ /#{data[:body]}/i
assert(true, "matching '#{data[:body]}' in body '#{body}'")
else
@ -1617,21 +1654,21 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
instance.find_elements({ css: '.js-overviewsMenuItem' })[0].click
instance.find_elements(css: '.js-overviewsMenuItem')[0].click
sleep 1
execute(
browser: instance,
js: '$(".content.active .sidebar").css("display", "block")',
)
instance.find_elements({ css: ".content.active .sidebar a[href=\"#{params[:link]}\"]" })[0].click
instance.find_elements(css: ".content.active .sidebar a[href=\"#{params[:link]}\"]")[0].click
sleep 1
execute(
browser: instance,
js: '$(".content.active .sidebar").css("display", "none")',
)
instance.find_elements({ partial_link_text: params[:number] })[0].click
instance.find_elements(partial_link_text: params[:number])[0].click
sleep 1
number = instance.find_elements({ css: '.active .ticketZoom-header .ticket-number' })[0].text
number = instance.find_elements(css: '.active .ticketZoom-header .ticket-number')[0].text
if number !~ /#{params[:number]}/
screenshot(browser: instance, comment: 'ticket_open_by_overview_failed')
fail "unable to search/find ticket #{params[:number]}!"
@ -1657,31 +1694,31 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
# search by number
element = instance.find_elements({ css: '#global-search' })[0]
element = instance.find_elements(css: '#global-search')[0]
element.click
element.clear
element.send_keys(params[:number])
sleep 3
# empty search box by x
instance.find_elements({ css: '.search .empty-search' })[0].click
instance.find_elements(css: '.search .empty-search')[0].click
sleep 0.5
text = instance.find_elements({ css: '#global-search' })[0].attribute('value')
text = instance.find_elements(css: '#global-search')[0].attribute('value')
if !text
fail '#global-search is not empty!'
end
# search by number again
element = instance.find_elements({ css: '#global-search' })[0]
element = instance.find_elements(css: '#global-search')[0]
element.click
element.clear
element.send_keys(params[:number])
sleep 1
# open ticket
#instance.find_element({ partial_link_text: params[:number] } ).click
#instance.find_element(partial_link_text: params[:number] } ).click
instance.execute_script("$(\"#global-search-result a:contains('#{params[:value]}') .nav-tab-icon\").click()")
number = instance.find_elements({ css: '.active .ticketZoom-header .ticket-number' })[0].text
number = instance.find_elements(css: '.active .ticketZoom-header .ticket-number')[0].text
if number !~ /#{params[:number]}/
screenshot(browser: instance, comment: 'ticket_open_by_search_failed')
fail "unable to search/find ticket #{params[:number]}!"
@ -1706,16 +1743,16 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
# search by number
element = instance.find_elements({ css: '#global-search' })[0]
element = instance.find_elements(css: '#global-search')[0]
element.click
element.clear
element.send_keys(params[:title])
sleep 3
# open ticket
#instance.find_element({ partial_link_text: params[:title] } ).click
#instance.find_element(partial_link_text: params[:title] } ).click
instance.execute_script("$(\"#global-search-result a:contains('#{params[:title]}') .nav-tab-icon\").click()")
title = instance.find_elements({ css: '.active .ticketZoom-header .ticket-title-update' })[0].text
title = instance.find_elements(css: '.active .ticketZoom-header .ticket-title-update')[0].text
if title !~ /#{params[:title]}/
screenshot(browser: instance, comment: 'ticket_open_by_title_failed')
fail "unable to search/find ticket #{params[:title]}!"
@ -1743,7 +1780,7 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
instance.find_elements({ css: '.js-overviewsMenuItem' })[0].click
instance.find_elements(css: '.js-overviewsMenuItem')[0].click
sleep 2
execute(
@ -1756,7 +1793,7 @@ wait untill text in selector disabppears
#)
overviews = {}
instance.find_elements({ css: '.content.active .sidebar a[href]' }).each {|element|
instance.find_elements(css: '.content.active .sidebar a[href]').each {|element|
url = element.attribute('href')
url.gsub!(%r{(http|https)://.+?/(.+?)$}, '\\2')
overviews[url] = 0
@ -1764,7 +1801,7 @@ wait untill text in selector disabppears
#puts element.inspect
}
overviews.each {|url, _value|
count = instance.find_elements({ css: ".content.active .sidebar a[href=\"#{url}\"] .badge" })[0].text
count = instance.find_elements(css: ".content.active .sidebar a[href=\"#{url}\"] .badge")[0].text
overviews[url] = count.to_i
}
log('overview_counter', overviews)
@ -1786,26 +1823,26 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
element = instance.find_elements({ css: '#global-search' })[0]
element = instance.find_elements(css: '#global-search')[0]
element.click
element.clear
element.send_keys(params[:value])
sleep 3
instance.find_elements({ css: '.search .empty-search' })[0].click
instance.find_elements(css: '.search .empty-search')[0].click
sleep 0.5
text = instance.find_elements({ css: '#global-search' })[0].attribute('value')
text = instance.find_elements(css: '#global-search')[0].attribute('value')
if !text
fail '#global-search is not empty!'
end
element = instance.find_elements({ css: '#global-search' })[0]
element = instance.find_elements(css: '#global-search')[0]
element.click
element.clear
element.send_keys(params[:value])
sleep 2
#instance.find_element({ partial_link_text: params[:value] } ).click
#instance.find_element(partial_link_text: params[:value] } ).click
instance.execute_script("$(\"#global-search-result a:contains('#{params[:value]}') .nav-tab-icon\").click()")
name = instance.find_elements({ css: '.active h1' })[0].text
name = instance.find_elements(css: '.active h1')[0].text
if name !~ /#{params[:value]}/
screenshot(browser: instance, comment: 'organization_open_by_search_failed')
fail "unable to search/find org #{params[:value]}!"
@ -1830,14 +1867,14 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
element = instance.find_elements({ css: '#global-search' })[0]
element = instance.find_elements(css: '#global-search')[0]
element.click
element.clear
element.send_keys(params[:value])
sleep 3
#instance.find_element({ partial_link_text: params[:value] }).click
#instance.find_element(partial_link_text: params[:value]).click
instance.execute_script("$(\"#global-search-result a:contains('#{params[:value]}') .nav-tab-icon\").click()")
name = instance.find_elements({ css: '.active h1' })[0].text
name = instance.find_elements(css: '.active h1')[0].text
if name !~ /#{params[:value]}/
screenshot(browser: instance, comment: 'user_open_by_search_failed')
fail "unable to search/find user #{params[:value]}!"
@ -1869,29 +1906,29 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
data = params[:data]
instance.find_elements({ css: 'a[href="#manage"]' })[0].click
instance.find_elements(css: 'a[href="#manage"]')[0].click
sleep 1
instance.find_elements({ css: 'a[href="#manage/users"]' })[0].click
instance.find_elements(css: 'a[href="#manage/users"]')[0].click
sleep 2
instance.find_elements({ css: 'a[data-type="new"]' })[0].click
instance.find_elements(css: 'a[data-type="new"]')[0].click
sleep 2
element = instance.find_elements({ css: '.modal input[name=firstname]' })[0]
element = instance.find_elements(css: '.modal input[name=firstname]')[0]
element.clear
element.send_keys(data[:firstname])
element = instance.find_elements({ css: '.modal input[name=lastname]' })[0]
element = instance.find_elements(css: '.modal input[name=lastname]')[0]
element.clear
element.send_keys(data[:lastname])
element = instance.find_elements({ css: '.modal input[name=email]' })[0]
element = instance.find_elements(css: '.modal input[name=email]')[0]
element.clear
element.send_keys(data[:email])
element = instance.find_elements({ css: '.modal input[name=password]' })[0]
element = instance.find_elements(css: '.modal input[name=password]')[0]
element.clear
element.send_keys(data[:password])
element = instance.find_elements({ css: '.modal input[name=password_confirm]' })[0]
element = instance.find_elements(css: '.modal input[name=password_confirm]')[0]
element.clear
element.send_keys(data[:password])
instance.find_elements({ css: '.modal input[name="role_ids"][value="3"]' })[0].click
instance.find_elements({ css: '.modal button.js-submit' })[0].click
instance.find_elements(css: '.modal input[name="role_ids"][value="3"]')[0].click
instance.find_elements(css: '.modal button.js-submit')[0].click
sleep 3.5
set(
browser: instance,
@ -1926,21 +1963,21 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
data = params[:data]
instance.find_elements({ css: 'a[href="#manage"]' })[0].click
instance.find_elements(css: 'a[href="#manage"]')[0].click
sleep 1
instance.find_elements({ css: 'a[href="#manage/slas"]' })[0].click
instance.find_elements(css: 'a[href="#manage/slas"]')[0].click
sleep 2
instance.find_elements({ css: 'a.js-new' })[0].click
instance.find_elements(css: 'a.js-new')[0].click
sleep 2
element = instance.find_elements({ css: '.modal input[name=name]' })[0]
element = instance.find_elements(css: '.modal input[name=name]')[0]
element.clear
element.send_keys(data[:name])
element = instance.find_elements({ css: '.modal input[name=first_response_time_in_text]' })[0]
element = instance.find_elements(css: '.modal input[name=first_response_time_in_text]')[0]
element.clear
element.send_keys(data[:first_response_time_in_text])
instance.find_elements({ css: '.modal button.js-submit' })[0].click
instance.find_elements(css: '.modal button.js-submit')[0].click
(1..8).each {
element = instance.find_elements({ css: 'body' })[0]
element = instance.find_elements(css: 'body')[0]
text = element.text
if text =~ /#{Regexp.quote(data[:name])}/
assert(true, 'sla created')
@ -1972,24 +2009,24 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
data = params[:data]
instance.find_elements({ css: 'a[href="#manage"]' })[0].click
instance.find_elements(css: 'a[href="#manage"]')[0].click
sleep 1
instance.find_elements({ css: 'a[href="#manage/text_modules"]' })[0].click
instance.find_elements(css: 'a[href="#manage/text_modules"]')[0].click
sleep 2
instance.find_elements({ css: 'a[data-type="new"]' })[0].click
instance.find_elements(css: 'a[data-type="new"]')[0].click
sleep 2
element = instance.find_elements({ css: '.modal input[name=name]' })[0]
element = instance.find_elements(css: '.modal input[name=name]')[0]
element.clear
element.send_keys(data[:name])
element = instance.find_elements({ css: '.modal input[name=keywords]' })[0]
element = instance.find_elements(css: '.modal input[name=keywords]')[0]
element.clear
element.send_keys(data[:keywords])
element = instance.find_elements({ css: '.modal [data-name=content]' })[0]
element = instance.find_elements(css: '.modal [data-name=content]')[0]
element.clear
element.send_keys(data[:content])
instance.find_elements({ css: '.modal button.js-submit' })[0].click
instance.find_elements(css: '.modal button.js-submit')[0].click
(1..8).each {
element = instance.find_elements({ css: 'body' })[0]
element = instance.find_elements(css: 'body')[0]
text = element.text
if text =~ /#{Regexp.quote(data[:name])}/
assert(true, 'text module created')
@ -2020,23 +2057,23 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
data = params[:data]
instance.find_elements({ css: 'a[href="#manage"]' })[0].click
instance.find_elements(css: 'a[href="#manage"]')[0].click
sleep 1
instance.find_elements({ css: 'a[href="#channels/email"]' })[0].click
instance.find_elements(css: 'a[href="#channels/email"]')[0].click
sleep 1
instance.find_elements({ css: 'a[href="#c-signature"]' })[0].click
instance.find_elements(css: 'a[href="#c-signature"]')[0].click
sleep 8
instance.find_elements({ css: '#content #c-signature a[data-type="new"]' })[0].click
instance.find_elements(css: '#content #c-signature a[data-type="new"]')[0].click
sleep 2
element = instance.find_elements({ css: '.modal input[name=name]' })[0]
element = instance.find_elements(css: '.modal input[name=name]')[0]
element.clear
element.send_keys(data[:name])
element = instance.find_elements({ css: '.modal [data-name=body]' })[0]
element = instance.find_elements(css: '.modal [data-name=body]')[0]
element.clear
element.send_keys(data[:body])
instance.find_elements({ css: '.modal button.js-submit' })[0].click
instance.find_elements(css: '.modal button.js-submit')[0].click
(1..12).each {
element = instance.find_elements({ css: 'body' })[0]
element = instance.find_elements(css: 'body')[0]
text = element.text
if text =~ /#{Regexp.quote(data[:name])}/
assert(true, 'signature created')
@ -2070,27 +2107,27 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser
data = params[:data]
instance.find_elements({ css: 'a[href="#manage"]' })[0].click
instance.find_elements(css: 'a[href="#manage"]')[0].click
sleep 0.5
instance.find_elements({ css: 'a[href="#manage/groups"]' })[0].click
instance.find_elements(css: 'a[href="#manage/groups"]')[0].click
sleep 2
instance.find_elements({ css: 'a[data-type="new"]' })[0].click
instance.find_elements(css: 'a[data-type="new"]')[0].click
sleep 2
element = instance.find_elements({ css: '.modal input[name=name]' })[0]
element = instance.find_elements(css: '.modal input[name=name]')[0]
element.clear
element.send_keys(data[:name])
element = instance.find_elements({ css: '.modal select[name="email_address_id"]' })[0]
element = instance.find_elements(css: '.modal select[name="email_address_id"]')[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:index, 1)
#dropdown.select_by(:text, action[:group])
if data[:signature]
element = instance.find_elements({ css: '.modal select[name="signature_id"]' })[0]
element = instance.find_elements(css: '.modal select[name="signature_id"]')[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:text, data[:signature])
end
instance.find_elements({ css: '.modal button.js-submit' })[0].click
instance.find_elements(css: '.modal button.js-submit')[0].click
(1..12).each {
element = instance.find_elements({ css: 'body' })[0]
element = instance.find_elements(css: 'body')[0]
text = element.text
if text =~ /#{Regexp.quote(data[:name])}/
assert(true, 'group created')
@ -2098,20 +2135,20 @@ wait untill text in selector disabppears
# add member
if data[:member]
data[:member].each {|login|
instance.find_elements({ css: 'a[href="#manage"]' })[0].click
instance.find_elements(css: 'a[href="#manage"]')[0].click
sleep 0.5
instance.find_elements({ css: 'a[href="#manage/users"]' })[0].click
instance.find_elements(css: 'a[href="#manage/users"]')[0].click
sleep 3
element = instance.find_elements({ css: '#content [name="search"]' })[0]
element = instance.find_elements(css: '#content [name="search"]')[0]
element.clear
element.send_keys(login)
sleep 3
#instance.find_elements({ :css => '#content table [data-id]' })[0].click
#instance.find_elements(:css => '#content table [data-id]')[0].click
instance.execute_script('$("#content table [data-id] td").first().click()')
sleep 3
#instance.find_elements({ :css => 'label:contains(" ' + action[:name] + '")' })[0].click
#instance.find_elements(:css => 'label:contains(" ' + action[:name] + '")')[0].click
instance.execute_script('$(\'label:contains(" ' + data[:name] + '")\').first().click()')
instance.find_elements({ css: '.modal button.js-submit' })[0].click
instance.find_elements(css: '.modal button.js-submit')[0].click
}
end
end