diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/admin/users.feature | 8 | ||||
-rw-r--r-- | features/project/project.feature | 5 | ||||
-rw-r--r-- | features/project/redirects.feature | 7 | ||||
-rw-r--r-- | features/steps/admin/active_tab.rb | 2 | ||||
-rw-r--r-- | features/steps/admin/users.rb | 19 | ||||
-rw-r--r-- | features/steps/dashboard/active_tab.rb | 2 | ||||
-rw-r--r-- | features/steps/profile/active_tab.rb | 2 | ||||
-rw-r--r-- | features/steps/project/active_tab.rb | 2 | ||||
-rw-r--r-- | features/steps/project/merge_requests.rb | 12 | ||||
-rw-r--r-- | features/steps/project/project.rb | 12 | ||||
-rw-r--r-- | features/steps/project/redirects.rb | 22 | ||||
-rw-r--r-- | features/steps/shared/active_tab.rb | 6 | ||||
-rw-r--r-- | features/steps/shared/diff_note.rb | 48 |
13 files changed, 108 insertions, 39 deletions
diff --git a/features/admin/users.feature b/features/admin/users.feature index ce31aafd290..d8c1288e5f0 100644 --- a/features/admin/users.feature +++ b/features/admin/users.feature @@ -21,3 +21,11 @@ Feature: Admin Users And click edit on my user When I submit modified user Then I see user attributes changed + +@javascript + Scenario: Remove users secondary email + Given I visit admin users page + And I view the user with secondary email + And I see the secondary email + When I click remove secondary email + Then I should not see secondary email anymore diff --git a/features/project/project.feature b/features/project/project.feature index d8bb1d55e2d..d561c6e440e 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -24,3 +24,8 @@ Feature: Project Feature When I visit edit project "Shop" page And change project path settings Then I should see project with new path settings + + Scenario: I should see project readme and version + When I visit project "Shop" page + Then I should see project "Shop" README link + And I should see project "Shop" version diff --git a/features/project/redirects.feature b/features/project/redirects.feature index ce197912f64..776ab83a876 100644 --- a/features/project/redirects.feature +++ b/features/project/redirects.feature @@ -24,3 +24,10 @@ Feature: Project Redirects Given I sign in as a user When I visit project "Enterprise" page Then page status code should be 404 + + Scenario: I visit a public project without signing in + When I visit project "Community" page + And I should see project "Community" home page + And I click on "Sign In" + And Authenticate + Then I should be redirected to "Community" page diff --git a/features/steps/admin/active_tab.rb b/features/steps/admin/active_tab.rb index ccafe09c18f..8f09e51ccef 100644 --- a/features/steps/admin/active_tab.rb +++ b/features/steps/admin/active_tab.rb @@ -4,7 +4,7 @@ class AdminActiveTab < Spinach::FeatureSteps include SharedActiveTab Then 'the active main tab should be Home' do - ensure_active_main_tab('Home') + ensure_active_main_tab('Overview') end Then 'the active main tab should be Projects' do diff --git a/features/steps/admin/users.rb b/features/steps/admin/users.rb index 659008dd875..253c4609e82 100644 --- a/features/steps/admin/users.rb +++ b/features/steps/admin/users.rb @@ -44,4 +44,23 @@ class AdminUsers < Spinach::FeatureSteps step 'click edit on my user' do find("#edit_user_#{current_user.id}").click end + + step 'I view the user with secondary email' do + @user_with_secondary_email = User.last + @user_with_secondary_email.emails.new(email: "secondary@example.com") + @user_with_secondary_email.save + visit "/admin/users/#{@user_with_secondary_email.username}" + end + + step 'I see the secondary email' do + page.should have_content "Secondary email: #{@user_with_secondary_email.emails.last.email}" + end + + step 'I click remove secondary email' do + find("#remove_email_#{@user_with_secondary_email.emails.last.id}").click + end + + step 'I should not see secondary email anymore' do + page.should_not have_content "Secondary email:" + end end diff --git a/features/steps/dashboard/active_tab.rb b/features/steps/dashboard/active_tab.rb index 8f5f0eed816..68d32ed971a 100644 --- a/features/steps/dashboard/active_tab.rb +++ b/features/steps/dashboard/active_tab.rb @@ -4,7 +4,7 @@ class DashboardActiveTab < Spinach::FeatureSteps include SharedActiveTab Then 'the active main tab should be Home' do - ensure_active_main_tab('Home') + ensure_active_main_tab('Activity') end Then 'the active main tab should be Issues' do diff --git a/features/steps/profile/active_tab.rb b/features/steps/profile/active_tab.rb index ee9f5f201cf..1924a6fa785 100644 --- a/features/steps/profile/active_tab.rb +++ b/features/steps/profile/active_tab.rb @@ -4,7 +4,7 @@ class ProfileActiveTab < Spinach::FeatureSteps include SharedActiveTab Then 'the active main tab should be Home' do - ensure_active_main_tab('Home') + ensure_active_main_tab('Profile') end Then 'the active main tab should be Account' do diff --git a/features/steps/project/active_tab.rb b/features/steps/project/active_tab.rb index dcc252f4765..dfafbc6fc0e 100644 --- a/features/steps/project/active_tab.rb +++ b/features/steps/project/active_tab.rb @@ -7,7 +7,7 @@ class ProjectActiveTab < Spinach::FeatureSteps # Main Tabs Then 'the active main tab should be Home' do - ensure_active_main_tab('Home') + ensure_active_main_tab('Activity') end Then 'the active main tab should be Settings' do diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index e0aec699a56..b0a6e530e8a 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -131,21 +131,21 @@ class ProjectMergeRequests < Spinach::FeatureSteps end step 'I should see a discussion has started on line 185' do - page.should have_content "#{current_user.name} started a discussion on this merge request diff" - page.should have_content "app/assets/stylesheets/tree.scss:L185" + page.should have_content "#{current_user.name} started a discussion" + page.should have_content "app/assets/stylesheets/tree.scss" page.should have_content "Line is wrong" end step 'I should see a discussion has started on commit b1e6a9dbf1:L185' do page.should have_content "#{current_user.name} started a discussion on commit" - page.should have_content "app/assets/stylesheets/tree.scss:L185" + page.should have_content "app/assets/stylesheets/tree.scss" page.should have_content "Line is wrong" end step 'I should see a discussion has started on commit b1e6a9dbf1' do page.should have_content "#{current_user.name} started a discussion on commit" page.should have_content "One comment to rule them all" - page.should have_content "app/assets/stylesheets/tree.scss:L185" + page.should have_content "app/assets/stylesheets/tree.scss" end step 'merge request is mergeable' do @@ -257,9 +257,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps click_button "Add Comment" end - within ".note-text" do - page.should have_content message - end + page.should have_content message end def init_diff_note_first_file diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index 92728d474b2..7c0b2509416 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -24,4 +24,16 @@ class ProjectFeature < Spinach::FeatureSteps step 'I should see project with new path settings' do project.path.should == "new-path" end + + step 'I should see project "Shop" README link' do + within '.project-side' do + page.should have_content "README.md" + end + end + + step 'I should see project "Shop" version' do + within '.project-side' do + page.should have_content "Version: 2.2.0" + end + end end diff --git a/features/steps/project/redirects.rb b/features/steps/project/redirects.rb index cfa4ce82be3..5a4342dba30 100644 --- a/features/steps/project/redirects.rb +++ b/features/steps/project/redirects.rb @@ -31,5 +31,27 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps project = Project.find_by(name: 'Community') visit project_path(project) + 'DoesNotExist' end + + step 'I click on "Sign In"' do + within '.pull-right' do + click_link "Sign in" + end + end + + step 'Authenticate' do + admin = create(:admin) + project = Project.find_by(name: 'Community') + find(:xpath, "//input[@id='return_to']").set "/#{project.path_with_namespace}" + fill_in "user_login", with: admin.email + fill_in "user_password", with: admin.password + click_button "Sign in" + Thread.current[:current_user] = admin + end + + step 'I should be redirected to "Community" page' do + project = Project.find_by(name: 'Community') + page.current_path.should == "/#{project.path_with_namespace}" + page.status_code.should == 200 + end end diff --git a/features/steps/shared/active_tab.rb b/features/steps/shared/active_tab.rb index d504fda3327..e3cd5fcfe85 100644 --- a/features/steps/shared/active_tab.rb +++ b/features/steps/shared/active_tab.rb @@ -2,11 +2,7 @@ module SharedActiveTab include Spinach::DSL def ensure_active_main_tab(content) - if content == "Home" - page.find('.main-nav li.active').should have_css('i.icon-home') - else - page.find('.main-nav li.active').should have_content(content) - end + page.find('.main-nav li.active').should have_content(content) end def ensure_active_sub_tab(content) diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb index f917d7bde08..201642a086e 100644 --- a/features/steps/shared/diff_note.rb +++ b/features/steps/shared/diff_note.rb @@ -2,7 +2,7 @@ module SharedDiffNote include Spinach::DSL Given 'I cancel the diff comment' do - within(".diff-file") do + within(diff_file_selector) do find(".js-close-discussion-note-form").click end end @@ -13,14 +13,14 @@ module SharedDiffNote end Given 'I haven\'t written any diff comment text' do - within(".diff-file") do + within(diff_file_selector) do fill_in "note[note]", with: "" end end Given 'I leave a diff comment like "Typo, please fix"' do find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_29_14"]').click - within(".diff-file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do + within("#{diff_file_selector} form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do fill_in "note[note]", with: "Typo, please fix" find(".js-comment-button").trigger("click") sleep 0.05 @@ -29,7 +29,7 @@ module SharedDiffNote Given 'I preview a diff comment text like "Should fix it :smile:"' do find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_29_14"]').click - within(".diff-file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do + within("#{diff_file_selector} form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do fill_in "note[note]", with: "Should fix it :smile:" find(".js-note-preview-button").trigger("click") end @@ -38,7 +38,7 @@ module SharedDiffNote Given 'I preview another diff comment text like "DRY this up"' do find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_57_41"]').click - within(".diff-file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_57_41']") do + within("#{diff_file_selector} form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_57_41']") do fill_in "note[note]", with: "DRY this up" find(".js-note-preview-button").trigger("click") end @@ -53,63 +53,61 @@ module SharedDiffNote end Given 'I write a diff comment like ":-1: I don\'t like this"' do - within(".diff-file") do + within(diff_file_selector) do fill_in "note[note]", with: ":-1: I don\'t like this" end end Given 'I submit the diff comment' do - within(".diff-file") do + within(diff_file_selector) do click_button("Add Comment") end end - - Then 'I should not see the diff comment form' do - within(".diff-file") do + within(diff_file_selector) do page.should_not have_css("form.new_note") end end Then 'I should not see the diff comment preview button' do - within(".diff-file") do + within(diff_file_selector) do page.should have_css(".js-note-preview-button", visible: false) end end Then 'I should not see the diff comment text field' do - within(".diff-file") do + within(diff_file_selector) do page.should have_css(".js-note-text", visible: false) end end Then 'I should only see one diff form' do - within(".diff-file") do + within(diff_file_selector) do page.should have_css("form.new_note", count: 1) end end Then 'I should see a diff comment form with ":-1: I don\'t like this"' do - within(".diff-file") do + within(diff_file_selector) do page.should have_field("note[note]", with: ":-1: I don\'t like this") end end Then 'I should see a diff comment saying "Typo, please fix"' do - within(".diff-file .note") do + within("#{diff_file_selector} .note") do page.should have_content("Typo, please fix") end end Then 'I should see a discussion reply button' do - within(".diff-file") do + within(diff_file_selector) do page.should have_link("Reply") end end Then 'I should see a temporary diff comment form' do - within(".diff-file") do + within(diff_file_selector) do page.should have_css(".js-temp-notes-holder form.new_note") end end @@ -119,40 +117,44 @@ module SharedDiffNote end Then 'I should see an empty diff comment form' do - within(".diff-file") do + within(diff_file_selector) do page.should have_field("note[note]", with: "") end end Then 'I should see the cancel comment button' do - within(".diff-file form") do + within("#{diff_file_selector} form") do page.should have_css(".js-close-discussion-note-form", text: "Cancel") end end Then 'I should see the diff comment preview' do - within(".diff-file form") do + within("#{diff_file_selector} form") do page.should have_css(".js-note-preview", visible: false) end end Then 'I should see the diff comment edit button' do - within(".diff-file") do + within(diff_file_selector) do page.should have_css(".js-note-write-button", visible: true) end end Then 'I should see the diff comment preview button' do - within(".diff-file") do + within(diff_file_selector) do page.should have_css(".js-note-preview-button", visible: true) end end Then 'I should see two separate previews' do - within(".diff-file") do + within(diff_file_selector) do page.should have_css(".js-note-preview", visible: true, count: 2) page.should have_content("Should fix it") page.should have_content("DRY this up") end end + + def diff_file_selector + ".diff-file" + end end |