diff options
Diffstat (limited to 'features')
20 files changed, 592 insertions, 0 deletions
diff --git a/features/dashboard/todos.feature b/features/dashboard/todos.feature new file mode 100644 index 00000000000..1e7b1b50d64 --- /dev/null +++ b/features/dashboard/todos.feature @@ -0,0 +1,38 @@ +@dashboard +Feature: Dashboard Todos + Background: + Given I sign in as a user + And I own project "Shop" + And "John Doe" is a developer of project "Shop" + And "Mary Jane" is a developer of project "Shop" + And "Mary Jane" owns private project "Enterprise" + And I am a developer of project "Enterprise" + And I have todos + And I visit dashboard todos page + + @javascript + Scenario: I mark todos as done + Then I should see todos assigned to me + And I mark the todo as done + And I click on the "Done" tab + Then I should see all todos marked as done + + @javascript + Scenario: I filter by project + Given I filter by "Enterprise" + Then I should not see todos + + @javascript + Scenario: I filter by author + Given I filter by "John Doe" + Then I should not see todos related to "Mary Jane" in the list + + @javascript + Scenario: I filter by type + Given I filter by "Issue" + Then I should not see todos related to "Merge Requests" in the list + + @javascript + Scenario: I filter by action + Given I filter by "Mentioned" + Then I should not see todos related to "Assignments" in the list diff --git a/features/project/builds/summary.feature b/features/project/builds/summary.feature index b69d279517b..4f3fd194d00 100644 --- a/features/project/builds/summary.feature +++ b/features/project/builds/summary.feature @@ -13,3 +13,12 @@ Feature: Project Builds Summary Scenario: I browse project builds page When I visit project builds page Then I see button to CI Lint + + Scenario: I erase a build + Given recent build is successful + And recent build has a build trace + When I visit recent build details page + And I click erase build button + Then recent build has been erased + And recent build summary does not have artifacts widget + And recent build summary contains information saying that build has been erased diff --git a/features/project/commits/revert.feature b/features/project/commits/revert.feature new file mode 100644 index 00000000000..7a2effafe03 --- /dev/null +++ b/features/project/commits/revert.feature @@ -0,0 +1,28 @@ +@project_commits +Feature: Revert Commits + Background: + Given I sign in as a user + And I own a project + And I visit my project's commits page + + Scenario: I revert a commit + Given I click on commit link + And I click on the revert button + And I revert the changes directly + Then I should see the revert commit notice + + Scenario: I revert a commit that was previously reverted + Given I click on commit link + And I click on the revert button + And I revert the changes directly + And I visit my project's commits page + And I click on commit link + And I click on the revert button + And I revert the changes directly + Then I should see a revert error + + Scenario: I revert a commit in a new merge request + Given I click on commit link + And I click on the revert button + And I revert the changes in a new merge request + Then I should see the new merge request notice diff --git a/features/project/fork.feature b/features/project/fork.feature index 12695204e47..ca3f2771aa5 100644 --- a/features/project/fork.feature +++ b/features/project/fork.feature @@ -32,6 +32,13 @@ Feature: Project Fork And I visit the forks page of the "Shop" project Then I should see my fork on the list + Scenario: Viewing forks of a Project that has no repo + Given I click link "Fork" + When I fork to my namespace + And I make forked repo invalid + And I visit the forks page of the "Shop" project + Then I should see my fork on the list + Scenario: Viewing private forks of a Project Given There is an existent fork of the "Shop" project And I click link "Fork" diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature index ca2399d85a9..89af58dcef3 100644 --- a/features/project/issues/issues.feature +++ b/features/project/issues/issues.feature @@ -89,6 +89,16 @@ Feature: Project Issues Then The list should be sorted by "Oldest updated" @javascript + Scenario: Sort issues by upvotes/downvotes + Given project "Shop" have "Bugfix" open issue + And issue "Release 0.4" have 2 upvotes and 1 downvote + And issue "Tweet control" have 1 upvote and 2 downvotes + And I sort the list by "Most popular" + Then The list should be sorted by "Most popular" + And I sort the list by "Least popular" + Then The list should be sorted by "Least popular" + + @javascript Scenario: I search issue Given I fill in issue search with "Re" Then I should see "Release 0.4" in issues diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature index 5995e787961..495f25f28e7 100644 --- a/features/project/merge_requests.feature +++ b/features/project/merge_requests.feature @@ -108,6 +108,17 @@ Feature: Project Merge Requests Then The list should be sorted by "Oldest updated" @javascript + Scenario: Sort merge requests by upvotes/downvotes + Given project "Shop" have "Bug NS-05" open merge request with diffs inside + And project "Shop" have "Bug NS-06" open merge request + And merge request "Bug NS-04" have 2 upvotes and 1 downvote + And merge request "Bug NS-06" have 1 upvote and 2 downvotes + And I sort the list by "Most popular" + Then The list should be sorted by "Most popular" + And I sort the list by "Least popular" + Then The list should be sorted by "Least popular" + + @javascript Scenario: Visiting Merge Requests after commenting on diffs Given project "Shop" have "Bug NS-05" open merge request with diffs inside And I visit merge request page "Bug NS-05" diff --git a/features/project/merge_requests/revert.feature b/features/project/merge_requests/revert.feature new file mode 100644 index 00000000000..d767b088883 --- /dev/null +++ b/features/project/merge_requests/revert.feature @@ -0,0 +1,30 @@ +@project_merge_requests +Feature: Revert Merge Requests + Background: + Given There is an open Merge Request + And I am signed in as a developer of the project + And I am on the Merge Request detail page + And I click on Accept Merge Request + + @javascript + Scenario: I revert a merge request + Given I click on the revert button + And I revert the changes directly + Then I should see the revert merge request notice + + @javascript + Scenario: I revert a merge request that was previously reverted + Given I click on the revert button + And I revert the changes directly + And I am on the Merge Request detail page + And I click on the revert button + And I revert the changes directly + Then I should see a revert error + + @javascript + Scenario: I revert a merge request in a new merge request + Given I click on the revert button + And I am on the Merge Request detail page + And I click on the revert button + And I revert the changes in a new merge request + Then I should see the new merge request notice diff --git a/features/project/milestone.feature b/features/project/milestone.feature new file mode 100644 index 00000000000..e0f4c0e9d7c --- /dev/null +++ b/features/project/milestone.feature @@ -0,0 +1,23 @@ +Feature: Project Milestone + Background: + Given I sign in as a user + And I own project "Shop" + And project "Shop" has labels: "bug", "feature", "enhancement" + And project "Shop" has milestone "v2.2" + And milestone has issue "Bugfix1" with labels: "bug", "feature" + And milestone has issue "Bugfix2" with labels: "bug", "enhancement" + + + @javascript + Scenario: Listing issues from issues tab + Given I visit project "Shop" milestones page + And I click link "v2.2" + Then I should see the labels "bug", "enhancement" and "feature" + + @javascript + Scenario: Listing labels from labels tab + Given I visit project "Shop" milestones page + And I click link "v2.2" + And I click link "Labels" + Then I should see the list of labels + And I should see the labels "bug", "enhancement" and "feature" diff --git a/features/steps/dashboard/todos.rb b/features/steps/dashboard/todos.rb new file mode 100644 index 00000000000..9722a5a848c --- /dev/null +++ b/features/steps/dashboard/todos.rb @@ -0,0 +1,128 @@ +class Spinach::Features::DashboardTodos < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + include SharedUser + include Select2Helper + + step '"John Doe" is a developer of project "Shop"' do + project.team << [john_doe, :developer] + end + + step 'I am a developer of project "Enterprise"' do + enterprise.team << [current_user, :developer] + end + + step '"Mary Jane" is a developer of project "Shop"' do + project.team << [john_doe, :developer] + end + + step 'I have todos' do + create(:todo, user: current_user, project: project, author: mary_jane, target: issue, action: Todo::MENTIONED) + create(:todo, user: current_user, project: project, author: john_doe, target: issue, action: Todo::ASSIGNED) + note = create(:note, author: john_doe, noteable: issue, note: "#{current_user.to_reference} Wdyt?") + create(:todo, user: current_user, project: project, author: john_doe, target: issue, action: Todo::MENTIONED, note: note) + create(:todo, user: current_user, project: project, author: john_doe, target: merge_request, action: Todo::ASSIGNED) + end + + step 'I should see todos assigned to me' do + expect(page).to have_content 'To do 4' + expect(page).to have_content 'Done 0' + + expect(page).to have_link project.name_with_namespace + should_see_todo(1, "John Doe assigned you merge request !#{merge_request.iid}", merge_request.title) + should_see_todo(2, "John Doe mentioned you on issue ##{issue.iid}", "#{current_user.to_reference} Wdyt?") + should_see_todo(3, "John Doe assigned you issue ##{issue.iid}", issue.title) + should_see_todo(4, "Mary Jane mentioned you on issue ##{issue.iid}", issue.title) + end + + step 'I mark the todo as done' do + page.within('.todo:nth-child(1)') do + click_link 'Done' + end + + expect(page).to have_content 'Todo was successfully marked as done.' + expect(page).to have_content 'To do 3' + expect(page).to have_content 'Done 1' + should_not_see_todo "John Doe assigned you merge request !#{merge_request.iid}" + end + + step 'I click on the "Done" tab' do + click_link 'Done 1' + end + + step 'I should see all todos marked as done' do + expect(page).to have_link project.name_with_namespace + should_see_todo(1, "John Doe assigned you merge request !#{merge_request.iid}", merge_request.title, false) + end + + step 'I filter by "Enterprise"' do + select2(enterprise.id, from: "#project_id") + end + + step 'I filter by "John Doe"' do + select2(john_doe.id, from: "#author_id") + end + + step 'I filter by "Issue"' do + select2('Issue', from: "#type") + end + + step 'I filter by "Mentioned"' do + select2("#{Todo::MENTIONED}", from: '#action_id') + end + + step 'I should not see todos' do + expect(page).to have_content "You're all done!" + end + + step 'I should not see todos related to "Mary Jane" in the list' do + should_not_see_todo "Mary Jane mentioned you on issue ##{issue.iid}" + end + + step 'I should not see todos related to "Merge Requests" in the list' do + should_not_see_todo "John Doe assigned you merge request !#{merge_request.iid}" + end + + step 'I should not see todos related to "Assignments" in the list' do + should_not_see_todo "John Doe assigned you merge request !#{merge_request.iid}" + should_not_see_todo "John Doe assigned you issue ##{issue.iid}" + end + + def should_see_todo(position, title, body, pending = true) + page.within(".todo:nth-child(#{position})") do + expect(page).to have_content title + expect(page).to have_content body + + if pending + expect(page).to have_link 'Done' + else + expect(page).to_not have_link 'Done' + end + end + end + + def should_not_see_todo(title) + expect(page).not_to have_content title + end + + def john_doe + @john_doe ||= user_exists("John Doe", { username: "john_doe" }) + end + + def mary_jane + @mary_jane ||= user_exists("Mary Jane", { username: "mary_jane" }) + end + + def enterprise + @enterprise ||= Project.find_by(name: 'Enterprise') + end + + def issue + @issue ||= create(:issue, assignee: current_user, project: project) + end + + def merge_request + @merge_request ||= create(:merge_request, assignee: current_user, source_project: project) + end +end diff --git a/features/steps/project/builds/summary.rb b/features/steps/project/builds/summary.rb index 4f94fc96354..4688a0e2096 100644 --- a/features/steps/project/builds/summary.rb +++ b/features/steps/project/builds/summary.rb @@ -10,4 +10,24 @@ class Spinach::Features::ProjectBuildsSummary < Spinach::FeatureSteps expect(ci_lint_tool_link[:href]).to eq ci_lint_path end end + + step 'I click erase build button' do + click_link 'Erase' + end + + step 'recent build has been erased' do + expect(@build.artifacts_file.exists?).to be_falsy + expect(@build.artifacts_metadata.exists?).to be_falsy + expect(@build.trace).to be_empty + end + + step 'recent build summary does not have artifacts widget' do + expect(page).to have_no_css('.artifacts') + end + + step 'recent build summary contains information saying that build has been erased' do + page.within('.erased') do + expect(page).to have_content 'Build has been erased' + end + end end diff --git a/features/steps/project/commits/revert.rb b/features/steps/project/commits/revert.rb new file mode 100644 index 00000000000..94a5d4e2e4d --- /dev/null +++ b/features/steps/project/commits/revert.rb @@ -0,0 +1,40 @@ +class Spinach::Features::RevertCommits < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + include SharedDiffNote + include RepoHelpers + + step 'I click on commit link' do + visit namespace_project_commit_path(@project.namespace, @project, sample_commit.id) + end + + step 'I click on the revert button' do + find("a[href='#modal-revert-commit']").click + end + + step 'I revert the changes directly' do + page.within('#modal-revert-commit') do + uncheck 'create_merge_request' + click_button 'Revert' + end + end + + step 'I should see the revert commit notice' do + page.should have_content('The commit has been successfully reverted.') + end + + step 'I should see a revert error' do + page.should have_content('Sorry, we cannot revert this commit automatically.') + end + + step 'I revert the changes in a new merge request' do + page.within('#modal-revert-commit') do + click_button 'Revert' + end + end + + step 'I should see the new merge request notice' do + page.should have_content('The commit has been successfully reverted. You can now submit a merge request to get this change into the original branch.') + end +end diff --git a/features/steps/project/fork.rb b/features/steps/project/fork.rb index 5810276ced3..527f7853da9 100644 --- a/features/steps/project/fork.rb +++ b/features/steps/project/fork.rb @@ -62,6 +62,12 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps end end + step 'I make forked repo invalid' do + project = @user.fork_of(@project) + project.path = 'test-crappy-path' + project.save! + end + step 'There is an existent fork of the "Shop" project' do user = create(:user, name: 'Mike') @forked_project = Projects::ForkService.new(@project, user).execute diff --git a/features/steps/project/issues/award_emoji.rb b/features/steps/project/issues/award_emoji.rb index 8b9aa6aabfa..93cf608cc62 100644 --- a/features/steps/project/issues/award_emoji.rb +++ b/features/steps/project/issues/award_emoji.rb @@ -46,6 +46,8 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps end step 'I have award added' do + sleep 0.2 + page.within '.awards' do expect(page).to have_selector '.award' expect(page.find('.award.active .counter')).to have_content '1' diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb index 09a89e99831..565bf088b41 100644 --- a/features/steps/project/issues/issues.rb +++ b/features/steps/project/issues/issues.rb @@ -174,6 +174,13 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps author: project.users.first) end + step 'project "Shop" have "Bugfix" open issue' do + create(:issue, + title: "Bugfix", + project: project, + author: project.users.first) + end + step 'project "Shop" have "Release 0.3" closed issue' do create(:closed_issue, title: "Release 0.3", @@ -181,6 +188,56 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps author: project.users.first) end + step 'issue "Release 0.4" have 2 upvotes and 1 downvote' do + issue = Issue.find_by(title: 'Release 0.4') + create_list(:upvote_note, 2, project: project, noteable: issue) + create(:downvote_note, project: project, noteable: issue) + end + + step 'issue "Tweet control" have 1 upvote and 2 downvotes' do + issue = Issue.find_by(title: 'Tweet control') + create(:upvote_note, project: project, noteable: issue) + create_list(:downvote_note, 2, project: project, noteable: issue) + end + + step 'The list should be sorted by "Least popular"' do + page.within '.issues-list' do + page.within 'li.issue:nth-child(1)' do + expect(page).to have_content 'Tweet control' + expect(page).to have_content '1 2' + end + + page.within 'li.issue:nth-child(2)' do + expect(page).to have_content 'Release 0.4' + expect(page).to have_content '2 1' + end + + page.within 'li.issue:nth-child(3)' do + expect(page).to have_content 'Bugfix' + expect(page).to_not have_content '0 0' + end + end + end + + step 'The list should be sorted by "Most popular"' do + page.within '.issues-list' do + page.within 'li.issue:nth-child(1)' do + expect(page).to have_content 'Release 0.4' + expect(page).to have_content '2 1' + end + + page.within 'li.issue:nth-child(2)' do + expect(page).to have_content 'Tweet control' + expect(page).to have_content '1 2' + end + + page.within 'li.issue:nth-child(3)' do + expect(page).to have_content 'Bugfix' + expect(page).to_not have_content '0 0' + end + end + end + step 'empty project "Empty Project"' do create :empty_project, name: 'Empty Project', namespace: @user.namespace end diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index 337893e6209..dde864f5180 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -138,6 +138,56 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps author: project.users.first) end + step 'merge request "Bug NS-04" have 2 upvotes and 1 downvote' do + merge_request = MergeRequest.find_by(title: 'Bug NS-04') + create_list(:upvote_note, 2, project: project, noteable: merge_request) + create(:downvote_note, project: project, noteable: merge_request) + end + + step 'merge request "Bug NS-06" have 1 upvote and 2 downvotes' do + merge_request = MergeRequest.find_by(title: 'Bug NS-06') + create(:upvote_note, project: project, noteable: merge_request) + create_list(:downvote_note, 2, project: project, noteable: merge_request) + end + + step 'The list should be sorted by "Least popular"' do + page.within '.mr-list' do + page.within 'li.merge-request:nth-child(1)' do + expect(page).to have_content 'Bug NS-06' + expect(page).to have_content '1 2' + end + + page.within 'li.merge-request:nth-child(2)' do + expect(page).to have_content 'Bug NS-04' + expect(page).to have_content '2 1' + end + + page.within 'li.merge-request:nth-child(3)' do + expect(page).to have_content 'Bug NS-05' + expect(page).to_not have_content '0 0' + end + end + end + + step 'The list should be sorted by "Most popular"' do + page.within '.mr-list' do + page.within 'li.merge-request:nth-child(1)' do + expect(page).to have_content 'Bug NS-04' + expect(page).to have_content '2 1' + end + + page.within 'li.merge-request:nth-child(2)' do + expect(page).to have_content 'Bug NS-06' + expect(page).to have_content '1 2' + end + + page.within 'li.merge-request:nth-child(3)' do + expect(page).to have_content 'Bug NS-05' + expect(page).to_not have_content '0 0' + end + end + end + step 'I click on the Changes tab' do page.within '.merge-request-tabs' do click_link 'Changes' diff --git a/features/steps/project/merge_requests/revert.rb b/features/steps/project/merge_requests/revert.rb new file mode 100644 index 00000000000..c5a4cfce6f0 --- /dev/null +++ b/features/steps/project/merge_requests/revert.rb @@ -0,0 +1,56 @@ +class Spinach::Features::RevertMergeRequests < Spinach::FeatureSteps + include LoginHelpers + include GitlabRoutingHelper + + step 'I click on the revert button' do + find("a[href='#modal-revert-commit']").click + end + + step 'I revert the changes directly' do + page.within('#modal-revert-commit') do + uncheck 'create_merge_request' + click_button 'Revert' + end + end + + step 'I should see the revert merge request notice' do + page.should have_content('The merge request has been successfully reverted.') + end + + step 'I should not see the revert button' do + expect(page).not_to have_selector(:xpath, "a[href='#modal-revert-commit']") + end + + step 'I am on the Merge Request detail page' do + visit merge_request_path(@merge_request) + end + + step 'I click on Accept Merge Request' do + click_button('Accept Merge Request') + end + + step 'I am signed in as a developer of the project' do + login_as(@user) + end + + step 'There is an open Merge Request' do + @user = create(:user) + @project = create(:project, :public) + @project_member = create(:project_member, user: @user, project: @project, access_level: ProjectMember::DEVELOPER) + @merge_request = create(:merge_request, :with_diffs, :simple, source_project: @project) + end + + step 'I should see a revert error' do + page.should have_content('Sorry, we cannot revert this merge request automatically.') + end + + step 'I revert the changes in a new merge request' do + page.within('#modal-revert-commit') do + click_button 'Revert' + end + end + + step 'I should see the new merge request notice' do + page.should have_content('The merge request has been successfully reverted. You can now submit a merge request to get this change into the original branch.') + end +end diff --git a/features/steps/project/project_milestone.rb b/features/steps/project/project_milestone.rb new file mode 100644 index 00000000000..ec881c0d8fc --- /dev/null +++ b/features/steps/project/project_milestone.rb @@ -0,0 +1,53 @@ +class Spinach::Features::ProjectMilestone < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + step 'milestone has issue "Bugfix1" with labels: "bug", "feature"' do + project = Project.find_by(name: "Shop") + milestone = project.milestones.find_by(title: 'v2.2') + issue = create(:issue, title: "Bugfix1", project: project, milestone: milestone) + issue.labels << project.labels.find_by(title: 'bug') + issue.labels << project.labels.find_by(title: 'feature') + end + + step 'milestone has issue "Bugfix2" with labels: "bug", "enhancement"' do + project = Project.find_by(name: "Shop") + milestone = project.milestones.find_by(title: 'v2.2') + issue = create(:issue, title: "Bugfix2", project: project, milestone: milestone) + issue.labels << project.labels.find_by(title: 'bug') + issue.labels << project.labels.find_by(title: 'enhancement') + end + + step 'project "Shop" has milestone "v2.2"' do + project = Project.find_by(name: "Shop") + milestone = create(:milestone, + title: "v2.2", + project: project, + description: "# Description header" + ) + 3.times { create(:issue, project: project, milestone: milestone) } + end + + step 'I should see the list of labels' do + expect(page).to have_selector('ul.manage-labels-list') + end + + step 'I should see the labels "bug", "enhancement" and "feature"' do + page.within('#tab-issues') do + expect(page).to have_content 'bug' + expect(page).to have_content 'enhancement' + expect(page).to have_content 'feature' + end + end + + step 'I click link "v2.2"' do + click_link "v2.2" + end + + step 'I click link "Labels"' do + page.within('.nav-links') do + page.find(:xpath, "//a[@href='#tab-labels']").click + end + end +end diff --git a/features/steps/shared/builds.rb b/features/steps/shared/builds.rb index fa54c93df0f..0bd5d93b997 100644 --- a/features/steps/shared/builds.rb +++ b/features/steps/shared/builds.rb @@ -42,6 +42,10 @@ module SharedBuilds @build.update_attributes(artifacts_metadata: gzip) end + step 'recent build has a build trace' do + @build.trace = 'build trace' + end + step 'download of build artifacts archive starts' do expect(page.response_headers['Content-Type']).to eq 'application/zip' expect(page.response_headers['Content-Transfer-Encoding']).to eq 'binary' diff --git a/features/steps/shared/issuable.rb b/features/steps/shared/issuable.rb index 2117feaedb8..ae10c6069a9 100644 --- a/features/steps/shared/issuable.rb +++ b/features/steps/shared/issuable.rb @@ -113,6 +113,22 @@ module SharedIssuable end end + step 'I sort the list by "Least popular"' do + find('button.dropdown-toggle.btn').click + + page.within('ul.dropdown-menu.dropdown-menu-align-right li') do + click_link 'Least popular' + end + end + + step 'I sort the list by "Most popular"' do + find('button.dropdown-toggle.btn').click + + page.within('ul.dropdown-menu.dropdown-menu-align-right li') do + click_link 'Most popular' + end + end + step 'The list should be sorted by "Oldest updated"' do page.within('div.dropdown.inline.prepend-left-10') do expect(page.find('button.dropdown-toggle.btn')).to have_content('Oldest updated') diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index 2c854ac7bf9..f4df4874d2f 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -103,6 +103,10 @@ module SharedPaths visit dashboard_groups_path end + step 'I visit dashboard todos page' do + visit dashboard_todos_path + end + step 'I should be redirected to the dashboard groups page' do expect(current_path).to eq dashboard_groups_path end |