Maintenance: Port old first steps tests to capybara.
This commit is contained in:
parent
e9f0d3bcb1
commit
fc461e74c1
8 changed files with 113 additions and 213 deletions
|
@ -27,9 +27,3 @@
|
|||
- .template_browser-core_chrome
|
||||
variables:
|
||||
TEST_SLICE: "5"
|
||||
|
||||
6_chrome:
|
||||
extends:
|
||||
- .template_browser-core_chrome
|
||||
variables:
|
||||
TEST_SLICE: "6"
|
||||
|
|
|
@ -28,9 +28,3 @@
|
|||
- .template_browser-core_firefox
|
||||
variables:
|
||||
TEST_SLICE: "5"
|
||||
|
||||
6_firefox:
|
||||
extends:
|
||||
- .template_browser-core_firefox
|
||||
variables:
|
||||
TEST_SLICE: "6"
|
||||
|
|
|
@ -44,7 +44,6 @@ if [ "$LEVEL" == '1' ]; then
|
|||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/customer_ticket_create_test.rb
|
||||
rm test/browser/first_steps_test.rb
|
||||
# test/browser/manage_test.rb
|
||||
# test/browser/swich_to_user_test.rb
|
||||
# test/browser/taskbar_session_test.rb
|
||||
|
@ -91,7 +90,6 @@ elif [ "$LEVEL" == '2' ]; then
|
|||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/customer_ticket_create_test.rb
|
||||
rm test/browser/first_steps_test.rb
|
||||
rm test/browser/manage_test.rb
|
||||
rm test/browser/taskbar_session_test.rb
|
||||
rm test/browser/taskbar_task_test.rb
|
||||
|
@ -137,7 +135,6 @@ elif [ "$LEVEL" == '3' ]; then
|
|||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/customer_ticket_create_test.rb
|
||||
rm test/browser/first_steps_test.rb
|
||||
rm test/browser/manage_test.rb
|
||||
rm test/browser/taskbar_session_test.rb
|
||||
rm test/browser/taskbar_task_test.rb
|
||||
|
@ -183,7 +180,6 @@ elif [ "$LEVEL" == '4' ]; then
|
|||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
# test/browser/customer_ticket_create_test.rb
|
||||
rm test/browser/first_steps_test.rb
|
||||
rm test/browser/manage_test.rb
|
||||
rm test/browser/taskbar_session_test.rb
|
||||
rm test/browser/taskbar_task_test.rb
|
||||
|
@ -228,55 +224,6 @@ elif [ "$LEVEL" == '5' ]; then
|
|||
# test/browser/agent_user_manage_test.rb
|
||||
# test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/customer_ticket_create_test.rb
|
||||
rm test/browser/first_steps_test.rb
|
||||
rm test/browser/manage_test.rb
|
||||
rm test/browser/taskbar_session_test.rb
|
||||
rm test/browser/taskbar_task_test.rb
|
||||
rm test/browser/user_access_permissions_test.rb
|
||||
rm test/browser/user_switch_cache_test.rb
|
||||
|
||||
elif [ "$LEVEL" == '6' ]; then
|
||||
echo "slicing level 6"
|
||||
|
||||
# only profile action & admin
|
||||
rm test/browser/aaa_getting_started_test.rb
|
||||
cp contrib/auto_wizard_test.json auto_wizard.json
|
||||
cp test/integration/aaa_auto_wizard_base_setup_test.rb test/browser/aaa_auto_wizard_base_setup_test.rb
|
||||
rm test/browser/abb_one_group_test.rb
|
||||
rm test/browser/admin_drag_drop_to_new_group_test.rb
|
||||
rm test/browser/admin_overview_test.rb
|
||||
rm test/browser/admin_role_test.rb
|
||||
rm test/browser/agent_navigation_and_title_test.rb
|
||||
rm test/browser/agent_organization_profile_test.rb
|
||||
rm test/browser/agent_ticket_attachment_test.rb
|
||||
rm test/browser/agent_ticket_create_available_types_test.rb
|
||||
rm test/browser/agent_ticket_create_attachment_missing_after_reload_test.rb
|
||||
rm test/browser/agent_ticket_create_cc_tokenizer_test.rb
|
||||
rm test/browser/agent_ticket_create_default_type_test.rb
|
||||
rm test/browser/agent_ticket_create_reset_customer_selection_test.rb
|
||||
rm test/browser/agent_ticket_create_template_test.rb
|
||||
rm test/browser/agent_ticket_email_reply_keep_body_test.rb
|
||||
rm test/browser/agent_ticket_email_signature_test.rb
|
||||
rm test/browser/agent_ticket_link_test.rb
|
||||
rm test/browser/agent_ticket_macro_test.rb
|
||||
rm test/browser/agent_ticket_merge_test.rb
|
||||
rm test/browser/agent_ticket_online_notification_test.rb
|
||||
rm test/browser/agent_ticket_overview_group_by_organization_test.rb
|
||||
rm test/browser/agent_ticket_overview_level0_test.rb
|
||||
rm test/browser/agent_ticket_overview_level1_test.rb
|
||||
rm test/browser/agent_ticket_overview_pending_til_test.rb
|
||||
rm test/browser/agent_ticket_overview_tab_test.rb
|
||||
rm test/browser/agent_ticket_tag_test.rb
|
||||
rm test/browser/agent_ticket_task_changed_test.rb
|
||||
rm test/browser/agent_ticket_text_module_test.rb
|
||||
rm test/browser/agent_ticket_time_accounting_test.rb
|
||||
rm test/browser/agent_ticket_update_with_attachment_refresh_test.rb
|
||||
rm test/browser/agent_ticket_update_and_reload_test.rb
|
||||
rm test/browser/agent_ticket_zoom_hide_test.rb
|
||||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/customer_ticket_create_test.rb
|
||||
# test/browser/first_steps_test.rb
|
||||
rm test/browser/manage_test.rb
|
||||
rm test/browser/taskbar_session_test.rb
|
||||
rm test/browser/taskbar_task_test.rb
|
||||
|
@ -284,6 +231,6 @@ elif [ "$LEVEL" == '6' ]; then
|
|||
rm test/browser/user_switch_cache_test.rb
|
||||
|
||||
else
|
||||
echo "ERROR: Invalid level $LEVEL - 1, 2, 3, 4, 5 or 6 is available"
|
||||
echo "ERROR: Invalid level $LEVEL - 1, 2, 3, 4 or 5 is available"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -10,10 +10,6 @@ Capybara.add_selector(:active_content) do
|
|||
css { |content_class| ['.content.active', content_class].compact.join(' ') }
|
||||
end
|
||||
|
||||
Capybara.add_selector(:active_modal_content) do
|
||||
css { |content_class| ['.modal .modal-content', content_class].compact.join(' ') }
|
||||
end
|
||||
|
||||
Capybara.add_selector(:active_ticket_article) do
|
||||
css { |article| ['.content.active', "#article-#{article.id}" ].compact.join(' ') }
|
||||
end
|
||||
|
|
28
spec/support/capybara/sessions_jobs.rb
Normal file
28
spec/support/capybara/sessions_jobs.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.before(type: :system) do |example|
|
||||
sessions_jobs_required = example.metadata.fetch(:sessions_jobs, false)
|
||||
|
||||
next if !sessions_jobs_required
|
||||
|
||||
allow_any_instance_of(Sessions::Backend::Base).to receive(:to_run?).and_return(true) # rubocop:disable RSpec/AnyInstance
|
||||
end
|
||||
|
||||
config.around(:each, type: :system) do |example|
|
||||
sessions_jobs_required = example.metadata.fetch(:sessions_jobs, false)
|
||||
|
||||
if sessions_jobs_required
|
||||
sessions_jobs_thread = Thread.new do
|
||||
Sessions.jobs
|
||||
end
|
||||
end
|
||||
|
||||
example.run
|
||||
|
||||
next if !sessions_jobs_required
|
||||
|
||||
sessions_jobs_thread.exit
|
||||
sessions_jobs_thread.join
|
||||
end
|
||||
end
|
|
@ -85,21 +85,18 @@ RSpec.describe 'Keyboard Shortcuts', type: :system do
|
|||
context 'for list of shortcuts' do
|
||||
before do
|
||||
send_keys([*hot_keys, 'h'])
|
||||
wait.until_exists { find :active_modal_content }
|
||||
end
|
||||
|
||||
it 'shows list of shortcuts' do
|
||||
within :active_modal_content do
|
||||
in_modal disappears: false do
|
||||
expect(page).to have_selector('h1.modal-title', text: 'Keyboard Shortcuts')
|
||||
end
|
||||
end
|
||||
|
||||
it 'hides list of shortcuts when re-pressed' do
|
||||
within :active_modal_content do
|
||||
in_modal do
|
||||
send_keys([*hot_keys, 'h'])
|
||||
end
|
||||
|
||||
expect(page).to have_no_selector :active_modal_content
|
||||
end
|
||||
end
|
||||
|
||||
|
|
82
spec/system/setup/first_steps_spec.rb
Normal file
82
spec/system/setup/first_steps_spec.rb
Normal file
|
@ -0,0 +1,82 @@
|
|||
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'First Steps', type: :system do
|
||||
|
||||
let(:agent) { "bob.smith_#{SecureRandom.uuid}" }
|
||||
let(:customer) { "customer.smith_#{SecureRandom.uuid}" }
|
||||
|
||||
before do
|
||||
visit 'dashboard'
|
||||
|
||||
within :active_content do
|
||||
click '.tab[data-area="first-steps-widgets"]'
|
||||
end
|
||||
end
|
||||
|
||||
it 'show first steps configuration page' do
|
||||
within :active_content do
|
||||
expect(page).to have_text 'Configuration'
|
||||
end
|
||||
end
|
||||
|
||||
it 'invites agent (with more then one group)' do
|
||||
within(:active_content) { click '.js-inviteAgent' }
|
||||
|
||||
target_group = Group.last
|
||||
|
||||
in_modal do
|
||||
fill_in 'firstname', with: 'Bob'
|
||||
fill_in 'lastname', with: 'Smith'
|
||||
fill_in 'email', with: "#{agent}@example.com"
|
||||
|
||||
check "group_ids::#{target_group.id}", option: 'full', allow_label_click: true
|
||||
click('button')
|
||||
end
|
||||
|
||||
wait.until { expect(User.last).to have_attributes(firstname: 'Bob', lastname: 'Smith', group_ids: [target_group.id]) }
|
||||
expect(page).to have_no_text 'Sending'
|
||||
end
|
||||
|
||||
it 'invites customer' do
|
||||
within(:active_content) { click '.js-inviteCustomer' }
|
||||
|
||||
in_modal do
|
||||
fill_in 'firstname', with: 'Client'
|
||||
fill_in 'lastname', with: 'Smith'
|
||||
fill_in 'email', with: "#{customer}@example.com"
|
||||
|
||||
click('button')
|
||||
end
|
||||
|
||||
wait.until { expect(User.last).to have_attributes(firstname: 'Client', lastname: 'Smith') }
|
||||
expect(page).to have_no_text 'Sending'
|
||||
end
|
||||
|
||||
it 'creates test ticket', sessions_jobs: true do
|
||||
# make window large enough to show activity stream
|
||||
page.current_window.resize_to(1520, 800)
|
||||
|
||||
initial_ticket_count = Ticket.count
|
||||
|
||||
within(:active_content) { click '.js-testTicket' }
|
||||
|
||||
within '.sidebar .js-activityContent' do
|
||||
wait.until { Ticket.count == (initial_ticket_count + 1) }
|
||||
expect(page).to have_text 'Nicole Braun created article for Test Ticket!'
|
||||
end
|
||||
end
|
||||
|
||||
it 'updates online form channel' do
|
||||
Setting.set('form_ticket_create', true)
|
||||
|
||||
page.refresh
|
||||
|
||||
within :active_content do
|
||||
click '.tab[data-area="first-steps-widgets"]'
|
||||
end
|
||||
|
||||
expect(page).to have_selector 'a[href="#channels/form"].todo.is-done'
|
||||
end
|
||||
end
|
|
@ -1,138 +0,0 @@
|
|||
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
||||
|
||||
require 'browser_test_helper'
|
||||
|
||||
class FirstStepsTest < TestCase
|
||||
|
||||
def test_basic
|
||||
agent = "bob.smith_#{SecureRandom.uuid}"
|
||||
customer = "customer.smith_#{SecureRandom.uuid}"
|
||||
|
||||
@browser = browser_instance
|
||||
login(
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all
|
||||
|
||||
click(css: '.active.content .tab[data-area="first-steps-widgets"]')
|
||||
watch_for(
|
||||
css: '.active.content',
|
||||
value: 'Configuration',
|
||||
)
|
||||
|
||||
# invite agent (with more then one group)
|
||||
click(css: '.active.content .js-inviteAgent')
|
||||
|
||||
modal_ready
|
||||
|
||||
set(
|
||||
css: '.modal [name="firstname"]',
|
||||
value: 'Bob',
|
||||
)
|
||||
set(
|
||||
css: '.modal [name="lastname"]',
|
||||
value: 'Smith',
|
||||
)
|
||||
set(
|
||||
css: '.modal [name="email"]',
|
||||
value: "#{agent}@example.com",
|
||||
)
|
||||
check(css: '.modal .js-groupListItem[value=full]')
|
||||
click(
|
||||
css: '.modal button.btn.btn--primary',
|
||||
fast: true,
|
||||
)
|
||||
watch_for(
|
||||
css: 'body div.modal',
|
||||
value: 'Sending',
|
||||
)
|
||||
watch_for_disappear(
|
||||
css: 'body div.modal',
|
||||
value: 'Sending',
|
||||
)
|
||||
modal_disappear
|
||||
|
||||
# invite customer
|
||||
click(css: '.active.content .js-inviteCustomer')
|
||||
modal_ready
|
||||
set(
|
||||
css: '.modal [name="firstname"]',
|
||||
value: 'Client',
|
||||
)
|
||||
set(
|
||||
css: '.modal [name="lastname"]',
|
||||
value: 'Smith',
|
||||
)
|
||||
set(
|
||||
css: '.modal [name="email"]',
|
||||
value: "#{customer}@example.com",
|
||||
)
|
||||
set(
|
||||
css: '.modal [data-name="note"]',
|
||||
value: 'some note',
|
||||
)
|
||||
click(
|
||||
css: '.modal button.btn.btn--primary',
|
||||
fast: true,
|
||||
)
|
||||
watch_for(
|
||||
css: 'body div.modal',
|
||||
value: 'Sending',
|
||||
)
|
||||
watch_for_disappear(
|
||||
css: 'body div.modal',
|
||||
value: 'Sending',
|
||||
)
|
||||
modal_disappear
|
||||
|
||||
# test ticket
|
||||
click(
|
||||
css: '.active.content .js-testTicket',
|
||||
fast: true,
|
||||
)
|
||||
modal_ready
|
||||
watch_for(
|
||||
css: 'body div.modal',
|
||||
value: 'A Test Ticket has been created',
|
||||
)
|
||||
click(
|
||||
css: '.modal .modal-body',
|
||||
fast: true,
|
||||
)
|
||||
watch_for_disappear(
|
||||
css: 'body div.modal',
|
||||
value: 'Test Ticket',
|
||||
)
|
||||
modal_disappear
|
||||
|
||||
execute(
|
||||
js: '$(".active.content .sidebar").show()',
|
||||
)
|
||||
watch_for(
|
||||
css: '.active.content .js-activityContent',
|
||||
value: 'Nicole Braun created article for Test Ticket!',
|
||||
timeout: 35,
|
||||
)
|
||||
|
||||
# check update
|
||||
click(css: '.active.content a[href="#channels/form"]')
|
||||
sleep 2
|
||||
switch(
|
||||
css: '.content.active .js-formSetting',
|
||||
type: 'on',
|
||||
)
|
||||
click(css: '#navigation a[href="#dashboard"]')
|
||||
hit = false
|
||||
37.times do
|
||||
next if !@browser.find_elements(css: '.active.content a[href="#channels/form"].todo.is-done')[0]
|
||||
|
||||
hit = true
|
||||
break
|
||||
end
|
||||
assert(hit)
|
||||
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue