2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
RSpec.describe 'User edit profile', feature_category: :user_profile do
|
2023-06-20 00:43:36 +05:30
|
|
|
include Features::NotesHelpers
|
2021-02-22 17:27:13 +05:30
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
let_it_be(:user) { create(:user) }
|
2018-03-27 19:54:05 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
visit(profile_path)
|
|
|
|
end
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
def submit_settings
|
|
|
|
click_button 'Update profile settings'
|
2019-03-02 22:35:43 +05:30
|
|
|
wait_for_requests if respond_to?(:wait_for_requests)
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
def update_user_email
|
|
|
|
fill_in 'user_email', with: 'new-email@example.com'
|
|
|
|
click_button 'Update profile settings'
|
|
|
|
end
|
|
|
|
|
|
|
|
def confirm_password(password)
|
|
|
|
fill_in 'password-confirmation', with: password
|
|
|
|
click_button 'Confirm password'
|
|
|
|
wait_for_requests if respond_to?(:wait_for_requests)
|
|
|
|
end
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
def visit_user
|
|
|
|
visit user_path(user)
|
|
|
|
wait_for_requests
|
|
|
|
end
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
def toggle_busy_status
|
|
|
|
find('[data-testid="user-availability-checkbox"]').set(true)
|
|
|
|
end
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
it 'changes user profile' do
|
|
|
|
fill_in 'user_skype', with: 'testskype'
|
|
|
|
fill_in 'user_linkedin', with: 'testlinkedin'
|
|
|
|
fill_in 'user_twitter', with: 'testtwitter'
|
2021-11-11 11:23:49 +05:30
|
|
|
fill_in 'user_website_url', with: 'http://testurl.com'
|
2018-03-27 19:54:05 +05:30
|
|
|
fill_in 'user_location', with: 'Ukraine'
|
2020-07-28 23:09:34 +05:30
|
|
|
fill_in 'user_bio', with: 'I <3 GitLab :tada:'
|
2020-04-08 14:13:33 +05:30
|
|
|
fill_in 'user_job_title', with: 'Frontend Engineer'
|
2018-03-27 19:54:05 +05:30
|
|
|
fill_in 'user_organization', with: 'GitLab'
|
2018-11-18 11:00:15 +05:30
|
|
|
submit_settings
|
2018-03-27 19:54:05 +05:30
|
|
|
|
|
|
|
expect(user.reload).to have_attributes(
|
|
|
|
skype: 'testskype',
|
|
|
|
linkedin: 'testlinkedin',
|
|
|
|
twitter: 'testtwitter',
|
2021-11-11 11:23:49 +05:30
|
|
|
website_url: 'http://testurl.com',
|
2020-07-28 23:09:34 +05:30
|
|
|
bio: 'I <3 GitLab :tada:',
|
2020-04-08 14:13:33 +05:30
|
|
|
job_title: 'Frontend Engineer',
|
|
|
|
organization: 'GitLab'
|
2018-03-27 19:54:05 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
expect(find('#user_location').value).to eq 'Ukraine'
|
|
|
|
expect(page).to have_content('Profile was successfully updated')
|
|
|
|
end
|
|
|
|
|
2021-11-11 11:23:49 +05:30
|
|
|
it 'does not set secondary emails without user input' do
|
|
|
|
fill_in 'user_organization', with: 'GitLab'
|
|
|
|
submit_settings
|
|
|
|
|
|
|
|
user.reload
|
|
|
|
expect(page).to have_field('user_commit_email', with: '')
|
|
|
|
expect(page).to have_field('user_public_email', with: '')
|
|
|
|
|
|
|
|
User::SECONDARY_EMAIL_ATTRIBUTES.each do |attribute|
|
|
|
|
expect(user.read_attribute(attribute)).to be_blank
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
it 'shows an error if the full name contains an emoji', :js do
|
|
|
|
simulate_input('#user_name', 'Martin 😀')
|
|
|
|
submit_settings
|
|
|
|
|
2019-10-12 21:52:04 +05:30
|
|
|
page.within('.rspec-full-name') do
|
2019-03-02 22:35:43 +05:30
|
|
|
expect(page).to have_css '.gl-field-error-outline'
|
|
|
|
expect(find('.gl-field-error')).not_to have_selector('.hidden')
|
|
|
|
expect(find('.gl-field-error')).to have_content('Using emojis in names seems fun, but please try to set a status message instead')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-11-11 11:23:49 +05:30
|
|
|
it 'shows an error if the website url is not valid' do
|
|
|
|
fill_in 'user_website_url', with: 'admin@gitlab.com'
|
|
|
|
submit_settings
|
|
|
|
|
|
|
|
expect(user.reload).to have_attributes(
|
|
|
|
website_url: ''
|
|
|
|
)
|
|
|
|
|
|
|
|
expect(page).to have_content('Website url is not a valid URL')
|
|
|
|
end
|
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
it 'validates that the discord id has a valid length', :js do
|
|
|
|
valid_discord_id = '123456789123456789'
|
2023-05-27 22:25:52 +05:30
|
|
|
too_short_discord_id = '123456'
|
|
|
|
too_long_discord_id = '123456789abcdefghijkl'
|
|
|
|
|
|
|
|
fill_in 'user_discord', with: too_short_discord_id
|
|
|
|
expect(page).to have_content('Discord ID is too short')
|
|
|
|
|
|
|
|
fill_in 'user_discord', with: too_long_discord_id
|
|
|
|
expect(page).to have_content('Discord ID is too long')
|
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
fill_in 'user_discord', with: valid_discord_id
|
2023-05-27 22:25:52 +05:30
|
|
|
|
|
|
|
submit_settings
|
|
|
|
|
|
|
|
expect(user.reload).to have_attributes(
|
2023-06-20 00:43:36 +05:30
|
|
|
discord: valid_discord_id
|
2023-05-27 22:25:52 +05:30
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
describe 'when I change my email', :js do
|
2019-09-04 21:01:54 +05:30
|
|
|
before do
|
|
|
|
user.send_reset_password_instructions
|
|
|
|
end
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
it 'will prompt to confirm my password' do
|
|
|
|
expect(user.reset_password_token?).to be true
|
|
|
|
|
|
|
|
update_user_email
|
|
|
|
|
|
|
|
expect(page).to have_selector('[data-testid="password-prompt-modal"]')
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when prompted to confirm password' do
|
|
|
|
before do
|
|
|
|
update_user_email
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'with the correct password successfully updates' do
|
|
|
|
confirm_password(user.password)
|
|
|
|
|
|
|
|
expect(page).to have_text("Profile was successfully updated")
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'with the incorrect password fails to update' do
|
|
|
|
confirm_password("Fake password")
|
|
|
|
|
|
|
|
expect(page).to have_text("Invalid password")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
it 'clears the reset password token' do
|
|
|
|
expect(user.reset_password_token?).to be true
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
update_user_email
|
|
|
|
confirm_password(user.password)
|
2019-09-04 21:01:54 +05:30
|
|
|
|
|
|
|
user.reload
|
|
|
|
expect(user.confirmation_token).not_to be_nil
|
|
|
|
expect(user.reset_password_token?).to be false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
context 'user avatar' do
|
|
|
|
before do
|
|
|
|
attach_file(:user_avatar, Rails.root.join('spec', 'fixtures', 'banana_sample.gif'))
|
2018-11-18 11:00:15 +05:30
|
|
|
submit_settings
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'changes user avatar' do
|
|
|
|
expect(page).to have_link('Remove avatar')
|
|
|
|
|
|
|
|
user.reload
|
|
|
|
expect(user.avatar).to be_instance_of AvatarUploader
|
|
|
|
expect(user.avatar.url).to eq "/uploads/-/system/user/avatar/#{user.id}/banana_sample.gif"
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'removes user avatar' do
|
|
|
|
click_link 'Remove avatar'
|
|
|
|
|
|
|
|
user.reload
|
|
|
|
|
|
|
|
expect(user.avatar?).to eq false
|
|
|
|
expect(page).not_to have_link('Remove avatar')
|
|
|
|
expect(page).to have_link('gravatar.com')
|
|
|
|
end
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
|
|
|
|
context 'user status', :js do
|
2018-12-05 23:21:45 +05:30
|
|
|
def select_emoji(emoji_name, is_modal = false)
|
2022-06-21 17:19:12 +05:30
|
|
|
toggle_button = find('.emoji-menu-toggle-button')
|
2018-11-18 11:00:15 +05:30
|
|
|
toggle_button.click
|
2022-06-21 17:19:12 +05:30
|
|
|
emoji_button = find("gl-emoji[data-name=\"#{emoji_name}\"]")
|
2018-11-18 11:00:15 +05:30
|
|
|
emoji_button.click
|
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
context 'profile edit form' do
|
|
|
|
it 'shows the user status form' do
|
|
|
|
expect(page).to have_content('Current status')
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
it 'adds emoji to user status' do
|
2022-10-11 01:57:18 +05:30
|
|
|
emoji = 'basketball'
|
2018-12-05 23:21:45 +05:30
|
|
|
select_emoji(emoji)
|
|
|
|
submit_settings
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
visit_user
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
within('.cover-status') do
|
|
|
|
expect(page).to have_emoji(emoji)
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
it 'adds message to user status' do
|
|
|
|
message = 'I have something to say'
|
2022-10-11 01:57:18 +05:30
|
|
|
fill_in s_("SetStatusModal|What's your status?"), with: message
|
2018-12-05 23:21:45 +05:30
|
|
|
submit_settings
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
visit_user
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
within('.cover-status') do
|
|
|
|
expect(page).to have_emoji('speech_balloon')
|
|
|
|
expect(page).to have_content message
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
it 'adds message and emoji to user status' do
|
2022-06-21 17:19:12 +05:30
|
|
|
emoji = '8ball'
|
2018-12-05 23:21:45 +05:30
|
|
|
message = 'Playing outside'
|
|
|
|
select_emoji(emoji)
|
2022-10-11 01:57:18 +05:30
|
|
|
fill_in s_("SetStatusModal|What's your status?"), with: message
|
2018-12-05 23:21:45 +05:30
|
|
|
submit_settings
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
visit_user
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
within('.cover-status') do
|
|
|
|
expect(page).to have_emoji(emoji)
|
|
|
|
expect(page).to have_content message
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
it 'clears the user status' do
|
|
|
|
user_status = create(:user_status, user: user, message: 'Eating bread', emoji: 'stuffed_flatbread')
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
visit_user
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
within('.cover-status') do
|
|
|
|
expect(page).to have_emoji(user_status.emoji)
|
|
|
|
expect(page).to have_content user_status.message
|
|
|
|
end
|
|
|
|
|
|
|
|
visit(profile_path)
|
2022-10-11 01:57:18 +05:30
|
|
|
click_button s_('SetStatusModal|Clear status')
|
2018-12-05 23:21:45 +05:30
|
|
|
submit_settings
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
visit_user
|
2018-12-13 13:39:08 +05:30
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
expect(page).not_to have_selector '.cover-status'
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
it 'displays a default emoji if only message is entered' do
|
|
|
|
message = 'a status without emoji'
|
2022-10-11 01:57:18 +05:30
|
|
|
fill_in s_("SetStatusModal|What's your status?"), with: message
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
within('.emoji-menu-toggle-button') do
|
2018-12-05 23:21:45 +05:30
|
|
|
expect(page).to have_emoji('speech_balloon')
|
|
|
|
end
|
|
|
|
end
|
2021-01-29 00:20:46 +05:30
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
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
|
2021-04-29 21:17:54 +05:30
|
|
|
page.within('.assignee') do
|
|
|
|
click_button('Edit')
|
|
|
|
wait_for_requests
|
|
|
|
end
|
2021-03-11 19:13:27 +05:30
|
|
|
|
|
|
|
page.within '.dropdown-menu-user' do
|
2023-06-20 00:43:36 +05:30
|
|
|
expect(page).to have_content("#{user.name} Busy")
|
2021-03-11 19:13:27 +05:30
|
|
|
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
|
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
expect(page.find('.issuable-assignees')).to have_content("#{user.name} Busy")
|
2021-03-11 19:13:27 +05:30
|
|
|
end
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
2018-11-20 20:47:30 +05:30
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
context 'user menu' do
|
2022-08-27 11:52:29 +05:30
|
|
|
let(:issue) { create(:issue, project: project) }
|
2019-02-15 15:39:39 +05:30
|
|
|
let(:project) { create(:project) }
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
def open_modal(button_text)
|
2018-12-05 23:21:45 +05:30
|
|
|
find('.header-user-dropdown-toggle').click
|
|
|
|
|
|
|
|
page.within ".header-user" do
|
2023-01-13 00:05:48 +05:30
|
|
|
find('.js-set-status-modal-trigger.ready')
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
click_button button_text
|
2018-12-05 23:21:45 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
def open_user_status_modal
|
|
|
|
open_modal 'Set status'
|
|
|
|
end
|
|
|
|
|
|
|
|
def open_edit_status_modal
|
2021-02-22 17:27:13 +05:30
|
|
|
open_modal 'Edit status'
|
2021-01-29 00:20:46 +05:30
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
def set_user_status_in_modal
|
|
|
|
page.within "#set-user-status-modal" do
|
|
|
|
click_button 'Set status'
|
|
|
|
end
|
2019-03-02 22:35:43 +05:30
|
|
|
wait_for_requests
|
2018-12-05 23:21:45 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
visit root_path(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows the "Set status" menu item in the user menu' do
|
|
|
|
find('.header-user-dropdown-toggle').click
|
|
|
|
|
|
|
|
page.within ".header-user" do
|
|
|
|
expect(page).to have_content('Set status')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows the "Edit status" menu item in the user menu' do
|
|
|
|
user_status = create(:user_status, user: user, message: 'Eating bread', emoji: 'stuffed_flatbread')
|
|
|
|
visit root_path(user)
|
|
|
|
|
|
|
|
find('.header-user-dropdown-toggle').click
|
|
|
|
|
|
|
|
page.within ".header-user" do
|
|
|
|
expect(page).to have_emoji(user_status.emoji)
|
|
|
|
expect(page).to have_content user_status.message
|
|
|
|
expect(page).to have_content('Edit status')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows user status modal' do
|
|
|
|
open_user_status_modal
|
|
|
|
|
|
|
|
expect(page.find('#set-user-status-modal')).to be_visible
|
|
|
|
expect(page).to have_content('Set a status')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'adds emoji to user status' do
|
2022-06-21 17:19:12 +05:30
|
|
|
emoji = '8ball'
|
2018-12-05 23:21:45 +05:30
|
|
|
open_user_status_modal
|
|
|
|
select_emoji(emoji, true)
|
|
|
|
set_user_status_in_modal
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
visit_user
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
within('.cover-status') do
|
|
|
|
expect(page).to have_emoji(emoji)
|
|
|
|
end
|
|
|
|
end
|
2020-06-23 00:09:42 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
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
|
2021-02-22 17:27:13 +05:30
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
visit root_path(user)
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
open_edit_status_modal
|
|
|
|
|
|
|
|
expect(busy_status.checked?).to eq(true)
|
|
|
|
end
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
it 'opens the emoji modal again after closing it' do
|
|
|
|
open_user_status_modal
|
2022-06-21 17:19:12 +05:30
|
|
|
select_emoji('8ball', true)
|
2020-06-23 00:09:42 +05:30
|
|
|
|
2022-06-21 17:19:12 +05:30
|
|
|
find('.emoji-menu-toggle-button').click
|
2020-06-23 00:09:42 +05:30
|
|
|
|
2022-06-21 17:19:12 +05:30
|
|
|
expect(page).to have_selector('.emoji-picker-emoji')
|
2020-06-23 00:09:42 +05:30
|
|
|
end
|
2018-12-05 23:21:45 +05:30
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
it 'does not update the awards panel emoji' do
|
|
|
|
project.add_maintainer(user)
|
|
|
|
visit(project_issue_path(project, issue))
|
|
|
|
|
2022-06-21 17:19:12 +05:30
|
|
|
emoji = '8ball'
|
2019-02-15 15:39:39 +05:30
|
|
|
open_user_status_modal
|
|
|
|
select_emoji(emoji, true)
|
|
|
|
|
|
|
|
expect(page.all('.award-control .js-counter')).to all(have_content('0'))
|
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
it 'adds message to user status' do
|
|
|
|
message = 'I have something to say'
|
|
|
|
open_user_status_modal
|
2022-10-11 01:57:18 +05:30
|
|
|
find_field(s_("SetStatusModal|What's your status?")).native.send_keys(message)
|
2018-12-05 23:21:45 +05:30
|
|
|
set_user_status_in_modal
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
visit_user
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
within('.cover-status') do
|
|
|
|
expect(page).to have_emoji('speech_balloon')
|
|
|
|
expect(page).to have_content message
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'adds message and emoji to user status' do
|
2022-06-21 17:19:12 +05:30
|
|
|
emoji = '8ball'
|
2018-12-05 23:21:45 +05:30
|
|
|
message = 'Playing outside'
|
|
|
|
open_user_status_modal
|
|
|
|
select_emoji(emoji, true)
|
2022-10-11 01:57:18 +05:30
|
|
|
find_field(s_("SetStatusModal|What's your status?")).native.send_keys(message)
|
2018-12-05 23:21:45 +05:30
|
|
|
set_user_status_in_modal
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
visit_user
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
within('.cover-status') do
|
|
|
|
expect(page).to have_emoji(emoji)
|
|
|
|
expect(page).to have_content message
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'clears the user status with the "X" button' do
|
|
|
|
user_status = create(:user_status, user: user, message: 'Eating bread', emoji: 'stuffed_flatbread')
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
visit_user
|
|
|
|
wait_for_requests
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
within('.cover-status') do
|
|
|
|
expect(page).to have_emoji(user_status.emoji)
|
|
|
|
expect(page).to have_content user_status.message
|
|
|
|
end
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
open_edit_status_modal
|
2018-12-05 23:21:45 +05:30
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
click_button s_('SetStatusModal|Clear status')
|
2018-12-05 23:21:45 +05:30
|
|
|
set_user_status_in_modal
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
visit_user
|
|
|
|
wait_for_requests
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
expect(page).not_to have_selector '.cover-status'
|
|
|
|
end
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
context 'Remove status button' do
|
2022-11-25 23:54:43 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
before do
|
|
|
|
user.status = UserStatus.new(message: 'Eating bread', emoji: 'stuffed_flatbread')
|
2018-12-05 23:21:45 +05:30
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
visit_user
|
|
|
|
wait_for_requests
|
2019-03-02 22:35:43 +05:30
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
open_edit_status_modal
|
|
|
|
|
|
|
|
page.within "#set-user-status-modal" do
|
|
|
|
click_button 'Remove status'
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_requests
|
2018-12-05 23:21:45 +05:30
|
|
|
end
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
it 'clears the user status with the "Remove status" button' do
|
|
|
|
visit_user
|
2018-12-05 23:21:45 +05:30
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
expect(page).not_to have_selector '.cover-status'
|
2018-12-05 23:21:45 +05:30
|
|
|
end
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
it 'shows the "Set status" menu item in the user menu' do
|
|
|
|
visit root_path(user)
|
2019-03-02 22:35:43 +05:30
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
find('.header-user-dropdown-toggle').click
|
|
|
|
|
|
|
|
page.within ".header-user" do
|
|
|
|
expect(page).to have_content('Set status')
|
|
|
|
end
|
|
|
|
end
|
2018-12-05 23:21:45 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'displays a default emoji if only message is entered' do
|
|
|
|
message = 'a status without emoji'
|
|
|
|
open_user_status_modal
|
2022-10-11 01:57:18 +05:30
|
|
|
find_field(s_("SetStatusModal|What's your status?")).native.send_keys(message)
|
2018-11-20 20:47:30 +05:30
|
|
|
|
2022-06-21 17:19:12 +05:30
|
|
|
expect(page).to have_emoji('speech_balloon')
|
2018-11-20 20:47:30 +05:30
|
|
|
end
|
|
|
|
end
|
2019-07-31 22:56:46 +05:30
|
|
|
|
|
|
|
context 'User time preferences', :js do
|
2022-08-27 11:52:29 +05:30
|
|
|
let(:issue) { create(:issue, project: project) }
|
2019-07-31 22:56:46 +05:30
|
|
|
let(:project) { create(:project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
stub_feature_flags(user_time_settings: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows the user time preferences form' do
|
|
|
|
expect(page).to have_content('Time settings')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'allows the user to select a time zone from a dropdown list of options' do
|
|
|
|
expect(page.find('.user-time-preferences .dropdown')).not_to have_css('.show')
|
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
page.find('.user-time-preferences .dropdown').click
|
2019-07-31 22:56:46 +05:30
|
|
|
|
|
|
|
expect(page.find('.user-time-preferences .dropdown')).to have_css('.show')
|
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
page.find("button", text: "Arizona").click
|
2019-07-31 22:56:46 +05:30
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
expect(page).to have_field(:user_timezone, with: 'America/Phoenix', type: :hidden)
|
2019-07-31 22:56:46 +05:30
|
|
|
end
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
it 'timezone defaults to empty' do
|
|
|
|
expect(page).to have_field(:user_timezone, with: '', type: :hidden)
|
2019-07-31 22:56:46 +05:30
|
|
|
end
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
2020-04-08 14:13:33 +05:30
|
|
|
|
|
|
|
context 'work information', :js do
|
|
|
|
context 'when job title and organziation are entered' do
|
|
|
|
it "shows job title and organzation on user's profile" do
|
|
|
|
fill_in 'user_job_title', with: 'Frontend Engineer'
|
|
|
|
fill_in 'user_organization', with: 'GitLab - work info test'
|
|
|
|
submit_settings
|
|
|
|
|
|
|
|
visit_user
|
|
|
|
|
|
|
|
expect(page).to have_content('Frontend Engineer at GitLab - work info test')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when only job title is entered' do
|
|
|
|
it "shows only job title on user's profile" do
|
|
|
|
fill_in 'user_job_title', with: 'Frontend Engineer - work info test'
|
|
|
|
submit_settings
|
|
|
|
|
|
|
|
visit_user
|
|
|
|
|
|
|
|
expect(page).to have_content('Frontend Engineer - work info test')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when only organization is entered' do
|
|
|
|
it "shows only organization on user's profile" do
|
|
|
|
fill_in 'user_organization', with: 'GitLab - work info test'
|
|
|
|
submit_settings
|
|
|
|
|
|
|
|
visit_user
|
|
|
|
|
|
|
|
expect(page).to have_content('GitLab - work info test')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|