diff options
Diffstat (limited to 'doc/development')
4 files changed, 11 insertions, 15 deletions
diff --git a/doc/development/fe_guide/view_component.md b/doc/development/fe_guide/view_component.md index a616a3d7c48..a0c626dfb6d 100644 --- a/doc/development/fe_guide/view_component.md +++ b/doc/development/fe_guide/view_component.md @@ -163,7 +163,7 @@ For example: ```haml = render Pajamas::CheckboxTagComponent.new(name: 'project[initialize_with_sast]', - checkbox_options: { data: { qa_selector: 'initialize_with_sast_checkbox', track_label: track_label, track_action: 'activate_form_input', track_property: 'init_with_sast' } }) do |c| + checkbox_options: { data: { testid: 'initialize-with-sast-checkbox', track_label: track_label, track_action: 'activate_form_input', track_property: 'init_with_sast' } }) do |c| - c.with_label do = s_('ProjectsNew|Enable Static Application Security Testing (SAST)') - c.with_help_text do diff --git a/doc/development/testing_guide/end_to_end/beginners_guide.md b/doc/development/testing_guide/end_to_end/beginners_guide.md index b57757c5aac..5fc18d7aeae 100644 --- a/doc/development/testing_guide/end_to_end/beginners_guide.md +++ b/doc/development/testing_guide/end_to_end/beginners_guide.md @@ -321,22 +321,22 @@ the **Issue Show** page already exists, add the `closed?` method. module Page::Project::Issue class Show view 'app/views/projects/issues/show.html.haml' do - element :closed_status_box + element 'closed-status-box' end def closed? - has_element?(:closed_status_box) + has_element?('closed-status-box') end end end ``` -Next, define the element `closed_status_box` within your view, so your Page Object +Next, define the element `closed-status-box` within your view, so your Page Object can see it. ```haml -#=> app/views/projects/issues/show.html.haml -.issuable-status-box.status-box.status-box-issue-closed{ ..., data: { qa_selector: 'closed_status_box' } } +.issuable-status-box.status-box.status-box-issue-closed{ ..., data: { testid: 'closed-status-box' } } ``` ## Run the spec diff --git a/doc/development/testing_guide/end_to_end/capybara_to_chemlab_migration_guide.md b/doc/development/testing_guide/end_to_end/capybara_to_chemlab_migration_guide.md index 64bb5df5db1..98484b7f2d6 100644 --- a/doc/development/testing_guide/end_to_end/capybara_to_chemlab_migration_guide.md +++ b/doc/development/testing_guide/end_to_end/capybara_to_chemlab_migration_guide.md @@ -95,12 +95,12 @@ end ### Element Naming Convention -Since the element type is preserved within the Page Library, there is no need to specify a `_field` or `_button` suffix to the data-qa-selector. +Since the element type is preserved within the Page Library, there is no need to specify a `_field` or `_button` suffix to the data-testid. ```html <!-- Before --> <input type="text" name="first-name" data-testid="first_name_field" /> -<input type="submit" name="continue" value="Continue" data-testid="continue_button" /> +<input type="submit" name="continue" value="Continue" data-testid="continue-button" /> <!-- After --> <input type="text" name="first-name" data-testid="first_name" /> diff --git a/doc/development/testing_guide/end_to_end/page_objects.md b/doc/development/testing_guide/end_to_end/page_objects.md index 812d2724b72..33f70c73c91 100644 --- a/doc/development/testing_guide/end_to_end/page_objects.md +++ b/doc/development/testing_guide/end_to_end/page_objects.md @@ -158,20 +158,16 @@ Things to note: - The name of the element and the `data-testid` must match and be either snake cased or kebab cased - If the element appears on the page unconditionally, add `required: true` to the element. See [Dynamic element validation](dynamic_element_validation.md) -- You may see `data-qa-selector` classes in existing Page Objects. We should prefer the [`data-testid`](#data-testid-vs-data-qa-selector) - method of definition over the `data-qa-selector` CSS class +- You should not see `data-qa-selector` classes in Page Objects. + We should use the [`data-testid`](#data-testid-vs-data-qa-selector) + method of definition ### `data-testid` vs `data-qa-selector` > Introduced in GitLab 16.1 -There are two supported methods of defining elements within a view. - -1. `data-testid` -1. `data-qa-selector` attribute - Any existing `data-qa-selector` class should be considered deprecated -and we should prefer the `data-testid` method of definition. +and we should use the `data-testid` method of definition. ### Dynamic element selection |