Some new rubocop checks.
This commit is contained in:
parent
1e6dcbee1f
commit
6909430eac
13 changed files with 59 additions and 104 deletions
|
@ -167,9 +167,9 @@ class AaaGettingStartedTest < TestCase
|
||||||
#return # TODO: temp disable
|
#return # TODO: temp disable
|
||||||
accounts = []
|
accounts = []
|
||||||
(1..10).each {|count|
|
(1..10).each {|count|
|
||||||
next if !ENV["MAILBOX_AUTO#{count.to_s}"]
|
next if !ENV["MAILBOX_AUTO#{count}"]
|
||||||
mailbox_user = ENV["MAILBOX_AUTO#{count.to_s}"].split(':')[0]
|
mailbox_user = ENV["MAILBOX_AUTO#{count}"].split(':')[0]
|
||||||
mailbox_password = ENV["MAILBOX_AUTO#{count.to_s}"].split(':')[1]
|
mailbox_password = ENV["MAILBOX_AUTO#{count}"].split(':')[1]
|
||||||
account = {
|
account = {
|
||||||
realname: 'auto account',
|
realname: 'auto account',
|
||||||
email: mailbox_user,
|
email: mailbox_user,
|
||||||
|
@ -230,11 +230,11 @@ class AaaGettingStartedTest < TestCase
|
||||||
#return # TODO: temp disable
|
#return # TODO: temp disable
|
||||||
accounts = []
|
accounts = []
|
||||||
(1..10).each {|count|
|
(1..10).each {|count|
|
||||||
next if !ENV["MAILBOX_MANUAL#{count.to_s}"]
|
next if !ENV["MAILBOX_MANUAL#{count}"]
|
||||||
mailbox_user = ENV["MAILBOX_MANUAL#{count.to_s}"].split(':')[0]
|
mailbox_user = ENV["MAILBOX_MANUAL#{count}"].split(':')[0]
|
||||||
mailbox_password = ENV["MAILBOX_MANUAL#{count.to_s}"].split(':')[1]
|
mailbox_password = ENV["MAILBOX_MANUAL#{count}"].split(':')[1]
|
||||||
mailbox_inbound = ENV["MAILBOX_MANUAL#{count.to_s}"].split(':')[2]
|
mailbox_inbound = ENV["MAILBOX_MANUAL#{count}"].split(':')[2]
|
||||||
mailbox_outbound = ENV["MAILBOX_MANUAL#{count.to_s}"].split(':')[3]
|
mailbox_outbound = ENV["MAILBOX_MANUAL#{count}"].split(':')[3]
|
||||||
account = {
|
account = {
|
||||||
realname: 'manual account',
|
realname: 'manual account',
|
||||||
email: mailbox_user,
|
email: mailbox_user,
|
||||||
|
|
|
@ -34,7 +34,7 @@ class AgentTicketActionLevel1Test < TestCase
|
||||||
tasks_close_all()
|
tasks_close_all()
|
||||||
|
|
||||||
# create second ticket to merge
|
# create second ticket to merge
|
||||||
ticket2 = ticket_create(
|
ticket_create(
|
||||||
data: {
|
data: {
|
||||||
customer: 'nico',
|
customer: 'nico',
|
||||||
group: 'Users',
|
group: 'Users',
|
||||||
|
@ -103,7 +103,7 @@ class AgentTicketActionLevel1Test < TestCase
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
ticket4 = ticket_create(
|
ticket_create(
|
||||||
data: {
|
data: {
|
||||||
customer: 'nico',
|
customer: 'nico',
|
||||||
group: 'Users',
|
group: 'Users',
|
||||||
|
|
|
@ -5,7 +5,6 @@ class AgentTicketActionsLevel2Test < TestCase
|
||||||
def test_work_with_two_browser_on_same_ticket
|
def test_work_with_two_browser_on_same_ticket
|
||||||
|
|
||||||
# work on one ticket with two browsers
|
# work on one ticket with two browsers
|
||||||
message = 'message 1äöüß ' + rand(99_999_999_999_999_999).to_s
|
|
||||||
|
|
||||||
browser1 = browser_instance
|
browser1 = browser_instance
|
||||||
login(
|
login(
|
||||||
|
|
|
@ -66,7 +66,7 @@ class AgentTicketActionLevel4Test < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
ticket_id = nil
|
ticket_id = nil
|
||||||
if @browser.current_url =~ /ticket\/zoom\/(.+?)$/i
|
if @browser.current_url =~ %r{ticket/zoom/(.+?)$}i
|
||||||
ticket_id = $1
|
ticket_id = $1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
require 'browser_test_helper'
|
require 'browser_test_helper'
|
||||||
|
|
||||||
class AgentTicketOverviewLevel0Test < TestCase
|
class AgentTicketOverviewLevel0Test < TestCase
|
||||||
def test_I
|
def test_i
|
||||||
@browser = browser_instance
|
@browser = browser_instance
|
||||||
login(
|
login(
|
||||||
username: 'master@example.com',
|
username: 'master@example.com',
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
require 'browser_test_helper'
|
require 'browser_test_helper'
|
||||||
|
|
||||||
class AgentTicketOverviewLevel1Test < TestCase
|
class AgentTicketOverviewLevel1Test < TestCase
|
||||||
def test_I
|
def test_i
|
||||||
name = 'name-' + rand(999_999).to_s
|
name = 'name-' + rand(999_999).to_s
|
||||||
|
|
||||||
browser1 = browser_instance
|
browser1 = browser_instance
|
||||||
|
@ -24,7 +24,7 @@ class AgentTicketOverviewLevel1Test < TestCase
|
||||||
tasks_close_all( browser: browser2 )
|
tasks_close_all( browser: browser2 )
|
||||||
|
|
||||||
# create new overview
|
# create new overview
|
||||||
overview = overview_create(
|
overview_create(
|
||||||
browser: browser1,
|
browser: browser1,
|
||||||
data: {
|
data: {
|
||||||
:name => name,
|
:name => name,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# rubocop:disable all
|
||||||
require 'browser_test_helper'
|
require 'browser_test_helper'
|
||||||
|
|
||||||
class ChatTest < TestCase
|
class ChatTest < TestCase
|
||||||
|
|
|
@ -23,7 +23,7 @@ class PreferencesTest < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# start ticket zoom
|
# start ticket zoom
|
||||||
ticket = ticket_create(
|
ticket_create(
|
||||||
data: {
|
data: {
|
||||||
customer: 'nicole',
|
customer: 'nicole',
|
||||||
group: 'Users',
|
group: 'Users',
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
ENV['RAILS_ENV'] = 'test'
|
ENV['RAILS_ENV'] = 'test'
|
||||||
|
# rubocop:disable Next, CyclomaticComplexity, PerceivedComplexity
|
||||||
require File.expand_path('../../config/environment', __FILE__)
|
require File.expand_path('../../config/environment', __FILE__)
|
||||||
require 'selenium-webdriver'
|
require 'selenium-webdriver'
|
||||||
|
|
||||||
|
@ -12,7 +13,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
if browser =~ /(internet_explorer|ie)/i
|
if browser =~ /(internet_explorer|ie)/i
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def browser_url
|
def browser_url
|
||||||
|
@ -44,7 +45,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
)
|
)
|
||||||
browser_instance_preferences(local_browser)
|
browser_instance_preferences(local_browser)
|
||||||
@browsers[local_browser.hash] = local_browser
|
@browsers[local_browser.hash] = local_browser
|
||||||
return local_browser
|
local_browser
|
||||||
end
|
end
|
||||||
|
|
||||||
def browser_instance_close(local_browser)
|
def browser_instance_close(local_browser)
|
||||||
|
@ -548,19 +549,19 @@ class TestCase < Test::Unit::TestCase
|
||||||
#puts "CCC #{cookie.inspect}"
|
#puts "CCC #{cookie.inspect}"
|
||||||
# :name=>"_zammad_session_c25832f4de2", :value=>"adc31cd21615cb0a7ab269184ec8b76f", :path=>"/", :domain=>"localhost", :expires=>nil, :secure=>false}
|
# :name=>"_zammad_session_c25832f4de2", :value=>"adc31cd21615cb0a7ab269184ec8b76f", :path=>"/", :domain=>"localhost", :expires=>nil, :secure=>false}
|
||||||
if cookie[:name] =~ /#{params[:name]}/i
|
if cookie[:name] =~ /#{params[:name]}/i
|
||||||
if params.has_key?( :value ) && cookie[:value].to_s =~ /#{params[:value]}/i
|
if params.key?( :value ) && cookie[:value].to_s =~ /#{params[:value]}/i
|
||||||
assert( true, "matching value '#{params[:value]}' in cookie '#{cookie.to_s}'" )
|
assert( true, "matching value '#{params[:value]}' in cookie '#{cookie}'" )
|
||||||
else
|
else
|
||||||
raise "not matching value '#{params[:value]}' in cookie '#{cookie.to_s}'"
|
raise "not matching value '#{params[:value]}' in cookie '#{cookie}'"
|
||||||
end
|
end
|
||||||
if params.has_key?( :expires ) && cookie[:expires].to_s =~ /#{params[:expires]}/i
|
if params.key?( :expires ) && cookie[:expires].to_s =~ /#{params[:expires]}/i
|
||||||
assert( true, "matching expires '#{params[:expires].inspect}' in cookie '#{cookie.to_s}'" )
|
assert( true, "matching expires '#{params[:expires].inspect}' in cookie '#{cookie}'" )
|
||||||
else
|
else
|
||||||
raise "not matching expires '#{params[:expires]}' in cookie '#{cookie.to_s}'"
|
raise "not matching expires '#{params[:expires]}' in cookie '#{cookie}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:should_not_exist]
|
if params[:should_not_exist]
|
||||||
raise "cookie with name '#{params[:name]}' should not exist, but exists '#{cookies.to_s}'"
|
raise "cookie with name '#{params[:name]}' should not exist, but exists '#{cookies}'"
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -569,7 +570,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
assert( true, "cookie with name '#{params[:name]}' is not existing" )
|
assert( true, "cookie with name '#{params[:name]}' is not existing" )
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
raise "not matching name '#{params[:name]}' in cookie '#{cookies.to_s}'"
|
raise "not matching name '#{params[:name]}' in cookie '#{cookies}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
@ -627,7 +628,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
puts "tv #{params.inspect}"
|
puts "tv #{params.inspect}"
|
||||||
# verify modified
|
# verify modified
|
||||||
if data.has_key?(:modified)
|
if data.key?(:modified)
|
||||||
exists = instance.find_elements( { css: '.tasks .active .icon' } )[0]
|
exists = instance.find_elements( { css: '.tasks .active .icon' } )[0]
|
||||||
is_modified = instance.find_elements( { css: '.tasks .active .icon.modified' } )[0]
|
is_modified = instance.find_elements( { css: '.tasks .active .icon.modified' } )[0]
|
||||||
puts "m #{data[:modified].inspect}"
|
puts "m #{data[:modified].inspect}"
|
||||||
|
@ -1293,7 +1294,7 @@ wait untill text in selector disabppears
|
||||||
sleep 1
|
sleep 1
|
||||||
instance.find_elements( { css: ".content.active .sidebar a[href=\"#{params[:link]}\"]" } )[0].click
|
instance.find_elements( { css: ".content.active .sidebar a[href=\"#{params[:link]}\"]" } )[0].click
|
||||||
sleep 1
|
sleep 1
|
||||||
element = instance.find_elements( { partial_link_text: params[:number] } )[0].click
|
instance.find_elements( { partial_link_text: params[:number] } )[0].click
|
||||||
sleep 1
|
sleep 1
|
||||||
number = instance.find_elements( { css: '.active .page-header .ticket-number' } )[0].text
|
number = instance.find_elements( { css: '.active .page-header .ticket-number' } )[0].text
|
||||||
if number !~ /#{params[:number]}/
|
if number !~ /#{params[:number]}/
|
||||||
|
@ -1341,7 +1342,7 @@ wait untill text in selector disabppears
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# open ticket
|
# open ticket
|
||||||
element = instance.find_element( { partial_link_text: params[:number] } ).click
|
instance.find_element( { partial_link_text: params[:number] } ).click
|
||||||
number = instance.find_elements( { css: '.active .page-header .ticket-number' } )[0].text
|
number = instance.find_elements( { css: '.active .page-header .ticket-number' } )[0].text
|
||||||
if number !~ /#{params[:number]}/
|
if number !~ /#{params[:number]}/
|
||||||
raise "unable to search/find ticket #{params[:number]}!"
|
raise "unable to search/find ticket #{params[:number]}!"
|
||||||
|
@ -1416,11 +1417,10 @@ wait untill text in selector disabppears
|
||||||
element.clear
|
element.clear
|
||||||
element.send_keys( params[:value] )
|
element.send_keys( params[:value] )
|
||||||
sleep 2
|
sleep 2
|
||||||
element = instance.find_element( { partial_link_text: params[:value] } ).click
|
instance.find_element( { partial_link_text: params[:value] } ).click
|
||||||
name = instance.find_elements( { css: '.active h1' } )[0].text
|
name = instance.find_elements( { css: '.active h1' } )[0].text
|
||||||
if name !~ /#{params[:value]}/
|
if name !~ /#{params[:value]}/
|
||||||
raise "unable to search/find org #{params[:value]}!"
|
raise "unable to search/find org #{params[:value]}!"
|
||||||
return
|
|
||||||
end
|
end
|
||||||
assert( true, "org #{params[:value]} found" )
|
assert( true, "org #{params[:value]} found" )
|
||||||
sleep 2
|
sleep 2
|
||||||
|
@ -1446,7 +1446,7 @@ wait untill text in selector disabppears
|
||||||
element.clear
|
element.clear
|
||||||
element.send_keys( params[:value] )
|
element.send_keys( params[:value] )
|
||||||
sleep 3
|
sleep 3
|
||||||
element = instance.find_element( { partial_link_text: params[:value] } ).click
|
instance.find_element( { partial_link_text: params[:value] } ).click
|
||||||
name = instance.find_elements( { css: '.active h1' } )[0].text
|
name = instance.find_elements( { css: '.active h1' } )[0].text
|
||||||
if name !~ /#{params[:value]}/
|
if name !~ /#{params[:value]}/
|
||||||
raise "unable to search/find user #{params[:value]}!"
|
raise "unable to search/find user #{params[:value]}!"
|
||||||
|
@ -1726,6 +1726,6 @@ wait untill text in selector disabppears
|
||||||
|
|
||||||
def log(method, params)
|
def log(method, params)
|
||||||
return if !@@debug
|
return if !@@debug
|
||||||
puts "#{Time.now.to_s}/#{method}: #{params.inspect}"
|
puts "#{Time.zone.now}/#{method}: #{params.inspect}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# rubocop:disable UselessAssignment
|
||||||
require 'integration_test_helper'
|
require 'integration_test_helper'
|
||||||
|
|
||||||
class ElasticsearchTest < ActiveSupport::TestCase
|
class ElasticsearchTest < ActiveSupport::TestCase
|
||||||
|
@ -121,7 +122,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
|
||||||
Store.add(
|
Store.add(
|
||||||
object: 'Ticket::Article',
|
object: 'Ticket::Article',
|
||||||
o_id: article1.id,
|
o_id: article1.id,
|
||||||
data: File.open("#{Rails.root.to_s}/test/fixtures/es-normal.txt", 'rb') { |file| file.read },
|
data: File.open("#{Rails.root}/test/fixtures/es-normal.txt", 'rb') { |file| file.read },
|
||||||
filename: 'es-normal.txt',
|
filename: 'es-normal.txt',
|
||||||
preferences: {},
|
preferences: {},
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
|
@ -132,7 +133,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
|
||||||
Store.add(
|
Store.add(
|
||||||
object: 'Ticket::Article',
|
object: 'Ticket::Article',
|
||||||
o_id: article1.id,
|
o_id: article1.id,
|
||||||
data: File.open("#{Rails.root.to_s}/test/fixtures/es-pdf1.pdf", 'rb') { |file| file.read },
|
data: File.open("#{Rails.root}/test/fixtures/es-pdf1.pdf", 'rb') { |file| file.read },
|
||||||
filename: 'es-pdf1.pdf',
|
filename: 'es-pdf1.pdf',
|
||||||
preferences: {},
|
preferences: {},
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
|
@ -143,7 +144,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
|
||||||
Store.add(
|
Store.add(
|
||||||
object: 'Ticket::Article',
|
object: 'Ticket::Article',
|
||||||
o_id: article1.id,
|
o_id: article1.id,
|
||||||
data: File.open("#{Rails.root.to_s}/test/fixtures/es-box1.box", 'rb') { |file| file.read },
|
data: File.open("#{Rails.root}/test/fixtures/es-box1.box", 'rb') { |file| file.read },
|
||||||
filename: 'mail1.box',
|
filename: 'mail1.box',
|
||||||
preferences: {},
|
preferences: {},
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
|
@ -154,7 +155,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
|
||||||
Store.add(
|
Store.add(
|
||||||
object: 'Ticket::Article',
|
object: 'Ticket::Article',
|
||||||
o_id: article1.id,
|
o_id: article1.id,
|
||||||
data: File.open("#{Rails.root.to_s}/test/fixtures/es-too-big.txt", 'rb') { |file| file.read },
|
data: File.open("#{Rails.root}/test/fixtures/es-too-big.txt", 'rb') { |file| file.read },
|
||||||
filename: 'es-too-big.txt',
|
filename: 'es-too-big.txt',
|
||||||
preferences: {},
|
preferences: {},
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
|
|
|
@ -20,11 +20,11 @@ class OtrsImportTest < ActiveSupport::TestCase
|
||||||
http = nil
|
http = nil
|
||||||
system_id = nil
|
system_id = nil
|
||||||
fqdn = nil
|
fqdn = nil
|
||||||
if ENV['IMPORT_OTRS_ENDPOINT'] =~ /^(http|https):\/\/((.+?)\..+?)\//
|
if ENV['IMPORT_OTRS_ENDPOINT'] =~ %r{^(http|https)://((.+?)\..+?)/}
|
||||||
http = $1
|
http = $1
|
||||||
fqdn = $2
|
fqdn = $2
|
||||||
system_id = $3
|
system_id = $3
|
||||||
system_id.gsub!(/[A-z]/, '') # strip chars
|
system_id.gsub!(/[A-z]/, '') # strip chars
|
||||||
end
|
end
|
||||||
assert_equal( system_id, Setting.get('system_id'), 'system_id' )
|
assert_equal( system_id, Setting.get('system_id'), 'system_id' )
|
||||||
assert_equal( fqdn, Setting.get('fqdn'), 'fqdn' )
|
assert_equal( fqdn, Setting.get('fqdn'), 'fqdn' )
|
||||||
|
@ -171,11 +171,11 @@ class OtrsImportTest < ActiveSupport::TestCase
|
||||||
assert_equal( 'agent-2', ticket.owner.login )
|
assert_equal( 'agent-2', ticket.owner.login )
|
||||||
assert_equal( 'partner', ticket.customer.login )
|
assert_equal( 'partner', ticket.customer.login )
|
||||||
assert_equal( 'Partner der betreut', ticket.organization.name )
|
assert_equal( 'Partner der betreut', ticket.organization.name )
|
||||||
assert_equal( Time.parse('2014-11-20 22:33:41 +0000').gmtime.to_s, ticket.created_at.to_s )
|
assert_equal( Time.zone.parse('2014-11-20 22:33:41 +0000').gmtime.to_s, ticket.created_at.to_s )
|
||||||
assert_equal( nil, ticket.close_time )
|
assert_equal( nil, ticket.close_time )
|
||||||
|
|
||||||
# check history
|
# check history
|
||||||
# create entry
|
# - create entry
|
||||||
|
|
||||||
# ticket is created with state closed
|
# ticket is created with state closed
|
||||||
ticket = Ticket.find(729)
|
ticket = Ticket.find(729)
|
||||||
|
@ -186,11 +186,11 @@ class OtrsImportTest < ActiveSupport::TestCase
|
||||||
assert_equal( 'agent-2', ticket.owner.login )
|
assert_equal( 'agent-2', ticket.owner.login )
|
||||||
assert_equal( 'jn2', ticket.customer.login )
|
assert_equal( 'jn2', ticket.customer.login )
|
||||||
assert_equal( 'Znuny GmbH', ticket.organization.name )
|
assert_equal( 'Znuny GmbH', ticket.organization.name )
|
||||||
assert_equal( Time.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.created_at.to_s )
|
assert_equal( Time.zone.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.created_at.to_s )
|
||||||
assert_equal( Time.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.close_time.to_s )
|
assert_equal( Time.zone.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.close_time.to_s )
|
||||||
|
|
||||||
# check history
|
# check history
|
||||||
# create entry
|
# - create entry
|
||||||
|
|
||||||
# ticket is created open and now closed
|
# ticket is created open and now closed
|
||||||
ticket = Ticket.find(730)
|
ticket = Ticket.find(730)
|
||||||
|
@ -201,11 +201,11 @@ class OtrsImportTest < ActiveSupport::TestCase
|
||||||
assert_equal( 'agent-2', ticket.owner.login )
|
assert_equal( 'agent-2', ticket.owner.login )
|
||||||
assert_equal( 'betreuterkunde2', ticket.customer.login )
|
assert_equal( 'betreuterkunde2', ticket.customer.login )
|
||||||
assert_equal( 'Noch ein betreuter Kunde', ticket.organization.name )
|
assert_equal( 'Noch ein betreuter Kunde', ticket.organization.name )
|
||||||
assert_equal( Time.parse('2014-11-21 00:17:40 +0000').gmtime.to_s, ticket.created_at.to_s )
|
assert_equal( Time.zone.parse('2014-11-21 00:17:40 +0000').gmtime.to_s, ticket.created_at.to_s )
|
||||||
assert_equal( Time.parse('2014-11-21 00:21:08 +0000').gmtime.to_s, ticket.close_time.to_s )
|
assert_equal( Time.zone.parse('2014-11-21 00:21:08 +0000').gmtime.to_s, ticket.close_time.to_s )
|
||||||
|
|
||||||
# check history
|
# check history
|
||||||
# create entry
|
# - create entry
|
||||||
# state change entry
|
# - state change entry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# rubocop:disable UselessAssignment
|
||||||
require 'integration_test_helper'
|
require 'integration_test_helper'
|
||||||
|
|
||||||
class TwitterTest < ActiveSupport::TestCase
|
class TwitterTest < ActiveSupport::TestCase
|
||||||
|
@ -85,9 +86,9 @@ class TwitterTest < ActiveSupport::TestCase
|
||||||
type_id: Ticket::Article::Type.where( name: 'twitter status' ).first.id,
|
type_id: Ticket::Article::Type.where( name: 'twitter status' ).first.id,
|
||||||
sender_id: Ticket::Article::Sender.where( name: 'Agent' ).first.id,
|
sender_id: Ticket::Article::Sender.where( name: 'Agent' ).first.id,
|
||||||
body: text,
|
body: text,
|
||||||
# :from => sender.name,
|
#:from => sender.name,
|
||||||
# :to => to,
|
#:to => to,
|
||||||
# :message_id => tweet.id,
|
#:message_id => tweet.id,
|
||||||
internal: false,
|
internal: false,
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
|
@ -179,13 +180,13 @@ class TwitterTest < ActiveSupport::TestCase
|
||||||
puts '----------------------------------------'
|
puts '----------------------------------------'
|
||||||
|
|
||||||
assert( article, 'inbound article created' )
|
assert( article, 'inbound article created' )
|
||||||
# ticket = Ticket.find( article.ticket.id )
|
#ticket = Ticket.find( article.ticket.id )
|
||||||
ticket = article.ticket
|
ticket = article.ticket
|
||||||
assert( ticket, 'ticket of inbound article exists' )
|
assert( ticket, 'ticket of inbound article exists' )
|
||||||
assert( ticket.articles, 'ticket.articles exists' )
|
assert( ticket.articles, 'ticket.articles exists' )
|
||||||
article_count = ticket.articles.count
|
article_count = ticket.articles.count
|
||||||
assert( article_count )
|
assert( article_count )
|
||||||
# assert_equal( ticket.state.name, 'new' )
|
#assert_equal( ticket.state.name, 'new' )
|
||||||
|
|
||||||
# reply via ticket
|
# reply via ticket
|
||||||
outbound_article = Ticket::Article.create(
|
outbound_article = Ticket::Article.create(
|
||||||
|
@ -193,7 +194,7 @@ class TwitterTest < ActiveSupport::TestCase
|
||||||
type_id: Ticket::Article::Type.where( name: 'twitter direct-message' ).first.id,
|
type_id: Ticket::Article::Type.where( name: 'twitter direct-message' ).first.id,
|
||||||
sender_id: Ticket::Article::Sender.where( name: 'Agent' ).first.id,
|
sender_id: Ticket::Article::Sender.where( name: 'Agent' ).first.id,
|
||||||
body: text,
|
body: text,
|
||||||
# :from => sender.name,
|
#:from => sender.name,
|
||||||
to: 'me_bauer',
|
to: 'me_bauer',
|
||||||
internal: false,
|
internal: false,
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
ENV['RAILS_ENV'] = 'test'
|
|
||||||
require File.expand_path('../../config/environment', __FILE__)
|
|
||||||
require 'rails/test_help'
|
|
||||||
require 'test/unit'
|
|
||||||
require 'rubygems'
|
|
||||||
require 'selenium-webdriver'
|
|
||||||
|
|
||||||
class ExampleTest < Test::Unit::TestCase
|
|
||||||
attr_reader :browser
|
|
||||||
|
|
||||||
def setup
|
|
||||||
@browser = Selenium::WebDriver.for :chrome
|
|
||||||
end
|
|
||||||
|
|
||||||
def teardown
|
|
||||||
browser.quit
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_first_page
|
|
||||||
browser.get 'http://portal.znuny.com/'
|
|
||||||
assert_equal browser.current_url, 'https://portal.znuny.com/#login'
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_login_failed
|
|
||||||
browser.get 'http://portal.znuny.com/'
|
|
||||||
element_username = browser.find_element name: 'username'
|
|
||||||
element_username.send_keys 'roy@kaldung.de'
|
|
||||||
element_password = browser.find_element name: 'password'
|
|
||||||
element_password.send_keys '123456'
|
|
||||||
element_password.submit
|
|
||||||
wait = Selenium::WebDriver::Wait.new(timeout: 10) # seconds
|
|
||||||
wait.until { browser.find_element(id: 'app') }
|
|
||||||
assert_equal browser.current_url, 'https://portal.znuny.com/#login'
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_login_passed
|
|
||||||
browser.get 'http://portal.znuny.com/'
|
|
||||||
element_username = browser.find_element name: 'username'
|
|
||||||
element_username.send_keys 'roy@kaldung.com'
|
|
||||||
element_password = browser.find_element name: 'password'
|
|
||||||
element_password.send_keys '090504'
|
|
||||||
element_password.submit
|
|
||||||
wait = Selenium::WebDriver::Wait.new(timeout: 10) # seconds
|
|
||||||
wait.until { browser.find_element(id: 'app') }
|
|
||||||
assert_equal browser.current_url, 'https://portal.znuny.com/#ticket_view/my_tickets'
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue