diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-14 15:08:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-14 15:08:58 +0300 |
commit | c9ca178ba4c9a3e48d9d069f7d7486a29827cc61 (patch) | |
tree | 07a4f84921b80ff967d30229f0d887c152b9b1d8 /spec/features | |
parent | 6035fcc36ead3b415fa2422b0204a795a70f3e2f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
7 files changed, 118 insertions, 124 deletions
diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb index 38d11ee2560..da44fe398fb 100644 --- a/spec/features/issues/issue_sidebar_spec.rb +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -140,6 +140,18 @@ RSpec.describe 'Issue Sidebar' do end end end + + it 'shows label text as "Apply" when assignees are changed' do + project.add_developer(user) + visit_issue(project, issue2) + + find('.block.assignee .edit-link').click + wait_for_requests + + click_on 'Unassigned' + + expect(page).to have_link('Apply') + end end context 'as a allowed user' do diff --git a/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb b/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb index abdbd3a6f8a..9268190c7e0 100644 --- a/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb +++ b/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb @@ -250,7 +250,7 @@ RSpec.describe 'User comments on a diff', :js do end context 'multiple suggestions in a single note' do - it 'suggestions are presented' do + it 'suggestions are presented', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/258989' do click_diff_line(find("[id='#{sample_compare.changes[1][:line_code]}']")) page.within('.js-discussion-note-form') do 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 index a271a4f43a8..fda2992af8d 100644 --- 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 @@ -2,7 +2,9 @@ require 'spec_helper' -RSpec.describe 'User creates blob in new project', :js do +RSpec.describe 'User creates new blob', :js do + include WebIdeSpecHelpers + let(:user) { create(:user) } let(:project) { create(:project, :empty_repo) } @@ -12,16 +14,19 @@ RSpec.describe 'User creates blob in new project', :js do visit project_path(project) end - it 'allows the user to add a new file' do + it 'allows the user to add a new file in Web IDE' do click_link 'New file' - execute_script("monaco.editor.getModels()[0].setValue('Hello world')") + wait_for_requests + + ide_create_new_file('dummy-file', content: "Hello world\n") - fill_in(:file_name, with: 'dummy-file') + ide_commit - click_button('Commit changes') + click_button('Commit') - expect(page).to have_content('The file has been successfully created') + 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 diff --git a/spec/features/projects/ci/lint_spec.rb b/spec/features/projects/ci/lint_spec.rb index ce435151b84..eb2efb4357d 100644 --- a/spec/features/projects/ci/lint_spec.rb +++ b/spec/features/projects/ci/lint_spec.rb @@ -8,117 +8,88 @@ RSpec.describe 'CI Lint', :js do let(:project) { create(:project, :repository) } let(:user) { create(:user) } - shared_examples 'correct ci linting process' do - describe 'YAML parsing' do - shared_examples 'validates the YAML' do - before do - stub_feature_flags(ci_lint_vue: false) - click_on 'Validate' - end + let(:content_selector) { '.content .view-lines' } - context 'YAML is correct' do - let(:yaml_content) do - File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) - end + before do + stub_feature_flags(ci_lint_vue: false) + project.add_developer(user) + sign_in(user) - it 'parses Yaml and displays the jobs' do - expect(page).to have_content('Status: syntax is correct') + visit project_ci_lint_path(project) + editor_set_value(yaml_content) - within "table" do - aggregate_failures do - expect(page).to have_content('Job - rspec') - expect(page).to have_content('Job - spinach') - expect(page).to have_content('Deploy Job - staging') - expect(page).to have_content('Deploy Job - production') - end - end - end - end + wait_for('YAML content') do + find(content_selector).text.present? + end + end - context 'YAML is incorrect' do - let(:yaml_content) { 'value: cannot have :' } + describe 'YAML parsing' do + shared_examples 'validates the YAML' do + before do + stub_feature_flags(ci_lint_vue: false) + click_on 'Validate' + end - it 'displays information about an error' do - expect(page).to have_content('Status: syntax is incorrect') - expect(page).to have_selector(content_selector, text: yaml_content) - end + context 'YAML is correct' do + let(:yaml_content) do + File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) end - end - it_behaves_like 'validates the YAML' + it 'parses Yaml and displays the jobs' do + expect(page).to have_content('Status: syntax is correct') - context 'when Dry Run is checked' do - before do - check 'Simulate a pipeline created for the default branch' + within "table" do + aggregate_failures do + expect(page).to have_content('Job - rspec') + expect(page).to have_content('Job - spinach') + expect(page).to have_content('Deploy Job - staging') + expect(page).to have_content('Deploy Job - production') + end + end end - - it_behaves_like 'validates the YAML' end - describe 'YAML revalidate' do - let(:yaml_content) { 'my yaml content' } + context 'YAML is incorrect' do + let(:yaml_content) { 'value: cannot have :' } - it 'loads previous YAML content after validation' do - expect(page).to have_field('content', with: 'my yaml content', visible: false, type: 'textarea') + it 'displays information about an error' do + expect(page).to have_content('Status: syntax is incorrect') + expect(page).to have_selector(content_selector, text: yaml_content) end end end - describe 'YAML clearing' do + it_behaves_like 'validates the YAML' + + context 'when Dry Run is checked' do before do - click_on 'Clear' + check 'Simulate a pipeline created for the default branch' end - context 'YAML is present' do - let(:yaml_content) do - File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) - end - - it 'YAML content is cleared' do - expect(page).to have_field('content', with: '', visible: false, type: 'textarea') - end - end + it_behaves_like 'validates the YAML' end - end - context 'with ACE editor' do - it_behaves_like 'correct ci linting process' do - let(:content_selector) { '.ace_content' } + describe 'YAML revalidate' do + let(:yaml_content) { 'my yaml content' } - before do - stub_feature_flags(monaco_ci: false) - stub_feature_flags(ci_lint_vue: false) - project.add_developer(user) - sign_in(user) - - visit project_ci_lint_path(project) - find('#ci-editor') - execute_script("ace.edit('ci-editor').setValue(#{yaml_content.to_json});") - - # Ace editor updates a hidden textarea and it happens asynchronously - wait_for('YAML content') do - find(content_selector).text.present? - end + it 'loads previous YAML content after validation' do + expect(page).to have_field('content', with: 'my yaml content', visible: false, type: 'textarea') end end end - context 'with Editor Lite' do - it_behaves_like 'correct ci linting process' do - let(:content_selector) { '.content .view-lines' } - - before do - stub_feature_flags(monaco_ci: true) - stub_feature_flags(ci_lint_vue: false) - project.add_developer(user) - sign_in(user) + describe 'YAML clearing' do + before do + click_on 'Clear' + end - visit project_ci_lint_path(project) - editor_set_value(yaml_content) + context 'YAML is present' do + let(:yaml_content) do + File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) + end - wait_for('YAML content') do - find(content_selector).text.present? - end + it 'YAML content is cleared' do + expect(page).to have_field('content', with: '', visible: false, type: 'textarea') end end end diff --git a/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb b/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb index eed1e7aaf1b..d28e31c08dc 100644 --- a/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb +++ b/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'Projects > Files > Project owner sees a link to create a license file in empty project', :js do + include WebIdeSpecHelpers + let(:project) { create(:project_empty_repo) } let(:project_maintainer) { project.owner } @@ -10,36 +12,35 @@ RSpec.describe 'Projects > Files > Project owner sees a link to create a license sign_in(project_maintainer) end - it 'project maintainer creates a license file from a template' do + it 'allows project maintainer creates a license file from a template in Web IDE' do visit project_path(project) click_on 'Add LICENSE' - expect(page).to have_content('New file') - expect(current_path).to eq( - project_new_blob_path(project, 'master')) - expect(find('#file_name').value).to eq('LICENSE') - expect(page).to have_selector('.license-selector') + expect(current_path).to eq("/-/ide/project/#{project.full_path}/edit/master/-/LICENSE") + + expect(page).to have_selector('.qa-file-templates-bar') select_template('MIT License') - file_content = first('.file-editor') - expect(file_content).to have_content('MIT License') - expect(file_content).to have_content("Copyright (c) #{Time.now.year} #{project.namespace.human_name}") + expect(ide_editor_value).to have_content('MIT License') + expect(ide_editor_value).to have_content("Copyright (c) #{Time.now.year} #{project.namespace.human_name}") + + ide_commit + + click_button('Commit') + + expect(current_path).to eq("/-/ide/project/#{project.full_path}/tree/master/-/") - fill_in :commit_message, with: 'Add a LICENSE file', visible: true - click_button 'Commit changes' + expect(page).to have_content('All changes are committed') - expect(current_path).to eq( - project_blob_path(project, 'master/LICENSE')) - expect(page).to have_content('MIT License') - expect(page).to have_content("Copyright (c) #{Time.now.year} #{project.namespace.human_name}") + license_file = project.repository.blob_at('master', 'LICENSE').data + expect(license_file).to have_content('MIT License') + expect(license_file).to have_content("Copyright (c) #{Time.now.year} #{project.namespace.human_name}") end def select_template(template) - page.within('.js-license-selector-wrap') do - click_button 'Apply a template' - click_link template - wait_for_requests - end + click_button 'Choose a template...' + click_button template + wait_for_requests end end diff --git a/spec/features/projects/show/user_sees_setup_shortcut_buttons_spec.rb b/spec/features/projects/show/user_sees_setup_shortcut_buttons_spec.rb index afa9de5ce86..189aa45ff75 100644 --- a/spec/features/projects/show/user_sees_setup_shortcut_buttons_spec.rb +++ b/spec/features/projects/show/user_sees_setup_shortcut_buttons_spec.rb @@ -46,21 +46,21 @@ RSpec.describe 'Projects > Show > User sees setup shortcut buttons' do visit project_path(project) end - it '"New file" button linked to new file page' do + it '"New file" button linked to IDE new file page' do page.within('.project-buttons') do - expect(page).to have_link('New file', href: project_new_blob_path(project, project.default_branch || 'master')) + expect(page).to have_link('New file', href: presenter.ide_edit_path(project, project.default_branch || 'master')) end end - it '"Add README" button linked to new file populated for a README' do + it '"Add README" button linked to IDE new file populated for a README' do page.within('.project-buttons') do - expect(page).to have_link('Add README', href: presenter.add_readme_path) + expect(page).to have_link('Add README', href: presenter.add_readme_ide_path) end end - it '"Add license" button linked to new file populated for a license' do + it '"Add license" button linked to IDE new file populated for a license' do page.within('.project-buttons') do - expect(page).to have_link('Add LICENSE', href: presenter.add_license_path) + expect(page).to have_link('Add LICENSE', href: presenter.add_license_ide_path) end end @@ -74,9 +74,9 @@ RSpec.describe 'Projects > Show > User sees setup shortcut buttons' do visit project_path(project) end - it '"New file" button linked to new file page' do + it '"New file" button linked to IDE new file page' do page.within('.project-buttons') do - expect(page).to have_link('New file', href: project_new_blob_path(project, 'example_branch')) + expect(page).to have_link('New file', href: presenter.ide_edit_path(project, 'example_branch')) end end end @@ -144,7 +144,7 @@ RSpec.describe 'Projects > Show > User sees setup shortcut buttons' do expect(project.repository.readme).not_to be_nil page.within('.project-buttons') do - expect(page).not_to have_link('Add README', href: presenter.add_readme_path) + expect(page).not_to have_link('Add README', href: presenter.add_readme_ide_path) expect(page).to have_link('README', href: presenter.readme_path) end end @@ -164,7 +164,7 @@ RSpec.describe 'Projects > Show > User sees setup shortcut buttons' do end context 'when the project does not have a README' do - it 'shows the "Add README" button' do + it 'shows the single file editor "Add README" button' do allow(project.repository).to receive(:readme).and_return(nil) visit project_path(project) diff --git a/spec/features/tags/developer_views_tags_spec.rb b/spec/features/tags/developer_views_tags_spec.rb index 4888611472c..6bae53afe6f 100644 --- a/spec/features/tags/developer_views_tags_spec.rb +++ b/spec/features/tags/developer_views_tags_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'Developer views tags' do + include RepoHelpers + let(:user) { create(:user) } let(:group) { create(:group) } @@ -15,10 +17,13 @@ RSpec.describe 'Developer views tags' do let(:project) { create(:project_empty_repo, namespace: group) } before do - visit project_path(project) - click_on 'Add README' - fill_in :commit_message, with: 'Add a README file', visible: true - click_button 'Commit changes' + project.repository.create_file( + user, + 'README.md', + 'Example readme', + message: 'Add README', + branch_name: 'master') + visit project_tags_path(project) end |