Added additional browser tests for overviews (bulk and change overview settings).

This commit is contained in:
Martin Edenhofer 2015-02-24 21:22:45 +01:00
parent 294c131438
commit b4145be452
4 changed files with 131 additions and 7 deletions

View file

@ -416,7 +416,7 @@ class Table extends App.Controller
noFieldset: true noFieldset: true
) )
html.bind('submit', (e) => html.bind('js-submit', (e) =>
e.preventDefault() e.preventDefault()
@bulk_submit(e) @bulk_submit(e)
) )

View file

@ -9,7 +9,7 @@
<div id="form-ticket-bulk-typeVisibility" class="form-inline"></div> <div id="form-ticket-bulk-typeVisibility" class="form-inline"></div>
<div class="bulkAction-controls align-right"> <div class="bulkAction-controls align-right">
<a class="subtle-link standalone js-cancel"><%- @T( 'Go Back' ) %></a> <a class="subtle-link standalone js-cancel"><%- @T( 'Go Back' ) %></a>
<input type="submit" class="btn btn--primary submit" value="<%- @T('Update') %>"> <input type="submit" class="btn btn--primary js-submit" value="<%- @T('Update') %>">
</div> </div>
</div> </div>
</div> </div>

View file

@ -76,6 +76,7 @@ class TicketOverviewsController < ApplicationController
# return result # return result
render :json => { render :json => {
:view => params[:view],
:overview => overview[:overview], :overview => overview[:overview],
:ticket_ids => overview[:ticket_ids], :ticket_ids => overview[:ticket_ids],
:tickets_count => overview[:tickets_count], :tickets_count => overview[:tickets_count],

View file

@ -11,11 +11,134 @@ class AgentTicketOverviewLevel0Test < TestCase
) )
tasks_close_all() tasks_close_all()
# remember current overview count # test bulk action
overview_counter_before = overview_counter()
# create new ticket # create new ticket
ticket1 = ticket_create( ticket1 = ticket_create(
:data => {
:customer => 'nico*',
:group => 'Users',
:title => 'overview count test #2',
:body => 'overview count test #2',
}
)
ticket2 = ticket_create(
:data => {
:customer => 'nico*',
:group => 'Users',
:title => 'overview count test #3',
:body => 'overview count test #3',
}
)
click( :css => '#navigation li.overviews a' )
click( :css => '.content.active .sidebar a[href="#ticket/view/all_unassigned"]' )
sleep 10
# select both via bulk action
click(
:css => '.active table tr td input[value="' + ticket1[:id] + '"] + .checkbox',
)
click(
:css => '.active table tr td input[value="' + ticket2[:id] + '"] + .checkbox',
)
exists(
:css => '.active table tr td input[value="' + ticket1[:id] + '"]:checked',
)
exists(
:css => '.active table tr td input[value="' + ticket2[:id] + '"]:checked',
)
# select close state & submit
select(
:css => '.active .bulkAction [name="state_id"]',
:value => 'closed',
)
click(
:css => '.active .bulkAction .js-confirm',
)
click(
:css => '.active .bulkAction .js-submit',
)
sleep 3
exists_not(
:css => '.active table tr td input[value="' + ticket1[:id] + '"]',
)
exists_not(
:css => '.active table tr td input[value="' + ticket2[:id] + '"]',
)
# remember current overview count
overview_counter_before = overview_counter()
# click options and enable number and article count
click( :css => '.active [data-type="settings"]' )
watch_for(
:css => '.modal h1',
:value => 'Edit',
)
check(
:css => '.modal input[value="number"]',
)
check(
:css => '.modal input[value="article_count"]',
)
click( :css => '.modal .js-submit' )
sleep 2
# check if number and article count is shown
match(
:css => '.active table th:nth-child(3)',
:value => '#',
)
match(
:css => '.active table th:nth-child(7)',
:value => 'Article#',
)
# reload browser
reload()
# check if number and article count is shown
match(
:css => '.active table th:nth-child(3)',
:value => '#',
)
match(
:css => '.active table th:nth-child(7)',
:value => 'Article#',
)
# disable number and article count
click( :css => '.active [data-type="settings"]' )
watch_for(
:css => '.modal h1',
:value => 'Edit',
)
uncheck(
:css => '.modal input[value="number"]',
)
uncheck(
:css => '.modal input[value="article_count"]',
)
click( :css => '.modal .js-submit' )
sleep 2
# check if number and article count is gone
match_not(
:css => '.active table th:nth-child(3)',
:value => '#',
)
exists_not(
:css => '.active table th:nth-child(7)',
)
# create new ticket
ticket3 = ticket_create(
:data => { :data => {
:customer => 'nico*', :customer => 'nico*',
:group => 'Users', :group => 'Users',
@ -31,7 +154,7 @@ class AgentTicketOverviewLevel0Test < TestCase
# open ticket by search # open ticket by search
ticket_open_by_search( ticket_open_by_search(
:number => ticket1[:number], :number => ticket3[:number],
) )
sleep 1 sleep 1