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>2021-06-16 21:25:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 21:25:58 +0300
commita5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch)
treefb69158581673816a8cd895f9d352dcb3c678b1e /spec/features/issues
parentd16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff)
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/features/issues')
-rw-r--r--spec/features/issues/csv_spec.rb4
-rw-r--r--spec/features/issues/issue_detail_spec.rb63
-rw-r--r--spec/features/issues/issue_sidebar_spec.rb4
-rw-r--r--spec/features/issues/user_creates_issue_spec.rb48
-rw-r--r--spec/features/issues/user_edits_issue_spec.rb5
-rw-r--r--spec/features/issues/user_interacts_with_awards_spec.rb10
-rw-r--r--spec/features/issues/user_resets_their_incoming_email_token_spec.rb4
-rw-r--r--spec/features/issues/user_toggles_subscription_spec.rb71
8 files changed, 137 insertions, 72 deletions
diff --git a/spec/features/issues/csv_spec.rb b/spec/features/issues/csv_spec.rb
index d41a41c4383..51e0d54ca5e 100644
--- a/spec/features/issues/csv_spec.rb
+++ b/spec/features/issues/csv_spec.rb
@@ -16,9 +16,7 @@ RSpec.describe 'Issues csv', :js do
def request_csv(params = {})
visit project_issues_path(project, params)
- page.within('.nav-controls') do
- find('[data-testid="export-csv-button"]').click
- end
+ click_button 'Export as CSV'
click_on 'Export issues'
end
diff --git a/spec/features/issues/issue_detail_spec.rb b/spec/features/issues/issue_detail_spec.rb
index 1c8da227412..a942a1a44f6 100644
--- a/spec/features/issues/issue_detail_spec.rb
+++ b/spec/features/issues/issue_detail_spec.rb
@@ -6,6 +6,7 @@ RSpec.describe 'Issue Detail', :js do
let(:user) { create(:user) }
let(:project) { create(:project, :public) }
let(:issue) { create(:issue, project: project, author: user) }
+ let(:incident) { create(:incident, project: project, author: user) }
context 'when user displays the issue' do
before do
@@ -21,10 +22,8 @@ RSpec.describe 'Issue Detail', :js do
end
context 'when user displays the issue as an incident' do
- let(:issue) { create(:incident, project: project, author: user) }
-
before do
- visit project_issue_path(project, issue)
+ visit project_issue_path(project, incident)
wait_for_requests
end
@@ -58,9 +57,9 @@ RSpec.describe 'Issue Detail', :js do
visit project_issue_path(project, issue)
wait_for_requests
- page.find('.js-issuable-edit').click
+ click_button 'Edit title and description'
fill_in 'issuable-title', with: 'issue title'
- click_button 'Save'
+ click_button 'Save changes'
wait_for_requests
Users::DestroyService.new(user).execute(user)
@@ -74,4 +73,58 @@ RSpec.describe 'Issue Detail', :js do
end
end
end
+
+ describe 'user updates `issue_type` via the issue type dropdown' do
+ context 'when an issue `issue_type` is edited by a signed in user' do
+ before do
+ sign_in(user)
+
+ visit project_issue_path(project, issue)
+ wait_for_requests
+ end
+
+ it 'routes the user to the incident details page when the `issue_type` is set to incident' do
+ open_issue_edit_form
+
+ page.within('[data-testid="issuable-form"]') do
+ update_type_select('Issue', 'Incident')
+
+ expect(page).to have_current_path(project_issues_incident_path(project, issue))
+ end
+ end
+ end
+
+ context 'when an incident `issue_type` is edited by a signed in user' do
+ before do
+ sign_in(user)
+
+ visit project_issue_path(project, incident)
+ wait_for_requests
+ end
+
+ it 'routes the user to the issue details page when the `issue_type` is set to issue' do
+ open_issue_edit_form
+
+ page.within('[data-testid="issuable-form"]') do
+ update_type_select('Incident', 'Issue')
+
+ expect(page).to have_current_path(project_issue_path(project, incident))
+ end
+ end
+ end
+ end
+
+ def update_type_select(from, to)
+ click_button from
+ click_button to
+ click_button 'Save changes'
+
+ wait_for_requests
+ end
+
+ def open_issue_edit_form
+ wait_for_requests
+ click_button 'Edit title and description'
+ wait_for_requests
+ end
end
diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb
index d147476f1ab..d828b1c1f0c 100644
--- a/spec/features/issues/issue_sidebar_spec.rb
+++ b/spec/features/issues/issue_sidebar_spec.rb
@@ -32,7 +32,7 @@ RSpec.describe 'Issue Sidebar' do
stub_feature_flags(issue_assignees_widget: false)
end
- include_examples 'issuable invite members experiments' do
+ include_examples 'issuable invite members' do
let(:issuable_path) { project_issue_path(project, issue2) }
end
@@ -266,7 +266,7 @@ RSpec.describe 'Issue Sidebar' do
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
+ page.within('[data-testid="milestone_title"]') do
click_on 'Edit'
end
end
diff --git a/spec/features/issues/user_creates_issue_spec.rb b/spec/features/issues/user_creates_issue_spec.rb
index e2e204f03db..4a77e850d51 100644
--- a/spec/features/issues/user_creates_issue_spec.rb
+++ b/spec/features/issues/user_creates_issue_spec.rb
@@ -30,7 +30,7 @@ RSpec.describe "User creates issue" do
end
end
- context "when signed in as guest" do
+ context "when signed in as guest", :js do
before do
project.add_guest(user)
sign_in(user)
@@ -38,41 +38,19 @@ RSpec.describe "User creates issue" do
visit(new_project_issue_path(project))
end
- it "creates issue", :js do
- page.within(".issue-form") do
- expect(page).to have_no_content("Assign to")
- .and have_no_content("Labels")
- .and have_no_content("Milestone")
-
- expect(page.find('#issue_title')['placeholder']).to eq 'Title'
- expect(page.find('#issue_description')['placeholder']).to eq 'Write a description or drag your files hereā€¦'
+ context 'available metadata' do
+ it 'allows guest to set issue metadata' do
+ page.within(".issue-form") do
+ expect(page).to have_content("Title")
+ .and have_content("Description")
+ .and have_content("Type")
+ .and have_content("Assignee")
+ .and have_content("Milestone")
+ .and have_content("Labels")
+ .and have_content("Due date")
+ .and have_content("This issue is confidential and should only be visible to team members with at least Reporter access.")
+ end
end
-
- issue_title = "500 error on profile"
-
- fill_in("Title", with: issue_title)
- first('.js-md').click
- first('.rspec-issuable-form-description').native.send_keys('Description')
-
- click_button("Create issue")
-
- expect(page).to have_content(issue_title)
- .and have_content(user.name)
- .and have_content(project.name)
- expect(page).to have_selector('strong', text: 'Description')
- end
-
- it 'does not render the issue type dropdown' do
- expect(page).not_to have_selector('.s-issuable-type-filter-dropdown-wrap')
- end
- end
-
- context "when signed in as developer", :js do
- before do
- project.add_developer(user)
- sign_in(user)
-
- visit(new_project_issue_path(project))
end
context "when previewing" do
diff --git a/spec/features/issues/user_edits_issue_spec.rb b/spec/features/issues/user_edits_issue_spec.rb
index cb4a5a32762..c59cc99467c 100644
--- a/spec/features/issues/user_edits_issue_spec.rb
+++ b/spec/features/issues/user_edits_issue_spec.rb
@@ -187,7 +187,8 @@ RSpec.describe "Issues > User edits issue", :js do
click_link 'Edit'
click_link 'Unassigned'
- first('.title').click
+
+ close_dropdown_menu_if_visible
expect(page).to have_content 'None - assign yourself'
end
@@ -227,7 +228,7 @@ RSpec.describe "Issues > User edits issue", :js do
close_dropdown_menu_if_visible
- page.within '.value .assign-yourself' do
+ page.within '[data-testid="no-value"]' do
expect(page).to have_content "None"
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 bbb7e8a028d..2921eea7641 100644
--- a/spec/features/issues/user_interacts_with_awards_spec.rb
+++ b/spec/features/issues/user_interacts_with_awards_spec.rb
@@ -62,11 +62,11 @@ RSpec.describe 'User interacts with awards' do
page.within('.awards') do
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(page.find('[data-testid="award-button"].selected .js-counter')).to have_content('1')
+ expect(page).to have_css('[data-testid="award-button"].selected[title="You"]')
expect do
- page.find('[data-testid="award-button"].is-active').click
+ page.find('[data-testid="award-button"].selected').click
wait_for_requests
end.to change { page.all('[data-testid="award-button"]').size }.from(3).to(2)
end
@@ -205,7 +205,7 @@ RSpec.describe 'User interacts with awards' do
it 'adds award to issue' do
first('[data-testid="award-button"]').click
- expect(page).to have_selector('[data-testid="award-button"].is-active')
+ expect(page).to have_selector('[data-testid="award-button"].selected')
expect(first('[data-testid="award-button"]')).to have_content '1'
visit project_issue_path(project, issue)
@@ -215,7 +215,7 @@ RSpec.describe 'User interacts with awards' do
it 'removes award from issue' do
first('[data-testid="award-button"]').click
- find('[data-testid="award-button"].is-active').click
+ find('[data-testid="award-button"].selected').click
expect(first('[data-testid="award-button"]')).to have_content '0'
diff --git a/spec/features/issues/user_resets_their_incoming_email_token_spec.rb b/spec/features/issues/user_resets_their_incoming_email_token_spec.rb
index 2b1c25174c2..4580378dc8a 100644
--- a/spec/features/issues/user_resets_their_incoming_email_token_spec.rb
+++ b/spec/features/issues/user_resets_their_incoming_email_token_spec.rb
@@ -16,11 +16,11 @@ RSpec.describe 'Issues > User resets their incoming email token' do
end
it 'changes incoming email address token', :js do
- page.find('[data-testid="issuable-email-modal-btn"]').click
+ click_button 'Email a new issue to this project'
page.within '#issuable-email-modal' do
previous_token = page.find('input[type="text"]').value
- page.find('[data-testid="incoming-email-token-reset"]').click
+ find('[data-testid="reset_email_token_link"]').click
wait_for_requests
diff --git a/spec/features/issues/user_toggles_subscription_spec.rb b/spec/features/issues/user_toggles_subscription_spec.rb
index 35f4b415463..9809bb34d26 100644
--- a/spec/features/issues/user_toggles_subscription_spec.rb
+++ b/spec/features/issues/user_toggles_subscription_spec.rb
@@ -5,35 +5,70 @@ require "spec_helper"
RSpec.describe "User toggles subscription", :js do
let(:project) { create(:project_empty_repo, :public) }
let(:user) { create(:user) }
+ let(:user2) { create(:user) }
let(:issue) { create(:issue, project: project, author: user) }
- before do
- project.add_developer(user)
- sign_in(user)
+ context 'user is not logged in' do
+ before do
+ visit(project_issue_path(project, issue))
+ end
- visit(project_issue_path(project, issue))
+ it 'does not display the Notification toggle' do
+ expect(page).not_to have_button('Notifications')
+ end
end
- it "unsubscribes from issue" do
- subscription_button = find('[data-testid="subscription-toggle"]')
+ context 'user is logged in' do
+ before do
+ project.add_developer(user)
+ sign_in(user)
+
+ visit(project_issue_path(project, issue))
+ end
+
+ it 'unsubscribes from issue' do
+ subscription_button = find('[data-testid="subscription-toggle"]')
+
+ # Check we're subscribed.
+ expect(subscription_button).to have_css("button.is-checked")
+
+ # Toggle subscription.
+ find('[data-testid="subscription-toggle"]').click
+ wait_for_requests
- # Check we're subscribed.
- expect(subscription_button).to have_css("button.is-checked")
+ # Check we're unsubscribed.
+ expect(subscription_button).to have_css("button:not(.is-checked)")
+ end
- # Toggle subscription.
- find('[data-testid="subscription-toggle"]').click
- wait_for_requests
+ context 'when project emails are disabled' do
+ let(:project) { create(:project_empty_repo, :public, emails_disabled: true) }
- # Check we're unsubscribed.
- expect(subscription_button).to have_css("button:not(.is-checked)")
+ it 'is disabled' do
+ expect(page).to have_content('Disabled by project owner')
+ expect(page).to have_button('Notifications', class: 'is-disabled')
+ end
+ end
end
- context 'when project emails are disabled' do
- let(:project) { create(:project_empty_repo, :public, emails_disabled: true) }
+ context 'user is logged in without edit permission' do
+ before do
+ sign_in(user2)
+
+ visit(project_issue_path(project, issue))
+ end
+
+ it 'subscribes to issue' do
+ subscription_button = find('[data-testid="subscription-toggle"]')
+
+ # Check we're not subscribed.
+ expect(subscription_button).to have_css("button:not(.is-checked)")
+
+ # Toggle subscription.
+ find('[data-testid="subscription-toggle"]').click
+ wait_for_requests
- it 'is disabled' do
- expect(page).to have_content('Disabled by project owner')
- expect(page).to have_button('Notifications', class: 'is-disabled')
+ # Check we're subscribed.
+ expect(subscription_button).to have_css("button.is-checked")
end
end
end