Browse Source

Maintenance: Adapt SAML spec to KC 26 needs

Co-authored-by: Florian Liebe <fl@zammad.com>
Co-authored-by: Tobias Schäfer <ts@zammad.com>
Tobias Schäfer 2 weeks ago
parent
commit
5d961c1f8e
2 changed files with 11 additions and 9 deletions
  1. 2 2
      spec/system/apps/mobile/login_spec.rb
  2. 9 7
      spec/system/saml_spec.rb

+ 2 - 2
spec/system/apps/mobile/login_spec.rb

@@ -36,7 +36,7 @@ RSpec.describe 'Mobile > Login', app: :mobile, authenticated_as: false, type: :s
     end
   end
 
-  context 'when loggin in via external authentication provider', authenticated_as: false, integration: true, integration_standalone: :saml, required_envs: %w[KEYCLOAK_BASE_URL KEYCLOAK_ADMIN_USER KEYCLOAK_ADMIN_PASSWORD] do
+  context 'when logging in via external authentication provider', authenticated_as: false, integration: true, integration_standalone: :saml, required_envs: %w[KEYCLOAK_BASE_URL KEYCLOAK_ADMIN_USER KEYCLOAK_ADMIN_PASSWORD] do
     let(:zammad_base_url)              { "#{Capybara.app_host}:#{Capybara.current_session.server.port}" }
     let(:zammad_saml_metadata)         { "#{zammad_base_url}/auth/saml/metadata" }
     let(:saml_base_url)                { ENV['KEYCLOAK_BASE_URL'] }
@@ -73,8 +73,8 @@ RSpec.describe 'Mobile > Login', app: :mobile, authenticated_as: false, type: :s
       # Manual logout
       click_on 'JD' # avatar
       click_on 'Sign out'
-      expect(page).to have_current_path(%r{/login})
       wait_for_test_flag('applicationLoaded.loaded', skip_clearing: true)
+      expect(page).to have_current_path(%r{/login})
 
       visit '/'
       expect_current_route '/login'

+ 9 - 7
spec/system/saml_spec.rb

@@ -53,6 +53,11 @@ RSpec.describe 'SAML Authentication', authenticated_as: false, integration: true
     find_by_id('app')
   end
 
+  def check_mobile_logout_saml
+    find('.pf-v5-c-masthead__content .pf-v5-c-menu-toggle.pf-m-plain').click
+    expect(page).to have_text('Sign out')
+  end
+
   # TODO: Should be replaced with tests for the new desktop-view (or the test in general should be removed outside of selenium).
   describe 'SP login and SP logout' do
     before do
@@ -146,7 +151,7 @@ RSpec.describe 'SAML Authentication', authenticated_as: false, integration: true
       visit saml_realm_zammad_accounts
 
       click_on 'John Doe'
-      find('a', text: 'Sign out').click
+      find('span', text: 'Sign out', class: 'pf-v5-c-menu__item-text').click
 
       visit '/'
       expect(page).to have_current_route('login')
@@ -216,8 +221,7 @@ RSpec.describe 'SAML Authentication', authenticated_as: false, integration: true
         login_saml(app: 'mobile')
 
         visit saml_realm_zammad_accounts
-        click_on 'Actions'
-        expect(page).to have_text('Sign out')
+        check_mobile_logout_saml
       end
     end
 
@@ -253,8 +257,7 @@ RSpec.describe 'SAML Authentication', authenticated_as: false, integration: true
         login_saml(app: 'mobile')
 
         visit saml_realm_zammad_accounts
-        click_on 'Actions'
-        expect(page).to have_text('Sign out')
+        check_mobile_logout_saml
       end
     end
 
@@ -274,8 +277,7 @@ RSpec.describe 'SAML Authentication', authenticated_as: false, integration: true
         end
 
         visit saml_realm_zammad_accounts
-        click_on 'Actions'
-        expect(page).to have_text('Sign out')
+        check_mobile_logout_saml
       end
     end