diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/features/profiles/user_edit_profile_spec.rb | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/features/profiles/user_edit_profile_spec.rb')
-rw-r--r-- | spec/features/profiles/user_edit_profile_spec.rb | 77 |
1 files changed, 65 insertions, 12 deletions
diff --git a/spec/features/profiles/user_edit_profile_spec.rb b/spec/features/profiles/user_edit_profile_spec.rb index 697fccaca34..d0340dfc880 100644 --- a/spec/features/profiles/user_edit_profile_spec.rb +++ b/spec/features/profiles/user_edit_profile_spec.rb @@ -20,6 +20,10 @@ RSpec.describe 'User edit profile' do wait_for_requests end + def toggle_busy_status + find('[data-testid="user-availability-checkbox"]').set(true) + end + it 'changes user profile' do fill_in 'user_skype', with: 'testskype' fill_in 'user_linkedin', with: 'testlinkedin' @@ -180,20 +184,51 @@ RSpec.describe 'User edit profile' do expect(page).to have_emoji('speech_balloon') end end + + it 'sets the users status to busy' do + busy_status = find('[data-testid="user-availability-checkbox"]') + + expect(busy_status.checked?).to eq(false) + + toggle_busy_status + submit_settings + visit profile_path + + expect(busy_status.checked?).to eq(true) + end + + context 'with set_user_availability_status feature flag disabled' do + before do + stub_feature_flags(set_user_availability_status: false) + visit root_path(user) + end + + it 'does not display the availability checkbox' do + expect(page).not_to have_css('[data-testid="user-availability-checkbox"]') + end + end end context 'user menu' do let(:issue) { create(:issue, project: project)} let(:project) { create(:project) } - def open_user_status_modal + def open_modal(button_text) find('.header-user-dropdown-toggle').click page.within ".header-user" do - click_button 'Set status' + click_button button_text end end + def open_user_status_modal + open_modal 'Set status' + end + + def open_edit_status_modal + open_modal 'Edit status' + end + def set_user_status_in_modal page.within "#set-user-status-modal" do click_button 'Set status' @@ -246,6 +281,19 @@ RSpec.describe 'User edit profile' do end end + it 'sets the users status to busy' do + open_user_status_modal + busy_status = find('[data-testid="user-availability-checkbox"]') + + expect(busy_status.checked?).to eq(false) + + toggle_busy_status + set_user_status_in_modal + open_edit_status_modal + + expect(busy_status.checked?).to eq(true) + end + it 'opens the emoji modal again after closing it' do open_user_status_modal select_emoji('biohazard', true) @@ -307,11 +355,7 @@ RSpec.describe 'User edit profile' do expect(page).to have_content user_status.message end - find('.header-user-dropdown-toggle').click - - page.within ".header-user" do - click_button 'Edit status' - end + open_edit_status_modal find('.js-clear-user-status-button').click set_user_status_in_modal @@ -333,11 +377,7 @@ RSpec.describe 'User edit profile' do expect(page).to have_content user_status.message end - find('.header-user-dropdown-toggle').click - - page.within ".header-user" do - click_button 'Edit status' - end + open_edit_status_modal page.within "#set-user-status-modal" do click_button 'Remove status' @@ -357,6 +397,19 @@ RSpec.describe 'User edit profile' do expect(page).to have_emoji('speech_balloon') end end + + context 'with set_user_availability_status feature flag disabled' do + before do + stub_feature_flags(set_user_availability_status: false) + visit root_path(user) + end + + it 'does not display the availability checkbox' do + open_user_status_modal + + expect(page).not_to have_css('[data-testid="user-availability-checkbox"]') + end + end end context 'User time preferences', :js do |