Added browser tests for overview.

This commit is contained in:
Martin Edenhofer 2015-02-21 00:17:49 +01:00
parent 53f56d4087
commit 4a70ba3e3b
8 changed files with 175 additions and 4 deletions

View file

@ -92,6 +92,7 @@ class Table extends App.Controller
# remeber bulk attributes
@bulk = data.bulk
# fill cache
@cache[data.view] = data
# check if current view is updated

View file

@ -852,12 +852,18 @@ class OverviewNavigator extends App.Controller
open: (e) =>
e.preventDefault()
# get requested object and location
id = $(e.target).data('id')
url = $(e.target).attr('href')
if !id
id = $(e.target).closest('a').data('id')
url = $(e.target).closest('a').attr('href')
console.log('id', id, 'url', url)
# return if we are unable to get id
return if !id
# open task via task manager to get overview information
App.TaskManager.execute(
key: 'Ticket-' + id
controller: 'TicketZoom'

View file

@ -124,6 +124,10 @@ class _taskManagerSingleton extends Spine.Module
# input validation
params.key = App.Utils.htmlAttributeCleanup(params.key)
# if we have init task startups, let the controller know this
if params.init
params.params.init = true
# in case an init execute arrives later but is aleady executed, ignore it
if params.init && @workers[ params.key ]
#console.log('IGNORE LATER INIT', params)

View file

@ -6,6 +6,7 @@
<div class="ticket-title"></div>
<div class="overview-navigator"></div>
</div>
<div class="overview-navigator horizontal"></div>
<div class="page-header horizontal">
<div class="flex vertical center">
<%- @ticket.customer.avatar("50") %>

View file

@ -1,4 +1,4 @@
<div class="pagination-counter" title="<%- @T(@title) %>">
<div class="pagination-counter align-right" title="<%- @T(@title) %>">
<span class="pagination-item-current"><%= @current_position %></span>/<span class="pagination-total-items"><%= @total_count %></span>
</div>
<ul class="pagination">
@ -9,6 +9,5 @@
<li <% if !@next: %>class="disabled"<% end %> title="<%- @Ti( 'next in Overview' ) %>">
<a class="centered" href="<% if @next: %><%- @next.uiUrl() %><% end %>" data-id="<% if @next: %><%- @next.id %><% end %>">
<span class="right arrow icon"></span>
<% if @next: %>
</a>
</ul>

View file

@ -3162,7 +3162,7 @@ footer {
}
.ticketZoom .page-header {
margin-top: 62px;
margin-top: 24px;
margin-bottom: 0;
padding: 0;
}
@ -3171,6 +3171,11 @@ footer {
margin-top: 55px;
}
.ticketZoom > .overview-navigator {
margin-top: 32px;
padding-left: 20px;
}
.ticket-article,
.ticket-edit {
max-width: 800px;

View file

@ -0,0 +1,87 @@
# encoding: utf-8
require 'browser_test_helper'
class AgentTicketOverviewLevel1Test < TestCase
def test_I
name = 'name-' + rand(999999).to_s
tests = [
{
:name => 'start',
:instance1 => browser_instance,
:instance2 => browser_instance,
:instance1_username => 'master@example.com',
:instance1_password => 'test',
:instance2_username => 'agent1@example.com',
:instance2_password => 'test',
:url => browser_url,
:action => [
{
:where => :instance1,
:execute => 'close_all_tasks',
},
{
:where => :instance2,
:execute => 'close_all_tasks',
},
# create new overview
{
:where => :instance1,
:execute => 'create_overview',
:name => name,
:link => name,
:role => 'Agent',
:prio => 1000,
'order::direction' => 'down',
},
# create tickets
{
:where => :instance1,
:execute => 'create_ticket',
:group => 'Users',
:subject => 'overview #1',
:body => 'overview #1',
},
# remember ticket for later
{
:where => :instance1,
:execute => 'match',
:css => '.active .page-header .ticket-number',
:value => '^(.*)$',
:no_quote => true,
:match_result => true,
},
{
:where => :instance1,
:execute => 'create_ticket',
:group => 'Users',
:subject => 'overview #2',
:body => 'overview #2',
},
{
:where => :instance1,
:execute => 'create_ticket',
:group => 'Users',
:subject => 'overview #3',
:body => 'overview #3',
},
# click on first ticket on overview
{
:where => :instance2,
:execute => 'overview_ticket',
:number => '###stack###',
:link => name,
},
# use overview navigation to got to #2 & #3
],
},
]
browser_double_test(tests)
end
end

View file

@ -298,6 +298,8 @@ class TestCase < Test::Unit::TestCase
}
assert( false, "(#{test[:name]} / #{test[:area]}) still exsists" )
return
# create user
elsif action[:execute] == 'create_user'
instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click
instance.find_elements( { :css => 'a[href="#manage/users"]' } )[0].click
@ -336,6 +338,7 @@ class TestCase < Test::Unit::TestCase
assert( true, "(#{test[:name]}) user creation failed" )
return
# overview remember
elsif action[:execute] == 'overview_count_remember'
instance.find_elements( { :css => '#navigation li.overviews a' } )[0].click
sleep 2
@ -354,6 +357,8 @@ class TestCase < Test::Unit::TestCase
@overview_count_remember = overviews
assert( !overviews.empty?, "(#{test[:name]}) overview_count_remember" )
return
# overview verify
elsif action[:execute] == 'overview_count_verify'
instance.find_elements( { :css => '#navigation li.overviews a' } )[0].click
sleep 2
@ -380,6 +385,8 @@ class TestCase < Test::Unit::TestCase
end
}
return
# create signature
elsif action[:execute] == 'create_signature'
instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click
instance.find_elements( { :css => 'a[href="#channels/email"]' } )[0].click
@ -406,6 +413,47 @@ class TestCase < Test::Unit::TestCase
assert( true, "(#{test[:name]}) signature creation failed" )
return
# create overview
elsif action[:execute] == 'create_overview'
instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click
instance.find_elements( { :css => 'a[href="#manage/overviews"]' } )[0].click
instance.find_elements( { :css => '#content a[data-type="new"]' } )[0].click
sleep 2
element = instance.find_elements( { :css => '.modal input[name=name]' } )[0]
element.clear
element.send_keys( action[:name] )
element = instance.find_elements( { :css => '.modal input[name=link]' } )[0]
element.clear
element.send_keys( action[:link] )
element = instance.find_elements( { :css => '.modal select[name="role_id"]' } )[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by( :text, action[:role])
sleep 0.2
element = instance.find_elements( { :css => '.modal input[name=prio]' } )[0]
element.clear
element.send_keys( action[:prio] )
element = instance.find_elements( { :css => '.modal select[name="order::direction"]' } )[0]
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by( :text, action['order::direction'])
sleep 0.2
instance.find_elements( { :css => '.modal button.js-submit' } )[0].click
(1..12).each {|loop|
element = instance.find_elements( { :css => 'body' } )[0]
text = element.text
if text =~ /#{Regexp.quote(action[:name])}/
assert( true, "(#{test[:name]}) overview created" )
return
end
sleep 1
}
assert( true, "(#{test[:name]}) overview creation failed" )
return
# create group
elsif action[:execute] == 'create_group'
instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click
instance.find_elements( { :css => 'a[href="#manage/groups"]' } )[0].click
@ -704,6 +752,26 @@ class TestCase < Test::Unit::TestCase
end
assert( true, "(#{test[:name]}) ticket #{action[:number]} found" )
return
# overview ticket
elsif action[:execute] == 'overview_ticket'
instance.find_elements( { :css => '#navigation li.overviews a' } )[0].click
sleep 1
instance.find_elements( { :css => ".content.active .sidebar a[href=##{action[:link]}]" } ).click
sleep 1
action[:number].gsub! '###stack###', @stack
element = instance.find_element( { :partial_link_text => action[:number] } ).click
number = instance.find_elements( { :css => '.active .page-header .ticket-number' } )[0].text
if number !~ /#{action[:number]}/
assert( false, "(#{test[:name]}) unable to search/find ticket #{action[:number]}!" )
return
end
assert( true, "(#{test[:name]}) ticket #{action[:number]} found" )
return
# close all tasks
elsif action[:execute] == 'close_all_tasks'
for i in 1..100
sleep 1