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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-17 00:09:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-17 00:09:09 +0300
commitcffe2c2c348d86d67298fa6516d49c36d696ab2d (patch)
tree9511c62edd677012325946d19e4d2df4a9733aa1 /spec/features
parent7ff36fc6e9f0f5dffb41bfc79b4f07b2ce93e1c7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/groups/issues_spec.rb65
-rw-r--r--spec/features/labels_hierarchy_spec.rb64
-rw-r--r--spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb1
-rw-r--r--spec/features/merge_request/user_manages_subscription_spec.rb45
-rw-r--r--spec/features/merge_request/user_views_open_merge_request_spec.rb2
5 files changed, 100 insertions, 77 deletions
diff --git a/spec/features/groups/issues_spec.rb b/spec/features/groups/issues_spec.rb
index 6b663445124..ef3346b9763 100644
--- a/spec/features/groups/issues_spec.rb
+++ b/spec/features/groups/issues_spec.rb
@@ -11,6 +11,10 @@ RSpec.describe 'Group issues page' do
let(:project_with_issues_disabled) { create(:project, :issues_disabled, group: group) }
let(:path) { issues_group_path(group) }
+ before do
+ stub_feature_flags(vue_issues_list: true)
+ end
+
context 'with shared examples', :js do
let(:issuable) { create(:issue, project: project, title: "this is my created issuable")}
@@ -58,10 +62,10 @@ RSpec.describe 'Group issues page' do
let(:user2) { user_outside_group }
it 'filters by only group users' do
- filtered_search.set('assignee:=')
+ select_tokens 'Assignee', '='
- expect(find('#js-dropdown-assignee .filter-dropdown')).to have_content(user.name)
- expect(find('#js-dropdown-assignee .filter-dropdown')).not_to have_content(user2.name)
+ expect_suggestion(user.name)
+ expect_no_suggestion(user2.name)
end
end
end
@@ -76,23 +80,9 @@ RSpec.describe 'Group issues page' do
it 'returns all group and subgroup issues' do
visit issues_group_path(group)
- page.within('.issuable-list') do
- expect(page).to have_selector('li.issue', count: 2)
- expect(page).to have_content('root group issue')
- expect(page).to have_content('subgroup issue')
- end
- end
-
- it 'truncates issue counts if over the threshold', :clean_gitlab_redis_cache do
- allow(Rails.cache).to receive(:read).and_call_original
- allow(Rails.cache).to receive(:read).with(
- ['group', group.id, 'issues'],
- { expires_in: Gitlab::IssuablesCountForState::CACHE_EXPIRES_IN }
- ).and_return({ opened: 1050, closed: 500, all: 1550 })
-
- visit issues_group_path(group)
-
- expect(page).to have_text('Open 1.1k Closed 500 All 1.6k')
+ expect(page).to have_selector('li.issue', count: 2)
+ expect(page).to have_content('root group issue')
+ expect(page).to have_content('subgroup issue')
end
context 'when project is archived' do
@@ -115,7 +105,6 @@ RSpec.describe 'Group issues page' do
let!(:subgroup_issue) { create(:issue, project: subgroup_project) }
before do
- stub_feature_flags(vue_issues_list: true)
visit issues_group_path(group_with_no_issues)
end
@@ -135,14 +124,10 @@ RSpec.describe 'Group issues page' do
end
it 'shows projects only with issues feature enabled', :js do
- within '.empty-state' do
- click_button 'Toggle project select'
- end
+ click_button 'Toggle project select'
- page.within('.select2-results') do
- expect(page).to have_content(project.full_name)
- expect(page).not_to have_content(project_with_issues_disabled.full_name)
- end
+ expect(page).to have_button project.full_name
+ expect(page).not_to have_button project_with_issues_disabled.full_name
end
end
end
@@ -155,15 +140,15 @@ RSpec.describe 'Group issues page' do
let!(:issue3) { create(:issue, project: project, title: 'Issue #3', relative_position: 3) }
before do
+ stub_feature_flags(vue_issues_list: false)
+
sign_in(user_in_group)
end
it 'displays all issues' do
visit issues_group_path(group, sort: 'relative_position')
- page.within('.issues-list') do
- expect(page).to have_selector('li.issue', count: 3)
- end
+ expect(page).to have_selector('li.issue', count: 3)
end
it 'has manual-ordering css applied' do
@@ -218,11 +203,9 @@ RSpec.describe 'Group issues page' do
end
def check_issue_order
- page.within('.manual-ordering') do
- expect(find('.issue:nth-child(1) .title')).to have_content('Issue #2')
- expect(find('.issue:nth-child(2) .title')).to have_content('Issue #3')
- expect(find('.issue:nth-child(3) .title')).to have_content('Issue #1')
- end
+ expect(page).to have_css('.issue:nth-child(1) .title', text: 'Issue #2')
+ expect(page).to have_css('.issue:nth-child(2) .title', text: 'Issue #3')
+ expect(page).to have_css('.issue:nth-child(3) .title', text: 'Issue #1')
end
end
@@ -239,14 +222,8 @@ RSpec.describe 'Group issues page' do
end
it 'shows the pagination' do
- expect(page).to have_link 'Prev'
- expect(page).to have_link 'Next'
- end
-
- it 'first pagination item is active' do
- page.within('.gl-pagination') do
- expect(find('li.active')).to have_content('1')
- end
+ expect(page).to have_button 'Prev', disabled: true
+ expect(page).to have_button 'Next'
end
end
end
diff --git a/spec/features/labels_hierarchy_spec.rb b/spec/features/labels_hierarchy_spec.rb
index 479199b72b7..ea888d4b254 100644
--- a/spec/features/labels_hierarchy_spec.rb
+++ b/spec/features/labels_hierarchy_spec.rb
@@ -17,6 +17,8 @@ RSpec.describe 'Labels Hierarchy', :js do
let!(:project_label_1) { create(:label, project: project_1, title: 'Label_4') }
before do
+ stub_feature_flags(vue_issues_list: true)
+
grandparent.add_owner(user)
sign_in(user)
@@ -34,8 +36,6 @@ RSpec.describe 'Labels Hierarchy', :js do
click_on 'Close'
end
- wait_for_requests
-
expect(page).to have_selector('.gl-label', text: label.title)
end
end
@@ -44,8 +44,6 @@ RSpec.describe 'Labels Hierarchy', :js do
page.within('.block.labels') do
click_on 'Edit'
- wait_for_requests
-
expect(page).not_to have_text(child_group_label.title)
end
end
@@ -54,15 +52,21 @@ RSpec.describe 'Labels Hierarchy', :js do
shared_examples 'filtering by ancestor labels for projects' do |board = false|
it 'filters by ancestor labels' do
[grandparent_group_label, parent_group_label, project_label_1].each do |label|
- select_label_on_dropdown(label.title)
-
- wait_for_requests
-
if board
+ select_label_on_dropdown(label.title)
+
expect(page).to have_selector('.board-card-title') do |card|
expect(card).to have_selector('a', text: labeled_issue.title)
end
else
+ within '[data-testid="filtered-search-input"]' do
+ click_filtered_search_bar
+ click_on 'Label'
+ click_on '= is'
+ click_on label.title
+ send_keys :enter
+ end
+
expect_issues_list_count(1)
expect(page).to have_selector('.issue-title', text: labeled_issue.title)
end
@@ -70,9 +74,11 @@ RSpec.describe 'Labels Hierarchy', :js do
end
it 'does not filter by descendant group labels' do
- filtered_search.set("label=")
-
- wait_for_requests
+ if board
+ filtered_search.set("label=")
+ else
+ select_tokens 'Label', '='
+ end
expect(page).not_to have_link child_group_label.title
end
@@ -93,11 +99,9 @@ RSpec.describe 'Labels Hierarchy', :js do
it 'filters by ancestors and current group labels' do
[grandparent_group_label, parent_group_label].each do |label|
- select_label_on_dropdown(label.title)
-
- wait_for_requests
-
if board
+ select_label_on_dropdown(label.title)
+
expect(page).to have_selector('.board-card-title') do |card|
expect(card).to have_selector('a', text: labeled_issue.title)
end
@@ -106,6 +110,14 @@ RSpec.describe 'Labels Hierarchy', :js do
expect(card).to have_selector('a', text: labeled_issue_2.title)
end
else
+ within '[data-testid="filtered-search-input"]' do
+ click_filtered_search_bar
+ click_on 'Label'
+ click_on '= is'
+ click_on label.title
+ send_keys :enter
+ end
+
expect_issues_list_count(3)
expect(page).to have_selector('.issue-title', text: labeled_issue.title)
expect(page).to have_selector('.issue-title', text: labeled_issue_2.title)
@@ -115,11 +127,9 @@ RSpec.describe 'Labels Hierarchy', :js do
end
it 'filters by descendant group labels' do
- wait_for_requests
-
- select_label_on_dropdown(group_label_3.title)
-
if board
+ select_label_on_dropdown(group_label_3.title)
+
expect(page).to have_selector('.board-card-title') do |card|
expect(card).not_to have_selector('a', text: labeled_issue_2.title)
end
@@ -128,17 +138,23 @@ RSpec.describe 'Labels Hierarchy', :js do
expect(card).to have_selector('a', text: labeled_issue_3.title)
end
else
+ select_tokens 'Label', '=', group_label_3.title, submit: true
+
expect_issues_list_count(1)
expect(page).to have_selector('.issue-title', text: labeled_issue_3.title)
end
end
it 'does not filter by descendant group project labels' do
- filtered_search.set("label=")
+ if board
+ filtered_search.set("label=")
- wait_for_requests
+ expect(page).not_to have_selector('.btn-link', text: project_label_3.title)
+ else
+ select_tokens 'Label', '='
- expect(page).not_to have_selector('.btn-link', text: project_label_3.title)
+ expect(page).not_to have_link project_label_3.title
+ end
end
end
@@ -195,9 +211,7 @@ RSpec.describe 'Labels Hierarchy', :js do
it_behaves_like 'filtering by ancestor labels for projects'
it 'does not filter by descendant group labels' do
- filtered_search.set("label=")
-
- wait_for_requests
+ select_tokens 'Label', '='
expect(page).not_to have_link child_group_label.title
end
diff --git a/spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb b/spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb
index 7d67cde4bbb..f5b5460769e 100644
--- a/spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb
+++ b/spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb
@@ -59,7 +59,6 @@ RSpec.describe 'Batch diffs', :js do
# Confirm scrolled to correct UI element
expect(get_first_diff.find('.discussion-notes .timeline-entry li.note[id]').obscured?).to be_falsey
- expect(get_second_diff.find('.discussion-notes .timeline-entry li.note[id]').obscured?).to be_truthy
end
end
diff --git a/spec/features/merge_request/user_manages_subscription_spec.rb b/spec/features/merge_request/user_manages_subscription_spec.rb
index 3cdb22000f6..c64c761b8d1 100644
--- a/spec/features/merge_request/user_manages_subscription_spec.rb
+++ b/spec/features/merge_request/user_manages_subscription_spec.rb
@@ -6,29 +6,60 @@ RSpec.describe 'User manages subscription', :js do
let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
let(:user) { create(:user) }
+ let(:moved_mr_sidebar_enabled) { false }
before do
+ stub_feature_flags(moved_mr_sidebar: moved_mr_sidebar_enabled)
+
project.add_maintainer(user)
sign_in(user)
visit(merge_request_path(merge_request))
end
- it 'toggles subscription' do
- page.within('[data-testid="subscription-toggle"]') do
+ context 'moved sidebar flag disabled' do
+ it 'toggles subscription' do
+ page.within('[data-testid="subscription-toggle"]') do
+ wait_for_requests
+
+ expect(page).to have_css 'button:not(.is-checked)'
+ find('button:not(.is-checked)').click
+
+ wait_for_requests
+
+ expect(page).to have_css 'button.is-checked'
+ find('button.is-checked').click
+
+ wait_for_requests
+
+ expect(page).to have_css 'button:not(.is-checked)'
+ end
+ end
+ end
+
+ context 'moved sidebar flag enabled' do
+ let(:moved_mr_sidebar_enabled) { true }
+
+ it 'toggles subscription' do
wait_for_requests
- expect(page).to have_css 'button:not(.is-checked)'
- find('button:not(.is-checked)').click
+ click_button 'Toggle dropdown'
+
+ expect(page).to have_content('Turn on notifications')
+ click_button 'Turn on notifications'
wait_for_requests
- expect(page).to have_css 'button.is-checked'
- find('button.is-checked').click
+ click_button 'Toggle dropdown'
+
+ expect(page).to have_content('Turn off notifications')
+ click_button 'Turn off notifications'
wait_for_requests
- expect(page).to have_css 'button:not(.is-checked)'
+ click_button 'Toggle dropdown'
+
+ expect(page).to have_content('Turn on notifications')
end
end
end
diff --git a/spec/features/merge_request/user_views_open_merge_request_spec.rb b/spec/features/merge_request/user_views_open_merge_request_spec.rb
index fbb4847130c..1f4682b4a46 100644
--- a/spec/features/merge_request/user_views_open_merge_request_spec.rb
+++ b/spec/features/merge_request/user_views_open_merge_request_spec.rb
@@ -119,6 +119,8 @@ RSpec.describe 'User views an open merge request' do
let(:source_branch) { "&#39;&gt;&lt;iframe/srcdoc=&#39;&#39;&gt;&lt;/iframe&gt;" }
before do
+ stub_feature_flags(moved_mr_sidebar: false)
+
project.repository.create_branch(source_branch, "master")
mr = create(:merge_request, source_project: project, target_project: project, source_branch: source_branch)