Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-25 09:10:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-25 09:10:36 +0300
commit866b1f8ed7db9b29b1188ffcba309b92572f354b (patch)
tree48f59dd9b5a292e58e8ce20fbff7e95b6178afe1 /spec/features
parent01fbd09ea9ea4eeae52ed9fb4f7cc4dd97b4eb69 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/admin/admin_users_impersonation_tokens_spec.rb31
-rw-r--r--spec/features/profiles/personal_access_tokens_spec.rb39
-rw-r--r--spec/features/projects/settings/webhooks_settings_spec.rb2
3 files changed, 29 insertions, 43 deletions
diff --git a/spec/features/admin/admin_users_impersonation_tokens_spec.rb b/spec/features/admin/admin_users_impersonation_tokens_spec.rb
index 45dccf9921f..d93dac4834e 100644
--- a/spec/features/admin/admin_users_impersonation_tokens_spec.rb
+++ b/spec/features/admin/admin_users_impersonation_tokens_spec.rb
@@ -4,18 +4,11 @@ require 'spec_helper'
RSpec.describe 'Admin > Users > Impersonation Tokens', :js do
include Spec::Support::Helpers::ModalHelpers
+ include Spec::Support::Helpers::AccessTokenHelpers
let(:admin) { create(:admin) }
let!(:user) { create(:user) }
- def active_impersonation_tokens
- find("[data-testid='active-tokens']")
- end
-
- def created_impersonation_token
- find_field('new-access-token').value
- end
-
before do
sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin)
@@ -39,12 +32,12 @@ RSpec.describe 'Admin > Users > Impersonation Tokens', :js do
click_on "Create impersonation token"
- expect(active_impersonation_tokens).to have_text(name)
- expect(active_impersonation_tokens).to have_text('in')
- expect(active_impersonation_tokens).to have_text('read_api')
- expect(active_impersonation_tokens).to have_text('read_user')
+ expect(active_access_tokens).to have_text(name)
+ expect(active_access_tokens).to have_text('in')
+ expect(active_access_tokens).to have_text('read_api')
+ expect(active_access_tokens).to have_text('read_user')
expect(PersonalAccessTokensFinder.new(impersonation: true).execute.count).to equal(1)
- expect(created_impersonation_token).not_to be_empty
+ expect(created_access_token).to match(/[\w-]{20}/)
end
end
@@ -55,16 +48,16 @@ RSpec.describe 'Admin > Users > Impersonation Tokens', :js do
it 'only shows impersonation tokens' do
visit admin_user_impersonation_tokens_path(user_id: user.username)
- expect(active_impersonation_tokens).to have_text(impersonation_token.name)
- expect(active_impersonation_tokens).not_to have_text(personal_access_token.name)
- expect(active_impersonation_tokens).to have_text('in')
+ expect(active_access_tokens).to have_text(impersonation_token.name)
+ expect(active_access_tokens).not_to have_text(personal_access_token.name)
+ expect(active_access_tokens).to have_text('in')
end
it 'shows absolute times' do
admin.update!(time_display_relative: false)
visit admin_user_impersonation_tokens_path(user_id: user.username)
- expect(active_impersonation_tokens).to have_text(personal_access_token.expires_at.strftime('%b %-d'))
+ expect(active_access_tokens).to have_text(personal_access_token.expires_at.strftime('%b %-d'))
end
end
@@ -76,7 +69,7 @@ RSpec.describe 'Admin > Users > Impersonation Tokens', :js do
accept_gl_confirm(button_text: 'Revoke') { click_on "Revoke" }
- expect(active_impersonation_tokens).to have_text("This user has no active impersonation tokens.")
+ expect(active_access_tokens).to have_text("This user has no active impersonation tokens.")
end
it "removes expired tokens from 'active' section" do
@@ -84,7 +77,7 @@ RSpec.describe 'Admin > Users > Impersonation Tokens', :js do
visit admin_user_impersonation_tokens_path(user_id: user.username)
- expect(active_impersonation_tokens).to have_text("This user has no active impersonation tokens.")
+ expect(active_access_tokens).to have_text("This user has no active impersonation tokens.")
end
end
diff --git a/spec/features/profiles/personal_access_tokens_spec.rb b/spec/features/profiles/personal_access_tokens_spec.rb
index 088c8a7a15a..3ae88da06f6 100644
--- a/spec/features/profiles/personal_access_tokens_spec.rb
+++ b/spec/features/profiles/personal_access_tokens_spec.rb
@@ -4,22 +4,11 @@ require 'spec_helper'
RSpec.describe 'Profile > Personal Access Tokens', :js do
include Spec::Support::Helpers::ModalHelpers
+ include Spec::Support::Helpers::AccessTokenHelpers
let(:user) { create(:user) }
let(:pat_create_service) { double('PersonalAccessTokens::CreateService', execute: ServiceResponse.error(message: 'error', payload: { personal_access_token: PersonalAccessToken.new })) }
- def active_personal_access_tokens
- find("[data-testid='active-tokens']")
- end
-
- def created_personal_access_token
- find_field('new-access-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
-
before do
sign_in(user)
end
@@ -43,11 +32,11 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do
click_on "Create personal access token"
wait_for_all_requests
- expect(active_personal_access_tokens).to have_text(name)
- expect(active_personal_access_tokens).to have_text('in')
- expect(active_personal_access_tokens).to have_text('read_api')
- expect(active_personal_access_tokens).to have_text('read_user')
- expect(created_personal_access_token).not_to be_empty
+ expect(active_access_tokens).to have_text(name)
+ expect(active_access_tokens).to have_text('in')
+ expect(active_access_tokens).to have_text('read_api')
+ expect(active_access_tokens).to have_text('read_user')
+ expect(created_access_token).to match(/[\w-]{20}/)
end
context "when creation fails" do
@@ -73,8 +62,8 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do
it 'only shows personal access tokens' do
visit profile_personal_access_tokens_path
- expect(active_personal_access_tokens).to have_text(personal_access_token.name)
- expect(active_personal_access_tokens).not_to have_text(impersonation_token.name)
+ expect(active_access_tokens).to have_text(personal_access_token.name)
+ expect(active_access_tokens).not_to have_text(impersonation_token.name)
end
context 'when User#time_display_relative is false' do
@@ -85,7 +74,7 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do
it 'shows absolute times for expires_at' do
visit profile_personal_access_tokens_path
- expect(active_personal_access_tokens).to have_text(PersonalAccessToken.last.expires_at.strftime('%b %-d'))
+ expect(active_access_tokens).to have_text(PersonalAccessToken.last.expires_at.strftime('%b %-d'))
end
end
end
@@ -97,14 +86,14 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do
visit profile_personal_access_tokens_path
accept_gl_confirm(button_text: 'Revoke') { click_on "Revoke" }
- expect(active_personal_access_tokens).to have_text("This user has no active personal access tokens.")
+ expect(active_access_tokens).to have_text("This user has no active personal access tokens.")
end
it "removes expired tokens from 'active' section" do
personal_access_token.update!(expires_at: 5.days.ago)
visit profile_personal_access_tokens_path
- expect(active_personal_access_tokens).to have_text("This user has no active personal access tokens.")
+ expect(active_access_tokens).to have_text("This user has no active personal access tokens.")
end
context "when revocation fails" do
@@ -115,12 +104,16 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do
visit profile_personal_access_tokens_path
accept_gl_confirm(button_text: "Revoke") { click_on "Revoke" }
- expect(active_personal_access_tokens).to have_text(personal_access_token.name)
+ expect(active_access_tokens).to have_text(personal_access_token.name)
end
end
end
describe "feed token" do
+ 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
+
context "when enabled" do
it "displays feed token" do
allow(Gitlab::CurrentSettings).to receive(:disable_feed_token).and_return(false)
diff --git a/spec/features/projects/settings/webhooks_settings_spec.rb b/spec/features/projects/settings/webhooks_settings_spec.rb
index ad434749198..adbf2f6ee5c 100644
--- a/spec/features/projects/settings/webhooks_settings_spec.rb
+++ b/spec/features/projects/settings/webhooks_settings_spec.rb
@@ -87,7 +87,7 @@ RSpec.describe 'Projects > Settings > Webhook Settings' do
expect(page).to have_content('SSL Verification: enabled')
expect(page).to have_content('Tag push events')
expect(page).to have_content('Job events')
- expect(page).to have_selector('.js-vue-push-events', visible: :all)
+ expect(page).to have_content('Push events')
end
end