diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-05-04 22:48:21 +0000 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-05-04 22:48:21 +0000 |
commit | 12fbce2eacdfbbc9bca7f7eaca6e5679ee1aaffd (patch) | |
tree | 055c994736a0408af7c6b4c5ff6ca37ec65c336c /spec/features | |
parent | 1bf694fcb95c978e8cf32664b3ced186e7a7d850 (diff) | |
parent | 79dc817183bf1480e72016c3e6a78ac0e57d8c96 (diff) | |
download | gitlab-ce-12fbce2eacdfbbc9bca7f7eaca6e5679ee1aaffd.tar.gz |
Merge branch 'master' into 'add-sentry-js-again-with-vue'
# Conflicts:
# db/schema.rb
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/projects/artifacts/file_spec.rb | 59 | ||||
-rw-r--r-- | spec/features/projects/branches/new_branch_ref_dropdown_spec.rb | 48 | ||||
-rw-r--r-- | spec/features/projects/deploy_keys_spec.rb | 12 |
3 files changed, 115 insertions, 4 deletions
diff --git a/spec/features/projects/artifacts/file_spec.rb b/spec/features/projects/artifacts/file_spec.rb new file mode 100644 index 00000000000..74308a7e8dd --- /dev/null +++ b/spec/features/projects/artifacts/file_spec.rb @@ -0,0 +1,59 @@ +require 'spec_helper' + +feature 'Artifact file', :js, feature: true do + let(:project) { create(:project, :public) } + let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.sha, ref: 'master') } + let(:build) { create(:ci_build, :artifacts, pipeline: pipeline) } + + def visit_file(path) + visit file_namespace_project_build_artifacts_path(project.namespace, project, build, path) + end + + context 'Text file' do + before do + visit_file('other_artifacts_0.1.2/doc_sample.txt') + + wait_for_ajax + end + + it 'displays an error' do + aggregate_failures do + # shows an error message + expect(page).to have_content('The source could not be displayed because it is stored as a job artifact. You can download it instead.') + + # does not show a viewer switcher + expect(page).not_to have_selector('.js-blob-viewer-switcher') + + # does not show a copy button + expect(page).not_to have_selector('.js-copy-blob-source-btn') + + # shows a download button + expect(page).to have_link('Download') + end + end + end + + context 'JPG file' do + before do + visit_file('rails_sample.jpg') + + wait_for_ajax + end + + it 'displays the blob' do + aggregate_failures do + # shows rendered image + expect(page).to have_selector('.image_file img') + + # does not show a viewer switcher + expect(page).not_to have_selector('.js-blob-viewer-switcher') + + # does not show a copy button + expect(page).not_to have_selector('.js-copy-blob-source-btn') + + # shows a download button + expect(page).to have_link('Download') + end + end + end +end diff --git a/spec/features/projects/branches/new_branch_ref_dropdown_spec.rb b/spec/features/projects/branches/new_branch_ref_dropdown_spec.rb new file mode 100644 index 00000000000..cfc782c98ad --- /dev/null +++ b/spec/features/projects/branches/new_branch_ref_dropdown_spec.rb @@ -0,0 +1,48 @@ +require 'spec_helper' + +describe 'New Branch Ref Dropdown', :js, :feature do + let(:user) { create(:user) } + let(:project) { create(:project, :public) } + let(:toggle) { find('.create-from .dropdown-toggle') } + + before do + project.add_master(user) + + login_as(user) + visit new_namespace_project_branch_path(project.namespace, project) + end + + it 'filters a list of branches and tags' do + toggle.click + + filter_by('v1.0.0') + + expect(items_count).to be(1) + + filter_by('video') + + expect(items_count).to be(1) + + find('.create-from .dropdown-content li').click + + expect(toggle).to have_content 'video' + end + + it 'accepts a manually entered commit SHA' do + toggle.click + + filter_by('somecommitsha') + + find('.create-from input[type=search]').send_keys(:enter) + + expect(toggle).to have_content 'somecommitsha' + end + + def items_count + all('.create-from .dropdown-content li').length + end + + def filter_by(filter_text) + fill_in 'Filter by Git revision', with: filter_text + end +end diff --git a/spec/features/projects/deploy_keys_spec.rb b/spec/features/projects/deploy_keys_spec.rb index 0b997f130ea..06abfbbc86b 100644 --- a/spec/features/projects/deploy_keys_spec.rb +++ b/spec/features/projects/deploy_keys_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Project deploy keys', feature: true do +describe 'Project deploy keys', :js, :feature do let(:user) { create(:user) } let(:project) { create(:project_empty_repo) } @@ -17,9 +17,13 @@ describe 'Project deploy keys', feature: true do it 'removes association between project and deploy key' do visit namespace_project_settings_repository_path(project.namespace, project) - page.within '.deploy-keys' do - expect { click_on 'Remove' } - .to change { project.deploy_keys.count }.by(-1) + page.within(find('.deploy-keys')) do + expect(page).to have_selector('.deploy-keys li', count: 1) + + click_on 'Remove' + + expect(page).not_to have_selector('.fa-spinner', count: 0) + expect(page).to have_selector('.deploy-keys li', count: 0) end end end |