2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2016-08-16 00:10:41 +00:00
|
|
|
require 'browser_test_helper'
|
|
|
|
|
|
|
|
class IntegrationTest < TestCase
|
|
|
|
|
|
|
|
def test_sipgate
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
# change settings
|
|
|
|
click(css: 'a[href="#manage"]')
|
|
|
|
click(css: 'a[href="#system/integration"]')
|
|
|
|
click(css: 'a[href="#system/integration/sipgate"]')
|
|
|
|
sleep 2
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main .js-switch',
|
2016-08-16 00:10:41 +00:00
|
|
|
type: 'on',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main .js-inboundBlockCallerId input[name=caller_id]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: '041 1234567',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main .js-inboundBlockCallerId input[name=note]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'block spam caller id',
|
|
|
|
)
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active .main .js-inboundBlockCallerId .js-add')
|
|
|
|
click(css: '.content.active .main .js-submit')
|
2016-08-16 00:10:41 +00:00
|
|
|
|
|
|
|
exists(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
exists(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-inboundBlockCallerId [value="block spam caller id"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
click(css: 'a[href="#dashboard"]')
|
|
|
|
click(css: 'a[href="#manage"]')
|
|
|
|
click(css: 'a[href="#system/integration"]')
|
|
|
|
click(css: 'a[href="#system/integration/sipgate"]')
|
|
|
|
|
|
|
|
exists(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
exists(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-inboundBlockCallerId [value="block spam caller id"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
reload()
|
|
|
|
exists(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
exists(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-inboundBlockCallerId [value="block spam caller id"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active .main .js-inboundBlockCallerId .js-remove')
|
|
|
|
click(css: '.content.active .main .js-submit')
|
2016-08-16 00:10:41 +00:00
|
|
|
sleep 6
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main .js-switch',
|
2016-08-16 00:10:41 +00:00
|
|
|
type: 'off',
|
|
|
|
)
|
|
|
|
|
|
|
|
reload()
|
|
|
|
exists_not(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
exists_not(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-inboundBlockCallerId [value="block spam caller id"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_slack
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
# change settings
|
|
|
|
click(css: 'a[href="#manage"]')
|
|
|
|
click(css: 'a[href="#system/integration"]')
|
|
|
|
click(css: 'a[href="#system/integration/slack"]')
|
|
|
|
sleep 2
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main .js-switch',
|
2016-08-16 00:10:41 +00:00
|
|
|
type: 'on',
|
|
|
|
)
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active .main .checkbox-replacement')
|
2016-08-16 00:10:41 +00:00
|
|
|
select(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main select[name="group_ids"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'Users',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="webhook"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'http://some_url/webhook/123',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="username"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'someuser',
|
|
|
|
)
|
|
|
|
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active .main .js-submit')
|
2016-08-16 00:10:41 +00:00
|
|
|
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main select[name="group_ids"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'Users',
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="webhook"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'http://some_url/webhook/123',
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="username"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'someuser',
|
|
|
|
)
|
|
|
|
|
|
|
|
click(css: 'a[href="#dashboard"]')
|
|
|
|
click(css: 'a[href="#manage"]')
|
|
|
|
click(css: 'a[href="#system/integration"]')
|
|
|
|
click(css: 'a[href="#system/integration/slack"]')
|
|
|
|
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main select[name="group_ids"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'Users',
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="webhook"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'http://some_url/webhook/123',
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="username"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'someuser',
|
|
|
|
)
|
|
|
|
|
|
|
|
reload()
|
|
|
|
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main select[name="group_ids"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'Users',
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="webhook"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'http://some_url/webhook/123',
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="username"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'someuser',
|
|
|
|
)
|
|
|
|
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main .js-switch',
|
2016-08-16 00:10:41 +00:00
|
|
|
type: 'off',
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_clearbit
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
# change settings
|
|
|
|
click(css: 'a[href="#manage"]')
|
|
|
|
click(css: 'a[href="#system/integration"]')
|
|
|
|
click(css: 'a[href="#system/integration/clearbit"]')
|
|
|
|
sleep 2
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main .js-switch',
|
2016-08-16 00:10:41 +00:00
|
|
|
type: 'on',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="api_key"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'some_api_key',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main .js-userSync .js-new [name="source"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'source1',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main .js-userSync .js-new [name="destination"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'destination1',
|
|
|
|
)
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active .main .js-userSync .js-add')
|
|
|
|
click(css: '.content.active .main .js-submit')
|
2016-08-16 00:10:41 +00:00
|
|
|
|
|
|
|
click(css: 'a[href="#dashboard"]')
|
|
|
|
click(css: 'a[href="#manage"]')
|
|
|
|
click(css: 'a[href="#system/integration"]')
|
|
|
|
click(css: 'a[href="#system/integration/clearbit"]')
|
|
|
|
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="api_key"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'some_api_key',
|
|
|
|
)
|
|
|
|
exists(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-userSync [value="source1"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
exists(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-userSync [value="destination1"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
reload()
|
|
|
|
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="api_key"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'some_api_key',
|
|
|
|
)
|
|
|
|
exists(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-userSync [value="source1"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
exists(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-userSync [value="destination1"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main .js-switch',
|
2016-08-16 00:10:41 +00:00
|
|
|
type: 'off',
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="api_key"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: '-empty-',
|
|
|
|
)
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active .main .js-submit')
|
2016-08-16 00:10:41 +00:00
|
|
|
|
|
|
|
reload()
|
|
|
|
match_not(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="api_key"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'some_api_key',
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="api_key"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: '-empty-',
|
|
|
|
)
|
|
|
|
exists(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-userSync [value="source1"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
exists(
|
2016-09-27 17:46:23 +00:00
|
|
|
css: '.content.active .main .js-userSync [value="destination1"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_icinga
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2016-08-16 00:10:41 +00:00
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
# change settings
|
|
|
|
click(css: 'a[href="#manage"]')
|
|
|
|
click(css: 'a[href="#system/integration"]')
|
|
|
|
click(css: 'a[href="#system/integration/icinga"]')
|
|
|
|
sleep 2
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main .js-switch',
|
2016-08-16 00:10:41 +00:00
|
|
|
type: 'on',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="icinga_sender"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'some@othersender.com',
|
|
|
|
)
|
|
|
|
select(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main select[name="icinga_auto_close"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'no',
|
|
|
|
)
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active .main .js-submit')
|
2016-08-16 00:10:41 +00:00
|
|
|
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="icinga_sender"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'some@othersender.com',
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main select[name="icinga_auto_close"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'no',
|
|
|
|
)
|
|
|
|
|
|
|
|
click(css: 'a[href="#dashboard"]')
|
|
|
|
click(css: 'a[href="#manage"]')
|
|
|
|
click(css: 'a[href="#system/integration"]')
|
|
|
|
click(css: 'a[href="#system/integration/icinga"]')
|
|
|
|
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="icinga_sender"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'some@othersender.com',
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main select[name="icinga_auto_close"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'no',
|
|
|
|
)
|
|
|
|
|
|
|
|
reload()
|
|
|
|
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="icinga_sender"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'some@othersender.com',
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main select[name="icinga_auto_close"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'no',
|
|
|
|
)
|
|
|
|
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main .js-switch',
|
2016-08-16 00:10:41 +00:00
|
|
|
type: 'off',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="icinga_sender"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'icinga@monitoring.example.com',
|
|
|
|
)
|
|
|
|
select(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main select[name="icinga_auto_close"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'yes',
|
|
|
|
)
|
2016-09-27 17:46:23 +00:00
|
|
|
click(css: '.content.active .main .js-submit')
|
2016-08-16 00:10:41 +00:00
|
|
|
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main input[name="icinga_sender"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'icinga@monitoring.example.com',
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .main select[name="icinga_auto_close"]',
|
2016-08-16 00:10:41 +00:00
|
|
|
value: 'yes',
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|