diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-02 21:09:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-02 21:09:42 +0300 |
commit | 2d66c59d593354aa98785899cc8d5e640f62a012 (patch) | |
tree | b0f82a38ffba401a1ad448983785660038c4cf4b /spec/features | |
parent | dab865db1e85e2fc3dd29dae8dc6b8e11b1ba3f7 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
5 files changed, 57 insertions, 39 deletions
diff --git a/spec/features/merge_request/user_sees_mini_pipeline_graph_spec.rb b/spec/features/merge_request/user_sees_mini_pipeline_graph_spec.rb index 04d8c52df61..be6205598d8 100644 --- a/spec/features/merge_request/user_sees_mini_pipeline_graph_spec.rb +++ b/spec/features/merge_request/user_sees_mini_pipeline_graph_spec.rb @@ -9,6 +9,8 @@ RSpec.describe 'Merge request < User sees mini pipeline graph', :js do let(:pipeline) { create(:ci_empty_pipeline, project: project, ref: 'master', status: 'running', sha: project.commit.id) } let(:build) { create(:ci_build, pipeline: pipeline, stage: 'test') } + dropdown_toggle_selector = '[data-testid="mini-pipeline-graph-dropdown-toggle"]' + before do build.run build.trace.set('hello') @@ -51,40 +53,25 @@ RSpec.describe 'Merge request < User sees mini pipeline graph', :js do describe 'build list toggle' do let(:toggle) do - find('.mini-pipeline-graph-dropdown-toggle') - first('.mini-pipeline-graph-dropdown-toggle') + find(dropdown_toggle_selector) + first(dropdown_toggle_selector) end # Status icon button styles should update as described in # https://gitlab.com/gitlab-org/gitlab-foss/issues/42769 it 'has unique styles for default, :hover, :active, and :focus states' do - find('.mini-pipeline-graph-dropdown-toggle') - default_background_color = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible').css('background-color');") - default_foreground_color = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible svg').css('fill');") - default_box_shadow = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible').css('box-shadow');") + default_background_color, default_foreground_color, default_box_shadow = get_toggle_colors(dropdown_toggle_selector) toggle.hover - - find('.mini-pipeline-graph-dropdown-toggle') - hover_background_color = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible').css('background-color');") - hover_foreground_color = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible svg').css('fill');") - hover_box_shadow = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible').css('box-shadow');") + hover_background_color, hover_foreground_color, hover_box_shadow = get_toggle_colors(dropdown_toggle_selector) page.driver.browser.action.click_and_hold(toggle.native).perform - - find('.mini-pipeline-graph-dropdown-toggle') - active_background_color = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible').css('background-color');") - active_foreground_color = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible svg').css('fill');") - active_box_shadow = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible').css('box-shadow');") + active_background_color, active_foreground_color, active_box_shadow = get_toggle_colors(dropdown_toggle_selector) page.driver.browser.action.release(toggle.native) .move_by(100, 100) .perform - - find('.mini-pipeline-graph-dropdown-toggle') - focus_background_color = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible').css('background-color');") - focus_foreground_color = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible svg').css('fill');") - focus_box_shadow = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible').css('box-shadow');") + focus_background_color, focus_foreground_color, focus_box_shadow = get_toggle_colors(dropdown_toggle_selector) expect(default_background_color).not_to eq(hover_background_color) expect(hover_background_color).not_to eq(active_background_color) @@ -112,8 +99,8 @@ RSpec.describe 'Merge request < User sees mini pipeline graph', :js do describe 'builds list menu' do let(:toggle) do - find('.mini-pipeline-graph-dropdown-toggle') - first('.mini-pipeline-graph-dropdown-toggle') + find(dropdown_toggle_selector) + first(dropdown_toggle_selector) end before do @@ -157,4 +144,15 @@ RSpec.describe 'Merge request < User sees mini pipeline graph', :js do end end end + + private + + def get_toggle_colors(selector) + find(selector) + [ + evaluate_script("$('#{selector}:visible').css('background-color');"), + evaluate_script("$('#{selector}:visible svg').css('fill');"), + evaluate_script("$('#{selector}:visible').css('box-shadow');") + ] + end end diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index 5c4552510cb..5986a453dd5 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -525,24 +525,26 @@ RSpec.describe 'Pipelines', :js do name: 'build') end + dropdown_toggle_selector = '[data-testid="mini-pipeline-graph-dropdown-toggle"]' + before do visit_project_pipelines end it 'renders a mini pipeline graph' do expect(page).to have_selector('[data-testid="widget-mini-pipeline-graph"]') - expect(page).to have_selector('.js-builds-dropdown-button') + expect(page).to have_selector(dropdown_toggle_selector) end context 'when clicking a stage badge' do it 'opens a dropdown' do - find('.js-builds-dropdown-button').click + find(dropdown_toggle_selector).click expect(page).to have_link build.name end it 'is possible to cancel pending build' do - find('.js-builds-dropdown-button').click + find(dropdown_toggle_selector).click find('.js-ci-action').click wait_for_requests @@ -558,7 +560,7 @@ RSpec.describe 'Pipelines', :js do end it 'displays the failure reason' do - find('.js-builds-dropdown-button').click + find(dropdown_toggle_selector).click within('.js-builds-dropdown-list') do build_element = page.find('.mini-pipeline-graph-dropdown-item') diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index 3e520142117..2f257d299d8 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -63,7 +63,7 @@ RSpec.describe 'Projects > Settings > Repository settings' do click_button 'Add key' expect(page).to have_content('new_deploy_key') - expect(page).to have_content('Write access allowed') + expect(page).to have_content('Grant write permissions to this key') end it 'edit an existing deploy key' do @@ -77,7 +77,7 @@ RSpec.describe 'Projects > Settings > Repository settings' do click_button 'Save changes' expect(page).to have_content('updated_deploy_key') - expect(page).to have_content('Write access allowed') + expect(page).to have_content('Grant write permissions to this key') end it 'edit an existing public deploy key to be writable' do @@ -90,7 +90,7 @@ RSpec.describe 'Projects > Settings > Repository settings' do click_button 'Save changes' expect(page).to have_content('public_deploy_key') - expect(page).to have_content('Write access allowed') + expect(page).to have_content('Grant write permissions to this key') end it 'edit a deploy key from projects user has access to' do diff --git a/spec/features/search/user_searches_for_issues_spec.rb b/spec/features/search/user_searches_for_issues_spec.rb index e253b9f2f7a..828e478d701 100644 --- a/spec/features/search/user_searches_for_issues_spec.rb +++ b/spec/features/search/user_searches_for_issues_spec.rb @@ -75,7 +75,7 @@ RSpec.describe 'User searches for issues', :js do expect(page.all('.search-result-row').last).to have_link(issue1.title) end - find('.reverse-sort-btn').click + find('[data-testid="sort-highest-icon"]').click page.within('.results') do expect(page.all('.search-result-row').first).to have_link(issue1.title) diff --git a/spec/features/search/user_searches_for_merge_requests_spec.rb b/spec/features/search/user_searches_for_merge_requests_spec.rb index 21e8075739f..7271716644b 100644 --- a/spec/features/search/user_searches_for_merge_requests_spec.rb +++ b/spec/features/search/user_searches_for_merge_requests_spec.rb @@ -5,8 +5,14 @@ require 'spec_helper' RSpec.describe 'User searches for merge requests', :js do let(:user) { create(:user) } let(:project) { create(:project, namespace: user.namespace) } - let!(:merge_request1) { create(:merge_request, title: 'Foo', source_project: project, target_project: project) } - let!(:merge_request2) { create(:merge_request, :simple, title: 'Bar', source_project: project, target_project: project) } + let!(:merge_request1) { create(:merge_request, title: 'Merge Request Foo', source_project: project, target_project: project, created_at: 1.hour.ago) } + let!(:merge_request2) { create(:merge_request, :simple, title: 'Merge Request Bar', source_project: project, target_project: project) } + + def search_for_mr(search) + fill_in('dashboard_search', with: search) + find('.btn-search').click + select_search_scope('Merge requests') + end before do project.add_maintainer(user) @@ -18,9 +24,7 @@ RSpec.describe 'User searches for merge requests', :js do include_examples 'top right search form' it 'finds a merge request' do - fill_in('dashboard_search', with: merge_request1.title) - find('.btn-search').click - select_search_scope('Merge requests') + search_for_mr(merge_request1.title) page.within('.results') do expect(page).to have_link(merge_request1.title) @@ -28,6 +32,22 @@ RSpec.describe 'User searches for merge requests', :js do end end + it 'sorts by created date' do + search_for_mr('Merge Request') + + page.within('.results') do + expect(page.all('.search-result-row').first).to have_link(merge_request2.title) + expect(page.all('.search-result-row').last).to have_link(merge_request1.title) + end + + find('[data-testid="sort-highest-icon"]').click + + page.within('.results') do + expect(page.all('.search-result-row').first).to have_link(merge_request1.title) + expect(page.all('.search-result-row').last).to have_link(merge_request2.title) + end + end + context 'when on a project page' do it 'finds a merge request' do find('[data-testid="project-filter"]').click @@ -38,9 +58,7 @@ RSpec.describe 'User searches for merge requests', :js do click_on(project.full_name) end - fill_in('dashboard_search', with: merge_request1.title) - find('.btn-search').click - select_search_scope('Merge requests') + search_for_mr(merge_request1.title) page.within('.results') do expect(page).to have_link(merge_request1.title) |