diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/features/profiles | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/features/profiles')
-rw-r--r-- | spec/features/profiles/account_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/profiles/active_sessions_spec.rb | 11 | ||||
-rw-r--r-- | spec/features/profiles/emails_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/profiles/gpg_keys_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/profiles/keys_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/profiles/personal_access_tokens_spec.rb | 26 | ||||
-rw-r--r-- | spec/features/profiles/user_changes_notified_of_own_activity_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/profiles/user_edit_profile_spec.rb | 82 |
8 files changed, 112 insertions, 29 deletions
diff --git a/spec/features/profiles/account_spec.rb b/spec/features/profiles/account_spec.rb index 62d8a96c1b2..2e8d9ef80cd 100644 --- a/spec/features/profiles/account_spec.rb +++ b/spec/features/profiles/account_spec.rb @@ -78,14 +78,14 @@ RSpec.describe 'Profile > Account', :js do update_username(new_username) visit new_project_path expect(current_path).to eq(new_project_path) - expect(find('.breadcrumbs-sub-title')).to have_content('Details') + expect(find('.breadcrumbs')).to have_content(user.name) end it 'the old project path redirects to the new path' do update_username(new_username) visit old_project_path expect(current_path).to eq(new_project_path) - expect(find('.breadcrumbs-sub-title')).to have_content('Details') + expect(find('.breadcrumbs')).to have_content(user.name) end end end diff --git a/spec/features/profiles/active_sessions_spec.rb b/spec/features/profiles/active_sessions_spec.rb index 75531d43df2..fd64704b7c8 100644 --- a/spec/features/profiles/active_sessions_spec.rb +++ b/spec/features/profiles/active_sessions_spec.rb @@ -11,8 +11,8 @@ RSpec.describe 'Profile > Active Sessions', :clean_gitlab_redis_shared_state do let(:admin) { create(:admin) } - it 'User sees their active sessions' do - Timecop.freeze(Time.zone.parse('2018-03-12 09:06')) do + it 'user sees their active sessions' do + travel_to(Time.zone.parse('2018-03-12 09:06')) do Capybara::Session.new(:session1) Capybara::Session.new(:session2) Capybara::Session.new(:session3) @@ -45,6 +45,7 @@ RSpec.describe 'Profile > Active Sessions', :clean_gitlab_redis_shared_state do ) gitlab_sign_in(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_user_path(user) @@ -55,8 +56,8 @@ RSpec.describe 'Profile > Active Sessions', :clean_gitlab_redis_shared_state do visit profile_active_sessions_path expect(page).to( - have_selector('ul.list-group li.list-group-item', { text: 'Signed in on', - count: 2 })) + have_selector('ul.list-group li.list-group-item', text: 'Signed in on', + count: 2)) expect(page).to have_content( '127.0.0.1 ' \ @@ -81,7 +82,7 @@ RSpec.describe 'Profile > Active Sessions', :clean_gitlab_redis_shared_state do end end - it 'User can revoke a session', :js do + it 'user can revoke a session', :js do Capybara::Session.new(:session1) Capybara::Session.new(:session2) diff --git a/spec/features/profiles/emails_spec.rb b/spec/features/profiles/emails_spec.rb index fc7de6d8b23..bdf1f8b022a 100644 --- a/spec/features/profiles/emails_spec.rb +++ b/spec/features/profiles/emails_spec.rb @@ -42,7 +42,7 @@ RSpec.describe 'Profile > Emails' do end end - it 'User removes email' do + it 'user removes email' do user.emails.create(email: 'my@email.com') visit profile_emails_path expect(page).to have_content("my@email.com") @@ -51,7 +51,7 @@ RSpec.describe 'Profile > Emails' do expect(page).not_to have_content("my@email.com") end - it 'User confirms email' do + it 'user confirms email' do email = user.emails.create(email: 'my@email.com') visit profile_emails_path expect(page).to have_content("#{email.email} Unverified") @@ -63,7 +63,7 @@ RSpec.describe 'Profile > Emails' do expect(page).to have_content("#{email.email} Verified") end - it 'User re-sends confirmation email' do + it 'user re-sends confirmation email' do email = user.emails.create(email: 'my@email.com') visit profile_emails_path diff --git a/spec/features/profiles/gpg_keys_spec.rb b/spec/features/profiles/gpg_keys_spec.rb index 18ed4e646b3..4eedeeac262 100644 --- a/spec/features/profiles/gpg_keys_spec.rb +++ b/spec/features/profiles/gpg_keys_spec.rb @@ -36,7 +36,7 @@ RSpec.describe 'Profile > GPG Keys' do end end - it 'User sees their key' do + it 'user sees their key' do create(:gpg_key, user: user, key: GpgHelpers::User2.public_key) visit profile_gpg_keys_path @@ -45,7 +45,7 @@ RSpec.describe 'Profile > GPG Keys' do expect(page).to have_content(GpgHelpers::User2.fingerprint) end - it 'User removes a key via the key index' do + it 'user removes a key via the key index' do create(:gpg_key, user: user, key: GpgHelpers::User2.public_key) visit profile_gpg_keys_path @@ -54,7 +54,7 @@ RSpec.describe 'Profile > GPG Keys' do expect(page).to have_content('Your GPG keys (0)') end - it 'User revokes a key via the key index' do + it 'user revokes a key via the key index' do gpg_key = create :gpg_key, user: user, key: GpgHelpers::User2.public_key gpg_signature = create :gpg_signature, gpg_key: gpg_key, verification_status: :verified diff --git a/spec/features/profiles/keys_spec.rb b/spec/features/profiles/keys_spec.rb index 23bbe9c1587..c1e2d19ad9a 100644 --- a/spec/features/profiles/keys_spec.rb +++ b/spec/features/profiles/keys_spec.rb @@ -64,7 +64,7 @@ RSpec.describe 'Profile > SSH Keys' do end end - it 'User sees their keys' do + it 'user sees their keys' do key = create(:key, user: user) visit profile_keys_path diff --git a/spec/features/profiles/personal_access_tokens_spec.rb b/spec/features/profiles/personal_access_tokens_spec.rb index de5a594aca6..88bfc71cfbe 100644 --- a/spec/features/profiles/personal_access_tokens_spec.rb +++ b/spec/features/profiles/personal_access_tokens_spec.rb @@ -18,6 +18,10 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do find("#created-personal-access-token").value end + def feed_token + find("#feed_token").value + end + def disallow_personal_access_token_saves! allow(PersonalAccessTokens::CreateService).to receive(:new).and_return(pat_create_service) @@ -112,4 +116,26 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do end end end + + describe "feed token" do + context "when enabled" do + it "displays feed token" do + allow(Gitlab::CurrentSettings).to receive(:disable_feed_token).and_return(false) + visit profile_personal_access_tokens_path + + expect(page).to have_content("Your feed token is used to authenticate you when your RSS reader loads a personalized RSS feed or when your calendar application loads a personalized calendar, and is included in those feed URLs.") + expect(feed_token).to eq(user.feed_token) + end + end + + context "when disabled" do + it "does not display feed token" do + allow(Gitlab::CurrentSettings).to receive(:disable_feed_token).and_return(true) + visit profile_personal_access_tokens_path + + expect(page).not_to have_content("Your feed token is used to authenticate you when your RSS reader loads a personalized RSS feed or when your calendar application loads a personalized calendar, and is included in those feed URLs.") + expect(page).not_to have_css("#feed_token") + end + end + end end diff --git a/spec/features/profiles/user_changes_notified_of_own_activity_spec.rb b/spec/features/profiles/user_changes_notified_of_own_activity_spec.rb index a5b7b1fba9d..1b6215c1308 100644 --- a/spec/features/profiles/user_changes_notified_of_own_activity_spec.rb +++ b/spec/features/profiles/user_changes_notified_of_own_activity_spec.rb @@ -9,7 +9,7 @@ RSpec.describe 'Profile > Notifications > User changes notified_of_own_activity sign_in(user) end - it 'User opts into receiving notifications about their own activity' do + it 'user opts into receiving notifications about their own activity' do visit profile_notifications_path expect(page).not_to have_checked_field('user[notified_of_own_activity]') @@ -20,7 +20,7 @@ RSpec.describe 'Profile > Notifications > User changes notified_of_own_activity expect(page).to have_checked_field('user[notified_of_own_activity]') end - it 'User opts out of receiving notifications about their own activity' do + it 'user opts out of receiving notifications about their own activity' do user.update!(notified_of_own_activity: true) visit profile_notifications_path diff --git a/spec/features/profiles/user_edit_profile_spec.rb b/spec/features/profiles/user_edit_profile_spec.rb index d0340dfc880..239bc04a9cb 100644 --- a/spec/features/profiles/user_edit_profile_spec.rb +++ b/spec/features/profiles/user_edit_profile_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'User edit profile' do + include Spec::Support::Helpers::Features::NotesHelpers + let(:user) { create(:user) } before do @@ -226,7 +228,7 @@ RSpec.describe 'User edit profile' do end def open_edit_status_modal - open_modal 'Edit status' + open_modal 'Edit status' end def set_user_status_in_modal @@ -289,6 +291,10 @@ RSpec.describe 'User edit profile' do toggle_busy_status set_user_status_in_modal + + wait_for_requests + visit root_path(user) + open_edit_status_modal expect(busy_status.checked?).to eq(true) @@ -366,26 +372,37 @@ RSpec.describe 'User edit profile' do expect(page).not_to have_selector '.cover-status' end - it 'clears the user status with the "Remove status" button' do - user_status = create(:user_status, user: user, message: 'Eating bread', emoji: 'stuffed_flatbread') + context 'Remove status button' do + before do + user.status = UserStatus.new(message: 'Eating bread', emoji: 'stuffed_flatbread') - visit_user - wait_for_requests + visit_user + wait_for_requests - within('.cover-status') do - expect(page).to have_emoji(user_status.emoji) - expect(page).to have_content user_status.message + open_edit_status_modal + + page.within "#set-user-status-modal" do + click_button 'Remove status' + end + + wait_for_requests end - open_edit_status_modal + it 'clears the user status with the "Remove status" button' do + visit_user - page.within "#set-user-status-modal" do - click_button 'Remove status' + expect(page).not_to have_selector '.cover-status' end - visit_user + it 'shows the "Set status" menu item in the user menu' do + visit root_path(user) - expect(page).not_to have_selector '.cover-status' + find('.header-user-dropdown-toggle').click + + page.within ".header-user" do + expect(page).to have_content('Set status') + end + end end it 'displays a default emoji if only message is entered' do @@ -398,6 +415,45 @@ RSpec.describe 'User edit profile' do end end + context 'note header' do + let(:project) { create(:project_empty_repo, :public) } + let(:issue) { create(:issue, project: project) } + let(:emoji) { "stuffed_flatbread" } + + before do + project.add_guest(user) + create(:user_status, user: user, message: 'Taking notes', emoji: emoji) + + visit(project_issue_path(project, issue)) + + add_note("This is a comment") + visit(project_issue_path(project, issue)) + + wait_for_requests + end + + it 'displays the status emoji' do + first_note = page.find_all(".main-notes-list .timeline-entry").first + + expect(first_note).to have_emoji(emoji) + end + + it 'clears the status emoji' do + open_edit_status_modal + + page.within "#set-user-status-modal" do + click_button 'Remove status' + end + + visit(project_issue_path(project, issue)) + wait_for_requests + + first_note = page.find_all(".main-notes-list .timeline-entry").first + + expect(first_note).not_to have_css('.user-status-emoji') + end + end + context 'with set_user_availability_status feature flag disabled' do before do stub_feature_flags(set_user_availability_status: false) |