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>2021-06-01 12:09:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-01 12:09:36 +0300
commit8ef03669283030d0502a871113f8db013e6ac46c (patch)
treebeea5b086924cdea8846f4660613368019cf0115 /spec
parentb7ff336e241d1ece19498218f670041b16f62b1c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/features/boards/boards_spec.rb42
-rw-r--r--spec/finders/feature_flags_finder_spec.rb14
-rw-r--r--spec/frontend/nav/components/top_nav_app_spec.js29
-rw-r--r--spec/lib/gitlab/import_export/after_export_strategies/web_upload_strategy_spec.rb22
-rw-r--r--spec/requests/api/unleash_spec.rb26
5 files changed, 90 insertions, 43 deletions
diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb
index 5d9bb8d8087..02bb7574fb0 100644
--- a/spec/features/boards/boards_spec.rb
+++ b/spec/features/boards/boards_spec.rb
@@ -147,14 +147,23 @@ RSpec.describe 'Project issue boards', :js do
end
it 'infinite scrolls list' do
- create_list(:labeled_issue, 50, project: project, labels: [planning])
+ create_list(:labeled_issue, 30, project: project, labels: [planning])
visit_project_board_path_without_query_limit(project, board)
page.within(find('.board:nth-child(2)')) do
- expect(page.find('.board-header')).to have_content('58')
+ expect(page.find('.board-header')).to have_content('38')
+ expect(page).to have_selector('.board-card', count: 10)
+ expect(page).to have_content('Showing 10 of 38 issues')
+
+ find('.board .board-list')
+
+ inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
+ evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
+ end
+
expect(page).to have_selector('.board-card', count: 20)
- expect(page).to have_content('Showing 20 of 58 issues')
+ expect(page).to have_content('Showing 20 of 38 issues')
find('.board .board-list')
@@ -162,8 +171,8 @@ RSpec.describe 'Project issue boards', :js do
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
end
- expect(page).to have_selector('.board-card', count: 40)
- expect(page).to have_content('Showing 40 of 58 issues')
+ expect(page).to have_selector('.board-card', count: 30)
+ expect(page).to have_content('Showing 30 of 38 issues')
find('.board .board-list')
@@ -171,7 +180,7 @@ RSpec.describe 'Project issue boards', :js do
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
end
- expect(page).to have_selector('.board-card', count: 58)
+ expect(page).to have_selector('.board-card', count: 38)
expect(page).to have_content('Showing all issues')
end
end
@@ -464,7 +473,7 @@ RSpec.describe 'Project issue boards', :js do
end
it 'infinite scrolls list with label filter' do
- create_list(:labeled_issue, 50, project: project, labels: [planning, testing])
+ create_list(:labeled_issue, 30, project: project, labels: [planning, testing])
set_filter("label", testing.title)
click_filter_link(testing.title)
@@ -475,9 +484,18 @@ RSpec.describe 'Project issue boards', :js do
wait_for_requests
page.within(find('.board:nth-child(2)')) do
- expect(page.find('.board-header')).to have_content('51')
+ expect(page.find('.board-header')).to have_content('31')
+ expect(page).to have_selector('.board-card', count: 10)
+ expect(page).to have_content('Showing 10 of 31 issues')
+
+ find('.board .board-list')
+
+ inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
+ evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
+ end
+
expect(page).to have_selector('.board-card', count: 20)
- expect(page).to have_content('Showing 20 of 51 issues')
+ expect(page).to have_content('Showing 20 of 31 issues')
find('.board .board-list')
@@ -485,15 +503,15 @@ RSpec.describe 'Project issue boards', :js do
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
end
- expect(page).to have_selector('.board-card', count: 40)
- expect(page).to have_content('Showing 40 of 51 issues')
+ expect(page).to have_selector('.board-card', count: 30)
+ expect(page).to have_content('Showing 30 of 31 issues')
find('.board .board-list')
inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
end
- expect(page).to have_selector('.board-card', count: 51)
+ expect(page).to have_selector('.board-card', count: 31)
expect(page).to have_content('Showing all issues')
end
end
diff --git a/spec/finders/feature_flags_finder_spec.rb b/spec/finders/feature_flags_finder_spec.rb
index 8744a186212..4da5e954157 100644
--- a/spec/finders/feature_flags_finder_spec.rb
+++ b/spec/finders/feature_flags_finder_spec.rb
@@ -24,6 +24,10 @@ RSpec.describe FeatureFlagsFinder do
let!(:feature_flag_2) { create(:operations_feature_flag, name: 'flag-b', project: project) }
let(:args) { {} }
+ before do
+ stub_feature_flags(remove_legacy_flags: false)
+ end
+
it 'returns feature flags ordered by name' do
is_expected.to eq([feature_flag_1, feature_flag_2])
end
@@ -79,6 +83,16 @@ RSpec.describe FeatureFlagsFinder do
it 'returns new and legacy flags' do
is_expected.to eq([feature_flag_1, feature_flag_2, feature_flag_3])
end
+
+ context 'when legacy flags are disabled' do
+ before do
+ stub_feature_flags(remove_legacy_flags_override: false, remove_legacy_flags: true)
+ end
+
+ it 'returns only new flags' do
+ is_expected.to eq([feature_flag_3])
+ end
+ end
end
end
end
diff --git a/spec/frontend/nav/components/top_nav_app_spec.js b/spec/frontend/nav/components/top_nav_app_spec.js
index 06700ce748e..33fdb0c0c4f 100644
--- a/spec/frontend/nav/components/top_nav_app_spec.js
+++ b/spec/frontend/nav/components/top_nav_app_spec.js
@@ -1,5 +1,5 @@
-import { GlNavItemDropdown, GlTooltip } from '@gitlab/ui';
-import { shallowMount, mount } from '@vue/test-utils';
+import { GlNavItemDropdown } from '@gitlab/ui';
+import { shallowMount } from '@vue/test-utils';
import TopNavApp from '~/nav/components/top_nav_app.vue';
import TopNavDropdownMenu from '~/nav/components/top_nav_dropdown_menu.vue';
import { TEST_NAV_DATA } from '../mock_data';
@@ -7,8 +7,8 @@ import { TEST_NAV_DATA } from '../mock_data';
describe('~/nav/components/top_nav_app.vue', () => {
let wrapper;
- const createComponent = (mountFn = shallowMount) => {
- wrapper = mountFn(TopNavApp, {
+ const createComponent = () => {
+ wrapper = shallowMount(TopNavApp, {
propsData: {
navData: TEST_NAV_DATA,
},
@@ -17,7 +17,6 @@ describe('~/nav/components/top_nav_app.vue', () => {
const findNavItemDropdown = () => wrapper.findComponent(GlNavItemDropdown);
const findMenu = () => wrapper.findComponent(TopNavDropdownMenu);
- const findTooltip = () => wrapper.findComponent(GlTooltip);
afterEach(() => {
wrapper.destroy();
@@ -44,25 +43,5 @@ describe('~/nav/components/top_nav_app.vue', () => {
views: TEST_NAV_DATA.views,
});
});
-
- it('renders tooltip', () => {
- expect(findTooltip().attributes()).toMatchObject({
- 'boundary-padding': '0',
- placement: 'right',
- title: TopNavApp.TOOLTIP,
- });
- });
- });
-
- describe('when full mounted', () => {
- beforeEach(() => {
- createComponent(mount);
- });
-
- it('has dropdown toggle as tooltip target', () => {
- const targetFn = findTooltip().props('target');
-
- expect(targetFn()).toBe(wrapper.find('.js-top-nav-dropdown-toggle').element);
- });
});
});
diff --git a/spec/lib/gitlab/import_export/after_export_strategies/web_upload_strategy_spec.rb b/spec/lib/gitlab/import_export/after_export_strategies/web_upload_strategy_spec.rb
index 38f1d48798b..451fd6c6f46 100644
--- a/spec/lib/gitlab/import_export/after_export_strategies/web_upload_strategy_spec.rb
+++ b/spec/lib/gitlab/import_export/after_export_strategies/web_upload_strategy_spec.rb
@@ -27,20 +27,30 @@ RSpec.describe Gitlab::ImportExport::AfterExportStrategies::WebUploadStrategy do
expect(subject.new(url: example_url, http_method: 'whatever')).not_to be_valid
end
- it 'onyl allow urls as upload urls' do
+ it 'only allow urls as upload urls' do
expect(subject.new(url: example_url)).to be_valid
expect(subject.new(url: 'whatever')).not_to be_valid
end
end
describe '#execute' do
- it 'removes the exported project file after the upload' do
- allow(strategy).to receive(:send_file)
- allow(strategy).to receive(:handle_response_error)
+ context 'when upload succeeds' do
+ before do
+ allow(strategy).to receive(:send_file)
+ allow(strategy).to receive(:handle_response_error)
+ end
+
+ it 'does not remove the exported project file after the upload' do
+ expect(project).not_to receive(:remove_exports)
- expect(project).to receive(:remove_exports)
+ strategy.execute(user, project)
+ end
- strategy.execute(user, project)
+ it 'has finished export status' do
+ strategy.execute(user, project)
+
+ expect(project.export_status).to eq(:finished)
+ end
end
context 'when upload fails' do
diff --git a/spec/requests/api/unleash_spec.rb b/spec/requests/api/unleash_spec.rb
index 0b70d62b093..d3d193ba052 100644
--- a/spec/requests/api/unleash_spec.rb
+++ b/spec/requests/api/unleash_spec.rb
@@ -590,6 +590,32 @@ RSpec.describe API::Unleash do
}]
}])
end
+
+ it 'returns new flags when legacy flags are disabled' do
+ stub_feature_flags(remove_legacy_flags_override: false, remove_legacy_flags: true)
+
+ feature_flag_a = create(:operations_feature_flag, :new_version_flag, project: project,
+ name: 'feature_a', active: true)
+ strategy = create(:operations_strategy, feature_flag: feature_flag_a,
+ name: 'userWithId', parameters: { userIds: 'user8' })
+ create(:operations_scope, strategy: strategy, environment_scope: 'staging')
+ feature_flag_b = create(:operations_feature_flag, :legacy_flag, project: project,
+ name: 'feature_b', active: true)
+ create(:operations_feature_flag_scope, feature_flag: feature_flag_b,
+ active: true, strategies: [{ name: 'default', parameters: {} }], environment_scope: 'staging')
+
+ get api(features_url), headers: { 'UNLEASH-INSTANCEID' => client.token, 'UNLEASH-APPNAME' => 'staging' }
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response['features'].sort_by {|f| f['name']}).to eq([{
+ 'name' => 'feature_a',
+ 'enabled' => true,
+ 'strategies' => [{
+ 'name' => 'userWithId',
+ 'parameters' => { 'userIds' => 'user8' }
+ }]
+ }])
+ end
end
end
end