Specs enhancement: avoids showing clues modal

This commit is contained in:
Mantas Masalskis 2020-05-15 00:32:49 +03:00 committed by Thorsten Eckel
parent fa143749e4
commit 87987ac71d
3 changed files with 13 additions and 10 deletions

View file

@ -1,5 +1,9 @@
FactoryBot.define do FactoryBot.define do
factory :user do factory :user do
transient do
intro_clues { true }
end
login { 'nicole.braun' } login { 'nicole.braun' }
firstname { 'Nicole' } firstname { 'Nicole' }
lastname { 'Braun' } lastname { 'Braun' }
@ -10,6 +14,13 @@ FactoryBot.define do
updated_by_id { 1 } updated_by_id { 1 }
created_by_id { 1 } created_by_id { 1 }
callback(:after_stub, :before_create) do |object, context|
next if !context.intro_clues
object.preferences ||= {}
object.preferences[:intro] = true
end
factory :customer_user, aliases: %i[customer] do factory :customer_user, aliases: %i[customer] do
role_ids { Role.signup_role_ids.sort } role_ids { Role.signup_role_ids.sort }

View file

@ -36,10 +36,6 @@ module CommonActions
wait(4).until_exists do wait(4).until_exists do
current_login current_login
end end
return if User.find_by(login: current_login).preferences[:intro]
find(:clues_close, wait: 3).in_fixed_postion.click
end end
# Checks if the current session is logged in. # Checks if the current session is logged in.

View file

@ -1,14 +1,10 @@
RSpec.configure do |config| RSpec.configure do |config|
config.before(:each, type: :system) do |example| config.before(:each, type: :system) do |example|
# check if system is already set up
next if Setting.get('system_init_done')
# check if system should get set up # check if system should get set up
next if !example.metadata.fetch(:set_up, true) next if !example.metadata.fetch(:set_up, true)
# perform setup via auto_wizard # check if system is already set up and perform setup via auto_wizard if needed
Rake::Task['zammad:setup:auto_wizard'].execute Rake::Task['zammad:setup:auto_wizard'].execute if !Setting.get('system_init_done')
# skip intro/clues for created agents/admins # skip intro/clues for created agents/admins
%w[master@example.com agent1@example.com].each do |login| %w[master@example.com agent1@example.com].each do |login|