diff options
Diffstat (limited to 'spec/features/projects')
26 files changed, 195 insertions, 121 deletions
diff --git a/spec/features/projects/blobs/blob_show_spec.rb b/spec/features/projects/blobs/blob_show_spec.rb index 13a4c1b5912..93e5be18229 100644 --- a/spec/features/projects/blobs/blob_show_spec.rb +++ b/spec/features/projects/blobs/blob_show_spec.rb @@ -675,7 +675,7 @@ RSpec.describe 'File blob', :js do expect(page).to have_content('This project is licensed under the MIT License.') # shows a learn more link - expect(page).to have_link('Learn more', href: 'http://choosealicense.com/licenses/mit/') + expect(page).to have_link('Learn more', href: 'https://opensource.org/licenses/MIT') end end end diff --git a/spec/features/projects/blobs/edit_spec.rb b/spec/features/projects/blobs/edit_spec.rb index f198a1f42e2..5587b8abab3 100644 --- a/spec/features/projects/blobs/edit_spec.rb +++ b/spec/features/projects/blobs/edit_spec.rb @@ -7,8 +7,8 @@ RSpec.describe 'Editing file blob', :js do include TreeHelper include BlobSpecHelpers - let(:project) { create(:project, :public, :repository) } - let(:merge_request) { create(:merge_request, source_project: project, source_branch: 'feature', target_branch: 'master') } + let_it_be(:project) { create(:project, :public, :repository) } + let_it_be(:merge_request) { create(:merge_request, source_project: project, source_branch: 'feature', target_branch: 'master') } let(:branch) { 'master' } let(:file_path) { project.repository.ls_files(project.repository.root_ref)[1] } let(:readme_file_path) { 'README.md' } @@ -82,6 +82,34 @@ RSpec.describe 'Editing file blob', :js do end end + context 'blob edit toolbar' do + toolbar_buttons = [ + "Add bold text", + "Add italic text", + "Add strikethrough text", + "Insert a quote", + "Insert code", + "Add a link", + "Add a bullet list", + "Add a numbered list", + "Add a checklist", + "Add a collapsible section", + "Add a table" + ] + + before do + visit project_edit_blob_path(project, tree_join(branch, readme_file_path)) + end + + it "has defined set of toolbar buttons" do + buttons = page.all('.file-buttons .md-header-toolbar button[type="button"]') + expect(buttons.length).to eq(toolbar_buttons.length) + toolbar_buttons.each_with_index do |button_title, i| + expect(buttons[i]['title']).to include(button_title) + end + end + end + context 'from blob file path' do before do visit project_blob_path(project, tree_join(branch, file_path)) @@ -156,11 +184,14 @@ RSpec.describe 'Editing file blob', :js do end context 'as developer' do - let(:user) { create(:user) } + let_it_be(:user) { create(:user) } let(:protected_branch) { 'protected-branch' } - before do + before_all do project.add_developer(user) + end + + before do project.repository.add_branch(user, protected_branch, 'master') create(:protected_branch, project: project, name: protected_branch) sign_in(user) diff --git a/spec/features/projects/blobs/user_creates_new_blob_in_new_project_spec.rb b/spec/features/projects/blobs/user_creates_new_blob_in_new_project_spec.rb deleted file mode 100644 index d2774aa74c9..00000000000 --- a/spec/features/projects/blobs/user_creates_new_blob_in_new_project_spec.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'User creates new blob', :js do - include WebIdeSpecHelpers - - let(:user) { create(:user) } - let(:project) { create(:project, :empty_repo) } - - before do - stub_feature_flags(vscode_web_ide: false) - end - - shared_examples 'creating a file' do - it 'allows the user to add a new file in Web IDE' do - visit project_path(project) - - click_link 'New file' - - wait_for_requests - - ide_create_new_file('dummy-file', content: "Hello world\n") - - ide_commit - - expect(page).to have_content('All changes are committed') - expect(project.repository.blob_at('master', 'dummy-file').data).to eql("Hello world\n") - end - end - - describe 'as a maintainer' do - before do - project.add_maintainer(user) - sign_in(user) - end - - it_behaves_like 'creating a file' - end - - describe 'as an admin' do - let(:user) { create(:user, :admin) } - - before do - sign_in(user) - gitlab_enable_admin_mode_sign_in(user) - end - - it_behaves_like 'creating a file' - end - - describe 'as a developer' do - before do - project.add_developer(user) - sign_in(user) - visit project_path(project) - end - - it 'does not allow pushing to the default branch' do - expect(page).not_to have_content('New file') - end - end -end diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index 727f9aa486e..361a07ebd0b 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' RSpec.describe 'Branches' do - let(:user) { create(:user) } - let(:project) { create(:project, :public, :repository) } + let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project, :public, :repository) } let(:repository) { project.repository } context 'logged in as developer' do @@ -175,7 +175,7 @@ RSpec.describe 'Branches' do search_for_branch('fix') expect(page).not_to have_content('fix') - expect(all('.all-branches').last).to have_selector('li', count: 0) + expect(all('.all-branches', wait: false).last).to have_selector('li', count: 0) end end @@ -233,7 +233,7 @@ RSpec.describe 'Branches' do end context 'with one or more pipeline', :js do - let(:project) { create(:project, :public, :empty_repo) } + let_it_be(:project) { create(:project, :public, :empty_repo) } before do sha = create_file(branch_name: "branch") diff --git a/spec/features/projects/ci/editor_spec.rb b/spec/features/projects/ci/editor_spec.rb index 8197fe46c7b..c96d5f5823f 100644 --- a/spec/features/projects/ci/editor_spec.rb +++ b/spec/features/projects/ci/editor_spec.rb @@ -135,6 +135,19 @@ RSpec.describe 'Pipeline Editor', :js do end end + describe 'Commit Form' do + it 'is preserved when changing tabs' do + find('#commit-message').set('message', clear: :backspace) + find('#source-branch-field').set('new_branch', clear: :backspace) + + click_link 'Validate' + click_link 'Edit' + + expect(find('#commit-message').value).to eq('message') + expect(find('#source-branch-field').value).to eq('new_branch') + end + end + describe 'Editor content' do it 'user can reset their CI configuration' do page.within('#source-editor-') do diff --git a/spec/features/projects/ci/lint_spec.rb b/spec/features/projects/ci/lint_spec.rb index 608511ae5a5..8d5f62d8a06 100644 --- a/spec/features/projects/ci/lint_spec.rb +++ b/spec/features/projects/ci/lint_spec.rb @@ -5,13 +5,16 @@ require 'spec_helper' RSpec.describe 'CI Lint', :js do include Spec::Support::Helpers::Features::SourceEditorSpecHelpers - let(:project) { create(:project, :repository) } - let(:user) { create(:user) } + let_it_be(:project) { create(:project, :repository) } + let_it_be(:user) { create(:user) } let(:content_selector) { '.content .view-lines' } - before do + before_all do project.add_developer(user) + end + + before do sign_in(user) visit project_ci_lint_path(project) diff --git a/spec/features/projects/environments/environment_metrics_spec.rb b/spec/features/projects/environments/environment_metrics_spec.rb index bf0949443de..d486d8cf551 100644 --- a/spec/features/projects/environments/environment_metrics_spec.rb +++ b/spec/features/projects/environments/environment_metrics_spec.rb @@ -6,7 +6,7 @@ RSpec.describe 'Environment > Metrics' do include PrometheusHelpers let(:user) { create(:user) } - let(:project) { create(:prometheus_project, :repository) } + let(:project) { create(:project, :with_prometheus_integration, :repository) } let(:pipeline) { create(:ci_pipeline, project: project) } let(:build) { create(:ci_build, pipeline: pipeline) } let(:environment) { create(:environment, project: project) } diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index be4b21dfff4..dc6e496d081 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -97,6 +97,10 @@ RSpec.describe 'Environment' do it 'does show deployments' do expect(page).to have_link("#{build.name} (##{build.id})") end + + it 'shows a tooltip on the job name' do + expect(page).to have_css("[title=\"#{build.name} (##{build.id})\"].has-tooltip") + end end context 'when there is a failed deployment' do diff --git a/spec/features/projects/fork_spec.rb b/spec/features/projects/fork_spec.rb index b8c127f0078..24943e7dd0f 100644 --- a/spec/features/projects/fork_spec.rb +++ b/spec/features/projects/fork_spec.rb @@ -118,17 +118,28 @@ RSpec.describe 'Project fork' do end end + shared_examples "increments the fork counter on the source project's page" do + specify :sidekiq_might_not_need_inline do + create_forks + + visit project_path(project) + + expect(page).to have_css('.fork-count', text: 2) + end + end + it_behaves_like 'fork button on project page' it_behaves_like 'create fork page', 'Fork project' context 'fork form', :js do let(:group) { create(:group) } + let(:group2) { create(:group) } let(:user) { create(:group_member, :maintainer, user: create(:user), group: group ).user } - def submit_form + def submit_form(group_obj = group) find('[data-testid="select_namespace_dropdown"]').click - find('[data-testid="select_namespace_dropdown_search_field"]').fill_in(with: group.name) - click_button group.name + find('[data-testid="select_namespace_dropdown_search_field"]').fill_in(with: group_obj.name) + click_button group_obj.name click_button 'Fork project' end @@ -166,5 +177,41 @@ RSpec.describe 'Project fork' do expect(page).to have_content("#{group.name} / #{fork_name}") end end + + context 'with cache_home_panel feature flag' do + before do + create(:group_member, :maintainer, user: user, group: group2 ) + end + + context 'when caching is enabled' do + before do + stub_feature_flags(cache_home_panel: project) + end + + it_behaves_like "increments the fork counter on the source project's page" + end + + context 'when caching is disabled' do + before do + stub_feature_flags(cache_home_panel: false) + end + + it_behaves_like "increments the fork counter on the source project's page" + end + end end end + +private + +def create_fork(group_obj = group) + visit project_path(project) + find('.fork-btn').click + submit_form(group_obj) + wait_for_requests +end + +def create_forks + create_fork + create_fork(group2) +end diff --git a/spec/features/projects/infrastructure_registry_spec.rb b/spec/features/projects/infrastructure_registry_spec.rb index 27d0866bc69..aab1cec8762 100644 --- a/spec/features/projects/infrastructure_registry_spec.rb +++ b/spec/features/projects/infrastructure_registry_spec.rb @@ -57,7 +57,7 @@ RSpec.describe 'Infrastructure Registry' do it 'allows you to delete a module', :aggregate_failures do # this is still using the package copy in the UI too click_button('Remove package') - click_button('Delete package') + click_button('Permanently delete') expect(page).to have_content 'Package deleted successfully' expect(page).not_to have_content(terraform_module.name) diff --git a/spec/features/projects/labels/sort_labels_spec.rb b/spec/features/projects/labels/sort_labels_spec.rb index ecbc4b524dc..f2f1acd2348 100644 --- a/spec/features/projects/labels/sort_labels_spec.rb +++ b/spec/features/projects/labels/sort_labels_spec.rb @@ -28,7 +28,7 @@ RSpec.describe 'Sort labels', :js do it 'sorts by date' do click_button 'Name' - sort_options = find('ul.dropdown-menu').all('li').collect(&:text) + sort_options = find('ul[role="listbox"]').all('li').collect(&:text) expect(sort_options[0]).to eq('Name') expect(sort_options[1]).to eq('Name, descending') @@ -37,7 +37,7 @@ RSpec.describe 'Sort labels', :js do expect(sort_options[4]).to eq('Updated date') expect(sort_options[5]).to eq('Oldest updated') - click_button 'Name, descending' + find('li', text: 'Name, descending').click # assert default sorting within '.other-labels' do diff --git a/spec/features/projects/milestones/milestones_sorting_spec.rb b/spec/features/projects/milestones/milestones_sorting_spec.rb index c47350fb663..5ba4289fd11 100644 --- a/spec/features/projects/milestones/milestones_sorting_spec.rb +++ b/spec/features/projects/milestones/milestones_sorting_spec.rb @@ -42,10 +42,10 @@ RSpec.describe 'Milestones sorting', :js do milestones_for_sort_by.each do |sort_by, expected_milestones| within '[data-testid=milestone_sort_by_dropdown]' do click_button selected_sort_order - milestones = find('.gl-new-dropdown-contents').all('.gl-new-dropdown-item-text-wrapper p').map(&:text) + milestones = find('ul[role="listbox"]').all('li').map(&:text) expect(milestones).to eq(ordered_milestones) - click_button sort_by + find('li', text: sort_by).click expect(page).to have_button(sort_by) end diff --git a/spec/features/projects/packages_spec.rb b/spec/features/projects/packages_spec.rb index f518cc1fc63..bbe913cf1e5 100644 --- a/spec/features/projects/packages_spec.rb +++ b/spec/features/projects/packages_spec.rb @@ -49,7 +49,7 @@ RSpec.describe 'Packages' do it 'allows you to delete a package' do find('[data-testid="delete-dropdown"]').click find('[data-testid="action-delete"]').click - click_button('Delete package') + click_button('Permanently delete') expect(page).to have_content 'Package deleted successfully' expect(page).not_to have_content(package.name) diff --git a/spec/features/projects/pipeline_schedules_spec.rb b/spec/features/projects/pipeline_schedules_spec.rb index dcc46f5d223..4ed0a11da38 100644 --- a/spec/features/projects/pipeline_schedules_spec.rb +++ b/spec/features/projects/pipeline_schedules_spec.rb @@ -11,6 +11,10 @@ RSpec.describe 'Pipeline Schedules', :js do let(:scope) { nil } let!(:user) { create(:user) } + before do + stub_feature_flags(pipeline_schedules_vue: false) + end + context 'logged in as the pipeline schedule owner' do before do project.add_developer(user) diff --git a/spec/features/projects/pipelines/legacy_pipeline_spec.rb b/spec/features/projects/pipelines/legacy_pipeline_spec.rb index 250a336469c..d93c951791d 100644 --- a/spec/features/projects/pipelines/legacy_pipeline_spec.rb +++ b/spec/features/projects/pipelines/legacy_pipeline_spec.rb @@ -735,6 +735,8 @@ RSpec.describe 'Pipeline', :js do end it 'displays the PipelineSchedule in an inactive state' do + stub_feature_flags(pipeline_schedules_vue: false) + visit project_pipeline_schedules_path(project) page.click_link('Inactive') diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index 51a6fbc4d36..0b43e13996f 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -860,6 +860,8 @@ RSpec.describe 'Pipeline', :js do end it 'displays the PipelineSchedule in an inactive state' do + stub_feature_flags(pipeline_schedules_vue: false) + visit project_pipeline_schedules_path(project) page.click_link('Inactive') diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index 404e51048bc..1190b0f3558 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -673,7 +673,7 @@ RSpec.describe 'Pipelines', :js do end context 'when variables are specified' do - it 'creates a new pipeline with variables' do + it 'creates a new pipeline with variables', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/375552' do page.within(find("[data-testid='ci-variable-row']")) do find("[data-testid='pipeline-form-ci-variable-key']").set('key_name') find("[data-testid='pipeline-form-ci-variable-value']").set('value') @@ -701,7 +701,7 @@ RSpec.describe 'Pipelines', :js do it { expect(page).to have_content('Missing CI config file') } - it 'creates a pipeline after first request failed and a valid gitlab-ci.yml file is available when trying again' do + it 'creates a pipeline after first request failed and a valid gitlab-ci.yml file is available when trying again', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/375552' do stub_ci_pipeline_to_return_yaml_file expect do diff --git a/spec/features/projects/releases/user_creates_release_spec.rb b/spec/features/projects/releases/user_creates_release_spec.rb index d82c4229b71..4eb7581222e 100644 --- a/spec/features/projects/releases/user_creates_release_spec.rb +++ b/spec/features/projects/releases/user_creates_release_spec.rb @@ -11,6 +11,7 @@ RSpec.describe 'User creates release', :js do let_it_be(:user) { create(:user) } let(:new_page_url) { new_project_release_path(project) } + let(:tag_name) { 'new-tag' } before do project.add_developer(user) @@ -33,6 +34,8 @@ RSpec.describe 'User creates release', :js do end it 'defaults the "Create from" dropdown to the project\'s default branch' do + select_new_tag_name(tag_name) + expect(page.find('[data-testid="create-from-field"] .ref-selector button')).to have_content(project.default_branch) end diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index 63e0ee4a251..d9bdbf7aa1a 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -25,7 +25,7 @@ RSpec.describe 'Projects > Settings > Repository settings' do context 'for maintainer' do let(:role) { :maintainer } - context 'Deploy tokens' do + context 'Deploy tokens', :js do let!(:deploy_token) { create(:deploy_token, projects: [project]) } before do diff --git a/spec/features/projects/settings/user_changes_default_branch_spec.rb b/spec/features/projects/settings/user_changes_default_branch_spec.rb index 84e6c50cf61..508bbcc5327 100644 --- a/spec/features/projects/settings/user_changes_default_branch_spec.rb +++ b/spec/features/projects/settings/user_changes_default_branch_spec.rb @@ -3,8 +3,6 @@ require 'spec_helper' RSpec.describe 'Projects > Settings > User changes default branch' do - include Select2Helper - let(:user) { create(:user) } before do @@ -17,16 +15,21 @@ RSpec.describe 'Projects > Settings > User changes default branch' do let(:project) { create(:project, :repository, namespace: user.namespace) } it 'allows to change the default branch', :js do + dropdown_selector = '[data-testid="default-branch-dropdown"]' # Otherwise, running JS may overwrite our change to project_default_branch wait_for_requests - select2('fix', from: '#project_default_branch') + expect(page).to have_selector(dropdown_selector) + find(dropdown_selector).click + + fill_in 'Search branch', with: 'fix' + click_button 'fix' page.within '#default-branch-settings' do click_button 'Save changes' end - expect(find('#project_default_branch', visible: false).value).to eq 'fix' + expect(find("#{dropdown_selector} input", visible: false).value).to eq 'fix' end end @@ -34,7 +37,7 @@ RSpec.describe 'Projects > Settings > User changes default branch' do let(:project) { create(:project_empty_repo, namespace: user.namespace) } it 'does not show default branch selector' do - expect(page).not_to have_selector('#project_default_branch') + expect(page).not_to have_selector('[data-testid="default-branch-dropdown"]') end end end diff --git a/spec/features/projects/settings/user_transfers_a_project_spec.rb b/spec/features/projects/settings/user_transfers_a_project_spec.rb index 6041dca305b..23e10a36cee 100644 --- a/spec/features/projects/settings/user_transfers_a_project_spec.rb +++ b/spec/features/projects/settings/user_transfers_a_project_spec.rb @@ -8,7 +8,7 @@ RSpec.describe 'Projects > Settings > User transfers a project', :js do let(:group) { create(:group) } before do - stub_const('Gitlab::QueryLimiting::Transaction::THRESHOLD', 120) + allow(Gitlab::QueryLimiting::Transaction).to receive(:threshold).and_return(120) group.add_owner(user) sign_in(user) diff --git a/spec/features/projects/settings/webhooks_settings_spec.rb b/spec/features/projects/settings/webhooks_settings_spec.rb index d525544ac15..25752bcaf45 100644 --- a/spec/features/projects/settings/webhooks_settings_spec.rb +++ b/spec/features/projects/settings/webhooks_settings_spec.rb @@ -48,10 +48,10 @@ RSpec.describe 'Projects > Settings > Webhook Settings' do expect(page).to have_content('Releases events') end - it 'create webhook' do + it 'create webhook', :js do visit webhooks_path - fill_in 'hook_url', with: url + fill_in 'URL', with: url check 'Tag push events' fill_in 'hook_push_events_branch_filter', with: 'master' check 'Enable SSL verification' @@ -66,12 +66,12 @@ RSpec.describe 'Projects > Settings > Webhook Settings' do expect(page).to have_content('Job events') end - it 'edit existing webhook' do + it 'edit existing webhook', :js do hook visit webhooks_path click_link 'Edit' - fill_in 'hook_url', with: url + fill_in 'URL', with: url check 'Enable SSL verification' click_button 'Save changes' diff --git a/spec/features/projects/show/user_interacts_with_stars_spec.rb b/spec/features/projects/show/user_interacts_with_stars_spec.rb index e0dd4f65010..158b6aa9b46 100644 --- a/spec/features/projects/show/user_interacts_with_stars_spec.rb +++ b/spec/features/projects/show/user_interacts_with_stars_spec.rb @@ -13,6 +13,14 @@ RSpec.describe 'Projects > Show > User interacts with project stars' do visit(project_path(project)) end + it 'retains the star count even after a page reload' do + star_project + + reload_page + + expect(page).to have_css('.star-count', text: 1) + end + it 'toggles the star' do star_project @@ -63,6 +71,10 @@ end private +def reload_page + visit current_path +end + def star_project click_button(_('Star')) wait_for_requests diff --git a/spec/features/projects/show/user_sees_collaboration_links_spec.rb b/spec/features/projects/show/user_sees_collaboration_links_spec.rb index 1440db141a6..c63427e56e6 100644 --- a/spec/features/projects/show/user_sees_collaboration_links_spec.rb +++ b/spec/features/projects/show/user_sees_collaboration_links_spec.rb @@ -5,8 +5,8 @@ require 'spec_helper' RSpec.describe 'Projects > Show > Collaboration links', :js do using RSpec::Parameterized::TableSyntax - let(:project) { create(:project, :repository, :public) } - let(:user) { create(:user) } + let_it_be(:project) { create(:project, :repository, :public) } + let_it_be(:user) { create(:user) } before do sign_in(user) @@ -17,7 +17,7 @@ RSpec.describe 'Projects > Show > Collaboration links', :js do end context 'with developer user' do - before do + before_all do project.add_developer(user) end diff --git a/spec/features/projects/user_sorts_projects_spec.rb b/spec/features/projects/user_sorts_projects_spec.rb index b9b28398279..c40f01f3aa1 100644 --- a/spec/features/projects/user_sorts_projects_spec.rb +++ b/spec/features/projects/user_sorts_projects_spec.rb @@ -24,7 +24,6 @@ RSpec.describe 'User sorts projects and order persists' do end it "is set on the group_canonical_path" do - stub_feature_flags(group_overview_tabs_vue: false) visit(group_canonical_path(group)) within '[data-testid=group_sort_by_dropdown]' do @@ -33,7 +32,6 @@ RSpec.describe 'User sorts projects and order persists' do end it "is set on the details_group_path" do - stub_feature_flags(group_overview_tabs_vue: false) visit(details_group_path(group)) within '[data-testid=group_sort_by_dropdown]' do @@ -42,7 +40,7 @@ RSpec.describe 'User sorts projects and order persists' do end end - context "from explore projects" do + context "from explore projects", :js do before do sign_in(user) visit(explore_projects_path) @@ -50,10 +48,10 @@ RSpec.describe 'User sorts projects and order persists' do first(:link, 'Updated date').click end - it_behaves_like "sort order persists across all views", 'Updated date', 'Updated date' + it_behaves_like "sort order persists across all views", 'Updated date', 'Updated' end - context 'from dashboard projects' do + context 'from dashboard projects', :js do before do sign_in(user) visit(dashboard_projects_path) @@ -66,29 +64,29 @@ RSpec.describe 'User sorts projects and order persists' do context 'from group homepage', :js do before do - stub_feature_flags(group_overview_tabs_vue: false) sign_in(user) visit(group_canonical_path(group)) within '[data-testid=group_sort_by_dropdown]' do find('button.gl-dropdown-toggle').click - first(:button, 'Last created').click + first(:button, 'Created').click + wait_for_requests end end - it_behaves_like "sort order persists across all views", "Created date", "Last created" + it_behaves_like "sort order persists across all views", "Created date", "Created" end context 'from group details', :js do before do - stub_feature_flags(group_overview_tabs_vue: false) sign_in(user) visit(details_group_path(group)) within '[data-testid=group_sort_by_dropdown]' do find('button.gl-dropdown-toggle').click - first(:button, 'Most stars').click + first(:button, 'Stars').click + wait_for_requests end end - it_behaves_like "sort order persists across all views", "Stars", "Most stars" + it_behaves_like "sort order persists across all views", "Stars", "Stars" end end diff --git a/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb index fbb5c24f6e1..db2b3fc2f4b 100644 --- a/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb @@ -8,7 +8,7 @@ RSpec.describe 'Projects > Wiki > User views wiki in project page' do end context 'when repository is disabled for project' do - let_it_be(:project) do + let(:project) do create(:project, :wiki_repo, :repository_disabled, @@ -17,16 +17,31 @@ RSpec.describe 'Projects > Wiki > User views wiki in project page' do end context 'when wiki homepage contains a link' do - before do - create(:wiki_page, wiki: project.wiki, title: 'home', content: '[some link](other-page)') + shared_examples 'wiki homepage contains a link' do + it 'displays the correct URL for the link' do + visit project_path(project) + expect(page).to have_link( + 'some link', + href: project_wiki_path(project, 'other-page') + ) + end end - it 'displays the correct URL for the link' do - visit project_path(project) - expect(page).to have_link( - 'some link', - href: project_wiki_path(project, 'other-page') - ) + context 'when using markdown' do + before do + create(:wiki_page, wiki: project.wiki, title: 'home', content: '[some link](other-page)') + end + + it_behaves_like 'wiki homepage contains a link' + end + + context 'when using asciidoc' do + before do + create(:wiki_page, wiki: project.wiki, title: 'home', content: 'link:other-page[some link]', + format: :asciidoc) + end + + it_behaves_like 'wiki homepage contains a link' end end end |