2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2016-11-23 14:25:44 +00:00
|
|
|
require 'browser_test_helper'
|
|
|
|
|
|
|
|
class MonitoringTest < TestCase
|
|
|
|
|
|
|
|
def test_mode
|
|
|
|
browser1 = browser_instance
|
|
|
|
login(
|
2018-12-19 17:31:51 +00:00
|
|
|
browser: browser1,
|
2016-11-23 14:25:44 +00:00
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2016-11-23 14:25:44 +00:00
|
|
|
)
|
|
|
|
click(
|
|
|
|
browser: browser1,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: 'a[href="#manage"]',
|
2016-11-23 14:25:44 +00:00
|
|
|
)
|
|
|
|
click(
|
|
|
|
browser: browser1,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: 'a[href="#system/monitoring"]',
|
2016-11-23 14:25:44 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
token = browser1.find_elements(css: '.active.content .js-token')[0].attribute('value')
|
|
|
|
url = browser1.find_elements(css: '.active.content .js-url')[0].attribute('value')
|
|
|
|
|
|
|
|
assert_match(token.to_s, url)
|
|
|
|
|
|
|
|
click(
|
|
|
|
browser: browser1,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active.content .js-resetToken',
|
2016-11-23 14:25:44 +00:00
|
|
|
)
|
|
|
|
sleep 3
|
|
|
|
|
|
|
|
token_new = browser1.find_elements(css: '.active.content .js-token')[0].attribute('value')
|
|
|
|
url_new = browser1.find_elements(css: '.active.content .js-url')[0].attribute('value')
|
|
|
|
|
|
|
|
assert_not_equal(token, token_new)
|
|
|
|
assert_not_equal(url, url_new)
|
|
|
|
assert_match(token_new.to_s, url_new)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|