summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/admin/admin_deploy_keys_spec.rb37
-rw-r--r--spec/features/cycle_analytics_spec.rb126
-rw-r--r--spec/features/issues/award_emoji_spec.rb2
-rw-r--r--spec/features/merge_requests/merge_request_versions_spec.rb48
-rw-r--r--spec/features/notes_on_merge_requests_spec.rb40
-rw-r--r--spec/features/projects/issuable_templates_spec.rb21
-rw-r--r--spec/features/projects/pipelines/pipelines_spec.rb4
-rw-r--r--spec/features/projects/services/mattermost_slash_command_spec.rb6
-rw-r--r--spec/features/signup_spec.rb21
-rw-r--r--spec/features/users_spec.rb18
10 files changed, 270 insertions, 53 deletions
diff --git a/spec/features/admin/admin_deploy_keys_spec.rb b/spec/features/admin/admin_deploy_keys_spec.rb
index 8bf68480785..7ce6cce0a5c 100644
--- a/spec/features/admin/admin_deploy_keys_spec.rb
+++ b/spec/features/admin/admin_deploy_keys_spec.rb
@@ -15,15 +15,36 @@ RSpec.describe 'admin deploy keys', type: :feature do
expect(page).to have_content(another_deploy_key.title)
end
- it 'creates new deploy key' do
- visit admin_deploy_keys_path
+ describe 'create new deploy key' do
+ before do
+ visit admin_deploy_keys_path
+ click_link 'New Deploy Key'
+ end
+
+ it 'creates new deploy key' do
+ fill_deploy_key
+ click_button 'Create'
+
+ expect_renders_new_key
+ end
+
+ it 'creates new deploy key with write access' do
+ fill_deploy_key
+ check "deploy_key_can_push"
+ click_button "Create"
+
+ expect_renders_new_key
+ expect(page).to have_content('Yes')
+ end
- click_link 'New Deploy Key'
- fill_in 'deploy_key_title', with: 'laptop'
- fill_in 'deploy_key_key', with: 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop'
- click_button 'Create'
+ def expect_renders_new_key
+ expect(current_path).to eq admin_deploy_keys_path
+ expect(page).to have_content('laptop')
+ end
- expect(current_path).to eq admin_deploy_keys_path
- expect(page).to have_content('laptop')
+ def fill_deploy_key
+ fill_in 'deploy_key_title', with: 'laptop'
+ fill_in 'deploy_key_key', with: 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop'
+ end
end
end
diff --git a/spec/features/cycle_analytics_spec.rb b/spec/features/cycle_analytics_spec.rb
new file mode 100644
index 00000000000..e48a2b0c92e
--- /dev/null
+++ b/spec/features/cycle_analytics_spec.rb
@@ -0,0 +1,126 @@
+require 'spec_helper'
+
+feature 'Cycle Analytics', feature: true, js: true do
+ include WaitForAjax
+
+ let(:project) { create(:project) }
+ let(:user) { create(:user) }
+ let(:guest) { create(:user) }
+ let(:project) { create(:project) }
+ let(:issue) { create(:issue, project: project, created_at: 2.days.ago) }
+ let(:milestone) { create(:milestone, project: project) }
+ let(:mr) { create_merge_request_closing_issue(issue) }
+ let(:pipeline) { create(:ci_empty_pipeline, status: 'created', project: project, ref: mr.source_branch, sha: mr.source_branch_sha) }
+
+ context 'as an allowed user' do
+ context 'when project is new' do
+ before do
+ project.team << [user, :master]
+ login_as(user)
+ visit namespace_project_cycle_analytics_path(project.namespace, project)
+ wait_for_ajax
+ end
+
+ it 'shows introductory message' do
+ expect(page).to have_content('Introducing Cycle Analytics')
+ end
+
+ it 'shows active stage with empty message' do
+ expect(page).to have_selector('.stage-nav-item.active', text: 'Issue')
+ expect(page).to have_content("We don't have enough data to show this stage.")
+ end
+ end
+
+ context "when there's cycle analytics data" do
+ before do
+ project.team << [user, :master]
+
+ allow_any_instance_of(Gitlab::ReferenceExtractor).to receive(:issues).and_return([issue])
+ create_cycle
+ deploy_master
+
+ login_as(user)
+ visit namespace_project_cycle_analytics_path(project.namespace, project)
+ end
+
+ it 'shows data on each stage' do
+ expect_issue_to_be_present
+
+ click_stage('Plan')
+ expect(find('.stage-events')).to have_content(mr.commits.last.title)
+
+ click_stage('Code')
+ expect_merge_request_to_be_present
+
+ click_stage('Test')
+ expect_build_to_be_present
+
+ click_stage('Review')
+ expect_merge_request_to_be_present
+
+ click_stage('Staging')
+ expect_build_to_be_present
+
+ click_stage('Production')
+ expect_issue_to_be_present
+ end
+ end
+ end
+
+ context "as a guest" do
+ before do
+ project.team << [guest, :guest]
+
+ allow_any_instance_of(Gitlab::ReferenceExtractor).to receive(:issues).and_return([issue])
+ create_cycle
+ deploy_master
+
+ login_as(guest)
+ visit namespace_project_cycle_analytics_path(project.namespace, project)
+ wait_for_ajax
+ end
+
+ it 'needs permissions to see restricted stages' do
+ expect(find('.stage-events')).to have_content(issue.title)
+
+ click_stage('Code')
+ expect(find('.stage-events')).to have_content('You need permission.')
+
+ click_stage('Review')
+ expect(find('.stage-events')).to have_content('You need permission.')
+ end
+ end
+
+ def expect_issue_to_be_present
+ expect(find('.stage-events')).to have_content(issue.title)
+ expect(find('.stage-events')).to have_content(issue.author.name)
+ expect(find('.stage-events')).to have_content("##{issue.iid}")
+ end
+
+ def expect_build_to_be_present
+ expect(find('.stage-events')).to have_content(@build.ref)
+ expect(find('.stage-events')).to have_content(@build.short_sha)
+ expect(find('.stage-events')).to have_content("##{@build.id}")
+ end
+
+ def expect_merge_request_to_be_present
+ expect(find('.stage-events')).to have_content(mr.title)
+ expect(find('.stage-events')).to have_content(mr.author.name)
+ expect(find('.stage-events')).to have_content("!#{mr.iid}")
+ end
+
+ def create_cycle
+ issue.update(milestone: milestone)
+ pipeline.run
+
+ @build = create(:ci_build, pipeline: pipeline, status: :success, author: user)
+
+ merge_merge_requests_closing_issue(issue)
+ ProcessCommitWorker.new.perform(project.id, user.id, mr.commits.last.to_hash)
+ end
+
+ def click_stage(stage_name)
+ find('.stage-nav li', text: stage_name).click
+ wait_for_ajax
+ end
+end
diff --git a/spec/features/issues/award_emoji_spec.rb b/spec/features/issues/award_emoji_spec.rb
index efb53026449..73e43316dc7 100644
--- a/spec/features/issues/award_emoji_spec.rb
+++ b/spec/features/issues/award_emoji_spec.rb
@@ -76,7 +76,7 @@ describe 'Awards Emoji', feature: true do
end
it 'has disabled emoji button' do
- expect(first('.award-control')[:disabled]).to be(true)
+ expect(first('.award-control')[:class]).to have_text('disabled')
end
end
diff --git a/spec/features/merge_requests/merge_request_versions_spec.rb b/spec/features/merge_requests/merge_request_versions_spec.rb
index cd2272dd38f..04e85ed3f73 100644
--- a/spec/features/merge_requests/merge_request_versions_spec.rb
+++ b/spec/features/merge_requests/merge_request_versions_spec.rb
@@ -81,4 +81,52 @@ feature 'Merge Request versions', js: true, feature: true do
expect(page).to have_content '8 changed files'
end
end
+
+ describe 'compare with same version' do
+ before do
+ page.within '.mr-version-compare-dropdown' do
+ find('.btn-default').click
+ click_link 'version 1'
+ end
+ end
+
+ it 'should have 0 chages between versions' do
+ page.within '.mr-version-compare-dropdown' do
+ expect(page).to have_content 'version 1'
+ end
+
+ page.within '.mr-version-dropdown' do
+ find('.btn-default').click
+ find(:link, 'version 1').trigger('click')
+ end
+
+ expect(page).to have_content '0 changed files'
+ end
+ end
+
+ describe 'compare with newer version' do
+ before do
+ page.within '.mr-version-compare-dropdown' do
+ find('.btn-default').click
+ click_link 'version 2'
+ end
+ end
+
+ it 'should set the compared versions to be the same' do
+ page.within '.mr-version-compare-dropdown' do
+ expect(page).to have_content 'version 2'
+ end
+
+ page.within '.mr-version-dropdown' do
+ find('.btn-default').click
+ find(:link, 'version 1').trigger('click')
+ end
+
+ page.within '.mr-version-compare-dropdown' do
+ expect(page).to have_content 'version 1'
+ end
+
+ expect(page).to have_content '0 changed files'
+ end
+ end
end
diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb
index 9fffbb43e87..b785b2f7704 100644
--- a/spec/features/notes_on_merge_requests_spec.rb
+++ b/spec/features/notes_on_merge_requests_spec.rb
@@ -70,16 +70,15 @@ describe 'Comments', feature: true do
end
describe 'when editing a note', js: true do
- it 'contains the hidden edit form' do
- page.within("#note_#{note.id}") do
- is_expected.to have_css('.note-edit-form', visible: false)
- end
+ it 'there should be a hidden edit form' do
+ is_expected.to have_css('.note-edit-form:not(.mr-note-edit-form)', visible: false, count: 1)
+ is_expected.to have_css('.note-edit-form.mr-note-edit-form', visible: false, count: 1)
end
describe 'editing the note' do
before do
find('.note').hover
- find(".js-note-edit").click
+ find('.js-note-edit').click
end
it 'shows the note edit form and hide the note body' do
@@ -90,14 +89,29 @@ describe 'Comments', feature: true do
end
end
- # TODO: fix after 7.7 release
- # it "should reset the edit note form textarea with the original content of the note if cancelled" do
- # within(".current-note-edit-form") do
- # fill_in "note[note]", with: "Some new content"
- # find(".btn-cancel").click
- # expect(find(".js-note-text", visible: false).text).to eq note.note
- # end
- # end
+ it 'should reset the edit note form textarea with the original content of the note if cancelled' do
+ within('.current-note-edit-form') do
+ fill_in 'note[note]', with: 'Some new content'
+ find('.btn-cancel').click
+ expect(find('.js-note-text', visible: false).text).to eq ''
+ end
+ end
+
+ it 'allows using markdown buttons after saving a note and then trying to edit it again' do
+ page.within('.current-note-edit-form') do
+ fill_in 'note[note]', with: 'This is the new content'
+ find('.btn-save').click
+ end
+
+ find('.note').hover
+ find('.js-note-edit').click
+
+ page.within('.current-note-edit-form') do
+ expect(find('#note_note').value).to eq('This is the new content')
+ find('.js-md:first-child').click
+ expect(find('#note_note').value).to eq('This is the new content****')
+ end
+ end
it 'appends the edited at time to the note' do
page.within('.current-note-edit-form') do
diff --git a/spec/features/projects/issuable_templates_spec.rb b/spec/features/projects/issuable_templates_spec.rb
index 2f377312ea5..6dae5c64b30 100644
--- a/spec/features/projects/issuable_templates_spec.rb
+++ b/spec/features/projects/issuable_templates_spec.rb
@@ -27,7 +27,7 @@ feature 'issuable templates', feature: true, js: true do
scenario 'user selects "bug" template' do
select_template 'bug'
wait_for_ajax
- preview_template
+ assert_template
save_changes
end
@@ -35,8 +35,7 @@ feature 'issuable templates', feature: true, js: true do
select_template 'bug'
wait_for_ajax
select_option 'No template'
- wait_for_ajax
- preview_template('')
+ assert_template('')
save_changes('')
end
@@ -44,9 +43,9 @@ feature 'issuable templates', feature: true, js: true do
select_template 'bug'
wait_for_ajax
find_field('issue_description').send_keys(description_addition)
- preview_template(template_content + description_addition)
+ assert_template(template_content + description_addition)
select_option 'Reset template'
- preview_template
+ assert_template
save_changes
end
@@ -77,7 +76,7 @@ feature 'issuable templates', feature: true, js: true do
scenario 'user selects "bug" template' do
select_template 'bug'
wait_for_ajax
- preview_template("#{template_content}")
+ assert_template("#{template_content}")
save_changes
end
end
@@ -95,7 +94,7 @@ feature 'issuable templates', feature: true, js: true do
scenario 'user selects "feature-proposal" template' do
select_template 'feature-proposal'
wait_for_ajax
- preview_template
+ assert_template
save_changes
end
end
@@ -122,17 +121,15 @@ feature 'issuable templates', feature: true, js: true do
scenario 'user selects template' do
select_template 'feature-proposal'
wait_for_ajax
- preview_template
+ assert_template
save_changes
end
end
end
end
- def preview_template(expected_content = template_content)
- click_link 'Preview'
- expect(page).to have_content expected_content
- click_link 'Write'
+ def assert_template(expected_content = template_content)
+ expect(find('textarea')['value']).to eq(expected_content)
end
def save_changes(expected_content = template_content)
diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb
index 1ff57f92c4c..cef50f6f237 100644
--- a/spec/features/projects/pipelines/pipelines_spec.rb
+++ b/spec/features/projects/pipelines/pipelines_spec.rb
@@ -183,7 +183,7 @@ describe 'Pipelines', :feature, :js do
it 'should render a mini pipeline graph' do
endpoint = stage_namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline, stage: build.name)
- expect(page).to have_selector('.mini-pipeline-graph')
+ expect(page).to have_selector('.js-mini-pipeline-graph')
expect(page).to have_selector(".js-builds-dropdown-button[data-stage-endpoint='#{endpoint}']")
end
@@ -201,7 +201,7 @@ describe 'Pipelines', :feature, :js do
wait_for_ajax
- find('a.ci-action-icon-container').trigger('click')
+ find('a.js-ci-action-icon').trigger('click')
expect(page).not_to have_content('Cancel running')
end
end
diff --git a/spec/features/projects/services/mattermost_slash_command_spec.rb b/spec/features/projects/services/mattermost_slash_command_spec.rb
index 274d50e7ce4..8de827447ff 100644
--- a/spec/features/projects/services/mattermost_slash_command_spec.rb
+++ b/spec/features/projects/services/mattermost_slash_command_spec.rb
@@ -49,4 +49,10 @@ feature 'Setup Mattermost slash commands', feature: true do
end
end
end
+
+ describe 'stable logo url' do
+ it 'shows a publicly available logo' do
+ expect(File.exist?(Rails.root.join('public/slash-command-logo.png')))
+ end
+ end
end
diff --git a/spec/features/signup_spec.rb b/spec/features/signup_spec.rb
index 65544f79eba..9fde8d6e5cf 100644
--- a/spec/features/signup_spec.rb
+++ b/spec/features/signup_spec.rb
@@ -10,10 +10,11 @@ feature 'Signup', feature: true do
visit root_path
- fill_in 'new_user_name', with: user.name
- fill_in 'new_user_username', with: user.username
- fill_in 'new_user_email', with: user.email
- fill_in 'new_user_password', with: user.password
+ fill_in 'new_user_name', with: user.name
+ fill_in 'new_user_username', with: user.username
+ fill_in 'new_user_email', with: user.email
+ fill_in 'new_user_email_confirmation', with: user.email
+ fill_in 'new_user_password', with: user.password
click_button "Register"
expect(current_path).to eq users_almost_there_path
@@ -29,10 +30,11 @@ feature 'Signup', feature: true do
visit root_path
- fill_in 'new_user_name', with: user.name
- fill_in 'new_user_username', with: user.username
- fill_in 'new_user_email', with: user.email
- fill_in 'new_user_password', with: user.password
+ fill_in 'new_user_name', with: user.name
+ fill_in 'new_user_username', with: user.username
+ fill_in 'new_user_email', with: user.email
+ fill_in 'new_user_email_confirmation', with: user.email
+ fill_in 'new_user_password', with: user.password
click_button "Register"
expect(current_path).to eq dashboard_projects_path
@@ -55,8 +57,9 @@ feature 'Signup', feature: true do
click_button "Register"
expect(current_path).to eq user_registration_path
- expect(page).to have_content("error prohibited this user from being saved")
+ expect(page).to have_content("errors prohibited this user from being saved")
expect(page).to have_content("Email has already been taken")
+ expect(page).to have_content("Email confirmation doesn't match")
end
it 'does not redisplay the password' do
diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb
index afa98f3f715..2de0fbe7ab2 100644
--- a/spec/features/users_spec.rb
+++ b/spec/features/users_spec.rb
@@ -6,10 +6,11 @@ feature 'Users', feature: true, js: true do
scenario 'GET /users/sign_in creates a new user account' do
visit new_user_session_path
click_link 'Register'
- fill_in 'new_user_name', with: 'Name Surname'
- fill_in 'new_user_username', with: 'Great'
- fill_in 'new_user_email', with: 'name@mail.com'
- fill_in 'new_user_password', with: 'password1234'
+ fill_in 'new_user_name', with: 'Name Surname'
+ fill_in 'new_user_username', with: 'Great'
+ fill_in 'new_user_email', with: 'name@mail.com'
+ fill_in 'new_user_email_confirmation', with: 'name@mail.com'
+ fill_in 'new_user_password', with: 'password1234'
expect { click_button 'Register' }.to change { User.count }.by(1)
end
@@ -33,10 +34,11 @@ feature 'Users', feature: true, js: true do
scenario 'Should show one error if email is already taken' do
visit new_user_session_path
click_link 'Register'
- fill_in 'new_user_name', with: 'Another user name'
- fill_in 'new_user_username', with: 'anotheruser'
- fill_in 'new_user_email', with: user.email
- fill_in 'new_user_password', with: '12341234'
+ fill_in 'new_user_name', with: 'Another user name'
+ fill_in 'new_user_username', with: 'anotheruser'
+ fill_in 'new_user_email', with: user.email
+ fill_in 'new_user_email_confirmation', with: user.email
+ fill_in 'new_user_password', with: '12341234'
expect { click_button 'Register' }.to change { User.count }.by(0)
expect(page).to have_text('Email has already been taken')
expect(number_of_errors_on_page(page)).to be(1), 'errors on page:\n #{errors_on_page page}'