summaryrefslogtreecommitdiff
path: root/spec/features/issues
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 15:44:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 15:44:42 +0000
commit4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch)
tree5423a1c7516cffe36384133ade12572cf709398d /spec/features/issues
parente570267f2f6b326480d284e0164a6464ba4081bc (diff)
downloadgitlab-ce-4555e1b21c365ed8303ffb7a3325d773c9b8bf31.tar.gz
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'spec/features/issues')
-rw-r--r--spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb2
-rw-r--r--spec/features/issues/filtered_search/filter_issues_spec.rb22
-rw-r--r--spec/features/issues/issue_sidebar_spec.rb81
-rw-r--r--spec/features/issues/resource_label_events_spec.rb2
-rw-r--r--spec/features/issues/service_desk_spec.rb4
-rw-r--r--spec/features/issues/spam_issues_spec.rb1
-rw-r--r--spec/features/issues/user_bulk_edits_issues_labels_spec.rb (renamed from spec/features/issues/bulk_assignment_labels_spec.rb)91
-rw-r--r--spec/features/issues/user_bulk_edits_issues_spec.rb (renamed from spec/features/issues/update_issues_spec.rb)46
-rw-r--r--spec/features/issues/user_edits_issue_spec.rb8
-rw-r--r--spec/features/issues/user_interacts_with_awards_spec.rb53
-rw-r--r--spec/features/issues/user_toggles_subscription_spec.rb4
11 files changed, 144 insertions, 170 deletions
diff --git a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb
index 34d78880991..a4c0a84af7d 100644
--- a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb
+++ b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb
@@ -72,7 +72,7 @@ RSpec.describe 'Resolving all open threads in a merge request from an issue', :j
end
it 'shows a warning that the merge request contains unresolved threads' do
- expect(page).to have_content 'Before this can be merged,'
+ expect(page).to have_content 'all threads must be resolved'
end
it 'has a link to resolve all threads by creating an issue' do
diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb
index 4f4584e7dce..88a7b890daa 100644
--- a/spec/features/issues/filtered_search/filter_issues_spec.rb
+++ b/spec/features/issues/filtered_search/filter_issues_spec.rb
@@ -79,26 +79,6 @@ RSpec.describe 'Filter issues', :js do
expect_filtered_search_input(search_term)
end
- context 'with the NOT queries feature flag disabled' do
- before do
- stub_feature_flags(not_issuable_queries: false)
- visit project_issues_path(project)
- end
-
- it 'does not have the != option' do
- input_filtered_search("label:", submit: false, extra_space: false)
-
- wait_for_requests
- within('#js-dropdown-operator') do
- tokens = all(:css, 'li.filter-dropdown-item')
- expect(tokens.count).to eq(1)
- button = tokens[0].find('button')
- expect(button).to have_content('=')
- expect(button).not_to have_content('!=')
- end
- end
- end
-
describe 'filter issues by author' do
context 'only author' do
it 'filters issues by searched author' do
@@ -350,7 +330,7 @@ RSpec.describe 'Filter issues', :js do
context 'issue label clicked' do
it 'filters and displays in search bar' do
- find('[data-qa-selector="issuable-label"]', text: multiple_words_label.title).click
+ click_link multiple_words_label.title
expect_issues_list_count(1)
expect_tokens([label_token("\"#{multiple_words_label.title}\"")])
diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb
index 04b4caa52fe..d147476f1ab 100644
--- a/spec/features/issues/issue_sidebar_spec.rb
+++ b/spec/features/issues/issue_sidebar_spec.rb
@@ -5,17 +5,14 @@ require 'spec_helper'
RSpec.describe 'Issue Sidebar' do
include MobileHelpers
- let(:group) { create(:group, :nested) }
- let(:project) { create(:project, :public, namespace: group) }
- let!(:user) { create(:user) }
- let!(:label) { create(:label, project: project, title: 'bug') }
- let(:issue) { create(:labeled_issue, project: project, labels: [label]) }
- let!(:xss_label) { create(:label, project: project, title: '&lt;script&gt;alert("xss");&lt;&#x2F;script&gt;') }
- let!(:milestone_expired) { create(:milestone, project: project, due_date: 5.days.ago) }
- let!(:milestone_no_duedate) { create(:milestone, project: project, title: 'Foo - No due date') }
- let!(:milestone1) { create(:milestone, project: project, title: 'Milestone-1', due_date: 20.days.from_now) }
- let!(:milestone2) { create(:milestone, project: project, title: 'Milestone-2', due_date: 15.days.from_now) }
- let!(:milestone3) { create(:milestone, project: project, title: 'Milestone-3', due_date: 10.days.from_now) }
+ let_it_be(:group) { create(:group, :nested) }
+ let_it_be(:project) { create(:project, :public, namespace: group) }
+ let_it_be(:user) { create(:user) }
+ let_it_be(:label) { create(:label, project: project, title: 'bug') }
+ let_it_be(:issue) { create(:labeled_issue, project: project, labels: [label]) }
+ let_it_be(:mock_date) { Date.today.at_beginning_of_month + 2.days }
+ let_it_be(:issue_with_due_date) { create(:issue, project: project, due_date: mock_date) }
+ let_it_be(:xss_label) { create(:label, project: project, title: '&lt;script&gt;alert("xss");&lt;&#x2F;script&gt;') }
before do
stub_incoming_email_setting(enabled: true, address: "p+%{key}@gl.ab")
@@ -130,30 +127,7 @@ RSpec.describe 'Issue Sidebar' do
end
end
- context 'when invite_members_version_b experiment is enabled' do
- before do
- stub_experiment_for_subject(invite_members_version_b: true)
- end
-
- it 'shows a link for inviting members and follows through to modal' do
- project.add_developer(user)
- visit_issue(project, issue2)
-
- open_assignees_dropdown
-
- page.within '.dropdown-menu-user' do
- expect(page).to have_link('Invite members', href: '#')
- expect(page).to have_selector('[data-track-event="click_invite_members_version_b"]')
- expect(page).to have_selector('[data-track-label="edit_assignee"]')
- end
-
- click_link 'Invite members'
-
- expect(page).to have_content("Oops, this feature isn't ready yet")
- end
- end
-
- context 'when invite_members_version_b experiment is disabled' do
+ context 'when user cannot invite members in assignee dropdown' do
it 'shows author in assignee dropdown and no invite link' do
project.add_developer(user)
visit_issue(project, issue2)
@@ -212,7 +186,8 @@ RSpec.describe 'Issue Sidebar' do
click_link user2.name
end
- find('.js-right-sidebar').click
+ find('.participants').click
+ wait_for_requests
open_assignees_dropdown
@@ -226,7 +201,31 @@ RSpec.describe 'Issue Sidebar' do
end
end
- context 'as a allowed user' do
+ context 'due date widget', :js do
+ let(:due_date_value) { find('[data-testid="due-date"] [data-testid="sidebar-date-value"]') }
+
+ context 'when no due date exists' do
+ before do
+ visit_issue(project, issue)
+ end
+
+ it "displays 'None'" do
+ expect(due_date_value.text).to have_content 'None'
+ end
+ end
+
+ context 'when due date exists' do
+ before do
+ visit_issue(project, issue_with_due_date)
+ end
+
+ it "displays the due date" do
+ expect(due_date_value.text).to have_content mock_date.strftime('%b %-d, %Y')
+ end
+ end
+ end
+
+ context 'as an allowed user' do
before do
project.add_developer(user)
visit_issue(project, issue)
@@ -260,6 +259,12 @@ RSpec.describe 'Issue Sidebar' do
end
context 'editing issue milestone', :js do
+ let_it_be(:milestone_expired) { create(:milestone, project: project, due_date: 5.days.ago) }
+ let_it_be(:milestone_no_duedate) { create(:milestone, project: project, title: 'Foo - No due date') }
+ let_it_be(:milestone1) { create(:milestone, project: project, title: 'Milestone-1', due_date: 20.days.from_now) }
+ let_it_be(:milestone2) { create(:milestone, project: project, title: 'Milestone-2', due_date: 15.days.from_now) }
+ let_it_be(:milestone3) { create(:milestone, project: project, title: 'Milestone-3', due_date: 10.days.from_now) }
+
before do
page.within('.block.milestone > .title') do
click_on 'Edit'
@@ -448,6 +453,8 @@ RSpec.describe 'Issue Sidebar' do
def visit_issue(project, issue)
visit project_issue_path(project, issue)
+
+ wait_for_requests
end
def open_issue_sidebar
diff --git a/spec/features/issues/resource_label_events_spec.rb b/spec/features/issues/resource_label_events_spec.rb
index 8faec85f3df..33edf2f0b63 100644
--- a/spec/features/issues/resource_label_events_spec.rb
+++ b/spec/features/issues/resource_label_events_spec.rb
@@ -40,7 +40,7 @@ RSpec.describe 'List issue resource label events', :js do
labels.each { |label| click_link label }
- click_on 'Edit'
+ send_keys(:escape)
wait_for_requests
end
end
diff --git a/spec/features/issues/service_desk_spec.rb b/spec/features/issues/service_desk_spec.rb
index 75ea8c14f7f..0a879fdd4d4 100644
--- a/spec/features/issues/service_desk_spec.rb
+++ b/spec/features/issues/service_desk_spec.rb
@@ -9,6 +9,8 @@ RSpec.describe 'Service Desk Issue Tracker', :js do
let_it_be(:support_bot) { User.support_bot }
before do
+ stub_feature_flags(vue_issuables_list: true)
+
# The following two conditions equate to Gitlab::ServiceDesk.supported == true
allow(Gitlab::IncomingEmail).to receive(:enabled?).and_return(true)
allow(Gitlab::IncomingEmail).to receive(:supports_wildcard?).and_return(true)
@@ -21,7 +23,7 @@ RSpec.describe 'Service Desk Issue Tracker', :js do
before do
visit project_path(project)
find('.sidebar-top-level-items .shortcuts-issues').click
- find('.sidebar-sub-level-items a[title="Service Desk"]').click
+ find('.sidebar-sub-level-items a', text: 'Service Desk').click
end
it 'can navigate to the service desk from link in the sidebar' do
diff --git a/spec/features/issues/spam_issues_spec.rb b/spec/features/issues/spam_issues_spec.rb
index 461030d3176..70d7deadec3 100644
--- a/spec/features/issues/spam_issues_spec.rb
+++ b/spec/features/issues/spam_issues_spec.rb
@@ -14,6 +14,7 @@ RSpec.describe 'New issue', :js do
Gitlab::CurrentSettings.update!(
akismet_enabled: true,
akismet_api_key: 'testkey',
+ spam_check_api_key: 'testkey',
recaptcha_enabled: true,
recaptcha_site_key: 'test site key',
recaptcha_private_key: 'test private key'
diff --git a/spec/features/issues/bulk_assignment_labels_spec.rb b/spec/features/issues/user_bulk_edits_issues_labels_spec.rb
index 80bf964e2ee..97df2d0208b 100644
--- a/spec/features/issues/bulk_assignment_labels_spec.rb
+++ b/spec/features/issues/user_bulk_edits_issues_labels_spec.rb
@@ -20,17 +20,13 @@ RSpec.describe 'Issues > Labels bulk assignment' do
end
context 'sidebar' do
- before do
- enable_bulk_update
- end
-
it 'is present when bulk edit is enabled' do
- expect(page).to have_css('.issuable-sidebar')
+ enable_bulk_update
+ expect(page).to have_css 'aside[aria-label="Bulk update"]'
end
it 'is not present when bulk edit is disabled' do
- disable_bulk_update
- expect(page).not_to have_css('.issuable-sidebar')
+ expect(page).not_to have_css 'aside[aria-label="Bulk update"]'
end
end
@@ -42,7 +38,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'a label' do
context 'to all issues' do
before do
- check 'check-all-issues'
+ check 'Select all'
open_labels_dropdown ['bug']
update_issues
end
@@ -57,8 +53,8 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'to some issues' do
before do
- check "selected_issue_#{issue1.id}"
- check "selected_issue_#{issue2.id}"
+ check issue1.title
+ check issue2.title
open_labels_dropdown ['bug']
update_issues
end
@@ -73,7 +69,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'to an issue' do
before do
- check "selected_issue_#{issue1.id}"
+ check issue1.title
open_labels_dropdown ['bug']
update_issues
end
@@ -89,7 +85,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'to an issue by selecting the label first' do
before do
open_labels_dropdown ['bug']
- check "selected_issue_#{issue1.id}"
+ check issue1.title
update_issues
end
@@ -105,7 +101,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'multiple labels' do
context 'to all issues' do
before do
- check 'check-all-issues'
+ check 'Select all'
open_labels_dropdown %w(bug feature)
update_issues
end
@@ -120,7 +116,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'to a issue' do
before do
- check "selected_issue_#{issue1.id}"
+ check issue1.title
open_labels_dropdown %w(bug feature)
update_issues
end
@@ -141,7 +137,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
issue2.labels << feature
enable_bulk_update
- check 'check-all-issues'
+ check 'Select all'
open_labels_dropdown ['bug']
update_issues
@@ -162,7 +158,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
issue2.labels << feature
enable_bulk_update
- check 'check-all-issues'
+ check 'Select all'
unmark_labels_in_dropdown %w(bug feature)
update_issues
end
@@ -229,7 +225,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
expect(find("#issue_#{issue1.id}")).to have_content 'bug'
expect(find("#issue_#{issue2.id}")).to have_content 'feature'
- check 'check-all-issues'
+ check 'Select all'
open_milestone_dropdown(['First Release'])
update_issues
@@ -250,7 +246,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
it 'keeps existing label and new label is present' do
expect(find("#issue_#{issue1.id}")).to have_content 'bug'
- check 'check-all-issues'
+ check 'Select all'
open_milestone_dropdown ['First Release']
open_labels_dropdown ['feature']
update_issues
@@ -277,7 +273,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
expect(find("#issue_#{issue1.id}")).to have_content 'bug'
expect(find("#issue_#{issue2.id}")).to have_content 'feature'
- check 'check-all-issues'
+ check 'Select all'
open_milestone_dropdown ['First Release']
unmark_labels_in_dropdown ['feature']
@@ -309,7 +305,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
expect(find("#issue_#{issue2.id}")).to have_content 'feature'
expect(find("#issue_#{issue2.id}")).to have_content 'First Release'
- check 'check-all-issues'
+ check 'Select all'
open_milestone_dropdown(['No milestone'])
update_issues
@@ -369,31 +365,31 @@ RSpec.describe 'Issues > Labels bulk assignment' do
end
it 'applies label from filtered results' do
- check 'check-all-issues'
+ check 'Select all'
- page.within('.issues-bulk-update') do
+ within('aside[aria-label="Bulk update"]') do
click_button 'Select labels'
wait_for_requests
- expect(find('.dropdown-menu-labels li', text: 'bug')).to have_css('.is-active')
- expect(find('.dropdown-menu-labels li', text: 'feature')).to have_css('.is-indeterminate')
+ expect(page).to have_link 'bug', class: 'is-active'
+ expect(page).to have_link 'feature', class: 'is-indeterminate'
click_link 'bug'
- find('.dropdown-input-field', visible: true).set('wontfix')
+ fill_in 'Search', with: 'wontfix'
click_link 'wontfix'
end
update_issues
- page.within '.issues-holder' do
- expect(find("#issue_#{issue1.id}")).not_to have_content 'bug'
- expect(find("#issue_#{issue1.id}")).to have_content 'feature'
- expect(find("#issue_#{issue1.id}")).to have_content 'wontfix'
+ first_issue = find("#issue_#{issue1.id}")
+ expect(first_issue).not_to have_content 'bug'
+ expect(first_issue).to have_content 'feature'
+ expect(first_issue).to have_content 'wontfix'
- expect(find("#issue_#{issue2.id}")).not_to have_content 'bug'
- expect(find("#issue_#{issue2.id}")).not_to have_content 'feature'
- expect(find("#issue_#{issue2.id}")).to have_content 'wontfix'
- end
+ second_issue = find("#issue_#{issue2.id}")
+ expect(second_issue).not_to have_content 'bug'
+ expect(second_issue).not_to have_content 'feature'
+ expect(second_issue).to have_content 'wontfix'
end
end
end
@@ -408,24 +404,22 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'cannot bulk assign labels' do
it do
expect(page).not_to have_button 'Edit issues'
- expect(page).not_to have_css '.check-all-issues'
- expect(page).not_to have_css '.issue-check'
+ expect(page).not_to have_unchecked_field 'Select all'
+ expect(page).not_to have_unchecked_field issue1.title
end
end
end
def open_milestone_dropdown(items = [])
- page.within('.issues-bulk-update') do
- click_button 'Select milestone'
- wait_for_requests
- items.map do |item|
- click_link item
- end
+ click_button 'Select milestone'
+ wait_for_requests
+ items.map do |item|
+ click_link item
end
end
def open_labels_dropdown(items = [], unmark = false)
- page.within('.issues-bulk-update') do
+ within('aside[aria-label="Bulk update"]') do
click_button 'Select labels'
wait_for_requests
items.map do |item|
@@ -446,12 +440,10 @@ RSpec.describe 'Issues > Labels bulk assignment' do
end
def check_issue(issue, uncheck = false)
- page.within('.issues-list') do
- if uncheck
- uncheck "selected_issue_#{issue.id}"
- else
- check "selected_issue_#{issue.id}"
- end
+ if uncheck
+ uncheck issue.title
+ else
+ check issue.title
end
end
@@ -460,12 +452,13 @@ RSpec.describe 'Issues > Labels bulk assignment' do
end
def update_issues
- find('.update-selected-issues').click
+ click_button 'Update all'
wait_for_requests
end
def enable_bulk_update
visit project_issues_path(project)
+ wait_for_requests
click_button 'Edit issues'
end
diff --git a/spec/features/issues/update_issues_spec.rb b/spec/features/issues/user_bulk_edits_issues_spec.rb
index eb78e4e2456..e34c16e27ba 100644
--- a/spec/features/issues/update_issues_spec.rb
+++ b/spec/features/issues/user_bulk_edits_issues_spec.rb
@@ -17,10 +17,10 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
visit project_issues_path(project)
click_button 'Edit issues'
- find('#check-all-issues').click
- find('.js-issue-status').click
+ check 'Select all'
+ click_button 'Select status'
+ click_link 'Closed'
- find('.dropdown-menu-status a', text: 'Closed').click
click_update_issues_button
expect(page).to have_selector('.issue', count: 0)
end
@@ -30,10 +30,10 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
visit project_issues_path(project, state: 'closed')
click_button 'Edit issues'
- find('#check-all-issues').click
- find('.js-issue-status').click
+ check 'Select all'
+ click_button 'Select status'
+ click_link 'Open'
- find('.dropdown-menu-status a', text: 'Open').click
click_update_issues_button
expect(page).to have_selector('.issue', count: 0)
end
@@ -44,10 +44,10 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
visit project_issues_path(project)
click_button 'Edit issues'
- find('#check-all-issues').click
+ check 'Select all'
click_update_assignee_button
+ click_link user.username
- find('.dropdown-menu-user-link', text: user.username).click
click_update_issues_button
page.within('.issue .controls') do
@@ -59,13 +59,15 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
create_assigned
visit project_issues_path(project)
+ expect(find('.issue:first-of-type')).to have_link "Assigned to #{user.name}"
+
click_button 'Edit issues'
- find('#check-all-issues').click
+ check 'Select all'
click_update_assignee_button
-
click_link 'Unassigned'
click_update_issues_button
- expect(find('.issue:first-child .controls')).not_to have_css('.author-link')
+
+ expect(find('.issue:first-of-type')).not_to have_link "Assigned to #{user.name}"
end
end
@@ -76,10 +78,9 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
visit project_issues_path(project)
click_button 'Edit issues'
- find('#check-all-issues').click
- find('.issues-bulk-update .js-milestone-select').click
-
- find('.dropdown-menu-milestone a', text: milestone.title).click
+ check 'Select all'
+ click_button 'Select milestone'
+ click_link milestone.title
click_update_issues_button
expect(page.find('.issue')).to have_content milestone.title
@@ -91,16 +92,15 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
wait_for_requests
- expect(first('.issue')).to have_content milestone.title
+ expect(find('.issue:first-of-type')).to have_text milestone.title
click_button 'Edit issues'
- find('#check-all-issues').click
- find('.issues-bulk-update .js-milestone-select').click
-
- find('.dropdown-menu-milestone a', text: "No milestone").click
+ check 'Select all'
+ click_button 'Select milestone'
+ click_link 'No milestone'
click_update_issues_button
- expect(find('.issue:first-child')).not_to have_content milestone.title
+ expect(find('.issue:first-of-type')).not_to have_text milestone.title
end
end
@@ -117,12 +117,12 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
end
def click_update_assignee_button
- find('.js-update-assignee').click
+ click_button 'Select assignee'
wait_for_requests
end
def click_update_issues_button
- find('.update-selected-issues').click
+ click_button 'Update all'
wait_for_requests
end
end
diff --git a/spec/features/issues/user_edits_issue_spec.rb b/spec/features/issues/user_edits_issue_spec.rb
index 1bbb96ff479..cb4a5a32762 100644
--- a/spec/features/issues/user_edits_issue_spec.rb
+++ b/spec/features/issues/user_edits_issue_spec.rb
@@ -406,6 +406,12 @@ RSpec.describe "Issues > User edits issue", :js do
end
context 'update due date' do
+ before do
+ # Due date widget uses GraphQL and needs to wait for requests to come back
+ # The date picker won't be rendered before requests complete
+ wait_for_requests
+ end
+
it 'adds due date to issue' do
date = Date.today.at_beginning_of_month + 2.days
@@ -417,7 +423,7 @@ RSpec.describe "Issues > User edits issue", :js do
wait_for_requests
- expect(find('[data-testid="sidebar-duedate-value"]').text).to have_content date.strftime('%b %-d, %Y')
+ expect(find('[data-testid="sidebar-date-value"]').text).to have_content date.strftime('%b %-d, %Y')
end
end
diff --git a/spec/features/issues/user_interacts_with_awards_spec.rb b/spec/features/issues/user_interacts_with_awards_spec.rb
index e862f7030c0..bbb7e8a028d 100644
--- a/spec/features/issues/user_interacts_with_awards_spec.rb
+++ b/spec/features/issues/user_interacts_with_awards_spec.rb
@@ -5,10 +5,6 @@ require 'spec_helper'
RSpec.describe 'User interacts with awards' do
let(:user) { create(:user) }
- before do
- stub_feature_flags(improved_emoji_picker: false)
- end
-
describe 'User interacts with awards in an issue', :js do
let(:issue) { create(:issue, project: project)}
let(:project) { create(:project) }
@@ -55,29 +51,24 @@ RSpec.describe 'User interacts with awards' do
it 'toggles a custom award emoji' do
page.within('.awards') do
- page.find('.js-add-award').click
+ page.find('.add-reaction-button').click
end
- page.find('.emoji-menu.is-visible')
-
- expect(page).to have_selector('.js-emoji-menu-search')
- expect(page.evaluate_script("document.activeElement.classList.contains('js-emoji-menu-search')")).to eq(true)
-
- page.within('.emoji-menu-content') do
- emoji_button = page.first('.js-emoji-btn')
+ page.within('.emoji-picker') do
+ emoji_button = page.first('gl-emoji[data-name="8ball"]')
emoji_button.hover
emoji_button.click
end
page.within('.awards') do
- expect(page).to have_selector('.js-emoji-btn')
- expect(page.find('.js-emoji-btn.active .js-counter')).to have_content('1')
- expect(page).to have_css(".js-emoji-btn.active[title='You']")
+ expect(page).to have_selector('[data-testid="award-button"]')
+ expect(page.find('[data-testid="award-button"].is-active .js-counter')).to have_content('1')
+ expect(page).to have_css('[data-testid="award-button"].is-active[title="You"]')
expect do
- page.find('.js-emoji-btn.active').click
+ page.find('[data-testid="award-button"].is-active').click
wait_for_requests
- end.to change { page.all('.award-control.js-emoji-btn').size }.from(3).to(2)
+ end.to change { page.all('[data-testid="award-button"]').size }.from(3).to(2)
end
end
@@ -212,31 +203,25 @@ RSpec.describe 'User interacts with awards' do
end
it 'adds award to issue' do
- first('.js-emoji-btn').click
+ first('[data-testid="award-button"]').click
- expect(page).to have_selector('.js-emoji-btn.active')
- expect(first('.js-emoji-btn')).to have_content '1'
+ expect(page).to have_selector('[data-testid="award-button"].is-active')
+ expect(first('[data-testid="award-button"]')).to have_content '1'
visit project_issue_path(project, issue)
- expect(first('.js-emoji-btn')).to have_content '1'
+ expect(first('[data-testid="award-button"]')).to have_content '1'
end
it 'removes award from issue' do
- first('.js-emoji-btn').click
- find('.js-emoji-btn.active').click
+ first('[data-testid="award-button"]').click
+ find('[data-testid="award-button"].is-active').click
- expect(first('.js-emoji-btn')).to have_content '0'
+ expect(first('[data-testid="award-button"]')).to have_content '0'
visit project_issue_path(project, issue)
- expect(first('.js-emoji-btn')).to have_content '0'
- end
-
- it 'only has one menu on the page' do
- first('.js-add-award').click
-
- expect(page).to have_selector('.emoji-menu', count: 1)
+ expect(first('[data-testid="award-button"]')).to have_content '0'
end
end
@@ -311,7 +296,7 @@ RSpec.describe 'User interacts with awards' do
end
context 'execute /award quick action' do
- it 'toggles the emoji award on noteable', :js do
+ xit 'toggles the emoji award on noteable', :js do
execute_quick_action('/award :100:')
expect(find(noteable_award_counter)).to have_text("1")
@@ -330,7 +315,7 @@ RSpec.describe 'User interacts with awards' do
end
it 'has disabled emoji button' do
- expect(first('.award-control')[:class]).to have_text('disabled')
+ expect(first('[data-testid="award-button"]')[:class]).to have_text('disabled')
end
end
@@ -356,7 +341,7 @@ RSpec.describe 'User interacts with awards' do
end
def noteable_award_counter
- ".awards .active"
+ ".awards .is-active"
end
def toggle_smiley_emoji(status)
diff --git a/spec/features/issues/user_toggles_subscription_spec.rb b/spec/features/issues/user_toggles_subscription_spec.rb
index d91c187c840..35f4b415463 100644
--- a/spec/features/issues/user_toggles_subscription_spec.rb
+++ b/spec/features/issues/user_toggles_subscription_spec.rb
@@ -32,8 +32,8 @@ RSpec.describe "User toggles subscription", :js do
let(:project) { create(:project_empty_repo, :public, emails_disabled: true) }
it 'is disabled' do
- expect(page).to have_content('Notifications have been disabled by the project or group owner')
- expect(page).not_to have_selector('[data-testid="subscription-toggle"]')
+ expect(page).to have_content('Disabled by project owner')
+ expect(page).to have_button('Notifications', class: 'is-disabled')
end
end
end