diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /spec/features/profiles | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'spec/features/profiles')
-rw-r--r-- | spec/features/profiles/personal_access_tokens_spec.rb | 24 | ||||
-rw-r--r-- | spec/features/profiles/two_factor_auths_spec.rb | 8 | ||||
-rw-r--r-- | spec/features/profiles/user_visits_profile_spec.rb | 18 |
3 files changed, 39 insertions, 11 deletions
diff --git a/spec/features/profiles/personal_access_tokens_spec.rb b/spec/features/profiles/personal_access_tokens_spec.rb index 74505633cae..135a940807e 100644 --- a/spec/features/profiles/personal_access_tokens_spec.rb +++ b/spec/features/profiles/personal_access_tokens_spec.rb @@ -18,10 +18,6 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do find("#created-personal-access-token").value end - def feed_token - find("#feed_token").value - end - def feed_token_description "Your feed token authenticates you when your RSS reader loads a personalized RSS feed or when your calendar application loads a personalized calendar. It is visible in those feed URLs." end @@ -136,12 +132,24 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do describe "feed token" do context "when enabled" do - it "displays feed token" do + it "displays feed token with `hide_access_tokens` feature flag enabled" do allow(Gitlab::CurrentSettings).to receive(:disable_feed_token).and_return(false) visit profile_personal_access_tokens_path - expect(feed_token).to eq(user.feed_token) + within('[data-testid="feed-token-container"]') do + click_button('Click to reveal') + + expect(page).to have_field('Feed token', with: user.feed_token) + expect(page).to have_content(feed_token_description) + end + end + + it "displays feed token with `hide_access_tokens` feature flag disabled" do + stub_feature_flags(hide_access_tokens: false) + allow(Gitlab::CurrentSettings).to receive(:disable_feed_token).and_return(false) + visit profile_personal_access_tokens_path + expect(page).to have_field('Feed token', with: user.feed_token) expect(page).to have_content(feed_token_description) end end @@ -151,8 +159,8 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do allow(Gitlab::CurrentSettings).to receive(:disable_feed_token).and_return(true) visit profile_personal_access_tokens_path - expect(page).to have_no_content(feed_token_description) - expect(page).to have_no_css("#feed_token") + expect(page).not_to have_content(feed_token_description) + expect(page).not_to have_field('Feed token') end end end diff --git a/spec/features/profiles/two_factor_auths_spec.rb b/spec/features/profiles/two_factor_auths_spec.rb index a9256a73d7b..9a58950b8f3 100644 --- a/spec/features/profiles/two_factor_auths_spec.rb +++ b/spec/features/profiles/two_factor_auths_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'Two factor auths' do + include Spec::Support::Helpers::ModalHelpers + context 'when signed in' do before do sign_in(user) @@ -70,7 +72,7 @@ RSpec.describe 'Two factor auths' do click_button 'Disable two-factor authentication' - page.within('[role="dialog"]') do + within_modal do click_button 'Disable' end @@ -80,7 +82,7 @@ RSpec.describe 'Two factor auths' do click_button 'Disable two-factor authentication' - page.within('[role="dialog"]') do + within_modal do click_button 'Disable' end @@ -112,7 +114,7 @@ RSpec.describe 'Two factor auths' do click_button 'Disable two-factor authentication' - page.within('[role="dialog"]') do + within_modal do click_button 'Disable' end diff --git a/spec/features/profiles/user_visits_profile_spec.rb b/spec/features/profiles/user_visits_profile_spec.rb index 273d52996d3..d90ac439eee 100644 --- a/spec/features/profiles/user_visits_profile_spec.rb +++ b/spec/features/profiles/user_visits_profile_spec.rb @@ -29,6 +29,24 @@ RSpec.describe 'User visits their profile' do expect(find('.file-content')).to have_content('testme') end + it 'hides empty user readme' do + project = create(:project, :repository, :public, path: user.username, namespace: user.namespace) + + Files::UpdateService.new( + project, + user, + start_branch: 'master', + branch_name: 'master', + commit_message: 'Update feature', + file_path: 'README.md', + file_content: '' + ).execute + + visit(user_path(user)) + + expect(page).not_to have_selector('.file-content') + end + context 'when user has groups' do let(:group) do create :group do |group| |