summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/issues/move_spec.rb10
-rw-r--r--spec/features/issues_spec.rb38
-rw-r--r--spec/features/runners_spec.rb16
-rw-r--r--spec/features/signup_spec.rb55
4 files changed, 113 insertions, 6 deletions
diff --git a/spec/features/issues/move_spec.rb b/spec/features/issues/move_spec.rb
index 6fda0c31866..84c8e20ebaa 100644
--- a/spec/features/issues/move_spec.rb
+++ b/spec/features/issues/move_spec.rb
@@ -42,11 +42,9 @@ feature 'issue move to another project' do
expect(current_url).to include project_path(new_project)
- page.within('.issue') do
- expect(page).to have_content("Text with #{cross_reference}!1")
- expect(page).to have_content("Moved from #{cross_reference}#1")
- expect(page).to have_content(issue.title)
- end
+ expect(page).to have_content("Text with #{cross_reference}!1")
+ expect(page).to have_content("Moved from #{cross_reference}#1")
+ expect(page).to have_content(issue.title)
end
context 'projects user does not have permission to move issue to exist' do
@@ -74,7 +72,7 @@ feature 'issue move to another project' do
def edit_issue(issue)
visit issue_path(issue)
- page.within('.issuable-header') { click_link 'Edit' }
+ page.within('.issuable-actions') { first(:link, 'Edit').click }
end
def issue_path(issue)
diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb
index 1ce0024e93c..35c8f93abc1 100644
--- a/spec/features/issues_spec.rb
+++ b/spec/features/issues_spec.rb
@@ -292,6 +292,23 @@ describe 'Issues', feature: true do
end
end
+ describe 'new issue' do
+ context 'dropzone upload file', js: true do
+ before do
+ visit new_namespace_project_issue_path(project.namespace, project)
+ end
+
+ it 'should upload file when dragging into textarea' do
+ drop_in_dropzone test_image_file
+
+ # Wait for the file to upload
+ sleep 1
+
+ expect(page.find_field("issue_description").value).to have_content 'banana_sample'
+ end
+ end
+ end
+
def first_issue
page.all('ul.issues-list > li').first.text
end
@@ -299,4 +316,25 @@ describe 'Issues', feature: true do
def last_issue
page.all('ul.issues-list > li').last.text
end
+
+ def drop_in_dropzone(file_path)
+ # Generate a fake input selector
+ page.execute_script <<-JS
+ var fakeFileInput = window.$('<input/>').attr(
+ {id: 'fakeFileInput', type: 'file'}
+ ).appendTo('body');
+ JS
+ # Attach the file to the fake input selector with Capybara
+ attach_file("fakeFileInput", file_path)
+ # Add the file to a fileList array and trigger the fake drop event
+ page.execute_script <<-JS
+ var fileList = [$('#fakeFileInput')[0].files[0]];
+ var e = jQuery.Event('drop', { dataTransfer : { files : fileList } });
+ $('.div-dropzone')[0].dropzone.listeners[0].events.drop(e);
+ JS
+ end
+
+ def test_image_file
+ File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
+ end
end
diff --git a/spec/features/runners_spec.rb b/spec/features/runners_spec.rb
index e8886e7edf9..8edeb8d18af 100644
--- a/spec/features/runners_spec.rb
+++ b/spec/features/runners_spec.rb
@@ -80,6 +80,22 @@ describe "Runners" do
end
end
+ describe "shared runners description" do
+ let(:shared_runners_text) { 'custom **shared** runners description' }
+ let(:shared_runners_html) { 'custom shared runners description' }
+
+ before do
+ stub_application_setting(shared_runners_text: shared_runners_text)
+ project = FactoryGirl.create :empty_project, shared_runners_enabled: false
+ project.team << [user, :master]
+ visit runners_path(project)
+ end
+
+ it "sees shared runners description" do
+ expect(page.find(".shared-runners-description")).to have_content(shared_runners_html)
+ end
+ end
+
describe "show page" do
before do
@project = FactoryGirl.create :empty_project
diff --git a/spec/features/signup_spec.rb b/spec/features/signup_spec.rb
new file mode 100644
index 00000000000..01472743b2a
--- /dev/null
+++ b/spec/features/signup_spec.rb
@@ -0,0 +1,55 @@
+require 'spec_helper'
+
+feature 'Signup', feature: true do
+ describe 'signup with no errors' do
+ it 'creates the user account and sends a confirmation email' do
+ user = build(:user)
+
+ visit root_path
+
+ fill_in 'user_name', with: user.name
+ fill_in 'user_username', with: user.username
+ fill_in 'user_email', with: user.email
+ fill_in 'user_password_sign_up', with: user.password
+ click_button "Sign up"
+
+ expect(current_path).to eq user_session_path
+ expect(page).to have_content("A message with a confirmation link has been sent to your email address.")
+ end
+ end
+
+ describe 'signup with errors' do
+ it "displays the errors" do
+ existing_user = create(:user)
+ user = build(:user)
+
+ visit root_path
+
+ fill_in 'user_name', with: user.name
+ fill_in 'user_username', with: user.username
+ fill_in 'user_email', with: existing_user.email
+ fill_in 'user_password_sign_up', with: user.password
+ click_button "Sign up"
+
+ 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("Email has already been taken")
+ end
+
+ it 'does not redisplay the password' do
+ existing_user = create(:user)
+ user = build(:user)
+
+ visit root_path
+
+ fill_in 'user_name', with: user.name
+ fill_in 'user_username', with: user.username
+ fill_in 'user_email', with: existing_user.email
+ fill_in 'user_password_sign_up', with: user.password
+ click_button "Sign up"
+
+ expect(current_path).to eq user_registration_path
+ expect(page.body).not_to match(/#{user.password}/)
+ end
+ end
+end