diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/features/profiles | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/features/profiles')
6 files changed, 75 insertions, 8 deletions
diff --git a/spec/features/profiles/user_edit_preferences_spec.rb b/spec/features/profiles/user_edit_preferences_spec.rb index d489d92c524..3129e4bd952 100644 --- a/spec/features/profiles/user_edit_preferences_spec.rb +++ b/spec/features/profiles/user_edit_preferences_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -RSpec.describe 'User edit preferences profile' do +RSpec.describe 'User edit preferences profile', :js do let(:user) { create(:user) } before do @@ -53,7 +53,14 @@ RSpec.describe 'User edit preferences profile' do fill_in 'Tab width', with: -1 click_button 'Save changes' - expect(page).to have_content('Failed to save preferences') + field = page.find_field('user[tab_width]') + message = field.native.attribute("validationMessage") + expect(message).to eq "Value must be greater than or equal to 1." + + # User trying to hack an invalid value + page.execute_script("document.querySelector('#user_tab_width').setAttribute('min', '-1')") + click_button 'Save changes' + expect(page).to have_content('Failed to save preferences.') end end diff --git a/spec/features/profiles/user_edit_profile_spec.rb b/spec/features/profiles/user_edit_profile_spec.rb index 239bc04a9cb..bd4917824d1 100644 --- a/spec/features/profiles/user_edit_profile_spec.rb +++ b/spec/features/profiles/user_edit_profile_spec.rb @@ -199,6 +199,38 @@ RSpec.describe 'User edit profile' do expect(busy_status.checked?).to eq(true) end + context 'with user status set to busy' do + let(:project) { create(:project, :public) } + let(:issue) { create(:issue, project: project, author: user) } + + before do + toggle_busy_status + submit_settings + + project.add_developer(user) + visit project_issue_path(project, issue) + end + + it 'shows author as busy in the assignee dropdown' do + find('.block.assignee .edit-link').click + wait_for_requests + + page.within '.dropdown-menu-user' do + expect(page).to have_content("#{user.name} (Busy)") + end + end + + it 'displays the assignee busy status' do + click_button 'assign yourself' + wait_for_requests + + visit project_issue_path(project, issue) + wait_for_requests + + expect(page.find('[data-testid="expanded-assignee"]')).to have_text("#{user.name} (Busy)") + end + end + context 'with set_user_availability_status feature flag disabled' do before do stub_feature_flags(set_user_availability_status: false) diff --git a/spec/features/profiles/user_search_settings_spec.rb b/spec/features/profiles/user_search_settings_spec.rb new file mode 100644 index 00000000000..60df0d7532b --- /dev/null +++ b/spec/features/profiles/user_search_settings_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'User searches their settings', :js do + let_it_be(:user) { create(:user) } + + before do + sign_in(user) + end + + context 'in profile page' do + let(:visit_path) { profile_path } + + it_behaves_like 'can search settings with feature flag check', 'Public Avatar', 'Main settings' + end + + context 'in preferences page' do + before do + visit profile_preferences_path + end + + it_behaves_like 'can search settings', 'Syntax highlighting theme', 'Behavior' + end +end diff --git a/spec/features/profiles/user_visits_notifications_tab_spec.rb b/spec/features/profiles/user_visits_notifications_tab_spec.rb index 997cc8e3c4b..289fbff0404 100644 --- a/spec/features/profiles/user_visits_notifications_tab_spec.rb +++ b/spec/features/profiles/user_visits_notifications_tab_spec.rb @@ -7,6 +7,7 @@ RSpec.describe 'User visits the notifications tab', :js do let(:user) { create(:user) } before do + stub_feature_flags(vue_notification_dropdown: false) project.add_maintainer(user) sign_in(user) visit(profile_notifications_path) diff --git a/spec/features/profiles/user_visits_profile_preferences_page_spec.rb b/spec/features/profiles/user_visits_profile_preferences_page_spec.rb index 56db7efff51..da63f7c0f41 100644 --- a/spec/features/profiles/user_visits_profile_preferences_page_spec.rb +++ b/spec/features/profiles/user_visits_profile_preferences_page_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'User visits the profile preferences page' do +RSpec.describe 'User visits the profile preferences page', :js do include Select2Helper let(:user) { create(:user) } @@ -39,7 +39,7 @@ RSpec.describe 'User visits the profile preferences page' do describe 'User changes their default dashboard', :js do it 'creates a flash message' do select2('stars', from: '#user_dashboard') - click_button 'Save' + click_button 'Save changes' wait_for_requests @@ -48,7 +48,7 @@ RSpec.describe 'User visits the profile preferences page' do it 'updates their preference' do select2('stars', from: '#user_dashboard') - click_button 'Save' + click_button 'Save changes' wait_for_requests @@ -67,7 +67,7 @@ RSpec.describe 'User visits the profile preferences page' do describe 'User changes their language', :js do it 'creates a flash message', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/31404' do select2('en', from: '#user_preferred_language') - click_button 'Save' + click_button 'Save changes' wait_for_requests @@ -77,7 +77,7 @@ RSpec.describe 'User visits the profile preferences page' do it 'updates their preference' do wait_for_requests select2('pt_BR', from: '#user_preferred_language') - click_button 'Save' + click_button 'Save changes' wait_for_requests refresh @@ -94,6 +94,8 @@ RSpec.describe 'User visits the profile preferences page' do click_button 'Save changes' + wait_for_requests + expect(user.reload.render_whitespace_in_code).to be(true) expect(render_whitespace_field).to be_checked end diff --git a/spec/features/profiles/user_visits_profile_spec.rb b/spec/features/profiles/user_visits_profile_spec.rb index 77da1f138c7..475fda5e7a1 100644 --- a/spec/features/profiles/user_visits_profile_spec.rb +++ b/spec/features/profiles/user_visits_profile_spec.rb @@ -39,7 +39,7 @@ RSpec.describe 'User visits their profile' do find(:css, '.header-user-dropdown-toggle').click page.within ".header-user" do - click_link "Profile" + click_link user.username end end |