2013-02-22 10:36:00 +00:00
# encoding: utf-8
require 'browser_test_helper'
2013-02-23 22:54:48 +00:00
class AaaGettingStartedTest < TestCase
2014-11-18 21:09:01 +00:00
def test_a_getting_started
2014-12-11 10:44:23 +00:00
#return # TODO: temp disable
2014-11-18 21:09:01 +00:00
if ! ENV [ 'MAILBOX_INIT' ]
2014-12-11 10:44:23 +00:00
#raise "Need MAILBOX_INIT as ENV variable like export MAILBOX_INIT='unittest01@znuny.com:somepass'"
puts " NOTICE: Need MAILBOX_INIT as ENV variable like export MAILBOX_INIT='unittest01@znuny.com:somepass' "
return
2014-11-18 21:09:01 +00:00
end
mailbox_user = ENV [ 'MAILBOX_INIT' ] . split ( ':' ) [ 0 ]
mailbox_password = ENV [ 'MAILBOX_INIT' ] . split ( ':' ) [ 1 ]
2014-11-16 23:46:39 +00:00
2015-03-01 23:16:36 +00:00
@browser = browser_instance
2015-04-27 13:42:53 +00:00
location ( url : browser_url )
2015-03-01 23:16:36 +00:00
watch_for (
2015-04-27 13:42:53 +00:00
css : '.setup.wizard' ,
value : 'setup new system' ,
2015-03-01 23:16:36 +00:00
)
2015-04-27 13:42:53 +00:00
click ( css : '.js-start .btn--primary' )
2015-09-29 08:51:15 +00:00
watch_for (
css : '.setup.wizard' ,
value : 'admin' ,
)
2015-03-01 23:16:36 +00:00
set (
2015-04-27 13:42:53 +00:00
css : '.js-admin input[name="firstname"]' ,
value : 'Test Master' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-admin input[name="lastname"]' ,
value : 'Agent' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-admin input[name="email"]' ,
value : 'master@example.com' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-admin input[name="firstname"]' ,
value : 'Test Master' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-admin input[name="password"]' ,
value : 'test1234äöüß' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-admin input[name="password_confirm"]' ,
value : 'test1234äöüß' ,
2015-03-01 23:16:36 +00:00
)
2015-04-27 13:42:53 +00:00
click ( css : '.js-admin .btn--success' )
2013-04-21 23:03:19 +00:00
2015-03-01 23:16:36 +00:00
# getting started - base
2015-08-28 00:53:14 +00:00
watch_for (
2015-04-27 13:42:53 +00:00
css : '.js-base h2' ,
value : 'Organization' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-base input[name="organization"]' ,
value : 'Some Organization' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-base input[name="url"]' ,
value : 'some host' ,
2015-03-01 23:16:36 +00:00
)
click (
2015-04-27 13:42:53 +00:00
css : '.js-base .btn--primary' ,
2015-03-01 23:16:36 +00:00
)
watch_for (
2015-04-27 13:42:53 +00:00
css : 'body' ,
value : 'A URL looks like' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-base input[name="url"]' ,
2016-02-01 22:21:47 +00:00
value : browser_url ,
2015-03-01 23:16:36 +00:00
)
click (
2015-04-27 13:42:53 +00:00
css : '.js-base .btn--primary' ,
2015-03-01 23:16:36 +00:00
)
2015-08-28 00:53:14 +00:00
# getting started - email notification
2015-03-01 23:16:36 +00:00
watch_for (
2015-08-28 00:53:14 +00:00
css : '.js-outbound h2' ,
value : 'Email Notification' ,
2015-03-01 23:16:36 +00:00
)
location_check (
2015-08-28 00:53:14 +00:00
url : '#getting_started/email_notification' ,
)
click (
css : '.js-outbound .btn--primary' ,
2015-03-01 23:16:36 +00:00
)
2014-11-16 23:46:39 +00:00
2015-03-01 23:16:36 +00:00
# getting started - create email account
2015-08-28 00:53:14 +00:00
watch_for (
2015-04-27 13:42:53 +00:00
css : '.js-channel h2' ,
value : 'Connect Channels' ,
2015-03-01 23:16:36 +00:00
)
2015-08-28 00:53:14 +00:00
location_check (
url : '#getting_started/channel' ,
)
2015-03-01 23:16:36 +00:00
click (
2015-04-27 13:42:53 +00:00
css : '.js-channel .email .provider_name' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-intro input[name="realname"]' ,
value : 'Some Realname' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-intro input[name="email"]' ,
value : mailbox_user ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-intro input[name="password"]' ,
value : mailbox_password ,
2015-03-01 23:16:36 +00:00
)
click (
2015-04-27 13:42:53 +00:00
css : '.js-intro .btn--primary' ,
2015-03-01 23:16:36 +00:00
)
watch_for (
2015-04-27 13:42:53 +00:00
css : 'body' ,
value : 'verify' ,
timeout : 20 ,
2015-03-01 23:16:36 +00:00
)
watch_for (
2015-04-27 13:42:53 +00:00
css : 'body' ,
value : 'invite' ,
timeout : 100 ,
2015-03-01 23:16:36 +00:00
)
2014-11-16 23:46:39 +00:00
2015-03-01 23:16:36 +00:00
# invite agent1
2015-08-28 00:53:14 +00:00
location_check (
url : '#getting_started/agents' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-agent input[name="firstname"]' ,
value : 'Agent 1' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-agent input[name="lastname"]' ,
value : 'Test' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-agent input[name="email"]' ,
value : 'agent1@example.com' ,
2015-03-01 23:16:36 +00:00
)
2016-03-07 06:46:11 +00:00
# not needed since we hide group selections if only one group exists
#click(
# css: '.js-agent input[name="group_ids"][value="1"]',
#)
2015-03-01 23:16:36 +00:00
click (
2015-04-27 13:42:53 +00:00
css : '.js-agent .btn--success' ,
2015-03-01 23:16:36 +00:00
)
watch_for (
2015-04-27 13:42:53 +00:00
css : 'body' ,
value : 'Invitation sent' ,
2015-03-01 23:16:36 +00:00
)
location_check (
2015-04-27 13:42:53 +00:00
url : '#getting_started/agents' ,
2015-03-01 23:16:36 +00:00
)
click (
2015-04-27 13:42:53 +00:00
css : '.js-agent .btn--primary' ,
2015-03-01 23:16:36 +00:00
)
watch_for (
2015-04-27 13:42:53 +00:00
css : 'body' ,
value : 'My Stats' ,
2015-03-01 23:16:36 +00:00
)
location_check (
2016-02-11 02:31:18 +00:00
url : '#clues' ,
#url: '#dashboard',
2015-03-01 23:16:36 +00:00
)
2013-02-22 10:36:00 +00:00
end
2014-11-18 21:09:01 +00:00
def test_b_accounts_auto
2014-12-11 10:44:23 +00:00
#return # TODO: temp disable
accounts = [ ]
( 1 .. 10 ) . each { | count |
2015-04-27 19:56:07 +00:00
next if ! ENV [ " MAILBOX_AUTO #{ count } " ]
mailbox_user = ENV [ " MAILBOX_AUTO #{ count } " ] . split ( ':' ) [ 0 ]
mailbox_password = ENV [ " MAILBOX_AUTO #{ count } " ] . split ( ':' ) [ 1 ]
2014-12-11 10:44:23 +00:00
account = {
2015-04-27 13:42:53 +00:00
realname : 'auto account' ,
email : mailbox_user ,
password : mailbox_password ,
2014-12-11 10:44:23 +00:00
}
accounts . push account
}
if accounts . empty?
#raise "Need min. MAILBOX_AUTO1 as ENV variable like export MAILBOX_AUTO1='nicole.braun2015@gmail.com:somepass'"
puts " NOTICE: Need min. MAILBOX_AUTO1 as ENV variable like export MAILBOX_AUTO1='nicole.braun2015@gmail.com:somepass' "
return
end
2015-03-01 23:16:36 +00:00
@browser = browser_instance
login (
2015-04-27 13:42:53 +00:00
username : 'master@example.com' ,
password : 'test' ,
url : browser_url ,
2015-03-01 23:16:36 +00:00
)
2014-11-18 21:09:01 +00:00
accounts . each { | account |
2015-03-01 23:16:36 +00:00
# getting started - auto mail
2015-04-27 13:42:53 +00:00
location ( url : browser_url + '/#getting_started/channel' )
2015-03-01 23:16:36 +00:00
click (
2015-04-27 13:42:53 +00:00
css : '.js-channel .email .provider_name' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-intro input[name="realname"]' ,
value : account [ :realname ] ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-intro input[name="email"]' ,
value : account [ :email ] ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-intro input[name="password"]' ,
value : account [ :password ] ,
2015-03-01 23:16:36 +00:00
)
click (
2015-04-27 13:42:53 +00:00
css : '.js-intro .btn--primary' ,
2015-03-01 23:16:36 +00:00
)
watch_for (
2015-04-27 13:42:53 +00:00
css : 'body' ,
value : 'verify' ,
timeout : 20 ,
2015-03-01 23:16:36 +00:00
)
watch_for (
2015-04-27 13:42:53 +00:00
css : 'body' ,
value : 'invite' ,
timeout : 100 ,
2015-03-01 23:16:36 +00:00
)
location_check (
2015-04-27 13:42:53 +00:00
url : '#getting_started/agents' ,
2015-03-01 23:16:36 +00:00
)
2014-11-18 21:09:01 +00:00
}
end
def test_b_accounts_manual
2014-12-11 10:44:23 +00:00
#return # TODO: temp disable
accounts = [ ]
( 1 .. 10 ) . each { | count |
2015-04-27 19:56:07 +00:00
next if ! ENV [ " MAILBOX_MANUAL #{ count } " ]
mailbox_user = ENV [ " MAILBOX_MANUAL #{ count } " ] . split ( ':' ) [ 0 ]
mailbox_password = ENV [ " MAILBOX_MANUAL #{ count } " ] . split ( ':' ) [ 1 ]
mailbox_inbound = ENV [ " MAILBOX_MANUAL #{ count } " ] . split ( ':' ) [ 2 ]
mailbox_outbound = ENV [ " MAILBOX_MANUAL #{ count } " ] . split ( ':' ) [ 3 ]
2014-12-11 10:44:23 +00:00
account = {
2015-04-27 13:42:53 +00:00
realname : 'manual account' ,
email : mailbox_user ,
password : mailbox_password ,
inbound : {
2014-11-18 21:09:01 +00:00
'options::host' = > mailbox_inbound ,
} ,
2015-04-27 13:42:53 +00:00
outbound : {
2014-11-18 21:09:01 +00:00
'options::host' = > mailbox_outbound ,
} ,
2014-12-11 10:44:23 +00:00
}
accounts . push account
}
if accounts . empty?
#raise "Need min. MAILBOX_MANUAL1 as ENV variable like export MAILBOX_MANUAL1='nicole.bauer2015@yahoo.de:somepass:imap.mail.yahoo.com:smtp.mail.yahoo.com'"
puts " NOTICE: Need min. MAILBOX_MANUAL1 as ENV variable like export MAILBOX_MANUAL1='nicole.bauer2015@yahoo.de:somepass:imap.mail.yahoo.com:smtp.mail.yahoo.com' "
return
end
2015-03-01 23:16:36 +00:00
@browser = browser_instance
login (
2015-04-27 13:42:53 +00:00
username : 'master@example.com' ,
password : 'test' ,
url : browser_url ,
2015-03-01 23:16:36 +00:00
)
2014-11-18 21:09:01 +00:00
accounts . each { | account |
2015-03-01 23:16:36 +00:00
# getting started - manual mail
2015-04-27 13:42:53 +00:00
location ( url : browser_url + '/#getting_started/channel' )
2015-03-01 23:16:36 +00:00
click (
2015-04-27 13:42:53 +00:00
css : '.js-channel .email .provider_name' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-intro input[name="realname"]' ,
value : account [ :realname ] ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-intro input[name="email"]' ,
value : account [ :email ] ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-intro input[name="password"]' ,
value : account [ :password ] ,
2015-03-01 23:16:36 +00:00
)
click (
2015-04-27 13:42:53 +00:00
css : '.js-intro .btn--primary' ,
2015-03-01 23:16:36 +00:00
)
watch_for (
2015-04-27 13:42:53 +00:00
css : '.js-inbound h2' ,
value : 'inbound' ,
timeout : 220 ,
2015-03-01 23:16:36 +00:00
)
watch_for (
2015-04-27 13:42:53 +00:00
css : '.js-inbound' ,
value : 'manual' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-inbound input[name="options::host"]' ,
value : account [ :inbound ] [ 'options::host' ] ,
2015-03-01 23:16:36 +00:00
)
click (
2015-04-27 13:42:53 +00:00
css : '.js-inbound .btn--primary' ,
2015-03-01 23:16:36 +00:00
)
watch_for (
2015-04-27 13:42:53 +00:00
css : '.js-outbound h2' ,
value : 'outbound' ,
2015-03-01 23:16:36 +00:00
)
select (
2015-04-27 13:42:53 +00:00
css : '.js-outbound select[name="adapter"]' ,
value : 'SMTP - configure your own outgoing SMTP settings' ,
2015-03-01 23:16:36 +00:00
)
set (
2015-04-27 13:42:53 +00:00
css : '.js-outbound input[name="options::host"]' ,
value : account [ :outbound ] [ 'options::host' ] ,
2015-03-01 23:16:36 +00:00
)
click (
2015-04-27 13:42:53 +00:00
css : '.js-outbound .btn--primary' ,
2015-03-01 23:16:36 +00:00
)
watch_for (
2015-04-27 13:42:53 +00:00
css : 'body' ,
value : 'verify' ,
2015-03-01 23:16:36 +00:00
)
watch_for (
2015-04-27 13:42:53 +00:00
css : 'body' ,
value : 'invite' ,
timeout : 190 ,
2015-03-01 23:16:36 +00:00
)
location_check (
2015-04-27 13:42:53 +00:00
url : '#getting_started/agents' ,
2015-03-01 23:16:36 +00:00
)
2014-11-18 21:09:01 +00:00
}
end
2015-04-27 14:15:29 +00:00
end