2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2016-03-10 15:47:42 +00:00
|
|
|
require 'browser_test_helper'
|
|
|
|
|
|
|
|
class AdminChannelEmailTest < TestCase
|
|
|
|
def test_account_add
|
|
|
|
|
|
|
|
if !ENV['MAILBOX_INIT']
|
2021-07-16 13:44:10 +00:00
|
|
|
# raise "Need MAILBOX_INIT as ENV variable like export MAILBOX_INIT='unittest01@znuny.com:somepass'"
|
2016-03-10 15:47:42 +00:00
|
|
|
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(
|
2021-08-17 12:10:02 +00:00
|
|
|
username: 'admin@example.com',
|
2016-03-10 15:47:42 +00:00
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2016-03-10 15:47:42 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2016-03-10 15:47:42 +00:00
|
|
|
|
|
|
|
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-10-26 23:09:10 +00:00
|
|
|
# check if postmaster filter are shown
|
|
|
|
click(css: '.content.active a[href="#c-filter"]')
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active #c-filter .overview',
|
2016-10-26 23:09:10 +00:00
|
|
|
value: 'No Entries',
|
|
|
|
)
|
|
|
|
|
|
|
|
# check if signatures are shown
|
|
|
|
click(css: '.content.active a[href="#c-signature"]')
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active #c-signature .overview',
|
2016-10-26 23:09:10 +00:00
|
|
|
value: 'default',
|
|
|
|
)
|
|
|
|
|
|
|
|
click(css: '.content.active a[href="#c-account"]')
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active .js-channelNew')
|
2016-03-10 15:47:42 +00:00
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2016-03-10 15:47:42 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal input[name="realname"]',
|
2016-03-10 15:47:42 +00:00
|
|
|
value: 'My System',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal input[name="email"]',
|
2016-03-10 15:47:42 +00:00
|
|
|
value: mailbox_user,
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal input[name="password"]',
|
2016-03-10 15:47:42 +00:00
|
|
|
value: mailbox_password,
|
|
|
|
)
|
|
|
|
select(
|
|
|
|
css: '.modal select[name="group_id"]',
|
|
|
|
value: 'Users',
|
|
|
|
)
|
|
|
|
click(css: '.modal button.js-submit')
|
|
|
|
sleep 4
|
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
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]
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active .js-channelDelete')
|
2016-03-11 05:58:27 +00:00
|
|
|
sleep 2
|
2019-01-12 11:19:00 +00:00
|
|
|
# flanky
|
2016-03-11 05:58:27 +00:00
|
|
|
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
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2016-03-10 15:47:42 +00:00
|
|
|
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal input[name="realname"]',
|
2016-03-10 15:47:42 +00:00
|
|
|
value: 'My System',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal input[name="email"]',
|
2016-03-10 15:47:42 +00:00
|
|
|
value: mailbox_user,
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal input[name="password"]',
|
2016-03-10 15:47:42 +00:00
|
|
|
value: mailbox_password,
|
|
|
|
)
|
|
|
|
select(
|
|
|
|
css: '.modal select[name="group_id"]',
|
|
|
|
value: 'Users',
|
|
|
|
)
|
|
|
|
click(css: '.modal button.js-submit')
|
2018-12-14 17:24:47 +00:00
|
|
|
modal_disappear(timeout: 20)
|
2016-03-10 15:47:42 +00:00
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +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
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2016-03-10 15:47:42 +00:00
|
|
|
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal input[name="options::folder"]',
|
2016-03-10 15:47:42 +00:00
|
|
|
value: 'not_existing_folder',
|
|
|
|
)
|
|
|
|
click(css: '.modal .js-inbound button.js-submit')
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal',
|
2016-03-10 15:47:42 +00:00
|
|
|
value: 'Mailbox doesn\'t exist',
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2018-08-08 08:16:05 +00:00
|
|
|
# test the creation and cloning of Postmaster filters
|
|
|
|
# confirm fix for issue #2170 - Cannot clone PostmasterFilter
|
|
|
|
def test_filter_clone
|
|
|
|
filter_name = "Test Filter #{rand(999_999)}"
|
|
|
|
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
2021-08-17 12:10:02 +00:00
|
|
|
username: 'admin@example.com',
|
2018-08-08 08:16:05 +00:00
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-08-08 08:16:05 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-08-08 08:16:05 +00:00
|
|
|
|
|
|
|
click(css: 'a[href="#manage"]')
|
|
|
|
click(css: '.content.active a[href="#channels/email"]')
|
|
|
|
|
|
|
|
click(css: '.content.active a[href="#c-filter"]')
|
|
|
|
|
|
|
|
# create a new email filter
|
|
|
|
click(css: '.content.active a[data-type="new"]')
|
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2018-08-08 08:16:05 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal input[name="name"]',
|
2018-08-08 08:16:05 +00:00
|
|
|
value: filter_name,
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal input[name="match::from::value"]',
|
2018-08-08 08:16:05 +00:00
|
|
|
value: 'target',
|
|
|
|
)
|
|
|
|
click(css: '.modal .js-submit')
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_disappear
|
2018-08-08 08:16:05 +00:00
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .table',
|
2018-08-08 08:16:05 +00:00
|
|
|
value: filter_name,
|
|
|
|
)
|
|
|
|
|
|
|
|
# now clone filter that we just created
|
2019-03-06 14:27:44 +00:00
|
|
|
click(css: '.content.active .table .dropdown .btn--table')
|
2018-08-08 08:16:05 +00:00
|
|
|
click(css: '.content.active .table .dropdown .js-clone')
|
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2018-08-08 08:16:05 +00:00
|
|
|
click(css: '.modal .js-submit')
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_disappear
|
2018-08-08 08:16:05 +00:00
|
|
|
|
|
|
|
# confirm the clone exists in the table
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .table',
|
2018-08-08 08:16:05 +00:00
|
|
|
value: "Clone: #{filter_name}",
|
|
|
|
)
|
|
|
|
end
|
2016-03-10 15:47:42 +00:00
|
|
|
end
|