diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-13 18:10:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-13 18:10:17 +0300 |
commit | effc12bf9dac4bf1e48f1397c25e0381ac1bd76f (patch) | |
tree | e2ff447fff4e156a94b684df6edddc108a767365 /spec/features | |
parent | c3eeb6a8d6a4b11f0bc5e5eb1ed43b0726f1ea26 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
7 files changed, 28 insertions, 38 deletions
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index d3b43029f2a..5f0d697b1e0 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -116,7 +116,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do it 'change Maximum export size' do page.within(find('[data-testid="account-limit"]')) do - fill_in 'Maximum export size (MB)', with: 25 + fill_in 'Maximum export size (MiB)', with: 25 click_button 'Save changes' end @@ -126,7 +126,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do it 'change Maximum import size' do page.within(find('[data-testid="account-limit"]')) do - fill_in 'Maximum import size (MB)', with: 15 + fill_in 'Maximum import size (MiB)', with: 15 click_button 'Save changes' end @@ -905,7 +905,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do it 'change Pages settings' do page.within('.as-pages') do - fill_in 'Maximum size of pages (MB)', with: 15 + fill_in 'Maximum size of pages (MiB)', with: 15 check 'Require users to prove ownership of custom domains' click_button 'Save changes' end diff --git a/spec/features/projects/blobs/edit_spec.rb b/spec/features/projects/blobs/edit_spec.rb index 3c68f310744..e8a9edcc0cc 100644 --- a/spec/features/projects/blobs/edit_spec.rb +++ b/spec/features/projects/blobs/edit_spec.rb @@ -23,15 +23,11 @@ RSpec.describe 'Editing file blob', :js, feature_category: :groups_and_projects end def edit_and_commit(commit_changes: true, is_diff: false) - set_default_button('edit') - refresh - wait_for_requests - if is_diff first('.js-diff-more-actions').click click_link('Edit in single-file editor') else - click_link('Edit') + edit_in_single_file_editor end fill_editor(content: 'class NextFeature\\nend\\n') diff --git a/spec/features/projects/blobs/user_views_pipeline_editor_button_spec.rb b/spec/features/projects/blobs/user_views_pipeline_editor_button_spec.rb index 3e4ee13269f..bef4e5f89b1 100644 --- a/spec/features/projects/blobs/user_views_pipeline_editor_button_spec.rb +++ b/spec/features/projects/blobs/user_views_pipeline_editor_button_spec.rb @@ -19,6 +19,8 @@ RSpec.describe 'User views pipeline editor button on root ci config file', :js, project.repository.create_file(user, project.ci_config_path_or_default, 'test', message: 'testing', branch_name: 'master') visit project_blob_path(project, File.join('master', '.my-config.yml')) + click_button 'Edit' + expect(page).to have_content('Edit in pipeline editor') end @@ -26,6 +28,8 @@ RSpec.describe 'User views pipeline editor button on root ci config file', :js, project.repository.create_file(user, '.my-sub-config.yml', 'test', message: 'testing', branch_name: 'master') visit project_blob_path(project, File.join('master', '.my-sub-config.yml')) + click_button 'Edit' + expect(page).not_to have_content('Edit in pipeline editor') end end @@ -36,6 +40,9 @@ RSpec.describe 'User views pipeline editor button on root ci config file', :js, end it 'does not shows the Pipeline Editor button' do visit project_blob_path(project, File.join('master', '.my-config.yml')) + + click_button 'Edit' + expect(page).not_to have_content('Edit in pipeline editor') end end diff --git a/spec/features/projects/files/user_browses_lfs_files_spec.rb b/spec/features/projects/files/user_browses_lfs_files_spec.rb index 04094ae2d6f..d8c1c8e4f2a 100644 --- a/spec/features/projects/files/user_browses_lfs_files_spec.rb +++ b/spec/features/projects/files/user_browses_lfs_files_spec.rb @@ -71,7 +71,9 @@ RSpec.describe 'Projects > Files > User browses LFS files', feature_category: :g expect(page).not_to have_content('Annotate') expect(page).not_to have_content('Blame') - expect(page).not_to have_selector(:link_or_button, text: /^Edit$/) + click_button 'Edit' + + expect(page).not_to have_selector(:link_or_button, text: /^Edit single file$/) expect(page).to have_selector(:link_or_button, 'Open in Web IDE') end end diff --git a/spec/features/projects/files/user_creates_files_spec.rb b/spec/features/projects/files/user_creates_files_spec.rb index 7d888aabf53..de82f3062a2 100644 --- a/spec/features/projects/files/user_creates_files_spec.rb +++ b/spec/features/projects/files/user_creates_files_spec.rb @@ -105,8 +105,6 @@ RSpec.describe 'Projects > Files > User creates files', :js, feature_category: : end it 'creates and commit a new file with new lines at the end of file' do - set_default_button('edit') - editor_set_value('Sample\n\n\n') fill_in(:file_name, with: 'not_a_file.md') fill_in(:commit_message, with: 'New commit message', visible: true) @@ -116,7 +114,7 @@ RSpec.describe 'Projects > Files > User creates files', :js, feature_category: : expect(page).to have_current_path(new_file_path, ignore_query: true) - click_link('Edit') + edit_in_single_file_editor expect(find('.monaco-editor')).to have_content('Sample\n\n\n') end diff --git a/spec/features/projects/files/user_edits_files_spec.rb b/spec/features/projects/files/user_edits_files_spec.rb index acaeffe5ef4..10fa4a21359 100644 --- a/spec/features/projects/files/user_edits_files_spec.rb +++ b/spec/features/projects/files/user_edits_files_spec.rb @@ -19,10 +19,6 @@ RSpec.describe 'Projects > Files > User edits files', :js, feature_category: :gr sign_in(user) end - after do - unset_default_button - end - shared_examples 'unavailable for an archived project' do it 'does not show the edit link for an archived project', :js do project.update!(archived: true) @@ -48,9 +44,8 @@ RSpec.describe 'Projects > Files > User edits files', :js, feature_category: :gr end it 'inserts a content of a file' do - set_default_button('edit') click_link('.gitignore') - click_link_or_button('Edit') + edit_in_single_file_editor find('.file-editor', match: :first) editor_set_value('*.rbca') @@ -69,9 +64,8 @@ RSpec.describe 'Projects > Files > User edits files', :js, feature_category: :gr end it 'commits an edited file' do - set_default_button('edit') click_link('.gitignore') - click_link_or_button('Edit') + edit_in_single_file_editor find('.file-editor', match: :first) editor_set_value('*.rbca') @@ -86,9 +80,8 @@ RSpec.describe 'Projects > Files > User edits files', :js, feature_category: :gr end it 'commits an edited file to a new branch' do - set_default_button('edit') click_link('.gitignore') - click_link_or_button('Edit') + edit_in_single_file_editor find('.file-editor', match: :first) @@ -105,10 +98,8 @@ RSpec.describe 'Projects > Files > User edits files', :js, feature_category: :gr end it 'shows loader on commit changes' do - set_default_button('edit') click_link('.gitignore') - click_link_or_button('Edit') - + edit_in_single_file_editor # why: We don't want the form to actually submit, so that we can assert the button's changed state page.execute_script("document.querySelector('.js-edit-blob-form').addEventListener('submit', e => e.preventDefault())") @@ -120,9 +111,8 @@ RSpec.describe 'Projects > Files > User edits files', :js, feature_category: :gr end it 'shows the diff of an edited file' do - set_default_button('edit') click_link('.gitignore') - click_link_or_button('Edit') + edit_in_single_file_editor find('.file-editor', match: :first) editor_set_value('*.rbca') @@ -158,9 +148,8 @@ RSpec.describe 'Projects > Files > User edits files', :js, feature_category: :gr end it 'inserts a content of a file in a forked project', :sidekiq_might_not_need_inline do - set_default_button('edit') click_link('.gitignore') - click_link_or_button('Edit') + edit_in_single_file_editor expect_fork_prompt @@ -176,9 +165,8 @@ RSpec.describe 'Projects > Files > User edits files', :js, feature_category: :gr end it 'opens the Web IDE in a forked project', :sidekiq_might_not_need_inline do - set_default_button('webide') click_link('.gitignore') - click_link_or_button('Web IDE') + edit_in_web_ide expect_fork_prompt @@ -191,9 +179,8 @@ RSpec.describe 'Projects > Files > User edits files', :js, feature_category: :gr end it 'commits an edited file in a forked project', :sidekiq_might_not_need_inline do - set_default_button('edit') click_link('.gitignore') - click_link_or_button('Edit') + edit_in_single_file_editor expect_fork_prompt click_link_or_button('Fork') @@ -222,9 +209,8 @@ RSpec.describe 'Projects > Files > User edits files', :js, feature_category: :gr end it 'links to the forked project for editing', :sidekiq_might_not_need_inline do - set_default_button('edit') click_link('.gitignore') - click_link_or_button('Edit') + edit_in_single_file_editor expect(page).not_to have_link('Fork') 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 a86bc0ae97a..29fb20841fd 100644 --- a/spec/features/projects/show/user_sees_collaboration_links_spec.rb +++ b/spec/features/projects/show/user_sees_collaboration_links_spec.rb @@ -51,7 +51,8 @@ RSpec.describe 'Projects > Show > Collaboration links', :js, feature_category: : end # The Web IDE - expect(page).to have_link('Web IDE') + click_button 'Edit' + expect(page).to have_button('Web IDE') end it 'hides the links when the project is archived' do @@ -73,7 +74,7 @@ RSpec.describe 'Projects > Show > Collaboration links', :js, feature_category: : expect(page).not_to have_selector('[data-testid="add-to-tree"]') - expect(page).not_to have_link('Web IDE') + expect(page).not_to have_button('Edit') end end @@ -95,7 +96,7 @@ RSpec.describe 'Projects > Show > Collaboration links', :js, feature_category: : end it "updates Web IDE link" do - expect(page.has_link?('Web IDE')).to be(expect_ide_link) + expect(page.has_button?('Edit')).to be(expect_ide_link) end end end |