From 32f101a221622c8b20091e8d9f95111ed907b365 Mon Sep 17 00:00:00 2001
From: Justin Ho Tuan Duong <hduong@gitlab.com>
Date: Mon, 29 Jan 2024 18:28:40 +0000
Subject: [PATCH] Remove .integration-settings-form

And replace with data-testid
---
 .../integrations/edit/components/integration_form.vue         | 3 ++-
 app/views/shared/_integration_settings.html.haml              | 2 +-
 .../projects/integrations/user_activates_jira_spec.rb         | 2 +-
 spec/features/projects/settings/slack_application_spec.rb     | 4 ++--
 .../shared_examples/integrations/integration_settings_form.rb | 2 +-
 5 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/app/assets/javascripts/integrations/edit/components/integration_form.vue b/app/assets/javascripts/integrations/edit/components/integration_form.vue
index efd5f395f7f15..eb3a17da974ef 100644
--- a/app/assets/javascripts/integrations/edit/components/integration_form.vue
+++ b/app/assets/javascripts/integrations/edit/components/integration_form.vue
@@ -186,7 +186,8 @@ export default {
   <gl-form
     ref="integrationForm"
     method="post"
-    class="gl-mt-6 gl-mb-3 gl-show-field-errors integration-settings-form"
+    class="gl-mt-6 gl-mb-3 gl-show-field-errors"
+    data-testid="integration-settings-form"
     :action="propsSource.formPath"
     :novalidate="!integrationActive"
   >
diff --git a/app/views/shared/_integration_settings.html.haml b/app/views/shared/_integration_settings.html.haml
index 84710b2ecc707..6337ac03ac74e 100644
--- a/app/views/shared/_integration_settings.html.haml
+++ b/app/views/shared/_integration_settings.html.haml
@@ -1,6 +1,6 @@
 = form_errors(integration)
 
-%div{ data: { testid: "integration-settings-form" } }
+%div
   - if @default_integration
     .js-vue-default-integration-settings{ data: integration_form_data(@default_integration, group: @group, project: @project) }
   .js-vue-integration-settings{ data: integration_form_data(integration, group: @group, project: @project) }
diff --git a/spec/features/projects/integrations/user_activates_jira_spec.rb b/spec/features/projects/integrations/user_activates_jira_spec.rb
index 704e959ff0e17..942327cdfe8b8 100644
--- a/spec/features/projects/integrations/user_activates_jira_spec.rb
+++ b/spec/features/projects/integrations/user_activates_jira_spec.rb
@@ -42,7 +42,7 @@
         fill_in 'service-password', with: 'password'
         click_test_integration
 
-        page.within('[data-testid="integration-settings-form"]') do
+        within_testid 'integration-settings-form' do
           expect(page).to have_content('This field is required.')
         end
       end
diff --git a/spec/features/projects/settings/slack_application_spec.rb b/spec/features/projects/settings/slack_application_spec.rb
index 79291094aae21..e2d195cdc263c 100644
--- a/spec/features/projects/settings/slack_application_spec.rb
+++ b/spec/features/projects/settings/slack_application_spec.rb
@@ -17,7 +17,7 @@
   it 'I can edit slack integration' do
     visit slack_application_form_path
 
-    within '[data-testid="integration-settings-form"]' do
+    within_testid 'integration-settings-form' do
       click_link 'Edit'
     end
 
@@ -26,7 +26,7 @@
 
     expect(page).to have_content('The project alias was updated successfully')
 
-    within '[data-testid="integration-settings-form"]' do
+    within_testid 'integration-settings-form' do
       expect(page).to have_content('alias-edited')
     end
   end
diff --git a/spec/support/shared_examples/integrations/integration_settings_form.rb b/spec/support/shared_examples/integrations/integration_settings_form.rb
index c665f6a57f150..854e31802dc00 100644
--- a/spec/support/shared_examples/integrations/integration_settings_form.rb
+++ b/spec/support/shared_examples/integrations/integration_settings_form.rb
@@ -14,7 +14,7 @@
       integrations.each do |integration|
         navigate_to_integration(integration)
 
-        page.within('form.integration-settings-form') do
+        within_testid 'integration-settings-form' do
           expect(page).to have_field('Active', type: 'checkbox', wait: 0),
             "#{integration.title} active field not present"
 
-- 
GitLab