trabajo-afectivo/test/browser/aaa_getting_started_test.rb

331 lines
8.5 KiB
Ruby
Raw Normal View History

# encoding: utf-8
require 'browser_test_helper'
class AaaGettingStartedTest < TestCase
2014-11-18 21:09:01 +00:00
def test_a_getting_started
#return # TODO: temp disable
2014-11-18 21:09:01 +00:00
if !ENV['MAILBOX_INIT']
#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
location( :url => browser_url )
watch_for(
:css => '.setup.wizard',
:value => 'setup new system',
)
click( :css => '.js-start .btn--primary' )
set(
:css => '.js-admin input[name="firstname"]',
:value => 'Test Master',
)
set(
:css => '.js-admin input[name="lastname"]',
:value => 'Agent',
)
set(
:css => '.js-admin input[name="email"]',
:value => 'master@example.com',
)
set(
:css => '.js-admin input[name="firstname"]',
:value => 'Test Master',
)
set(
:css => '.js-admin input[name="password"]',
:value => 'test1234äöüß',
)
set(
:css => '.js-admin input[name="password_confirm"]',
:value => 'test1234äöüß',
)
click( :css => '.js-admin .btn--success' )
watch_for(
:css => '.js-base h2',
:value => 'Organization',
)
2013-04-21 23:03:19 +00:00
2015-03-01 23:16:36 +00:00
# getting started - base
match(
:css => '.js-base h2',
:value => 'Organization',
)
set(
:css => '.js-base input[name="organization"]',
:value => 'Some Organization',
)
set(
:css => '.js-base input[name="url"]',
:value => 'some host',
)
click(
:css => '.js-base .btn--primary',
)
watch_for(
:css => 'body',
:value => 'A URL looks like',
)
set(
:css => '.js-base input[name="url"]',
:value => 'http://localhost:3333',
)
click(
:css => '.js-base .btn--primary',
)
watch_for(
:css => 'body',
:value => 'channel',
)
location_check(
:url => '#getting_started/channel',
)
2014-11-16 23:46:39 +00:00
2015-03-01 23:16:36 +00:00
# getting started - create email account
match(
:css => '.js-channel h2',
:value => 'Connect Channels',
)
click(
:css => '.js-channel .email .provider_name',
)
set(
:css => '.js-intro input[name="realname"]',
:value => 'Some Realname',
)
set(
:css => '.js-intro input[name="email"]',
:value => mailbox_user,
)
set(
:css => '.js-intro input[name="password"]',
:value => mailbox_password,
)
click(
:css => '.js-intro .btn--primary',
)
watch_for(
:css => 'body',
:value => 'verify',
:timeout => 20,
)
watch_for(
:css => 'body',
:value => 'invite',
:timeout => 100,
)
location_check(
:url => '#getting_started/agents',
)
2014-11-16 23:46:39 +00:00
2015-03-01 23:16:36 +00:00
# invite agent1
match(
:css => 'body',
:value => 'Invite',
)
set(
:css => '.js-agent input[name="firstname"]',
:value => 'Agent 1',
)
set(
:css => '.js-agent input[name="lastname"]',
:value => 'Test',
)
set(
:css => '.js-agent input[name="email"]',
:value => 'agent1@example.com',
)
click(
:css => '.js-agent input[name="group_ids"][value="1"]',
)
click(
:css => '.js-agent .btn--success',
)
watch_for(
:css => 'body',
:value => 'Invitation sent',
)
location_check(
:url => '#getting_started/agents',
)
click(
:css => '.js-agent .btn--primary',
)
watch_for(
:css => 'body',
:value => 'My Stats',
)
location_check(
:url => '#dashboard',
)
end
2014-11-18 21:09:01 +00:00
def test_b_accounts_auto
#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,
}
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(
:username => 'master@example.com',
:password => 'test',
:url => browser_url,
)
2014-11-18 21:09:01 +00:00
accounts.each {|account|
2015-03-01 23:16:36 +00:00
# getting started - auto mail
location( :url => browser_url + '/#getting_started/channel' )
click(
:css => '.js-channel .email .provider_name',
)
set(
:css => '.js-intro input[name="realname"]',
:value => account[:realname],
)
set(
:css => '.js-intro input[name="email"]',
:value => account[:email],
)
set(
:css => '.js-intro input[name="password"]',
:value => account[:password],
)
click(
:css => '.js-intro .btn--primary',
)
watch_for(
:css => 'body',
:value => 'verify',
:timeout => 20,
)
watch_for(
:css => 'body',
:value => 'invite',
:timeout => 100,
)
location_check(
:url => '#getting_started/agents',
)
2014-11-18 21:09:01 +00:00
}
end
def test_b_accounts_manual
#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,
},
}
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(
:username => 'master@example.com',
:password => 'test',
:url => browser_url,
)
2014-11-18 21:09:01 +00:00
accounts.each {|account|
2015-03-01 23:16:36 +00:00
# getting started - manual mail
location( :url => browser_url + '/#getting_started/channel' )
click(
:css => '.js-channel .email .provider_name',
)
set(
:css => '.js-intro input[name="realname"]',
:value => account[:realname],
)
set(
:css => '.js-intro input[name="email"]',
:value => account[:email],
)
set(
:css => '.js-intro input[name="password"]',
:value => account[:password],
)
click(
:css => '.js-intro .btn--primary',
)
watch_for(
:css => '.js-inbound h2',
:value => 'inbound',
:timeout => 220,
)
watch_for(
:css => '.js-inbound',
:value => 'manual',
)
set(
:css => '.js-inbound input[name="options::host"]',
:value => account[:inbound]['options::host'],
)
click(
:css => '.js-inbound .btn--primary',
)
watch_for(
:css => '.js-outbound h2',
:value => 'outbound',
)
select(
:css => '.js-outbound select[name="adapter"]',
:value => 'SMTP - configure your own outgoing SMTP settings',
)
set(
:css => '.js-outbound input[name="options::host"]',
:value => account[:outbound]['options::host'],
)
click(
:css => '.js-outbound .btn--primary',
)
watch_for(
:css => 'body',
:value => 'verify',
)
watch_for(
:css => 'body',
:value => 'invite',
:timeout => 190,
)
location_check(
:url => '#getting_started/agents',
)
2014-11-18 21:09:01 +00:00
}
end
2014-12-01 21:57:55 +00:00
end