164 lines
3.3 KiB
Ruby
164 lines
3.3 KiB
Ruby
|
# 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
|