trabajo-afectivo/test/browser/integration_test.rb

340 lines
8.5 KiB
Ruby
Raw Normal View History

2016-08-16 00:10:41 +00:00
# encoding: utf-8
require 'browser_test_helper'
class IntegrationTest < TestCase
def test_sipgate
@browser = browser_instance
login(
username: 'master@example.com',
password: 'test',
url: browser_url,
)
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(
css: '.content.active .main .js-switch',
2016-08-16 00:10:41 +00:00
type: 'on',
)
set(
css: '.content.active .main .js-inboundBlockCallerId input[name=caller_id]',
2016-08-16 00:10:41 +00:00
value: '041 1234567',
)
set(
css: '.content.active .main .js-inboundBlockCallerId input[name=note]',
2016-08-16 00:10:41 +00:00
value: 'block spam caller id',
)
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(
css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]',
2016-08-16 00:10:41 +00:00
)
exists(
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(
css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]',
2016-08-16 00:10:41 +00:00
)
exists(
css: '.content.active .main .js-inboundBlockCallerId [value="block spam caller id"]',
2016-08-16 00:10:41 +00:00
)
reload()
exists(
css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]',
2016-08-16 00:10:41 +00:00
)
exists(
css: '.content.active .main .js-inboundBlockCallerId [value="block spam caller id"]',
2016-08-16 00:10:41 +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(
css: '.content.active .main .js-switch',
2016-08-16 00:10:41 +00:00
type: 'off',
)
reload()
exists_not(
css: '.content.active .main .js-inboundBlockCallerId [value="0411234567"]',
2016-08-16 00:10:41 +00:00
)
exists_not(
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',
url: browser_url,
)
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(
css: '.content.active .main .js-switch',
2016-08-16 00:10:41 +00:00
type: 'on',
)
click(css: '.content.active .main .checkbox-replacement')
2016-08-16 00:10:41 +00:00
select(
css: '.content.active .main select[name="group_id"]',
2016-08-16 00:10:41 +00:00
value: 'Users',
)
set(
css: '.content.active .main input[name="webhook"]',
2016-08-16 00:10:41 +00:00
value: 'http://some_url/webhook/123',
)
set(
css: '.content.active .main input[name="username"]',
2016-08-16 00:10:41 +00:00
value: 'someuser',
)
click(css: '.content.active .main .js-submit')
2016-08-16 00:10:41 +00:00
match(
css: '.content.active .main select[name="group_id"]',
2016-08-16 00:10:41 +00:00
value: 'Users',
)
match(
css: '.content.active .main input[name="webhook"]',
2016-08-16 00:10:41 +00:00
value: 'http://some_url/webhook/123',
)
match(
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(
css: '.content.active .main select[name="group_id"]',
2016-08-16 00:10:41 +00:00
value: 'Users',
)
match(
css: '.content.active .main input[name="webhook"]',
2016-08-16 00:10:41 +00:00
value: 'http://some_url/webhook/123',
)
match(
css: '.content.active .main input[name="username"]',
2016-08-16 00:10:41 +00:00
value: 'someuser',
)
reload()
match(
css: '.content.active .main select[name="group_id"]',
2016-08-16 00:10:41 +00:00
value: 'Users',
)
match(
css: '.content.active .main input[name="webhook"]',
2016-08-16 00:10:41 +00:00
value: 'http://some_url/webhook/123',
)
match(
css: '.content.active .main input[name="username"]',
2016-08-16 00:10:41 +00:00
value: 'someuser',
)
switch(
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',
url: browser_url,
)
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(
css: '.content.active .main .js-switch',
2016-08-16 00:10:41 +00:00
type: 'on',
)
set(
css: '.content.active .main input[name="api_key"]',
2016-08-16 00:10:41 +00:00
value: 'some_api_key',
)
set(
css: '.content.active .main .js-userSync .js-new [name="source"]',
2016-08-16 00:10:41 +00:00
value: 'source1',
)
set(
css: '.content.active .main .js-userSync .js-new [name="destination"]',
2016-08-16 00:10:41 +00:00
value: 'destination1',
)
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(
css: '.content.active .main input[name="api_key"]',
2016-08-16 00:10:41 +00:00
value: 'some_api_key',
)
exists(
css: '.content.active .main .js-userSync [value="source1"]',
2016-08-16 00:10:41 +00:00
)
exists(
css: '.content.active .main .js-userSync [value="destination1"]',
2016-08-16 00:10:41 +00:00
)
reload()
match(
css: '.content.active .main input[name="api_key"]',
2016-08-16 00:10:41 +00:00
value: 'some_api_key',
)
exists(
css: '.content.active .main .js-userSync [value="source1"]',
2016-08-16 00:10:41 +00:00
)
exists(
css: '.content.active .main .js-userSync [value="destination1"]',
2016-08-16 00:10:41 +00:00
)
switch(
css: '.content.active .main .js-switch',
2016-08-16 00:10:41 +00:00
type: 'off',
)
set(
css: '.content.active .main input[name="api_key"]',
2016-08-16 00:10:41 +00:00
value: '-empty-',
)
click(css: '.content.active .main .js-submit')
2016-08-16 00:10:41 +00:00
reload()
match_not(
css: '.content.active .main input[name="api_key"]',
2016-08-16 00:10:41 +00:00
value: 'some_api_key',
)
match(
css: '.content.active .main input[name="api_key"]',
2016-08-16 00:10:41 +00:00
value: '-empty-',
)
exists(
css: '.content.active .main .js-userSync [value="source1"]',
2016-08-16 00:10:41 +00:00
)
exists(
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',
url: browser_url,
)
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(
css: '.content.active .main .js-switch',
2016-08-16 00:10:41 +00:00
type: 'on',
)
set(
css: '.content.active .main input[name="icinga_sender"]',
2016-08-16 00:10:41 +00:00
value: 'some@othersender.com',
)
select(
css: '.content.active .main select[name="icinga_auto_close"]',
2016-08-16 00:10:41 +00:00
value: 'no',
)
click(css: '.content.active .main .js-submit')
2016-08-16 00:10:41 +00:00
match(
css: '.content.active .main input[name="icinga_sender"]',
2016-08-16 00:10:41 +00:00
value: 'some@othersender.com',
)
match(
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(
css: '.content.active .main input[name="icinga_sender"]',
2016-08-16 00:10:41 +00:00
value: 'some@othersender.com',
)
match(
css: '.content.active .main select[name="icinga_auto_close"]',
2016-08-16 00:10:41 +00:00
value: 'no',
)
reload()
match(
css: '.content.active .main input[name="icinga_sender"]',
2016-08-16 00:10:41 +00:00
value: 'some@othersender.com',
)
match(
css: '.content.active .main select[name="icinga_auto_close"]',
2016-08-16 00:10:41 +00:00
value: 'no',
)
switch(
css: '.content.active .main .js-switch',
2016-08-16 00:10:41 +00:00
type: 'off',
)
set(
css: '.content.active .main input[name="icinga_sender"]',
2016-08-16 00:10:41 +00:00
value: 'icinga@monitoring.example.com',
)
select(
css: '.content.active .main select[name="icinga_auto_close"]',
2016-08-16 00:10:41 +00:00
value: 'yes',
)
click(css: '.content.active .main .js-submit')
2016-08-16 00:10:41 +00:00
match(
css: '.content.active .main input[name="icinga_sender"]',
2016-08-16 00:10:41 +00:00
value: 'icinga@monitoring.example.com',
)
match(
css: '.content.active .main select[name="icinga_auto_close"]',
2016-08-16 00:10:41 +00:00
value: 'yes',
)
end
end