2016-03-10 15:47:42 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
require 'browser_test_helper'
|
|
|
|
|
|
|
|
class AdminChannelEmailTest < TestCase
|
|
|
|
def test_account_add
|
|
|
|
|
|
|
|
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
|
|
|
|
end
|
|
|
|
mailbox_user = ENV['MAILBOX_INIT'].split(':')[0]
|
|
|
|
mailbox_password = ENV['MAILBOX_INIT'].split(':')[1]
|
|
|
|
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
|
|
|
url: browser_url,
|
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
click(css: 'a[href="#manage"]')
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active a[href="#channels/email"]')
|
2016-03-10 15:47:42 +00:00
|
|
|
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active .js-channelNew')
|
2016-03-10 15:47:42 +00:00
|
|
|
|
2016-03-23 07:24:25 +00:00
|
|
|
modal_ready()
|
2016-03-10 15:47:42 +00:00
|
|
|
|
|
|
|
set(
|
|
|
|
css: '.modal input[name="realname"]',
|
|
|
|
value: 'My System',
|
|
|
|
)
|
|
|
|
set(
|
|
|
|
css: '.modal input[name="email"]',
|
|
|
|
value: mailbox_user,
|
|
|
|
)
|
|
|
|
set(
|
|
|
|
css: '.modal input[name="password"]',
|
|
|
|
value: mailbox_password,
|
|
|
|
)
|
|
|
|
select(
|
|
|
|
css: '.modal select[name="group_id"]',
|
|
|
|
value: 'Users',
|
|
|
|
)
|
|
|
|
click(css: '.modal button.js-submit')
|
|
|
|
sleep 4
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
css: '.modal',
|
2016-03-11 05:58:27 +00:00
|
|
|
value: '(already exists|unknown mailbox)',
|
2016-03-10 15:47:42 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
click(css: '.modal .js-close')
|
|
|
|
|
2016-03-11 05:58:27 +00:00
|
|
|
# delete all channels
|
|
|
|
loop do
|
2016-09-27 17:46:23 +00:00
|
|
|
break if !@browser.find_elements(css: '.content.active .js-channelDelete')[0]
|
|
|
|
click(css: '.content.active .js-channelDelete')
|
2016-03-11 05:58:27 +00:00
|
|
|
sleep 2
|
|
|
|
click(css: '.modal .js-submit')
|
|
|
|
sleep 2
|
|
|
|
end
|
2016-03-10 15:47:42 +00:00
|
|
|
|
|
|
|
# re-create
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active .js-channelNew')
|
2016-03-10 15:47:42 +00:00
|
|
|
|
2016-03-23 07:24:25 +00:00
|
|
|
modal_ready()
|
2016-03-10 15:47:42 +00:00
|
|
|
|
|
|
|
set(
|
|
|
|
css: '.modal input[name="realname"]',
|
|
|
|
value: 'My System',
|
|
|
|
)
|
|
|
|
set(
|
|
|
|
css: '.modal input[name="email"]',
|
|
|
|
value: mailbox_user,
|
|
|
|
)
|
|
|
|
set(
|
|
|
|
css: '.modal input[name="password"]',
|
|
|
|
value: mailbox_password,
|
|
|
|
)
|
|
|
|
select(
|
|
|
|
css: '.modal select[name="group_id"]',
|
|
|
|
value: 'Users',
|
|
|
|
)
|
|
|
|
click(css: '.modal button.js-submit')
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
watch_for_disappear(
|
|
|
|
css: '.modal',
|
|
|
|
)
|
|
|
|
sleep 2
|
|
|
|
exists_not(css: '.modal')
|
|
|
|
|
|
|
|
watch_for(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active',
|
2016-03-10 15:47:42 +00:00
|
|
|
value: mailbox_user,
|
|
|
|
)
|
|
|
|
|
|
|
|
# set invalid folder
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active .js-editInbound')
|
2016-03-23 07:24:25 +00:00
|
|
|
|
|
|
|
modal_ready()
|
2016-03-10 15:47:42 +00:00
|
|
|
|
|
|
|
set(
|
|
|
|
css: '.modal input[name="options::folder"]',
|
|
|
|
value: 'not_existing_folder',
|
|
|
|
)
|
|
|
|
click(css: '.modal .js-inbound button.js-submit')
|
|
|
|
watch_for(
|
|
|
|
css: '.modal',
|
|
|
|
value: 'Mailbox doesn\'t exist',
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|