diff --git a/spec/system/knowledge_base/locale/category/permissions_spec.rb b/spec/system/knowledge_base/locale/category/permissions_spec.rb index 5e1fa81db..d241cc2d0 100644 --- a/spec/system/knowledge_base/locale/category/permissions_spec.rb +++ b/spec/system/knowledge_base/locale/category/permissions_spec.rb @@ -14,8 +14,6 @@ RSpec.describe 'Knowledge Base Locale Category Permissions', type: :system do it 'shows roles with has KB permissions only' do open_page category - find('[data-action=permissions]').click - in_modal disappears: false do expect(page) .to have_text(%r{Admin}i) @@ -28,8 +26,6 @@ RSpec.describe 'Knowledge Base Locale Category Permissions', type: :system do it 'shows existing permissions when category has no permissions' do open_page category - find('[data-action=permissions]').click - in_modal disappears: false do expect(page) .to have_css("input[name='#{role_editor.id}'][value='editor'][checked]:not([disabled])", visible: :all) @@ -43,8 +39,6 @@ RSpec.describe 'Knowledge Base Locale Category Permissions', type: :system do open_page category - find('[data-action=permissions]').click - in_modal disappears: false do expect(page) .to have_css("input[name='#{role_reader.id}'][value='reader']:not([disabled])", visible: :all) @@ -57,8 +51,6 @@ RSpec.describe 'Knowledge Base Locale Category Permissions', type: :system do open_page child_category - find('[data-action=permissions]').click - in_modal disappears: false do expect(page) .to have_css("input[name='#{role_reader.id}'][value='reader']:not([disabled])", visible: :all) @@ -71,8 +63,6 @@ RSpec.describe 'Knowledge Base Locale Category Permissions', type: :system do open_page child_category - find('[data-action=permissions]').click - in_modal disappears: false do expect(page) .to have_css("input[name='#{role_another_editor.id}'][value='none']:not([disabled])", visible: :all) @@ -86,8 +76,6 @@ RSpec.describe 'Knowledge Base Locale Category Permissions', type: :system do open_page child_category - find('[data-action=permissions]').click - in_modal disappears: false do expect(page) .to have_css("input[name='#{role_another_editor.id}'][value='none'][checked]:not([disabled])", visible: :all) @@ -101,8 +89,6 @@ RSpec.describe 'Knowledge Base Locale Category Permissions', type: :system do open_page child_category - find('[data-action=permissions]').click - in_modal disappears: false do expect(page) .to have_css("input[name='#{role_reader.id}'][value='none'][checked]:not([disabled])", visible: :all) @@ -115,8 +101,6 @@ RSpec.describe 'Knowledge Base Locale Category Permissions', type: :system do it 'saves permissions' do open_page category - find('[data-action=permissions]').click - in_modal do find("input[name='#{role_reader.id}'][value='none']", visible: :all) .ancestor('label') @@ -137,8 +121,6 @@ RSpec.describe 'Knowledge Base Locale Category Permissions', type: :system do open_page category - find('[data-action=permissions]').click - in_modal do find("input[name='#{role_reader.id}'][value='reader']", visible: :all) .ancestor('label') @@ -157,8 +139,6 @@ RSpec.describe 'Knowledge Base Locale Category Permissions', type: :system do it 'does not allow to lock user himself' do open_page category - find('[data-action=permissions]').click - in_modal disappears: false do find("input[name='#{role_editor.id}'][value='reader']", visible: :all) .ancestor('label') @@ -173,5 +153,9 @@ RSpec.describe 'Knowledge Base Locale Category Permissions', type: :system do def open_page(category) visit "knowledge_base/#{knowledge_base.id}/locale/#{Locale.first.locale}/category/#{category.id}/edit" + + find('[data-action=permissions]').click + + travel_to 1.hour.from_now end end diff --git a/spec/system/knowledge_base/locale/knowledge_base/permissions_spec.rb b/spec/system/knowledge_base/locale/knowledge_base/permissions_spec.rb index afe9ba07d..aa25fcea8 100644 --- a/spec/system/knowledge_base/locale/knowledge_base/permissions_spec.rb +++ b/spec/system/knowledge_base/locale/knowledge_base/permissions_spec.rb @@ -12,8 +12,6 @@ RSpec.describe 'Knowledge Base Locale Knowledge Base Permissions', type: :system it 'shows roles with has KB permissions only' do open_page - find('[data-action=permissions]').click - in_modal disappears: false do expect(page) .to have_text(%r{Admin}i) @@ -26,8 +24,6 @@ RSpec.describe 'Knowledge Base Locale Knowledge Base Permissions', type: :system it 'shows existing permissions when KB has no permissions' do open_page - find('[data-action=permissions]').click - in_modal disappears: false do expect(page) .to have_css("input[name='#{role_editor.id}'][value='editor'][checked]", visible: :all) @@ -40,8 +36,6 @@ RSpec.describe 'Knowledge Base Locale Knowledge Base Permissions', type: :system open_page - find('[data-action=permissions]').click - in_modal disappears: false do expect(page) .to have_css("input[name='#{role_another_editor.id}'][value='reader'][checked]", visible: :all) @@ -53,9 +47,8 @@ RSpec.describe 'Knowledge Base Locale Knowledge Base Permissions', type: :system describe 'saving changes' do it 'saves permissions' do role_another_editor - open_page - find('[data-action=permissions]').click + open_page in_modal do find("input[name='#{role_another_editor.id}'][value='reader']", visible: :all) @@ -75,9 +68,8 @@ RSpec.describe 'Knowledge Base Locale Knowledge Base Permissions', type: :system it 'allows to modify existing permissions' do KnowledgeBase::PermissionsUpdate.new(knowledge_base).update! role_another_editor => 'reader' - open_page - find('[data-action=permissions]').click + open_page in_modal do find("input[name='#{role_another_editor.id}'][value='editor']", visible: :all) @@ -98,8 +90,6 @@ RSpec.describe 'Knowledge Base Locale Knowledge Base Permissions', type: :system it 'does not allow to lock user himself' do open_page - find('[data-action=permissions]').click - in_modal disappears: false do find("input[name='#{role_editor.id}'][value='reader']", visible: :all) .ancestor('label') @@ -114,5 +104,9 @@ RSpec.describe 'Knowledge Base Locale Knowledge Base Permissions', type: :system def open_page visit "knowledge_base/#{knowledge_base.id}/locale/#{Locale.first.locale}/edit" + + find('[data-action=permissions]').click + + travel_to 1.hour.from_now end end