diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-05 15:13:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-05 15:13:40 +0300 |
commit | 7120254aee218529320c061696a2af530494e6aa (patch) | |
tree | c33bc6d9d7881b7ab22bbe09297b2c49aef9a3a9 /spec/features | |
parent | fc23bd54a1a49003eda83bc2331d9b8b8417a91b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb | 89 | ||||
-rw-r--r-- | spec/features/projects/work_items/linked_work_items_spec.rb | 33 |
2 files changed, 86 insertions, 36 deletions
diff --git a/spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb b/spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb index 9305467cbe4..3d9addfe456 100644 --- a/spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb +++ b/spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "spec_helper" +require 'spec_helper' RSpec.describe "User interacts with deploy keys", :js, feature_category: :continuous_delivery do let(:project) { create(:project, :repository) } @@ -10,43 +10,59 @@ RSpec.describe "User interacts with deploy keys", :js, feature_category: :contin sign_in(user) end - shared_examples "attaches a key" do - it "attaches key" do + shared_examples 'attaches a key' do + it 'attaches key' do visit(project_deploy_keys_path(project)) - page.within(".deploy-keys") do - find(".badge", text: "1").click + page.within('.deploy-keys') do + click_link(scope) - click_button("Enable") + click_button('Enable') - expect(page).not_to have_selector(".gl-spinner") + expect(page).not_to have_selector('.gl-spinner') expect(page).to have_current_path(project_settings_repository_path(project), ignore_query: true) - find(".js-deployKeys-tab-enabled_keys").click + click_link('Enabled deploy keys') expect(page).to have_content(deploy_key.title) end end end - context "viewing deploy keys" do + context 'viewing deploy keys' do let(:deploy_key) { create(:deploy_key) } - context "when project has keys" do + context 'when project has keys' do before do create(:deploy_keys_project, project: project, deploy_key: deploy_key) end - it "shows deploy keys" do + it 'shows deploy keys' do visit(project_deploy_keys_path(project)) - page.within(".deploy-keys") do + page.within('.deploy-keys') do expect(page).to have_content(deploy_key.title) end end end - context "when another project has keys" do + context 'when the project has many deploy keys' do + before do + create(:deploy_keys_project, project: project, deploy_key: deploy_key) + create_list(:deploy_keys_project, 5, project: project) + end + + it 'shows pagination' do + visit(project_deploy_keys_path(project)) + + page.within('.deploy-keys') do + expect(page).to have_link('Next') + expect(page).to have_link('2') + end + end + end + + context 'when another project has keys' do let(:another_project) { create(:project) } before do @@ -55,26 +71,25 @@ RSpec.describe "User interacts with deploy keys", :js, feature_category: :contin another_project.add_maintainer(user) end - it "shows deploy keys" do + it 'shows deploy keys' do visit(project_deploy_keys_path(project)) - page.within(".deploy-keys") do - find('.js-deployKeys-tab-available_project_keys').click + page.within('.deploy-keys') do + click_link('Privately accessible deploy keys') expect(page).to have_content(deploy_key.title) - expect(find(".js-deployKeys-tab-available_project_keys .badge")).to have_content("1") end end end - context "when there are public deploy keys" do + context 'when there are public deploy keys' do let!(:deploy_key) { create(:deploy_key, public: true) } - it "shows public deploy keys" do + it 'shows public deploy keys' do visit(project_deploy_keys_path(project)) - page.within(".deploy-keys") do - find(".js-deployKeys-tab-public_keys").click + page.within('.deploy-keys') do + click_link('Publicly accessible deploy keys') expect(page).to have_content(deploy_key.title) end @@ -82,43 +97,44 @@ RSpec.describe "User interacts with deploy keys", :js, feature_category: :contin end end - context "adding deploy keys" do + context 'adding deploy keys' do before do visit(project_deploy_keys_path(project)) end - it "adds new key" do + it 'adds new key' do deploy_key_title = attributes_for(:key)[:title] deploy_key_body = attributes_for(:key)[:key] - click_button("Add new key") - fill_in("deploy_key_title", with: deploy_key_title) - fill_in("deploy_key_key", with: deploy_key_body) + click_button('Add new key') + fill_in('deploy_key_title', with: deploy_key_title) + fill_in('deploy_key_key', with: deploy_key_body) - click_button("Add key") + click_button('Add key') expect(page).to have_current_path(project_settings_repository_path(project), ignore_query: true) - page.within(".deploy-keys") do + page.within('.deploy-keys') do expect(page).to have_content(deploy_key_title) end end - it "click on cancel hides the form" do - click_button("Add new key") + it 'click on cancel hides the form' do + click_button('Add new key') expect(page).to have_css('.gl-new-card-add-form') - click_button("Cancel") + click_button('Cancel') expect(page).not_to have_css('.gl-new-card-add-form') end end - context "attaching existing keys" do - context "from another project" do + context 'attaching existing keys' do + context 'from another project' do let(:another_project) { create(:project) } let(:deploy_key) { create(:deploy_key) } + let(:scope) { 'Privately accessible deploy keys' } before do create(:deploy_keys_project, project: another_project, deploy_key: deploy_key) @@ -126,13 +142,14 @@ RSpec.describe "User interacts with deploy keys", :js, feature_category: :contin another_project.add_maintainer(user) end - it_behaves_like "attaches a key" + it_behaves_like 'attaches a key' end - context "when keys are public" do + context 'when keys are public' do let!(:deploy_key) { create(:deploy_key, public: true) } + let(:scope) { 'Publicly accessible deploy keys' } - it_behaves_like "attaches a key" + it_behaves_like 'attaches a key' end end end diff --git a/spec/features/projects/work_items/linked_work_items_spec.rb b/spec/features/projects/work_items/linked_work_items_spec.rb index 963be23e5a8..f9cdd7b78ab 100644 --- a/spec/features/projects/work_items/linked_work_items_spec.rb +++ b/spec/features/projects/work_items/linked_work_items_spec.rb @@ -9,6 +9,12 @@ RSpec.describe 'Work item linked items', :js, feature_category: :team_planning d let_it_be(:work_item) { create(:work_item, project: project) } let(:work_items_path) { project_work_item_path(project, work_item.iid) } let_it_be(:task) { create(:work_item, :task, project: project, title: 'Task 1') } + let_it_be(:milestone) { create(:milestone, project: project, title: '1.0') } + let_it_be(:label) { create(:label, project: project) } + let_it_be(:objective) do + create(:work_item, :objective, project: project, milestone: milestone, + title: 'Objective 1', labels: [label]) + end context 'for signed in user' do let(:token_input_selector) { '[data-testid="work-item-token-select-input"] .gl-token-selector-input' } @@ -111,6 +117,33 @@ RSpec.describe 'Work item linked items', :js, feature_category: :team_planning d expect(page).not_to have_content('Task 1') end end + + it 'passes axe automated accessibility testing for linked items empty state' do + expect(page).to be_axe_clean.within('.work-item-relationships').skipping :'link-in-text-block' + end + + it 'passes axe automated accessibility testing for linked items' do + page.within('.work-item-relationships') do + click_button 'Add' + + find_by_testid('work-item-token-select-input').set(objective.title) + wait_for_all_requests + + form_selector = '.work-item-relationships' + expect(page).to be_axe_clean.within(form_selector).skipping :'aria-input-field-name', + :'aria-required-children' + + within_testid('link-work-item-form') do + click_button objective.title + + click_button 'Add' + end + + wait_for_all_requests + + expect(page).to be_axe_clean.within(form_selector) + end + end end def verify_linked_item_added(input) |