diff --git a/.rubocop_todo/capybara/testid_finders.yml b/.rubocop_todo/capybara/testid_finders.yml index 21bef5cfca5..16be25fbc9b 100644 --- a/.rubocop_todo/capybara/testid_finders.yml +++ b/.rubocop_todo/capybara/testid_finders.yml @@ -2,21 +2,8 @@ Capybara/TestidFinders: Exclude: - 'spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb' - - 'spec/features/projects/pipelines/pipeline_spec.rb' - - 'spec/features/projects/pipelines/pipelines_spec.rb' - - 'spec/features/projects/releases/user_creates_release_spec.rb' - - 'spec/features/projects/releases/user_views_releases_spec.rb' - - 'spec/features/projects/settings/merge_requests_settings_spec.rb' - - 'spec/features/projects/settings/monitor_settings_spec.rb' - - 'spec/features/projects/settings/project_settings_spec.rb' - 'spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb' - 'spec/features/projects/settings/registry_settings_spec.rb' - - 'spec/features/projects/settings/repository_settings_spec.rb' - - 'spec/features/projects/settings/secure_files_spec.rb' - - 'spec/features/projects/settings/service_desk_setting_spec.rb' - - 'spec/features/projects/settings/slack_application_spec.rb' - - 'spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb' - - 'spec/features/projects/settings/user_transfers_a_project_spec.rb' - 'spec/features/projects/show/user_sees_collaboration_links_spec.rb' - 'spec/features/projects/sub_group_issuables_spec.rb' - 'spec/features/projects/terraform_spec.rb' diff --git a/app/assets/javascripts/repository/mixins/highlight_mixin.js b/app/assets/javascripts/repository/mixins/highlight_mixin.js index 1cf182e8f90..dba9cb3b774 100644 --- a/app/assets/javascripts/repository/mixins/highlight_mixin.js +++ b/app/assets/javascripts/repository/mixins/highlight_mixin.js @@ -90,6 +90,8 @@ export default { this.instructWorker(rawTextBlob, language, fileType); }, handleWorkerMessage({ data }) { + // If the current length of chunks is bigger, it means we've highlighted the whole file already, so nothing to be done here + if (data.length < this.chunks.length) return; this.chunks = data; this.highlightHash(); // highlight the line if a line number hash is present in the URL }, diff --git a/app/models/namespace_setting.rb b/app/models/namespace_setting.rb index 4f43f30638f..41dd7b38b81 100644 --- a/app/models/namespace_setting.rb +++ b/app/models/namespace_setting.rb @@ -8,7 +8,7 @@ class NamespaceSetting < ApplicationRecord ignore_column :project_import_level, remove_with: '16.10', remove_after: '2024-02-22' ignore_column :third_party_ai_features_enabled, remove_with: '16.10', remove_after: '2024-02-22' - ignore_column %i[delayed_project_removal lock_delayed_project_removal], remove_with: '16.10', remove_after: '2024-02-22' + ignore_column %i[code suggestions delayed_project_removal lock_delayed_project_removal], remove_with: '16.10', remove_after: '2024-02-22' cascading_attr :toggle_security_policy_custom_ci cascading_attr :toggle_security_policies_policy_scope diff --git a/app/views/groups/settings/_permissions.html.haml b/app/views/groups/settings/_permissions.html.haml index 41f3662f202..02594b0cc96 100644 --- a/app/views/groups/settings/_permissions.html.haml +++ b/app/views/groups/settings/_permissions.html.haml @@ -36,7 +36,6 @@ - if @group.licensed_feature_available?(:group_wikis) = render_if_exists 'groups/settings/wiki', f: f, group: @group = render 'groups/settings/lfs', f: f - = render_if_exists 'groups/settings/code_suggestions', f: f, group: @group = render_if_exists 'groups/settings/security/security_policy_management', f: f, group: @group = render_if_exists 'groups/settings/experimental_settings', f: f, group: @group = render_if_exists 'groups/settings/product_analytics_settings', f: f, group: @group diff --git a/config/feature_flags/development/ai_assist_flag.yml b/config/feature_flags/development/ai_assist_flag.yml deleted file mode 100644 index 37d159e81da..00000000000 --- a/config/feature_flags/development/ai_assist_flag.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: ai_assist_flag -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/100500 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/378470 -milestone: '15.6' -type: development -group: group::ai framework -default_enabled: false diff --git a/db/docs/service_access_tokens.yml b/db/docs/service_access_tokens.yml index 8a0958707b0..18980741ee1 100644 --- a/db/docs/service_access_tokens.yml +++ b/db/docs/service_access_tokens.yml @@ -8,4 +8,4 @@ description: Persists JWT tokens for AI features (e.g. Code Suggestions) to auth the GitLab instance introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/125383 milestone: '16.2' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_clusterwide diff --git a/doc/update/versions/gitlab_16_changes.md b/doc/update/versions/gitlab_16_changes.md index 374039b7c1b..0d143ad815e 100644 --- a/doc/update/versions/gitlab_16_changes.md +++ b/doc/update/versions/gitlab_16_changes.md @@ -64,6 +64,18 @@ For more information about upgrading GitLab Helm Chart, see [the release notes f packaged GitLab 16.0 and later does not automatically create the directory structure. [Read the issue for more details and the workaround](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/8320). +## 16.9.0 + +You might encounter the following error while upgrading to GitLab 16.9.0: + +```plaintext +PG::UndefinedTable: ERROR: relation "p_ci_pipeline_variables" does not exist +``` + +Make sure that all migrations complete and restart all Rails and Sidekiq nodes. +A [fix](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/144952) for this bug is +planned for release in 16.9.1. + ## 16.8.0 - In GitLab 16.8.0 and 16.8.1, the Sidekiq gem was upgraded, and the newer version requires Redis 6.2 or later. If you are using Redis 6.0, upgrade diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 14f22fc125c..fb739b76c58 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -12123,18 +12123,12 @@ msgstr "" msgid "CodeSuggestions|%{linkStart}Code Suggestions%{linkEnd} uses generative AI to suggest code while you're developing." msgstr "" -msgid "CodeSuggestions|%{link_start}What are code suggestions?%{link_end}" -msgstr "" - msgid "CodeSuggestions|A user can be assigned a GitLab Duo Pro seat only once each billable month." msgstr "" msgid "CodeSuggestions|Boost productivity by using %{linkStart}Code Suggestions%{linkEnd} to write and understand code. Starting in February 2024, Code Suggestions will be part of %{duoLinkStart}GitLab Duo Pro%{duoLinkEnd}, available to Premium and Ultimate users for purchase now." msgstr "" -msgid "CodeSuggestions|Code Suggestions" -msgstr "" - msgid "CodeSuggestions|Enhance your coding experience with intelligent recommendations. %{linkStart}GitLab Duo Pro%{linkEnd} offers features that use generative AI to suggest code." msgstr "" @@ -12159,12 +12153,6 @@ msgstr "" msgid "CodeSuggestions|Manage seat assignments for GitLab Duo Pro across your instance." msgstr "" -msgid "CodeSuggestions|Projects in this group can use Code Suggestions" -msgstr "" - -msgid "CodeSuggestions|Subject to the %{terms_link_start}Testing Terms of Use%{link_end}. Code Suggestions uses third-party AI services." -msgstr "" - msgid "CodeownersValidation|An error occurred while loading the validation errors. Please try again later." msgstr "" diff --git a/package.json b/package.json index ed655b9dec1..173e6c4cde1 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@cubejs-client/core": "^0.34.37", "@cubejs-client/vue": "^0.34.37", "@floating-ui/dom": "^1.2.9", - "@gitlab/application-sdk-browser": "^0.3.1", + "@gitlab/application-sdk-browser": "^0.3.2", "@gitlab/at.js": "1.5.7", "@gitlab/cluster-client": "^2.1.0", "@gitlab/favicon-overlay": "2.0.0", diff --git a/qa/Gemfile b/qa/Gemfile index 9f56c9d521c..e770d1c6603 100644 --- a/qa/Gemfile +++ b/qa/Gemfile @@ -11,7 +11,7 @@ gem 'capybara', '~> 3.39.2' gem 'capybara-screenshot', '~> 1.0.26' gem 'rake', '~> 13', '>= 13.1.0' gem 'rspec', '~> 3.13' -gem 'selenium-webdriver', '= 4.17.0' +gem 'selenium-webdriver', '= 4.18.1' gem 'airborne', '~> 0.3.7', require: false # airborne is messing with rspec sandboxed mode so not requiring by default gem 'rest-client', '~> 2.1.0' gem 'rspec-retry', '~> 0.6.2', require: 'rspec/retry' diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock index 78625726cdd..102a11ffff4 100644 --- a/qa/Gemfile.lock +++ b/qa/Gemfile.lock @@ -301,7 +301,7 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) - selenium-webdriver (4.17.0) + selenium-webdriver (4.18.1) base64 (~> 0.2) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) @@ -376,7 +376,7 @@ DEPENDENCIES rspec-retry (~> 0.6.2) rspec_junit_formatter (~> 0.6.0) ruby-debug-ide (~> 0.7.3) - selenium-webdriver (= 4.17.0) + selenium-webdriver (= 4.18.1) slack-notifier (~> 2.4) terminal-table (~> 3.0.2) warning (~> 1.3) diff --git a/qa/gdk/Dockerfile.gdk b/qa/gdk/Dockerfile.gdk index c91793cd1f7..dea4bcb0a3f 100644 --- a/qa/gdk/Dockerfile.gdk +++ b/qa/gdk/Dockerfile.gdk @@ -1,4 +1,4 @@ -ARG GDK_SHA=dda0a9732d049f4b93c8440555722c6e6fe0398f +ARG GDK_SHA=6a9828e36b3f2d66c3f4b5f7cddf1f768d38bbf0 # Use tag prefix when running on 'stable' branch to make sure 'protected' image is used which is not deleted by registry cleanup ARG GDK_BASE_TAG_PREFIX diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index fccfe00f593..7de9b3ef7db 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -89,7 +89,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do it 'shows the pipeline information' do visit_pipeline - within '[data-testid="pipeline-details-header"]' do + within_testid 'pipeline-details-header' do expect(page).to have_content("For #{pipeline.ref}") expect(page).to have_content("#{pipeline.statuses.count} Jobs") expect(page).to have_link(pipeline.ref, @@ -100,7 +100,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do it 'displays pipeline name instead of commit title' do visit_pipeline - within '[data-testid="pipeline-details-header"]' do + within_testid 'pipeline-details-header' do expect(page).to have_content(pipeline.name) expect(page).to have_content(project.commit.short_id) expect(page).not_to have_selector('[data-testid="pipeline-commit-title"]') @@ -115,7 +115,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do it 'displays commit title' do visit_pipeline - within '[data-testid="pipeline-details-header"]' do + within_testid 'pipeline-details-header' do expect(page).to have_content(project.commit.title) expect(page).not_to have_selector('[data-testid="pipeline-name"]') end @@ -140,7 +140,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do it 'shows time ago' do visit project_pipeline_path(project, finished_pipeline) - within '[data-testid="pipeline-details-header"]' do + within_testid 'pipeline-details-header' do expect(page).to have_selector('[data-testid="pipeline-finished-time-ago"]') end end @@ -150,7 +150,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do it 'does not show time ago' do visit_pipeline - within '[data-testid="pipeline-details-header"]' do + within_testid 'pipeline-details-header' do expect(page).not_to have_selector('[data-testid="pipeline-finished-time-ago"]') end end @@ -223,7 +223,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do wait_for_requests expect(page).not_to have_content('Retry job') - within('[data-testid="pipeline-details-header"]') do + within_testid('pipeline-details-header') do expect(page).to have_selector('[data-testid="ci-icon"]', text: 'Running') end end @@ -277,7 +277,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do wait_for_requests expect(page).not_to have_content('Retry job') - within('[data-testid="pipeline-details-header"]') do + within_testid('pipeline-details-header') do expect(page).to have_selector('[data-testid="ci-icon"]', text: 'Running') end end @@ -311,7 +311,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do wait_for_requests expect(page).not_to have_content('Play job') - within('[data-testid="pipeline-details-header"]') do + within_testid('pipeline-details-header') do expect(page).to have_selector('[data-testid="ci-icon"]', text: 'Running') end end @@ -475,7 +475,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do end it 'shows counter in Jobs tab' do - expect(page.find('[data-testid="builds-counter"]').text).to eq(pipeline.total_size.to_s) + expect(find_by_testid('builds-counter').text).to eq(pipeline.total_size.to_s) end context 'without permission to access builds' do @@ -498,7 +498,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do context 'with test reports' do it 'shows badge counter in Tests tab' do - expect(page.find('[data-testid="tests-counter"]').text).to eq(pipeline.test_report_summary.total[:count].to_s) + expect(find_by_testid('tests-counter').text).to eq(pipeline.test_report_summary.total[:count].to_s) end it 'calls summary.json endpoint', :js do @@ -513,7 +513,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do let(:pipeline) { create(:ci_pipeline, project: project) } it 'shows zero' do - expect(page.find('[data-testid="tests-counter"]', visible: :all).text).to eq("0") + expect(find_by_testid('tests-counter', visible: :all).text).to eq("0") end end end @@ -527,7 +527,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do context 'when retrying' do before do - find('[data-testid="retry-pipeline"]').click + find_by_testid('retry-pipeline').click wait_for_requests end @@ -536,7 +536,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do end it 'shows running status in pipeline header', :sidekiq_might_not_need_inline do - within('[data-testid="pipeline-details-header"]') do + within_testid('pipeline-details-header') do expect(page).to have_selector('[data-testid="ci-icon"]', text: 'Running') end end @@ -606,7 +606,7 @@ RSpec.describe 'Pipeline', :js, feature_category: :continuous_integration do end it 'does not render render raw HTML to the pipeline ref' do - page.within '[data-testid="pipeline-details-header"]' do + within_testid 'pipeline-details-header' do expect(page).not_to have_content(' Settings > Merge requests', feature_category: :code_r end end - find('[data-testid="project-features-save-button"]').send_keys(:return) + find_by_testid('project-features-save-button').send_keys(:return) visit project_settings_merge_requests_path(project) @@ -88,7 +88,7 @@ RSpec.describe 'Projects > Settings > Merge requests', feature_category: :code_r end end - find('[data-testid="project-features-save-button"]').send_keys(:return) + find_by_testid('project-features-save-button').send_keys(:return) visit project_settings_merge_requests_path(project) @@ -146,7 +146,7 @@ RSpec.describe 'Projects > Settings > Merge requests', feature_category: :code_r end end - find('[data-testid="project-features-save-button"]').send_keys(:return) + find_by_testid('project-features-save-button').send_keys(:return) visit project_settings_merge_requests_path(project) diff --git a/spec/features/projects/settings/monitor_settings_spec.rb b/spec/features/projects/settings/monitor_settings_spec.rb index 4baa169238b..618fdc9ed58 100644 --- a/spec/features/projects/settings/monitor_settings_spec.rb +++ b/spec/features/projects/settings/monitor_settings_spec.rb @@ -59,13 +59,13 @@ RSpec.describe 'Projects > Settings > For a forked project', :js, feature_catego end def click_settings_tab - within '[data-testid="alert-integration-settings"]' do + within_testid 'alert-integration-settings' do click_link 'Alert settings' end end def save_form - page.within '[data-testid="alert-integration-settings"]' do + within_testid 'alert-integration-settings' do click_button 'Save changes' end diff --git a/spec/features/projects/settings/project_settings_spec.rb b/spec/features/projects/settings/project_settings_spec.rb index 1c1bbc7e85c..169b38d8d93 100644 --- a/spec/features/projects/settings/project_settings_spec.rb +++ b/spec/features/projects/settings/project_settings_spec.rb @@ -47,7 +47,7 @@ RSpec.describe 'Projects settings', feature_category: :groups_and_projects do # disable by clicking toggle forking_enabled_button.click page.within('.sharing-permissions') do - find('[data-testid="project-features-save-button"]').click + find_by_testid('project-features-save-button').click end wait_for_requests @@ -77,7 +77,7 @@ RSpec.describe 'Projects settings', feature_category: :groups_and_projects do expect(default_award_emojis_input.value).to eq('false') page.within('.sharing-permissions') do - find('[data-testid="project-features-save-button"]').click + find_by_testid('project-features-save-button').click end wait_for_requests diff --git a/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb b/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb index 96ccc061491..027632d3315 100644 --- a/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb +++ b/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb @@ -35,7 +35,7 @@ RSpec.describe 'Project > Settings > Packages and registries > Container registr expect(find('.breadcrumbs')).to have_content('Cleanup policies') - section = find('[data-testid="container-expiration-policy-project-settings"]') + section = find_by_testid('container-expiration-policy-project-settings') expect(section).to have_text 'Cleanup policies' end @@ -45,20 +45,20 @@ RSpec.describe 'Project > Settings > Packages and registries > Container registr wait_for_requests expect(page).to be_axe_clean.within('[data-testid="container-expiration-policy-project-settings"]') - .skipping :'link-in-text-block', :'heading-order' + .skipping :'link-in-text-block', :'heading-order' # rubocop:todo Capybara/TestidFinders -- Doesn't cover use case, see https://gitlab.com/gitlab-org/gitlab/-/issues/442224 end it 'saves cleanup policy submit the form' do subject - within '[data-testid="container-expiration-policy-project-settings"]' do + within_testid 'container-expiration-policy-project-settings' do select('Every day', from: 'Run cleanup') select('50 tags per image name', from: 'Keep the most recent:') fill_in('Keep tags matching:', with: 'stable') select('7 days', from: 'Remove tags older than:') fill_in('Remove tags matching:', with: '.*-production') - submit_button = find('[data-testid="save-button"') + submit_button = find_by_testid('save-button') expect(submit_button).not_to be_disabled submit_button.click end @@ -70,10 +70,10 @@ RSpec.describe 'Project > Settings > Packages and registries > Container registr it 'does not save cleanup policy submit form with invalid regex' do subject - within '[data-testid="container-expiration-policy-project-settings"]' do + within_testid 'container-expiration-policy-project-settings' do fill_in('Remove tags matching:', with: '*-production') - submit_button = find('[data-testid="save-button"') + submit_button = find_by_testid('save-button') expect(submit_button).not_to be_disabled submit_button.click end @@ -95,8 +95,8 @@ RSpec.describe 'Project > Settings > Packages and registries > Container registr it 'displays the related section' do subject - within '[data-testid="container-expiration-policy-project-settings"]' do - expect(find('[data-testid="enable-toggle"]')) + within_testid 'container-expiration-policy-project-settings' do + expect(find_by_testid('enable-toggle')) .to have_content('Disabled - Tags will not be automatically deleted.') end end @@ -110,7 +110,7 @@ RSpec.describe 'Project > Settings > Packages and registries > Container registr it 'does not display the related section' do subject - within '[data-testid="container-expiration-policy-project-settings"]' do + within_testid 'container-expiration-policy-project-settings' do expect(find('.gl-alert-title')).to have_content('Cleanup policy for tags is disabled') end end diff --git a/spec/features/projects/settings/registry_settings_spec.rb b/spec/features/projects/settings/registry_settings_spec.rb index dc4251aa92f..d6245d6327e 100644 --- a/spec/features/projects/settings/registry_settings_spec.rb +++ b/spec/features/projects/settings/registry_settings_spec.rb @@ -27,7 +27,7 @@ RSpec.describe 'Project > Settings > Packages and registries > Container registr wait_for_requests expect(page).to be_axe_clean.within('[data-testid="packages-and-registries-project-settings"]') - .skipping :'heading-order' + .skipping :'heading-order' # rubocop:todo Capybara/TestidFinders -- Doesn't cover use case, see https://gitlab.com/gitlab-org/gitlab/-/issues/442224 end it 'shows active tab on sidebar' do @@ -42,7 +42,7 @@ RSpec.describe 'Project > Settings > Packages and registries > Container registr it 'shows available section' do subject - settings_block = find('[data-testid="container-expiration-policy-project-settings"]') + settings_block = find_by_testid('container-expiration-policy-project-settings') expect(settings_block).to have_text 'Cleanup policies' end @@ -66,7 +66,7 @@ RSpec.describe 'Project > Settings > Packages and registries > Container registr it 'displays the related section' do subject - within '[data-testid="container-expiration-policy-project-settings"]' do + within_testid 'container-expiration-policy-project-settings' do expect(page).to have_link('Set cleanup rules', href: cleanup_image_tags_project_settings_packages_and_registries_path(project)) end end @@ -80,7 +80,7 @@ RSpec.describe 'Project > Settings > Packages and registries > Container registr it 'does not display the related section' do subject - within '[data-testid="container-expiration-policy-project-settings"]' do + within_testid 'container-expiration-policy-project-settings' do expect(find('.gl-alert-title')).to have_content('Cleanup policy for tags is disabled') end end diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index 8576518666c..71c4af3adcc 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -98,7 +98,9 @@ RSpec.describe 'Projects > Settings > Repository settings', feature_category: :s project.deploy_keys << private_deploy_key visit project_settings_repository_path(project) - find('.deploy-key', text: private_deploy_key.title).find('[data-testid="pencil-icon"]').click + within('.deploy-key', text: private_deploy_key.title) do + find_by_testid('pencil-icon').click + end fill_in 'deploy_key_title', with: 'updated_deploy_key' check 'deploy_key_deploy_keys_projects_attributes_0_can_push' @@ -112,7 +114,9 @@ RSpec.describe 'Projects > Settings > Repository settings', feature_category: :s project.deploy_keys << public_deploy_key visit project_settings_repository_path(project) - find('.deploy-key', text: public_deploy_key.title).find('[data-testid="pencil-icon"]').click + within('.deploy-key', text: public_deploy_key.title) do + find_by_testid('pencil-icon').click + end check 'deploy_key_deploy_keys_projects_attributes_0_can_push' click_button 'Save changes' @@ -130,7 +134,9 @@ RSpec.describe 'Projects > Settings > Repository settings', feature_category: :s find('.js-deployKeys-tab-available_project_keys').click - find('.deploy-key', text: private_deploy_key.title).find('[data-testid="pencil-icon"]').click + within('.deploy-key', text: private_deploy_key.title) do + find_by_testid('pencil-icon').click + end fill_in 'deploy_key_title', with: 'updated_deploy_key' click_button 'Save changes' diff --git a/spec/features/projects/settings/secure_files_spec.rb b/spec/features/projects/settings/secure_files_spec.rb index c456e760709..279bd4b2e4d 100644 --- a/spec/features/projects/settings/secure_files_spec.rb +++ b/spec/features/projects/settings/secure_files_spec.rb @@ -46,7 +46,7 @@ RSpec.describe 'Secure Files', :js, feature_category: :source_code_management do within '#js-secure-files' do expect(page).to have_content(file.name) - find('[data-testid="delete-button"]').click + find_by_testid('delete-button').click end expect(page).to have_content("Delete #{file.name}?") diff --git a/spec/features/projects/settings/service_desk_setting_spec.rb b/spec/features/projects/settings/service_desk_setting_spec.rb index 540c4691465..54012195853 100644 --- a/spec/features/projects/settings/service_desk_setting_spec.rb +++ b/spec/features/projects/settings/service_desk_setting_spec.rb @@ -39,7 +39,7 @@ RSpec.describe 'Service Desk Setting', :js, :clean_gitlab_redis_cache, feature_c project.reload expect(project.service_desk_enabled).to be_truthy expect(project.service_desk_address).to be_present - expect(find('[data-testid="incoming-email"]').value).to eq(project.service_desk_incoming_address) + expect(find_by_testid('incoming-email').value).to eq(project.service_desk_incoming_address) end end @@ -56,7 +56,7 @@ RSpec.describe 'Service Desk Setting', :js, :clean_gitlab_redis_cache, feature_c wait_for_requests project.reload - expect(find('[data-testid="incoming-email"]').value).to eq(project.service_desk_alias_address) + expect(find_by_testid('incoming-email').value).to eq(project.service_desk_alias_address) page.within '#js-service-desk' do fill_in('service-desk-project-suffix', with: 'foo') @@ -65,7 +65,7 @@ RSpec.describe 'Service Desk Setting', :js, :clean_gitlab_redis_cache, feature_c wait_for_requests - expect(find('[data-testid="incoming-email"]').value).to eq('address-suffix@example.com') + expect(find_by_testid('incoming-email').value).to eq('address-suffix@example.com') end describe 'issue description templates' do diff --git a/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb b/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb index 6fe8a2c3f10..3ace5f3f952 100644 --- a/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb +++ b/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb @@ -55,7 +55,7 @@ RSpec.describe 'Projects > Settings > User manages merge request settings', feat visit edit_project_path(project) find('.project-feature-controls[data-for="project[project_feature_attributes][merge_requests_access_level]"] .gl-toggle').click - find('[data-testid="project-features-save-button"]').send_keys(:return) + find_by_testid('project-features-save-button').send_keys(:return) visit project_settings_merge_requests_path(project) @@ -76,7 +76,7 @@ RSpec.describe 'Projects > Settings > User manages merge request settings', feat visit edit_project_path(project) find('.project-feature-controls[data-for="project[project_feature_attributes][builds_access_level]"] .gl-toggle').click - find('[data-testid="project-features-save-button"]').send_keys(:return) + find_by_testid('project-features-save-button').send_keys(:return) visit project_settings_merge_requests_path(project) @@ -100,7 +100,7 @@ RSpec.describe 'Projects > Settings > User manages merge request settings', feat within('.sharing-permissions-form') do find('.project-feature-controls[data-for="project[project_feature_attributes][merge_requests_access_level]"] .gl-toggle').click - find('[data-testid="project-features-save-button"]').send_keys(:return) + find_by_testid('project-features-save-button').send_keys(:return) end visit project_settings_merge_requests_path(project) diff --git a/spec/features/projects/settings/user_transfers_a_project_spec.rb b/spec/features/projects/settings/user_transfers_a_project_spec.rb index 97871eed296..b72f24a2386 100644 --- a/spec/features/projects/settings/user_transfers_a_project_spec.rb +++ b/spec/features/projects/settings/user_transfers_a_project_spec.rb @@ -18,10 +18,10 @@ RSpec.describe 'Projects > Settings > User transfers a project', :js, feature_ca visit edit_project_path(project) page.within('.js-project-transfer-form') do - page.find('[data-testid="transfer-project-namespace"]').click + find_by_testid('transfer-project-namespace').click end - page.within('[data-testid="transfer-project-namespace"]') do + within_testid('transfer-project-namespace') do page.find("li button", text: group.full_name).click end diff --git a/spec/frontend/repository/mixins/highlight_mixin_spec.js b/spec/frontend/repository/mixins/highlight_mixin_spec.js index ccde41f62e5..132d9b62c73 100644 --- a/spec/frontend/repository/mixins/highlight_mixin_spec.js +++ b/spec/frontend/repository/mixins/highlight_mixin_spec.js @@ -1,6 +1,7 @@ import { shallowMount } from '@vue/test-utils'; import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; +import { nextTick } from 'vue'; import { splitIntoChunks } from '~/vue_shared/components/source_viewer/workers/highlight_utils'; import highlightMixin from '~/repository/mixins/highlight_mixin'; import LineHighlighter from '~/blob/line_highlighter'; @@ -111,6 +112,20 @@ describe('HighlightMixin', () => { it('highlights hash', () => { expect(lineHighlighter.highlightHash).toHaveBeenCalledWith(hash); }); + + describe('when order of events are incorrect', () => { + it('renders the correct data', async () => { + const chunk1 = { highlightedContent: 'chunk 1 content' }; + const chunk2 = { highlightedContent: 'chunk 2 content' }; + + workerMock.onmessage({ data: [chunk1, chunk2] }); + workerMock.onmessage({ data: [chunk2] }); + + await nextTick(); + + expect(wrapper.text()).toBe(chunk1.highlightedContent); + }); + }); }); describe('LFS blobs', () => { diff --git a/yarn.lock b/yarn.lock index 2cfe9550145..4eb2697827e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1263,10 +1263,10 @@ resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.1.tgz#16308cea045f0fc777b6ff20a9f25474dd8293d2" integrity sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q== -"@gitlab/application-sdk-browser@^0.3.1": - version "0.3.1" - resolved "https://registry.yarnpkg.com/@gitlab/application-sdk-browser/-/application-sdk-browser-0.3.1.tgz#1eaf8838c48417223bcecbb19bf262c6c6d88d8e" - integrity sha512-I7IDm5yvVDAqi9/GlOfDSJBpxrAoJxs0A8dHQNIXZ+y5r66i259cW+laWfDiq40td/SFNjONjVs0PWBflkuoSQ== +"@gitlab/application-sdk-browser@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@gitlab/application-sdk-browser/-/application-sdk-browser-0.3.2.tgz#6cf08d9d0aaaaff97a5041c7503b915802e2991a" + integrity sha512-R7LQxJB329KJRQ7pyvewcJ4gDI1uGRhpHaN7f3cB33VGBFKvL2ffyz5PlNMOEhYpHs1kSPLX9grNhgkvuyaBWg== dependencies: "@snowplow/browser-plugin-client-hints" "^3.9.0" "@snowplow/browser-plugin-error-tracking" "^3.9.0"