From d0ebdbdd8a7e1babe5b6521ab6f1877375fe1741 Mon Sep 17 00:00:00 2001 From: Henriette Darge Date: Mon, 23 Mar 2026 15:56:06 +0100 Subject: [PATCH] Adapt test to new DangerDialogs --- .../features/administration/saml_crud_spec.rb | 16 ++-------------- .../synchronized_groups_controller_spec.rb | 7 ++++--- .../spec/features/administration_spec.rb | 4 ++-- .../administration/oidc_custom_crud_spec.rb | 16 ++-------------- 4 files changed, 10 insertions(+), 33 deletions(-) diff --git a/modules/auth_saml/spec/features/administration/saml_crud_spec.rb b/modules/auth_saml/spec/features/administration/saml_crud_spec.rb index 22949918fae..9e8c7df9e06 100644 --- a/modules/auth_saml/spec/features/administration/saml_crud_spec.rb +++ b/modules/auth_saml/spec/features/administration/saml_crud_spec.rb @@ -34,7 +34,6 @@ require_module_spec_helper RSpec.describe "SAML administration CRUD", :js do shared_let(:user) { create(:admin) } - let(:danger_zone) { DangerZone.new(page) } before do login_as(user) @@ -110,20 +109,9 @@ RSpec.describe "SAML administration CRUD", expect(provider.limit_self_registration).to be true click_link_or_button "Delete" - # Confirm the deletion - # Without confirmation, the button is disabled - expect(danger_zone).to be_disabled - # With wrong confirmation, the button is disabled - danger_zone.confirm_with("foo") - - expect(danger_zone).to be_disabled - - # With correct confirmation, the button is enabled - # and the project can be deleted - danger_zone.confirm_with(provider.display_name) - expect(danger_zone).not_to be_disabled - danger_zone.danger_button.click + check "I understand that this deletion cannot be reversed" + click_on "Delete permanently" expect(page).to have_text "No SAML providers configured yet." expect { provider.reload }.to raise_error ActiveRecord::RecordNotFound diff --git a/modules/ldap_groups/spec/controllers/synchronized_groups_controller_spec.rb b/modules/ldap_groups/spec/controllers/synchronized_groups_controller_spec.rb index 0ed0521fe7b..573ede10186 100644 --- a/modules/ldap_groups/spec/controllers/synchronized_groups_controller_spec.rb +++ b/modules/ldap_groups/spec/controllers/synchronized_groups_controller_spec.rb @@ -170,15 +170,16 @@ RSpec.describe LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groups let!(:group) { build_stubbed(:ldap_synchronized_group) } let(:id) { "foo" } - it "renders the page" do + it "renders the dialog" do expect(LdapGroups::SynchronizedGroup) .to receive(:find) .with("foo") .and_return(group) - get :destroy_info, params: { ldap_group_id: id } + get :destroy_info, params: { ldap_group_id: id }, format: :turbo_stream expect(response).to be_successful - expect(response).to render_template "destroy_info" + expect(response).to have_turbo_stream action: "dialog", + target: "ldap-groups-synchronized-groups-destroy-dialog-component" end end end diff --git a/modules/ldap_groups/spec/features/administration_spec.rb b/modules/ldap_groups/spec/features/administration_spec.rb index 656c8eb7c27..d857f193c71 100644 --- a/modules/ldap_groups/spec/features/administration_spec.rb +++ b/modules/ldap_groups/spec/features/administration_spec.rb @@ -73,10 +73,10 @@ RSpec.describe "LDAP group sync administration spec", :js do find(".buttons a", text: "Delete").click SeleniumHubWaiter.wait - find(".danger-zone--verification input").set "cn=bar,ou=groups,dc=example,dc=com" + check "I understand that this deletion cannot be reversed" + click_on "Delete permanently" SeleniumHubWaiter.wait - click_on "Delete" expect_flash(message: I18n.t(:notice_successful_delete)) expect(page).to have_css ".generic-table--empty-row" diff --git a/modules/openid_connect/spec/features/administration/oidc_custom_crud_spec.rb b/modules/openid_connect/spec/features/administration/oidc_custom_crud_spec.rb index 27da0ec708c..af0e65994ec 100644 --- a/modules/openid_connect/spec/features/administration/oidc_custom_crud_spec.rb +++ b/modules/openid_connect/spec/features/administration/oidc_custom_crud_spec.rb @@ -34,7 +34,6 @@ require_module_spec_helper RSpec.describe "OIDC administration CRUD", :js do shared_let(:user) { create(:admin) } - let(:danger_zone) { DangerZone.new(page) } before do login_as(user) @@ -130,20 +129,9 @@ RSpec.describe "OIDC administration CRUD", expect(provider.group_regexes).to eq(["Foo", "Bar"]) click_link_or_button "Delete" - # Confirm the deletion - # Without confirmation, the button is disabled - expect(danger_zone).to be_disabled - # With wrong confirmation, the button is disabled - danger_zone.confirm_with("foo") - - expect(danger_zone).to be_disabled - - # With correct confirmation, the button is enabled - # and the project can be deleted - danger_zone.confirm_with(provider.display_name) - expect(danger_zone).not_to be_disabled - danger_zone.danger_button.click + check "I understand that this deletion cannot be reversed" + click_on "Delete permanently" expect(page).to have_text "No OpenID providers configured yet." expect { provider.reload }.to raise_error ActiveRecord::RecordNotFound