Added first steps browser tests.
This commit is contained in:
parent
886618dfec
commit
0a51c96324
3 changed files with 160 additions and 23 deletions
|
@ -7,7 +7,7 @@ class App.DashboardFirstSteps extends App.Controller
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
@interval(@load, 35000)
|
@interval(@load, 25000)
|
||||||
|
|
||||||
load: =>
|
load: =>
|
||||||
return if @lastData && !@el.is(':visible')
|
return if @lastData && !@el.is(':visible')
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
class App.TaskManager
|
class App.TaskManager
|
||||||
_instance = undefined
|
_instance = undefined
|
||||||
|
|
||||||
@init: ( params ) ->
|
@init: (params) ->
|
||||||
_instance ?= new _taskManagerSingleton( params )
|
_instance ?= new _taskManagerSingleton(params)
|
||||||
|
|
||||||
@all: ->
|
@all: ->
|
||||||
_instance.all()
|
_instance.all()
|
||||||
|
|
||||||
@execute: ( params ) ->
|
@execute: (params) ->
|
||||||
_instance.execute( params )
|
_instance.execute(params)
|
||||||
|
|
||||||
@get: ( key ) ->
|
@get: (key) ->
|
||||||
_instance.get( key )
|
_instance.get(key)
|
||||||
|
|
||||||
@update: ( key, params ) ->
|
@update: (key, params) ->
|
||||||
_instance.update( key, params )
|
_instance.update(key, params)
|
||||||
|
|
||||||
@remove: (key, rerender = true) ->
|
@remove: (key, rerender = true) ->
|
||||||
_instance.remove(key, rerender)
|
_instance.remove(key, rerender)
|
||||||
|
|
||||||
@notify: ( key ) ->
|
@notify: (key) ->
|
||||||
_instance.notify( key )
|
_instance.notify(key)
|
||||||
|
|
||||||
@mute: ( key ) ->
|
@mute: (key) ->
|
||||||
_instance.mute( key )
|
_instance.mute(key)
|
||||||
|
|
||||||
@reorder: ( order ) ->
|
@reorder: (order) ->
|
||||||
_instance.reorder( order )
|
_instance.reorder(order)
|
||||||
|
|
||||||
@reset: ->
|
@reset: ->
|
||||||
_instance.reset()
|
_instance.reset()
|
||||||
|
|
||||||
@worker: ( key ) ->
|
@worker: (key) ->
|
||||||
_instance.worker( key )
|
_instance.worker(key)
|
||||||
|
|
||||||
@nextTaskUrl: ->
|
@nextTaskUrl: ->
|
||||||
_instance.nextTaskUrl()
|
_instance.nextTaskUrl()
|
||||||
|
@ -181,7 +181,7 @@ class _taskManagerSingleton extends App.Controller
|
||||||
if task.key isnt params.key
|
if task.key isnt params.key
|
||||||
if task.active
|
if task.active
|
||||||
task.active = false
|
task.active = false
|
||||||
@taskUpdate( task )
|
@taskUpdate(task)
|
||||||
else
|
else
|
||||||
changed = false
|
changed = false
|
||||||
if !task.active
|
if !task.active
|
||||||
|
@ -191,7 +191,7 @@ class _taskManagerSingleton extends App.Controller
|
||||||
changed = true
|
changed = true
|
||||||
task.notify = false
|
task.notify = false
|
||||||
if changed
|
if changed
|
||||||
@taskUpdate( task )
|
@taskUpdate(task)
|
||||||
|
|
||||||
# start worker for task if not exists
|
# start worker for task if not exists
|
||||||
@startController(params)
|
@startController(params)
|
||||||
|
@ -405,12 +405,12 @@ class _taskManagerSingleton extends App.Controller
|
||||||
return if @offlineModus
|
return if @offlineModus
|
||||||
for key of @tasksToUpdate
|
for key of @tasksToUpdate
|
||||||
continue if !key
|
continue if !key
|
||||||
task = @get( key )
|
task = @get(key)
|
||||||
continue if !task
|
continue if !task
|
||||||
if @tasksToUpdate[ task.key ] is 'toUpdate'
|
if @tasksToUpdate[ task.key ] is 'toUpdate'
|
||||||
@tasksToUpdate[ task.key ] = 'inProgress'
|
@tasksToUpdate[ task.key ] = 'inProgress'
|
||||||
taskUpdate = new App.Taskbar
|
taskUpdate = new App.Taskbar
|
||||||
taskUpdate.load( task )
|
taskUpdate.load(task)
|
||||||
if taskUpdate.isOnline()
|
if taskUpdate.isOnline()
|
||||||
ui = @
|
ui = @
|
||||||
taskUpdate.save(
|
taskUpdate.save(
|
||||||
|
@ -456,11 +456,11 @@ class _taskManagerSingleton extends App.Controller
|
||||||
|
|
||||||
# initial load of permanent tasks
|
# initial load of permanent tasks
|
||||||
authentication = App.Session.get('id')
|
authentication = App.Session.get('id')
|
||||||
permanentTask = App.Config.get( 'permanentTask' )
|
permanentTask = App.Config.get('permanentTask')
|
||||||
task_count = 0
|
task_count = 0
|
||||||
if permanentTask
|
if permanentTask
|
||||||
for key, config of permanentTask
|
for key, config of permanentTask
|
||||||
if !config.authentication || ( config.authentication && authentication )
|
if !config.authentication || (config.authentication && authentication)
|
||||||
task_count += 1
|
task_count += 1
|
||||||
do (key, config, task_count) =>
|
do (key, config, task_count) =>
|
||||||
App.Delay.set(
|
App.Delay.set(
|
||||||
|
|
137
test/browser/first_steps_test.rb
Normal file
137
test/browser/first_steps_test.rb
Normal 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
|
Loading…
Reference in a new issue