Maintenance: Port System > Monitoring test to capybara.

This commit is contained in:
Martin Gruner 2021-10-08 12:13:05 +02:00
parent 1de9c8d803
commit 52587ca9e2
3 changed files with 24 additions and 50 deletions

View file

@ -49,7 +49,6 @@ if [ "$LEVEL" == '1' ]; then
rm test/browser/integration_test.rb rm test/browser/integration_test.rb
rm test/browser/keyboard_shortcuts_test.rb rm test/browser/keyboard_shortcuts_test.rb
# test/browser/manage_test.rb # test/browser/manage_test.rb
# test/browser/monitoring_test.rb
rm test/browser/integration_sipgate_test.rb rm test/browser/integration_sipgate_test.rb
rm test/browser/integration_cti_test.rb rm test/browser/integration_cti_test.rb
rm test/browser/preferences_language_test.rb rm test/browser/preferences_language_test.rb
@ -103,7 +102,6 @@ elif [ "$LEVEL" == '2' ]; then
rm test/browser/integration_test.rb rm test/browser/integration_test.rb
rm test/browser/keyboard_shortcuts_test.rb rm test/browser/keyboard_shortcuts_test.rb
rm test/browser/manage_test.rb rm test/browser/manage_test.rb
rm test/browser/monitoring_test.rb
rm test/browser/integration_sipgate_test.rb rm test/browser/integration_sipgate_test.rb
rm test/browser/integration_cti_test.rb rm test/browser/integration_cti_test.rb
rm test/browser/preferences_language_test.rb rm test/browser/preferences_language_test.rb
@ -157,7 +155,6 @@ elif [ "$LEVEL" == '3' ]; then
rm test/browser/integration_test.rb rm test/browser/integration_test.rb
rm test/browser/keyboard_shortcuts_test.rb rm test/browser/keyboard_shortcuts_test.rb
rm test/browser/manage_test.rb rm test/browser/manage_test.rb
rm test/browser/monitoring_test.rb
rm test/browser/integration_sipgate_test.rb rm test/browser/integration_sipgate_test.rb
rm test/browser/integration_cti_test.rb rm test/browser/integration_cti_test.rb
rm test/browser/preferences_language_test.rb rm test/browser/preferences_language_test.rb
@ -211,7 +208,6 @@ elif [ "$LEVEL" == '4' ]; then
rm test/browser/integration_test.rb rm test/browser/integration_test.rb
rm test/browser/keyboard_shortcuts_test.rb rm test/browser/keyboard_shortcuts_test.rb
rm test/browser/manage_test.rb rm test/browser/manage_test.rb
rm test/browser/monitoring_test.rb
rm test/browser/integration_sipgate_test.rb rm test/browser/integration_sipgate_test.rb
rm test/browser/integration_cti_test.rb rm test/browser/integration_cti_test.rb
rm test/browser/preferences_language_test.rb rm test/browser/preferences_language_test.rb
@ -264,7 +260,6 @@ elif [ "$LEVEL" == '5' ]; then
rm test/browser/integration_test.rb rm test/browser/integration_test.rb
rm test/browser/keyboard_shortcuts_test.rb rm test/browser/keyboard_shortcuts_test.rb
rm test/browser/manage_test.rb rm test/browser/manage_test.rb
rm test/browser/monitoring_test.rb
rm test/browser/integration_sipgate_test.rb rm test/browser/integration_sipgate_test.rb
rm test/browser/integration_cti_test.rb rm test/browser/integration_cti_test.rb
rm test/browser/preferences_language_test.rb rm test/browser/preferences_language_test.rb
@ -320,7 +315,6 @@ elif [ "$LEVEL" == '6' ]; then
# test/browser/integration_test.rb # test/browser/integration_test.rb
# test/browser/keyboard_shortcuts_test.rb # test/browser/keyboard_shortcuts_test.rb
rm test/browser/manage_test.rb rm test/browser/manage_test.rb
rm test/browser/monitoring_test.rb
# rm test/browser/integration_sipgate_test.rb # rm test/browser/integration_sipgate_test.rb
# rm test/browser/integration_cti_test.rb # rm test/browser/integration_cti_test.rb
# test/browser/preferences_language_test.rb # test/browser/preferences_language_test.rb

View file

@ -0,0 +1,24 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'rails_helper'
RSpec.describe 'System > Monitoring', type: :system do
context 'when showing the token' do
it 'works correctly' do
visit 'system/monitoring'
within :active_content do
token = find('.js-token').value
url = find('.js-url').value
expect(url).to include(token)
click '.js-resetToken'
new_token = find('.js-token').value
new_url = find('.js-url').value
expect(new_url).to include(new_token)
expect(token).not_to eq(new_token)
end
end
end
end

View file

@ -1,44 +0,0 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'browser_test_helper'
class MonitoringTest < TestCase
def test_mode
browser1 = browser_instance
login(
browser: browser1,
username: 'admin@example.com',
password: 'test',
url: browser_url,
)
click(
browser: browser1,
css: 'a[href="#manage"]',
)
click(
browser: browser1,
css: 'a[href="#system/monitoring"]',
)
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,
css: '.active.content .js-resetToken',
)
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