Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-12-08 03:11:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-08 03:11:45 +0300
commit6352d2f7c2a9e62e07f854861f9f57dacbd6f4a4 (patch)
treec2401747b66f1112bcb4d1cd50037562bbfb9dff /spec
parent2cf4bdd0b060175c7058b395014b101fbe6214a3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/features/search/user_searches_for_code_spec.rb54
-rw-r--r--spec/features/search/user_searches_for_issues_spec.rb3
-rw-r--r--spec/features/search/user_searches_for_merge_requests_spec.rb3
-rw-r--r--spec/features/search/user_searches_for_milestones_spec.rb6
-rw-r--r--spec/features/search/user_searches_for_projects_spec.rb8
-rw-r--r--spec/features/search/user_searches_for_wiki_pages_spec.rb3
-rw-r--r--spec/frontend/search/topbar/components/app_spec.js4
-rw-r--r--spec/lib/gitlab/pages/deployment_update_spec.rb35
-rw-r--r--spec/support/helpers/search_helpers.rb9
9 files changed, 56 insertions, 69 deletions
diff --git a/spec/features/search/user_searches_for_code_spec.rb b/spec/features/search/user_searches_for_code_spec.rb
index 0cb2cc3f42a..9329b1f2a5e 100644
--- a/spec/features/search/user_searches_for_code_spec.rb
+++ b/spec/features/search/user_searches_for_code_spec.rb
@@ -53,8 +53,8 @@ RSpec.describe 'User searches for code', :js, :disable_rate_limiter, feature_cat
let(:expected_result) { 'Update capybara, rspec-rails, poltergeist to recent versions' }
before do
- fill_in('dashboard_search', with: 'rspec')
- find('.gl-search-box-by-click-search-button').click
+ submit_dashboard_search('rspec')
+ select_search_scope('Code')
end
it 'finds code and links to blob' do
@@ -81,8 +81,8 @@ RSpec.describe 'User searches for code', :js, :disable_rate_limiter, feature_cat
search = 'for naming files'
ref_selector = 'v1.0.0'
- fill_in('dashboard_search', with: search)
- find('.gl-search-box-by-click-search-button').click
+ submit_dashboard_search(search)
+ select_search_scope('Code')
expect(page).to have_selector('.results', text: expected_result)
@@ -99,52 +99,6 @@ RSpec.describe 'User searches for code', :js, :disable_rate_limiter, feature_cat
end
end
- context 'when header search' do
- context 'search code within refs' do
- let(:ref_name) { 'v1.0.0' }
-
- before do
- visit(project_tree_path(project, ref_name))
-
- submit_search('gitlab-grack')
- wait_for_requests
- select_search_scope('Code')
- end
-
- it 'shows ref switcher in code result summary' do
- expect(find('.ref-selector')).to have_text(ref_name)
- end
-
- it 'persists branch name across search' do
- find('.gl-search-box-by-click-search-button').click
- expect(find('.ref-selector')).to have_text(ref_name)
- end
-
- # this example is use to test the design that the refs is not
- # only represent the branch as well as the tags.
- it 'ref switcher list all the branches and tags' do
- find('.ref-selector').click
- wait_for_requests
-
- page.within('.ref-selector') do
- expect(page).to have_selector('li', text: 'add-ipython-files')
- expect(page).to have_selector('li', text: 'v1.0.0')
- end
- end
-
- it 'search result changes when refs switched' do
- expect(find('.results')).not_to have_content('path = gitlab-grack')
-
- find('.ref-selector').click
- wait_for_requests
-
- select_listbox_item('add-ipython-files')
-
- expect(page).to have_selector('.results', text: 'path = gitlab-grack')
- end
- end
- end
-
it 'no ref switcher shown in issue result summary' do
issue = create(:issue, title: 'test', project: project)
visit(project_tree_path(project))
diff --git a/spec/features/search/user_searches_for_issues_spec.rb b/spec/features/search/user_searches_for_issues_spec.rb
index c10562497e2..caddf8b698e 100644
--- a/spec/features/search/user_searches_for_issues_spec.rb
+++ b/spec/features/search/user_searches_for_issues_spec.rb
@@ -11,8 +11,7 @@ RSpec.describe 'User searches for issues', :js, :clean_gitlab_redis_rate_limitin
let!(:issue2) { create(:issue, :closed, :confidential, title: 'issue Bar', project: project) }
def search_for_issue(search)
- fill_in('dashboard_search', with: search)
- find('.gl-search-box-by-click-search-button').click
+ submit_dashboard_search(search)
select_search_scope('Issues')
end
diff --git a/spec/features/search/user_searches_for_merge_requests_spec.rb b/spec/features/search/user_searches_for_merge_requests_spec.rb
index 6fa8524ee46..7819e036f21 100644
--- a/spec/features/search/user_searches_for_merge_requests_spec.rb
+++ b/spec/features/search/user_searches_for_merge_requests_spec.rb
@@ -10,8 +10,7 @@ RSpec.describe 'User searches for merge requests', :js, :clean_gitlab_redis_rate
let_it_be(:merge_request2) { create(:merge_request, :simple, title: 'Merge Request Bar', source_project: project, target_project: project) }
def search_for_mr(search)
- fill_in('dashboard_search', with: search)
- find('.gl-search-box-by-click-search-button').click
+ submit_dashboard_search(search)
select_search_scope('Merge requests')
end
diff --git a/spec/features/search/user_searches_for_milestones_spec.rb b/spec/features/search/user_searches_for_milestones_spec.rb
index edd9ea2264b..334fe6f0170 100644
--- a/spec/features/search/user_searches_for_milestones_spec.rb
+++ b/spec/features/search/user_searches_for_milestones_spec.rb
@@ -21,8 +21,7 @@ RSpec.describe 'User searches for milestones', :js, :clean_gitlab_redis_rate_lim
include_examples 'search timeouts', 'milestones'
it 'finds a milestone' do
- fill_in('dashboard_search', with: milestone1.title)
- find('.gl-search-box-by-click-search-button').click
+ submit_dashboard_search(milestone1.title)
select_search_scope('Milestones')
page.within('.results') do
@@ -41,8 +40,7 @@ RSpec.describe 'User searches for milestones', :js, :clean_gitlab_redis_rate_lim
select_listbox_item project.name
end
- fill_in('dashboard_search', with: milestone1.title)
- find('.gl-search-box-by-click-search-button').click
+ submit_dashboard_search(milestone1.title)
select_search_scope('Milestones')
page.within('.results') do
diff --git a/spec/features/search/user_searches_for_projects_spec.rb b/spec/features/search/user_searches_for_projects_spec.rb
index 48a94161927..ee5a3ec9806 100644
--- a/spec/features/search/user_searches_for_projects_spec.rb
+++ b/spec/features/search/user_searches_for_projects_spec.rb
@@ -16,9 +16,7 @@ RSpec.describe 'User searches for projects', :js, :disable_rate_limiter, feature
it 'finds a project' do
visit(search_path)
-
- fill_in('dashboard_search', with: project.name[0..3])
- click_button('Search')
+ submit_dashboard_search(project.name[0..3])
expect(page).to have_link(project.name)
end
@@ -26,7 +24,7 @@ RSpec.describe 'User searches for projects', :js, :disable_rate_limiter, feature
it 'preserves the group being searched in' do
visit(search_path(group_id: project.namespace.id))
- submit_search('foo')
+ submit_dashboard_search('foo')
expect(find('#group_id', visible: false).value).to eq(project.namespace.id.to_s)
end
@@ -34,7 +32,7 @@ RSpec.describe 'User searches for projects', :js, :disable_rate_limiter, feature
it 'preserves the project being searched in' do
visit(search_path(project_id: project.id))
- submit_search('foo')
+ submit_dashboard_search('foo')
expect(find('#project_id', visible: false).value).to eq(project.id.to_s)
end
diff --git a/spec/features/search/user_searches_for_wiki_pages_spec.rb b/spec/features/search/user_searches_for_wiki_pages_spec.rb
index 622a19e12ed..4de28a99c21 100644
--- a/spec/features/search/user_searches_for_wiki_pages_spec.rb
+++ b/spec/features/search/user_searches_for_wiki_pages_spec.rb
@@ -33,8 +33,7 @@ RSpec.describe 'User searches for wiki pages', :js, :clean_gitlab_redis_rate_lim
select_listbox_item project.name
end
- fill_in('dashboard_search', with: search_term)
- find('.gl-search-box-by-click-search-button').click
+ submit_dashboard_search(search_term)
select_search_scope('Wiki')
page.within('.results') do
diff --git a/spec/frontend/search/topbar/components/app_spec.js b/spec/frontend/search/topbar/components/app_spec.js
index 33287892c3d..c4411f9f245 100644
--- a/spec/frontend/search/topbar/components/app_spec.js
+++ b/spec/frontend/search/topbar/components/app_spec.js
@@ -1,4 +1,4 @@
-import { GlSearchBoxByClick, GlButton } from '@gitlab/ui';
+import { GlSearchBoxByType, GlButton } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
// eslint-disable-next-line no-restricted-imports
@@ -43,7 +43,7 @@ describe('GlobalSearchTopbar', () => {
});
};
- const findGlSearchBox = () => wrapper.findComponent(GlSearchBoxByClick);
+ const findGlSearchBox = () => wrapper.findComponent(GlSearchBoxByType);
const findGroupFilter = () => wrapper.findComponent(GroupFilter);
const findProjectFilter = () => wrapper.findComponent(ProjectFilter);
const findSyntaxOptionButton = () => wrapper.findComponent(GlButton);
diff --git a/spec/lib/gitlab/pages/deployment_update_spec.rb b/spec/lib/gitlab/pages/deployment_update_spec.rb
index 9a7564ddd59..48f5b27b761 100644
--- a/spec/lib/gitlab/pages/deployment_update_spec.rb
+++ b/spec/lib/gitlab/pages/deployment_update_spec.rb
@@ -5,8 +5,8 @@ require 'spec_helper'
RSpec.describe Gitlab::Pages::DeploymentUpdate, feature_category: :pages do
let_it_be(:project, refind: true) { create(:project, :repository) }
- let_it_be(:old_pipeline) { create(:ci_pipeline, project: project, sha: project.commit('HEAD').sha) }
- let_it_be(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit('HEAD').sha) }
+ let_it_be(:old_pipeline) { create(:ci_pipeline, project: project, sha: project.commit('HEAD~~').sha) }
+ let_it_be(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit('HEAD~').sha) }
let(:build) { create(:ci_build, pipeline: pipeline, ref: 'HEAD') }
let(:invalid_file) { fixture_file_upload('spec/fixtures/dk.png') }
@@ -137,4 +137,35 @@ RSpec.describe Gitlab::Pages::DeploymentUpdate, feature_category: :pages do
expect(pages_deployment_update).to be_valid
end
end
+
+ context 'when validating if current build is outdated' do
+ before do
+ create(:ci_job_artifact, :correct_checksum, file: file, job: build)
+ create(:ci_job_artifact, file_type: :metadata, file_format: :gzip, file: metadata, job: build)
+ build.reload
+ end
+
+ context 'when there is NOT a newer build' do
+ it 'does not fail' do
+ expect(pages_deployment_update).to be_valid
+ end
+ end
+
+ context 'when there is a newer build' do
+ before do
+ new_pipeline = create(:ci_pipeline, project: project, sha: project.commit('HEAD').sha)
+ new_build = create(:ci_build, name: 'pages', pipeline: new_pipeline, ref: 'HEAD')
+ create(:ci_job_artifact, :correct_checksum, file: file, job: new_build)
+ create(:ci_job_artifact, file_type: :metadata, file_format: :gzip, file: metadata, job: new_build)
+ create(:pages_deployment, project: project, ci_build: new_build)
+ new_build.reload
+ end
+
+ it 'fails with outdated reference message' do
+ expect(pages_deployment_update).not_to be_valid
+ expect(pages_deployment_update.errors.full_messages)
+ .to include('build SHA is outdated for this ref')
+ end
+ end
+ end
end
diff --git a/spec/support/helpers/search_helpers.rb b/spec/support/helpers/search_helpers.rb
index a0ff8a13f4a..a2d111bdf5d 100644
--- a/spec/support/helpers/search_helpers.rb
+++ b/spec/support/helpers/search_helpers.rb
@@ -35,6 +35,15 @@ module SearchHelpers
end
end
+ def submit_dashboard_search(query)
+ visit(search_path) unless page.has_css?('#dashboard_search')
+
+ search_form = page.find('input[name="search"]', match: :first)
+
+ search_form.fill_in(with: query)
+ search_form.send_keys(:enter)
+ end
+
def select_search_scope(scope)
within_testid('search-filter') do
click_link scope