Maintenance: Stabilize KB granular permissions tests.
This commit is contained in:
parent
eb9882f39f
commit
381713e5db
2 changed files with 10 additions and 32 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue