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 ]
tests = [
2013-02-22 10:36:00 +00:00
{
:name = > 'start' ,
2013-02-23 22:54:48 +00:00
:instance = > browser_instance ,
2013-04-21 23:03:19 +00:00
:url = > browser_url + '/' ,
2013-02-22 10:36:00 +00:00
:action = > [
{
:execute = > 'check' ,
2014-11-16 23:46:39 +00:00
:css = > '.setup.wizard' ,
2013-02-22 10:36:00 +00:00
:result = > true ,
} ,
] ,
} ,
{
2013-04-21 23:03:19 +00:00
:name = > 'getting started - master agent' ,
2013-02-22 10:36:00 +00:00
:action = > [
2014-11-16 23:46:39 +00:00
{
:execute = > 'click' ,
:css = > '.js-start .btn--primary' ,
} ,
2013-02-22 10:36:00 +00:00
{
:execute = > 'set' ,
2014-11-16 23:46:39 +00:00
:css = > '.js-admin input[name="firstname"]' ,
2013-02-22 10:36:00 +00:00
:value = > 'Test Master' ,
} ,
{
:execute = > 'set' ,
2014-11-16 23:46:39 +00:00
:css = > '.js-admin input[name="lastname"]' ,
2013-02-22 10:36:00 +00:00
:value = > 'Agent' ,
} ,
{
:execute = > 'set' ,
2014-11-16 23:46:39 +00:00
:css = > '.js-admin input[name="email"]' ,
2013-02-22 10:36:00 +00:00
:value = > 'master@example.com' ,
} ,
{
:execute = > 'set' ,
2014-11-16 23:46:39 +00:00
:css = > '.js-admin input[name="password"]' ,
2013-02-22 10:36:00 +00:00
:value = > 'test1234äöüß' ,
} ,
{
:execute = > 'set' ,
2014-11-16 23:46:39 +00:00
:css = > '.js-admin input[name="password_confirm"]' ,
2013-02-22 10:36:00 +00:00
:value = > 'test1234äöüß' ,
} ,
{
:execute = > 'click' ,
2014-11-16 23:46:39 +00:00
:css = > '.js-admin .btn--success' ,
2013-02-22 10:36:00 +00:00
} ,
{
2014-11-20 07:44:50 +00:00
:execute = > 'watch_for' ,
:area = > '.js-base h2' ,
:value = > 'Organization' ,
2013-02-22 10:36:00 +00:00
} ,
2013-04-21 23:03:19 +00:00
] ,
} ,
2014-11-16 23:46:39 +00:00
# set base
{
:name = > 'getting started - base' ,
:action = > [
{
:execute = > 'match' ,
:css = > '.js-base h2' ,
:value = > 'Organization' ,
:match_result = > true ,
} ,
{
:execute = > 'set' ,
:css = > '.js-base input[name="organization"]' ,
:value = > 'Some Organization' ,
} ,
{
:execute = > 'set' ,
:css = > '.js-base input[name="url"]' ,
:value = > 'some host' ,
} ,
{
:execute = > 'click' ,
:css = > '.js-base .btn--primary' ,
} ,
{
:execute = > 'watch_for' ,
:area = > 'body' ,
:value = > 'A URL looks like' ,
} ,
{
:execute = > 'set' ,
:css = > '.js-base input[name="url"]' ,
:value = > 'http://localhost:3333' ,
} ,
{
:execute = > 'click' ,
:css = > '.js-base .btn--primary' ,
} ,
{
:execute = > 'watch_for' ,
:area = > 'body' ,
:value = > 'channel' ,
} ,
{
:execute = > 'check' ,
:element = > :url ,
:result = > '#getting_started/channel' ,
} ,
] ,
} ,
# create email account
{
:name = > 'getting started - base' ,
:action = > [
{
:execute = > 'match' ,
:css = > '.js-channel h2' ,
:value = > 'Connect Channels' ,
:match_result = > true ,
} ,
{
:execute = > 'click' ,
:css = > '.js-channel .email .provider_name' ,
} ,
{
:execute = > 'set' ,
:css = > '.js-intro input[name="realname"]' ,
:value = > 'Some Realname' ,
} ,
{
:execute = > 'set' ,
:css = > '.js-intro input[name="email"]' ,
2014-11-18 21:09:01 +00:00
:value = > mailbox_user ,
2014-11-16 23:46:39 +00:00
} ,
{
:execute = > 'set' ,
:css = > '.js-intro input[name="password"]' ,
2014-11-18 21:09:01 +00:00
:value = > mailbox_password ,
2014-11-16 23:46:39 +00:00
} ,
{
:execute = > 'click' ,
:css = > '.js-intro .btn--primary' ,
} ,
{
:execute = > 'watch_for' ,
:area = > 'body' ,
:value = > 'verify' ,
2014-12-14 13:13:46 +00:00
:timeout = > 20 ,
2014-11-16 23:46:39 +00:00
} ,
{
:execute = > 'watch_for' ,
:area = > 'body' ,
:value = > 'invite' ,
2014-12-14 13:13:46 +00:00
:timeout = > 100 ,
2014-11-16 23:46:39 +00:00
} ,
{
:execute = > 'check' ,
:element = > :url ,
:result = > '#getting_started/agents' ,
} ,
] ,
} ,
# invite agent1
2013-04-21 23:03:19 +00:00
{
:name = > 'getting started - agent 1' ,
:action = > [
{
:execute = > 'match' ,
:css = > 'body' ,
2014-11-16 23:46:39 +00:00
:value = > 'Invite' ,
2013-04-21 23:03:19 +00:00
:match_result = > true ,
} ,
{
:execute = > 'set' ,
2014-11-16 23:46:39 +00:00
:css = > '.js-agent input[name="firstname"]' ,
2013-04-21 23:03:19 +00:00
:value = > 'Agent 1' ,
} ,
{
:execute = > 'set' ,
2014-11-16 23:46:39 +00:00
:css = > '.js-agent input[name="lastname"]' ,
2013-04-21 23:03:19 +00:00
:value = > 'Test' ,
} ,
{
:execute = > 'set' ,
2014-11-16 23:46:39 +00:00
:css = > '.js-agent input[name="email"]' ,
2013-04-21 23:03:19 +00:00
:value = > 'agent1@example.com' ,
} ,
{
:execute = > 'click' ,
2014-11-16 23:46:39 +00:00
:css = > '.js-agent input[name="group_ids"][value="1"]' ,
2013-04-21 23:03:19 +00:00
} ,
{
:execute = > 'click' ,
2014-11-16 23:46:39 +00:00
:css = > '.js-agent .btn--success' ,
2013-04-21 23:03:19 +00:00
} ,
2013-07-15 10:22:02 +00:00
{
2013-08-27 21:05:33 +00:00
:execute = > 'watch_for' ,
:area = > 'body' ,
:value = > 'Invitation sent' ,
2013-04-21 23:03:19 +00:00
} ,
2013-08-27 21:26:43 +00:00
{
:execute = > 'check' ,
:element = > :url ,
2014-11-16 23:46:39 +00:00
:result = > '#getting_started/agents' ,
2013-08-27 21:26:43 +00:00
} ,
2013-02-22 10:36:00 +00:00
{
2014-11-16 23:46:39 +00:00
:execute = > 'click' ,
:css = > '.js-agent .btn--primary' ,
} ,
{
:execute = > 'watch_for' ,
:area = > 'body' ,
2014-11-16 23:49:01 +00:00
:value = > 'My Stats' ,
2014-11-16 23:46:39 +00:00
} ,
{
:execute = > 'check' ,
:element = > :url ,
:result = > '#dashboard' ,
2013-02-22 10:36:00 +00:00
} ,
] ,
} ,
]
browser_single_test ( tests )
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 |
next if ! ENV [ " MAILBOX_AUTO #{ count . to_s } " ]
mailbox_user = ENV [ " MAILBOX_AUTO #{ count . to_s } " ] . split ( ':' ) [ 0 ]
mailbox_password = ENV [ " MAILBOX_AUTO #{ count . to_s } " ] . split ( ':' ) [ 1 ]
account = {
:realname = > 'auto account' ,
2014-11-18 21:09:01 +00:00
: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
2014-11-18 21:09:01 +00:00
accounts . each { | account |
tests = [
{
:name = > 'getting started - auto mail' ,
:action = > [
{
:execute = > 'navigate' ,
:to = > browser_url + '/#getting_started/channel' ,
} ,
{
:execute = > 'click' ,
:css = > '.js-channel .email .provider_name' ,
} ,
{
:execute = > 'set' ,
:css = > '.js-intro input[name="realname"]' ,
:value = > account [ :realname ] ,
} ,
{
:execute = > 'set' ,
:css = > '.js-intro input[name="email"]' ,
:value = > account [ :email ] ,
} ,
{
:execute = > 'set' ,
:css = > '.js-intro input[name="password"]' ,
:value = > account [ :password ] ,
} ,
{
:execute = > 'click' ,
:css = > '.js-intro .btn--primary' ,
} ,
{
:execute = > 'watch_for' ,
:area = > 'body' ,
:value = > 'verify' ,
2014-12-14 13:13:46 +00:00
:timeout = > 20 ,
2014-11-18 21:09:01 +00:00
} ,
{
:execute = > 'watch_for' ,
:area = > 'body' ,
:value = > 'invite' ,
2014-12-14 13:13:46 +00:00
:timeout = > 100 ,
2014-11-18 21:09:01 +00:00
} ,
{
:execute = > 'check' ,
:element = > :url ,
:result = > '#getting_started/agents' ,
} ,
] ,
} ,
]
browser_signle_test_with_login ( tests , { :username = > 'master@example.com' } )
}
end
def test_b_accounts_manual
2014-12-11 10:44:23 +00:00
#return # TODO: temp disable
accounts = [ ]
( 1 .. 10 ) . each { | count |
next if ! ENV [ " MAILBOX_MANUAL #{ count . to_s } " ]
mailbox_user = ENV [ " MAILBOX_MANUAL #{ count . to_s } " ] . split ( ':' ) [ 0 ]
mailbox_password = ENV [ " MAILBOX_MANUAL #{ count . to_s } " ] . split ( ':' ) [ 1 ]
mailbox_inbound = ENV [ " MAILBOX_MANUAL #{ count . to_s } " ] . split ( ':' ) [ 2 ]
mailbox_outbound = ENV [ " MAILBOX_MANUAL #{ count . to_s } " ] . split ( ':' ) [ 3 ]
account = {
:realname = > 'manual account' ,
2014-11-18 21:09:01 +00:00
:email = > mailbox_user ,
:password = > mailbox_password ,
:inbound = > {
'options::host' = > mailbox_inbound ,
} ,
:outbound = > {
'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
2014-11-18 21:09:01 +00:00
accounts . each { | account |
tests = [
{
:name = > 'getting started - manual mail' ,
:action = > [
{
:execute = > 'navigate' ,
:to = > browser_url + '/#getting_started/channel' ,
} ,
{
:execute = > 'click' ,
:css = > '.js-channel .email .provider_name' ,
} ,
{
:execute = > 'set' ,
:css = > '.js-intro input[name="realname"]' ,
:value = > account [ :realname ] ,
} ,
{
:execute = > 'set' ,
:css = > '.js-intro input[name="email"]' ,
:value = > account [ :email ] ,
} ,
{
:execute = > 'set' ,
:css = > '.js-intro input[name="password"]' ,
:value = > account [ :password ] ,
} ,
{
:execute = > 'click' ,
:css = > '.js-intro .btn--primary' ,
} ,
{
:execute = > 'watch_for' ,
:area = > '.js-inbound h2' ,
:value = > 'inbound' ,
:timeout = > 220 ,
} ,
{
:execute = > 'watch_for' ,
:area = > '.js-inbound' ,
:value = > 'manual' ,
} ,
{
:execute = > 'set' ,
:css = > '.js-inbound input[name="options::host"]' ,
:value = > account [ :inbound ] [ 'options::host' ] ,
} ,
{
:execute = > 'click' ,
:css = > '.js-inbound .btn--primary' ,
} ,
{
:execute = > 'watch_for' ,
:area = > '.js-outbound h2' ,
:value = > 'outbound' ,
} ,
{
:execute = > 'select' ,
:css = > '.js-outbound select[name="adapter"]' ,
:value = > 'SMTP - configure your own outgoing SMTP settings' ,
} ,
{
:execute = > 'set' ,
:css = > '.js-outbound input[name="options::host"]' ,
:value = > account [ :outbound ] [ 'options::host' ] ,
} ,
{
:execute = > 'click' ,
:css = > '.js-outbound .btn--primary' ,
} ,
{
:execute = > 'watch_for' ,
:area = > 'body' ,
:value = > 'verify' ,
} ,
{
:execute = > 'watch_for' ,
:area = > 'body' ,
:value = > 'invite' ,
:timeout = > 190 ,
} ,
{
:execute = > 'check' ,
:element = > :url ,
:result = > '#getting_started/agents' ,
} ,
] ,
} ,
]
browser_signle_test_with_login ( tests , { :username = > 'master@example.com' } )
}
end
2014-12-01 21:57:55 +00:00
end