debian-mirror-gitlab/spec/features/profiles/user_visits_profile_preferences_page_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

106 lines
2.6 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2015-09-11 14:41:01 +05:30
require 'spec_helper'
2021-03-11 19:13:27 +05:30
RSpec.describe 'User visits the profile preferences page', :js do
2019-07-07 11:18:12 +05:30
include Select2Helper
2015-09-11 14:41:01 +05:30
let(:user) { create(:user) }
before do
2017-09-10 17:25:29 +05:30
sign_in(user)
2018-03-17 18:26:18 +05:30
visit(profile_preferences_path)
end
it 'shows correct menu item' do
expect(page).to have_active_navigation('Preferences')
2015-09-11 14:41:01 +05:30
end
2018-03-17 18:26:18 +05:30
describe 'User changes their syntax highlighting theme', :js do
2015-09-11 14:41:01 +05:30
it 'updates their preference' do
choose 'user_color_scheme_id_5'
2017-09-10 17:25:29 +05:30
wait_for_requests
refresh
expect(page).to have_checked_field('user_color_scheme_id_5')
2015-09-11 14:41:01 +05:30
end
end
2018-03-17 18:26:18 +05:30
describe 'User changes their default dashboard', :js do
2015-09-11 14:41:01 +05:30
it 'creates a flash message' do
2019-10-12 21:52:04 +05:30
select2('stars', from: '#user_dashboard')
2021-03-11 19:13:27 +05:30
click_button 'Save changes'
2015-09-11 14:41:01 +05:30
2017-09-10 17:25:29 +05:30
wait_for_requests
2015-09-11 14:41:01 +05:30
expect_preferences_saved_message
end
it 'updates their preference' do
2019-10-12 21:52:04 +05:30
select2('stars', from: '#user_dashboard')
2021-03-11 19:13:27 +05:30
click_button 'Save changes'
2015-09-11 14:41:01 +05:30
2017-09-10 17:25:29 +05:30
wait_for_requests
find('#logo').click
2016-09-13 17:45:13 +05:30
2017-09-10 17:25:29 +05:30
expect(page).to have_content("You don't have starred projects yet")
2022-05-07 20:08:51 +05:30
expect(page).to have_current_path starred_dashboard_projects_path, ignore_query: true
2015-09-11 14:41:01 +05:30
2018-03-17 18:26:18 +05:30
find('.shortcuts-activity').click
2016-09-13 17:45:13 +05:30
expect(page).not_to have_content("You don't have starred projects yet")
2022-05-07 20:08:51 +05:30
expect(page).to have_current_path dashboard_projects_path, ignore_query: true
2015-09-11 14:41:01 +05:30
end
end
2019-07-07 11:18:12 +05:30
describe 'User changes their language', :js do
2020-07-28 23:09:34 +05:30
it 'creates a flash message', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/31404' do
2019-07-07 11:18:12 +05:30
select2('en', from: '#user_preferred_language')
2021-03-11 19:13:27 +05:30
click_button 'Save changes'
2019-07-07 11:18:12 +05:30
wait_for_requests
expect_preferences_saved_message
end
it 'updates their preference' do
wait_for_requests
2020-10-24 23:57:45 +05:30
select2('pt_BR', from: '#user_preferred_language')
2021-03-11 19:13:27 +05:30
click_button 'Save changes'
2019-07-07 11:18:12 +05:30
wait_for_requests
refresh
2020-10-24 23:57:45 +05:30
expect(page).to have_css('html[lang="pt-BR"]')
2019-07-07 11:18:12 +05:30
end
end
2020-03-13 15:44:24 +05:30
describe 'User changes whitespace in code' do
it 'updates their preference' do
expect(user.render_whitespace_in_code).to be(false)
expect(render_whitespace_field).not_to be_checked
render_whitespace_field.click
click_button 'Save changes'
2021-03-11 19:13:27 +05:30
wait_for_requests
2020-03-13 15:44:24 +05:30
expect(user.reload.render_whitespace_in_code).to be(true)
expect(render_whitespace_field).to be_checked
end
end
def render_whitespace_field
find_field('user[render_whitespace_in_code]')
end
2015-09-11 14:41:01 +05:30
def expect_preferences_saved_message
page.within('.flash-container') do
expect(page).to have_content('Preferences saved.')
end
end
end