Added first steps browser tests.

This commit is contained in:
Martin Edenhofer 2016-03-01 15:12:27 +01:00
parent 886618dfec
commit 0a51c96324
3 changed files with 160 additions and 23 deletions

View file

@ -7,7 +7,7 @@ class App.DashboardFirstSteps extends App.Controller
constructor: ->
super
@interval(@load, 35000)
@interval(@load, 25000)
load: =>
return if @lastData && !@el.is(':visible')

View file

@ -1,38 +1,38 @@
class App.TaskManager
_instance = undefined
@init: ( params ) ->
_instance ?= new _taskManagerSingleton( params )
@init: (params) ->
_instance ?= new _taskManagerSingleton(params)
@all: ->
_instance.all()
@execute: ( params ) ->
_instance.execute( params )
@execute: (params) ->
_instance.execute(params)
@get: ( key ) ->
_instance.get( key )
@get: (key) ->
_instance.get(key)
@update: ( key, params ) ->
_instance.update( key, params )
@update: (key, params) ->
_instance.update(key, params)
@remove: (key, rerender = true) ->
_instance.remove(key, rerender)
@notify: ( key ) ->
_instance.notify( key )
@notify: (key) ->
_instance.notify(key)
@mute: ( key ) ->
_instance.mute( key )
@mute: (key) ->
_instance.mute(key)
@reorder: ( order ) ->
_instance.reorder( order )
@reorder: (order) ->
_instance.reorder(order)
@reset: ->
_instance.reset()
@worker: ( key ) ->
_instance.worker( key )
@worker: (key) ->
_instance.worker(key)
@nextTaskUrl: ->
_instance.nextTaskUrl()
@ -181,7 +181,7 @@ class _taskManagerSingleton extends App.Controller
if task.key isnt params.key
if task.active
task.active = false
@taskUpdate( task )
@taskUpdate(task)
else
changed = false
if !task.active
@ -191,7 +191,7 @@ class _taskManagerSingleton extends App.Controller
changed = true
task.notify = false
if changed
@taskUpdate( task )
@taskUpdate(task)
# start worker for task if not exists
@startController(params)
@ -405,12 +405,12 @@ class _taskManagerSingleton extends App.Controller
return if @offlineModus
for key of @tasksToUpdate
continue if !key
task = @get( key )
task = @get(key)
continue if !task
if @tasksToUpdate[ task.key ] is 'toUpdate'
@tasksToUpdate[ task.key ] = 'inProgress'
taskUpdate = new App.Taskbar
taskUpdate.load( task )
taskUpdate.load(task)
if taskUpdate.isOnline()
ui = @
taskUpdate.save(
@ -456,11 +456,11 @@ class _taskManagerSingleton extends App.Controller
# initial load of permanent tasks
authentication = App.Session.get('id')
permanentTask = App.Config.get( 'permanentTask' )
permanentTask = App.Config.get('permanentTask')
task_count = 0
if permanentTask
for key, config of permanentTask
if !config.authentication || ( config.authentication && authentication )
if !config.authentication || (config.authentication && authentication)
task_count += 1
do (key, config, task_count) =>
App.Delay.set(

View file

@ -0,0 +1,137 @@
# encoding: utf-8
require 'browser_test_helper'
class FirstStepsTest < TestCase
def test_basic
agent = "bob.smith_#{rand(99_999_999)}"
customer = "customer.smith_#{rand(99_999_999)}"
@browser = browser_instance
login(
username: 'master@example.com',
password: 'test',
url: browser_url,
)
tasks_close_all()
click(
css: '.active.content .tab[data-area="first-steps-widgets"]',
)
watch_for(
css: '.active.content',
value: 'Configuration',
)
# invite agent
click(
css: '.active.content .js-inviteAgent',
)
sleep 4
set(
css: '.modal [name="firstname"]',
value: 'Bob',
)
set(
css: '.modal [name="lastname"]',
value: 'Smith',
)
set(
css: '.modal [name="email"]',
value: "#{agent}@example.com",
)
check(
css: '.modal [name="group_ids"]',
)
click(
css: '.modal button.btn.btn--primary',
)
watch_for(
css: 'body div.modal',
value: 'Sending',
)
watch_for_disappear(
css: 'body div.modal',
value: 'Sending',
)
# invite customer
click(
css: '.active.content .js-inviteCustomer',
)
sleep 4
set(
css: '.modal [name="firstname"]',
value: 'Client',
)
set(
css: '.modal [name="lastname"]',
value: 'Smith',
)
set(
css: '.modal [name="email"]',
value: "#{customer}@example.com",
)
set(
css: '.modal [data-name="note"]',
value: 'some note',
)
click(
css: '.modal button.btn.btn--primary',
)
watch_for(
css: 'body div.modal',
value: 'Sending',
)
watch_for_disappear(
css: 'body div.modal',
value: 'Sending',
)
# test ticket
click(
css: '.active.content .js-testTicket',
)
watch_for(
css: 'body div.modal',
value: 'A Test Ticket has been created',
)
click(
css: '.modal .modal-body',
)
watch_for_disappear(
css: 'body div.modal',
value: 'Test Ticket',
)
execute(
js: '$(".active.content .sidebar").show()',
)
watch_for(
css: '.active.content .js-activityContent',
value: 'Nicole Braun created Article for Test Ticket!',
timeout: 35,
)
# check update
click(
css: '.active.content a[href="#channels/form"]',
)
sleep 2
switch(
css: '#content .js-formSetting',
type: 'on',
)
sleep 2
click(
css: '#navigation a[href="#dashboard"]',
)
hit = false
(1..38).each {
next if !@browser.find_elements(css: '.active.content a[href="#channels/form"].todo.is-done')[0]
hit = true
break
}
assert(hit)
end
end