2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2018-05-28 23:45:29 +00:00
|
|
|
require 'browser_test_helper'
|
|
|
|
|
2018-05-28 06:42:04 +00:00
|
|
|
class IntegrationSipgateTest < TestCase
|
|
|
|
# Regression test for #2017
|
|
|
|
def test_nav_menu_notification_badge_clears
|
2021-09-20 10:47:05 +00:00
|
|
|
id = SecureRandom.uuid
|
2018-05-28 23:45:29 +00:00
|
|
|
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
2021-08-17 12:10:02 +00:00
|
|
|
username: 'admin@example.com',
|
2018-05-28 23:45:29 +00:00
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-05-28 23:45:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
click(css: 'a[href="#manage"]')
|
|
|
|
click(css: 'a[href="#system/integration"]')
|
|
|
|
click(css: 'a[href="#system/integration/sipgate"]')
|
|
|
|
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .js-switch',
|
2018-05-28 23:45:29 +00:00
|
|
|
type: 'on'
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: 'a[href="#cti"]',
|
2018-06-05 08:31:59 +00:00
|
|
|
timeout: 4,
|
2018-05-28 23:45:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
click(css: 'a[href="#cti"]')
|
|
|
|
|
2018-06-05 08:31:59 +00:00
|
|
|
call_counter = @browser.find_elements(css: '.js-phoneMenuItem .counter')
|
|
|
|
.first&.text.to_i
|
|
|
|
|
|
|
|
# simulate cti callbacks
|
2018-05-28 23:45:29 +00:00
|
|
|
url = URI.join(browser_url, 'api/v1/sipgate/in')
|
2018-06-05 08:31:59 +00:00
|
|
|
params = {
|
|
|
|
direction: 'in',
|
2018-12-19 17:31:51 +00:00
|
|
|
from: '491715000003',
|
|
|
|
to: '4930600000004',
|
|
|
|
callId: "4991155921769858279-#{id}",
|
|
|
|
cause: 'busy'
|
2018-06-05 08:31:59 +00:00
|
|
|
}
|
2018-05-28 23:45:29 +00:00
|
|
|
Net::HTTP.post_form(url, params.merge(event: 'newCall'))
|
|
|
|
Net::HTTP.post_form(url, params.merge(event: 'hangup'))
|
|
|
|
|
2019-01-12 11:19:00 +00:00
|
|
|
# flanky
|
2018-05-28 23:45:29 +00:00
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.js-phoneMenuItem .counter',
|
|
|
|
value: (call_counter + 1).to_s,
|
2018-06-05 08:31:59 +00:00
|
|
|
timeout: 4,
|
2018-05-28 23:45:29 +00:00
|
|
|
)
|
|
|
|
|
2018-06-05 08:31:59 +00:00
|
|
|
check(css: '.content.active .table-checkbox input')
|
2018-05-28 23:45:29 +00:00
|
|
|
|
|
|
|
watch_for_disappear(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.js-phoneMenuItem .counter',
|
2018-06-05 08:31:59 +00:00
|
|
|
timeout: 6,
|
2018-05-28 23:45:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
click(css: 'a[href="#manage"]')
|
|
|
|
click(css: 'a[href="#system/integration"]')
|
2018-06-05 08:31:59 +00:00
|
|
|
click(css: 'a[href="#system/integration/sipgate"]')
|
2018-05-28 23:45:29 +00:00
|
|
|
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .js-switch',
|
2018-05-28 23:45:29 +00:00
|
|
|
type: 'off'
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|