From fa34901237cc244fe8b828d079af891e63de1c8f Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Thu, 2 Oct 2014 18:42:54 +0200 Subject: Make Spinach test names consistent - do not add Feature to feature titles - titleize feature titles - put steps on the same path as .feature files - make feature titles match their path --- features/dashboard/active_tab.feature | 2 +- features/dashboard/archived_projects.feature | 2 +- features/dashboard/event_filters.feature | 2 +- features/dashboard/help.feature | 2 +- features/dashboard/projects.feature | 2 +- features/dashboard/shortcuts.feature | 2 +- features/explore/groups.feature | 151 +++++++++++ features/explore/projects.feature | 2 +- features/explore/public_groups.feature | 151 ----------- features/group.feature | 143 ---------- features/groups.feature | 143 ++++++++++ features/profile/active_tab.feature | 2 +- features/project/active_tab.feature | 2 +- features/project/commits/branches.feature | 2 +- features/project/commits/comments.feature | 2 +- features/project/commits/commits.feature | 2 +- features/project/commits/diff_comments.feature | 2 +- features/project/commits/tags.feature | 2 +- features/project/commits/user_lookup.feature | 2 +- features/project/create.feature | 2 +- features/project/fork.feature | 2 +- features/project/issues/filter_labels.feature | 2 +- features/project/issues/labels.feature | 2 +- features/project/issues/milestones.feature | 2 +- features/project/network.feature | 40 --- features/project/network_graph.feature | 40 +++ features/project/project.feature | 2 +- features/project/shortcuts.feature | 2 +- features/project/source/browse_files.feature | 2 +- features/project/source/git_blame.feature | 2 +- features/project/source/markdown_render.feature | 2 +- features/project/source/multiselect_blob.feature | 2 +- features/project/source/search_code.feature | 2 +- features/project/team_management.feature | 2 +- features/snippets/discover.feature | 2 +- features/snippets/snippets.feature | 2 +- features/snippets/user.feature | 2 +- features/steps/dashboard/archived_projects.rb | 22 ++ features/steps/dashboard/help.rb | 21 ++ features/steps/dashboard/with_archived_projects.rb | 22 -- features/steps/explore/groups.rb | 92 +++++++ features/steps/explore/groups_feature.rb | 92 ------- features/steps/explore/projects.rb | 2 +- features/steps/group.rb | 277 -------------------- features/steps/groups.rb | 277 ++++++++++++++++++++ features/steps/help.rb | 21 -- features/steps/project/browse_branches.rb | 85 ------ features/steps/project/browse_commits.rb | 91 ------- .../steps/project/browse_commits_user_lookup.rb | 48 ---- features/steps/project/browse_files.rb | 176 ------------- features/steps/project/browse_git_repo.rb | 19 -- features/steps/project/browse_tags.rb | 82 ------ features/steps/project/comments_on_commit_diffs.rb | 6 - features/steps/project/comments_on_commits.rb | 6 - features/steps/project/commits/branches.rb | 85 ++++++ features/steps/project/commits/comments.rb | 6 + features/steps/project/commits/commits.rb | 91 +++++++ features/steps/project/commits/diff_comments.rb | 6 + features/steps/project/commits/tags.rb | 82 ++++++ features/steps/project/commits/user_lookup.rb | 48 ++++ features/steps/project/create.rb | 2 +- features/steps/project/filter_labels.rb | 79 ------ features/steps/project/fork.rb | 2 +- features/steps/project/issues.rb | 236 ----------------- features/steps/project/issues/filter_labels.rb | 79 ++++++ features/steps/project/issues/issues.rb | 236 +++++++++++++++++ features/steps/project/issues/labels.rb | 101 ++++++++ features/steps/project/issues/milestones.rb | 59 +++++ features/steps/project/labels.rb | 101 -------- features/steps/project/markdown_render.rb | 288 --------------------- features/steps/project/milestones.rb | 59 ----- features/steps/project/multiselect_blob.rb | 58 ----- features/steps/project/project.rb | 2 +- features/steps/project/search_code.rb | 19 -- features/steps/project/source/browse_files.rb | 176 +++++++++++++ features/steps/project/source/git_blame.rb | 19 ++ features/steps/project/source/markdown_render.rb | 288 +++++++++++++++++++++ features/steps/project/source/multiselect_blob.rb | 58 +++++ features/steps/project/source/search_code.rb | 19 ++ features/steps/snippets/discover.rb | 2 +- features/steps/snippets/snippets.rb | 2 +- features/steps/snippets/user.rb | 2 +- 82 files changed, 2137 insertions(+), 2137 deletions(-) create mode 100644 features/explore/groups.feature delete mode 100644 features/explore/public_groups.feature delete mode 100644 features/group.feature create mode 100644 features/groups.feature delete mode 100644 features/project/network.feature create mode 100644 features/project/network_graph.feature create mode 100644 features/steps/dashboard/archived_projects.rb create mode 100644 features/steps/dashboard/help.rb delete mode 100644 features/steps/dashboard/with_archived_projects.rb create mode 100644 features/steps/explore/groups.rb delete mode 100644 features/steps/explore/groups_feature.rb delete mode 100644 features/steps/group.rb create mode 100644 features/steps/groups.rb delete mode 100644 features/steps/help.rb delete mode 100644 features/steps/project/browse_branches.rb delete mode 100644 features/steps/project/browse_commits.rb delete mode 100644 features/steps/project/browse_commits_user_lookup.rb delete mode 100644 features/steps/project/browse_files.rb delete mode 100644 features/steps/project/browse_git_repo.rb delete mode 100644 features/steps/project/browse_tags.rb delete mode 100644 features/steps/project/comments_on_commit_diffs.rb delete mode 100644 features/steps/project/comments_on_commits.rb create mode 100644 features/steps/project/commits/branches.rb create mode 100644 features/steps/project/commits/comments.rb create mode 100644 features/steps/project/commits/commits.rb create mode 100644 features/steps/project/commits/diff_comments.rb create mode 100644 features/steps/project/commits/tags.rb create mode 100644 features/steps/project/commits/user_lookup.rb delete mode 100644 features/steps/project/filter_labels.rb delete mode 100644 features/steps/project/issues.rb create mode 100644 features/steps/project/issues/filter_labels.rb create mode 100644 features/steps/project/issues/issues.rb create mode 100644 features/steps/project/issues/labels.rb create mode 100644 features/steps/project/issues/milestones.rb delete mode 100644 features/steps/project/labels.rb delete mode 100644 features/steps/project/markdown_render.rb delete mode 100644 features/steps/project/milestones.rb delete mode 100644 features/steps/project/multiselect_blob.rb delete mode 100644 features/steps/project/search_code.rb create mode 100644 features/steps/project/source/browse_files.rb create mode 100644 features/steps/project/source/git_blame.rb create mode 100644 features/steps/project/source/markdown_render.rb create mode 100644 features/steps/project/source/multiselect_blob.rb create mode 100644 features/steps/project/source/search_code.rb diff --git a/features/dashboard/active_tab.feature b/features/dashboard/active_tab.feature index 22dfa2f7840..08b87808f33 100644 --- a/features/dashboard/active_tab.feature +++ b/features/dashboard/active_tab.feature @@ -1,5 +1,5 @@ @dashboard -Feature: Dashboard active tab +Feature: Dashboard Active Tab Background: Given I sign in as a user diff --git a/features/dashboard/archived_projects.feature b/features/dashboard/archived_projects.feature index e23238d225c..3af93bc373c 100644 --- a/features/dashboard/archived_projects.feature +++ b/features/dashboard/archived_projects.feature @@ -1,5 +1,5 @@ @dashboard -Feature: Dashboard with archived projects +Feature: Dashboard Archived Projects Background: Given I sign in as a user And I own project "Shop" diff --git a/features/dashboard/event_filters.feature b/features/dashboard/event_filters.feature index 41de0ae8317..ec5680caba6 100644 --- a/features/dashboard/event_filters.feature +++ b/features/dashboard/event_filters.feature @@ -1,5 +1,5 @@ @dashboard -Feature: Event filters +Feature: Event Filters Background: Given I sign in as a user And I own a project diff --git a/features/dashboard/help.feature b/features/dashboard/help.feature index 56a0a860ab9..bca2772897b 100644 --- a/features/dashboard/help.feature +++ b/features/dashboard/help.feature @@ -1,5 +1,5 @@ @dashboard -Feature: Help +Feature: Dashboard Help Background: Given I sign in as a user And I visit the "Rake Tasks" help page diff --git a/features/dashboard/projects.feature b/features/dashboard/projects.feature index 5214cfc28ef..bb4e84f0159 100644 --- a/features/dashboard/projects.feature +++ b/features/dashboard/projects.feature @@ -1,5 +1,5 @@ @dashboard -Feature: Dashboard projects +Feature: Dashboard Projects Background: Given I sign in as a user And I own project "Shop" diff --git a/features/dashboard/shortcuts.feature b/features/dashboard/shortcuts.feature index 7c25b3926c9..41d79aa6ec8 100644 --- a/features/dashboard/shortcuts.feature +++ b/features/dashboard/shortcuts.feature @@ -1,5 +1,5 @@ @dashboard -Feature: Dashboard shortcuts +Feature: Dashboard Shortcuts Background: Given I sign in as a user And I visit dashboard page diff --git a/features/explore/groups.feature b/features/explore/groups.feature new file mode 100644 index 00000000000..b50a3e766c6 --- /dev/null +++ b/features/explore/groups.feature @@ -0,0 +1,151 @@ +@public +Feature: Explore Groups + Background: + Given group "TestGroup" has private project "Enterprise" + + Scenario: I should not see group with private projects as visitor + When I visit group "TestGroup" page + Then I should be redirected to sign in page + + Scenario: I should not see group with private projects group as user + When I sign in as a user + And I visit group "TestGroup" page + Then page status code should be 404 + + Scenario: I should not see group with private and internal projects as visitor + Given group "TestGroup" has internal project "Internal" + When I visit group "TestGroup" page + Then I should be redirected to sign in page + + Scenario: I should see group with private and internal projects as user + Given group "TestGroup" has internal project "Internal" + When I sign in as a user + And I visit group "TestGroup" page + Then I should see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group issues for internal project as user + Given group "TestGroup" has internal project "Internal" + When I sign in as a user + And I visit group "TestGroup" issues page + And I change filter to Everyone's + Then I should see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group merge requests for internal project as user + Given group "TestGroup" has internal project "Internal" + When I sign in as a user + And I visit group "TestGroup" merge requests page + And I change filter to Everyone's + Then I should see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group's members as user + Given group "TestGroup" has internal project "Internal" + And "John Doe" is owner of group "TestGroup" + When I sign in as a user + And I visit group "TestGroup" members page + Then I should see group member "John Doe" + And I should not see member roles + + Scenario: I should see group with private, internal and public projects as visitor + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + When I visit group "TestGroup" page + Then I should see project "Community" items + And I should not see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group issues for public project as visitor + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + When I visit group "TestGroup" issues page + Then I should see project "Community" items + And I should not see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group merge requests for public project as visitor + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + When I visit group "TestGroup" merge requests page + Then I should see project "Community" items + And I should not see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group's members as visitor + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + And "John Doe" is owner of group "TestGroup" + When I visit group "TestGroup" members page + Then I should see group member "John Doe" + And I should not see member roles + + Scenario: I should see group with private, internal and public projects as user + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + When I sign in as a user + And I visit group "TestGroup" page + Then I should see project "Community" items + And I should see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group issues for internal and public projects as user + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + When I sign in as a user + And I visit group "TestGroup" issues page + And I change filter to Everyone's + Then I should see project "Community" items + And I should see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group merge requests for internal and public projects as user + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + When I sign in as a user + And I visit group "TestGroup" merge requests page + And I change filter to Everyone's + Then I should see project "Community" items + And I should see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group's members as user + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + And "John Doe" is owner of group "TestGroup" + When I sign in as a user + And I visit group "TestGroup" members page + Then I should see group member "John Doe" + And I should not see member roles + + Scenario: I should see group with public project in public groups area + Given group "TestGroup" has public project "Community" + When I visit the public groups area + Then I should see group "TestGroup" + + Scenario: I should not see group with internal project in public groups area + Given group "TestGroup" has internal project "Internal" + When I visit the public groups area + Then I should not see group "TestGroup" + + Scenario: I should not see group with private project in public groups area + When I visit the public groups area + Then I should not see group "TestGroup" + + Scenario: I should see group with public project in public groups area as user + Given group "TestGroup" has public project "Community" + When I sign in as a user + And I visit the public groups area + Then I should see group "TestGroup" + + Scenario: I should see group with internal project in public groups area as user + Given group "TestGroup" has internal project "Internal" + When I sign in as a user + And I visit the public groups area + Then I should see group "TestGroup" + + Scenario: I should not see group with private project in public groups area as user + When I sign in as a user + And I visit the public groups area + Then I should not see group "TestGroup" + diff --git a/features/explore/projects.feature b/features/explore/projects.feature index 9827ebe3e57..a1b29722678 100644 --- a/features/explore/projects.feature +++ b/features/explore/projects.feature @@ -1,5 +1,5 @@ @public -Feature: Explore Projects Feature +Feature: Explore Projects Background: Given public project "Community" And internal project "Internal" diff --git a/features/explore/public_groups.feature b/features/explore/public_groups.feature deleted file mode 100644 index 825e3da934e..00000000000 --- a/features/explore/public_groups.feature +++ /dev/null @@ -1,151 +0,0 @@ -@public -Feature: Explore Groups Feature - Background: - Given group "TestGroup" has private project "Enterprise" - - Scenario: I should not see group with private projects as visitor - When I visit group "TestGroup" page - Then I should be redirected to sign in page - - Scenario: I should not see group with private projects group as user - When I sign in as a user - And I visit group "TestGroup" page - Then page status code should be 404 - - Scenario: I should not see group with private and internal projects as visitor - Given group "TestGroup" has internal project "Internal" - When I visit group "TestGroup" page - Then I should be redirected to sign in page - - Scenario: I should see group with private and internal projects as user - Given group "TestGroup" has internal project "Internal" - When I sign in as a user - And I visit group "TestGroup" page - Then I should see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group issues for internal project as user - Given group "TestGroup" has internal project "Internal" - When I sign in as a user - And I visit group "TestGroup" issues page - And I change filter to Everyone's - Then I should see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group merge requests for internal project as user - Given group "TestGroup" has internal project "Internal" - When I sign in as a user - And I visit group "TestGroup" merge requests page - And I change filter to Everyone's - Then I should see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group's members as user - Given group "TestGroup" has internal project "Internal" - And "John Doe" is owner of group "TestGroup" - When I sign in as a user - And I visit group "TestGroup" members page - Then I should see group member "John Doe" - And I should not see member roles - - Scenario: I should see group with private, internal and public projects as visitor - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I visit group "TestGroup" page - Then I should see project "Community" items - And I should not see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group issues for public project as visitor - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I visit group "TestGroup" issues page - Then I should see project "Community" items - And I should not see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group merge requests for public project as visitor - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I visit group "TestGroup" merge requests page - Then I should see project "Community" items - And I should not see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group's members as visitor - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - And "John Doe" is owner of group "TestGroup" - When I visit group "TestGroup" members page - Then I should see group member "John Doe" - And I should not see member roles - - Scenario: I should see group with private, internal and public projects as user - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I sign in as a user - And I visit group "TestGroup" page - Then I should see project "Community" items - And I should see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group issues for internal and public projects as user - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I sign in as a user - And I visit group "TestGroup" issues page - And I change filter to Everyone's - Then I should see project "Community" items - And I should see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group merge requests for internal and public projects as user - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I sign in as a user - And I visit group "TestGroup" merge requests page - And I change filter to Everyone's - Then I should see project "Community" items - And I should see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group's members as user - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - And "John Doe" is owner of group "TestGroup" - When I sign in as a user - And I visit group "TestGroup" members page - Then I should see group member "John Doe" - And I should not see member roles - - Scenario: I should see group with public project in public groups area - Given group "TestGroup" has public project "Community" - When I visit the public groups area - Then I should see group "TestGroup" - - Scenario: I should not see group with internal project in public groups area - Given group "TestGroup" has internal project "Internal" - When I visit the public groups area - Then I should not see group "TestGroup" - - Scenario: I should not see group with private project in public groups area - When I visit the public groups area - Then I should not see group "TestGroup" - - Scenario: I should see group with public project in public groups area as user - Given group "TestGroup" has public project "Community" - When I sign in as a user - And I visit the public groups area - Then I should see group "TestGroup" - - Scenario: I should see group with internal project in public groups area as user - Given group "TestGroup" has internal project "Internal" - When I sign in as a user - And I visit the public groups area - Then I should see group "TestGroup" - - Scenario: I should not see group with private project in public groups area as user - When I sign in as a user - And I visit the public groups area - Then I should not see group "TestGroup" - diff --git a/features/group.feature b/features/group.feature deleted file mode 100644 index b5ff03db844..00000000000 --- a/features/group.feature +++ /dev/null @@ -1,143 +0,0 @@ -Feature: Groups - Background: - Given I sign in as "John Doe" - And "John Doe" is owner of group "Owned" - And "John Doe" is guest of group "Guest" - - @javascript - Scenario: I should see group "Owned" dashboard list - When I visit group "Owned" page - Then I should see group "Owned" projects list - And I should see projects activity feed - - Scenario: Create a group from dasboard - When I visit group "Owned" page - And I visit dashboard page - And I click new group link - And submit form with new group "Samurai" info - Then I should be redirected to group "Samurai" page - And I should see newly created group "Samurai" - - Scenario: I should see group "Owned" issues list - Given project from group "Owned" has issues assigned to me - When I visit group "Owned" issues page - Then I should see issues from group "Owned" assigned to me - - Scenario: I should see group "Owned" merge requests list - Given project from group "Owned" has merge requests assigned to me - When I visit group "Owned" merge requests page - Then I should see merge requests from group "Owned" assigned to me - - @javascript - Scenario: I should add user to projects in group "Owned" - Given User "Mary Jane" exists - When I visit group "Owned" members page - And I select user "Mary Jane" from list with role "Reporter" - Then I should see user "Mary Jane" in team list - - Scenario: I should see edit group "Owned" page - When I visit group "Owned" settings page - And I change group "Owned" name to "new-name" - Then I should see new group "Owned" name - - Scenario: I edit group "Owned" avatar - When I visit group "Owned" settings page - And I change group "Owned" avatar - And I visit group "Owned" settings page - Then I should see new group "Owned" avatar - And I should see the "Remove avatar" button - - Scenario: I remove group "Owned" avatar - When I visit group "Owned" settings page - And I have group "Owned" avatar - And I visit group "Owned" settings page - And I remove group "Owned" avatar - Then I should not see group "Owned" avatar - And I should not see the "Remove avatar" button - - # Leave - - @javascript - Scenario: Owner should be able to remove himself from group if he is not the last owner - Given "Mary Jane" is owner of group "Owned" - When I visit group "Owned" members page - Then I should see user "John Doe" in team list - Then I should see user "Mary Jane" in team list - When I click on the "Remove User From Group" button for "John Doe" - And I visit group "Owned" members page - Then I should not see user "John Doe" in team list - Then I should see user "Mary Jane" in team list - - @javascript - Scenario: Owner should not be able to remove himself from group if he is the last owner - Given "Mary Jane" is guest of group "Owned" - When I visit group "Owned" members page - Then I should see user "John Doe" in team list - Then I should see user "Mary Jane" in team list - Then I should not see the "Remove User From Group" button for "John Doe" - - @javascript - Scenario: Guest should be able to remove himself from group - Given "Mary Jane" is guest of group "Guest" - When I visit group "Guest" members page - Then I should see user "John Doe" in team list - Then I should see user "Mary Jane" in team list - When I click on the "Remove User From Group" button for "John Doe" - When I visit group "Guest" members page - Then I should not see user "John Doe" in team list - Then I should see user "Mary Jane" in team list - - @javascript - Scenario: Guest should be able to remove himself from group even if he is the only user in the group - When I visit group "Guest" members page - Then I should see user "John Doe" in team list - When I click on the "Remove User From Group" button for "John Doe" - When I visit group "Guest" members page - Then I should not see user "John Doe" in team list - - # Remove others - - Scenario: Owner should be able to remove other users from group - Given "Mary Jane" is owner of group "Owned" - When I visit group "Owned" members page - Then I should see user "John Doe" in team list - Then I should see user "Mary Jane" in team list - When I click on the "Remove User From Group" button for "Mary Jane" - When I visit group "Owned" members page - Then I should see user "John Doe" in team list - Then I should not see user "Mary Jane" in team list - - Scenario: Guest should not be able to remove other users from group - Given "Mary Jane" is guest of group "Guest" - When I visit group "Guest" members page - Then I should see user "John Doe" in team list - Then I should see user "Mary Jane" in team list - Then I should not see the "Remove User From Group" button for "Mary Jane" - - Scenario: Search member by name - Given "Mary Jane" is guest of group "Guest" - And I visit group "Guest" members page - When I search for 'Mary' member - Then I should see user "Mary Jane" in team list - Then I should not see user "John Doe" in team list - - # Group milestones - - Scenario: I should see group "Owned" milestone index page with no milestones - When I visit group "Owned" page - And I click on group milestones - Then I should see group milestones index page has no milestones - - Scenario: I should see group "Owned" milestone index page with milestones - Given Group has projects with milestones - When I visit group "Owned" page - And I click on group milestones - Then I should see group milestones index page with milestones - - Scenario: I should see group "Owned" milestone show page - Given Group has projects with milestones - When I visit group "Owned" page - And I click on group milestones - And I click on one group milestone - Then I should see group milestone with descriptions and expiry date - And I should see group milestone with all issues and MRs assigned to that milestone diff --git a/features/groups.feature b/features/groups.feature new file mode 100644 index 00000000000..b5ff03db844 --- /dev/null +++ b/features/groups.feature @@ -0,0 +1,143 @@ +Feature: Groups + Background: + Given I sign in as "John Doe" + And "John Doe" is owner of group "Owned" + And "John Doe" is guest of group "Guest" + + @javascript + Scenario: I should see group "Owned" dashboard list + When I visit group "Owned" page + Then I should see group "Owned" projects list + And I should see projects activity feed + + Scenario: Create a group from dasboard + When I visit group "Owned" page + And I visit dashboard page + And I click new group link + And submit form with new group "Samurai" info + Then I should be redirected to group "Samurai" page + And I should see newly created group "Samurai" + + Scenario: I should see group "Owned" issues list + Given project from group "Owned" has issues assigned to me + When I visit group "Owned" issues page + Then I should see issues from group "Owned" assigned to me + + Scenario: I should see group "Owned" merge requests list + Given project from group "Owned" has merge requests assigned to me + When I visit group "Owned" merge requests page + Then I should see merge requests from group "Owned" assigned to me + + @javascript + Scenario: I should add user to projects in group "Owned" + Given User "Mary Jane" exists + When I visit group "Owned" members page + And I select user "Mary Jane" from list with role "Reporter" + Then I should see user "Mary Jane" in team list + + Scenario: I should see edit group "Owned" page + When I visit group "Owned" settings page + And I change group "Owned" name to "new-name" + Then I should see new group "Owned" name + + Scenario: I edit group "Owned" avatar + When I visit group "Owned" settings page + And I change group "Owned" avatar + And I visit group "Owned" settings page + Then I should see new group "Owned" avatar + And I should see the "Remove avatar" button + + Scenario: I remove group "Owned" avatar + When I visit group "Owned" settings page + And I have group "Owned" avatar + And I visit group "Owned" settings page + And I remove group "Owned" avatar + Then I should not see group "Owned" avatar + And I should not see the "Remove avatar" button + + # Leave + + @javascript + Scenario: Owner should be able to remove himself from group if he is not the last owner + Given "Mary Jane" is owner of group "Owned" + When I visit group "Owned" members page + Then I should see user "John Doe" in team list + Then I should see user "Mary Jane" in team list + When I click on the "Remove User From Group" button for "John Doe" + And I visit group "Owned" members page + Then I should not see user "John Doe" in team list + Then I should see user "Mary Jane" in team list + + @javascript + Scenario: Owner should not be able to remove himself from group if he is the last owner + Given "Mary Jane" is guest of group "Owned" + When I visit group "Owned" members page + Then I should see user "John Doe" in team list + Then I should see user "Mary Jane" in team list + Then I should not see the "Remove User From Group" button for "John Doe" + + @javascript + Scenario: Guest should be able to remove himself from group + Given "Mary Jane" is guest of group "Guest" + When I visit group "Guest" members page + Then I should see user "John Doe" in team list + Then I should see user "Mary Jane" in team list + When I click on the "Remove User From Group" button for "John Doe" + When I visit group "Guest" members page + Then I should not see user "John Doe" in team list + Then I should see user "Mary Jane" in team list + + @javascript + Scenario: Guest should be able to remove himself from group even if he is the only user in the group + When I visit group "Guest" members page + Then I should see user "John Doe" in team list + When I click on the "Remove User From Group" button for "John Doe" + When I visit group "Guest" members page + Then I should not see user "John Doe" in team list + + # Remove others + + Scenario: Owner should be able to remove other users from group + Given "Mary Jane" is owner of group "Owned" + When I visit group "Owned" members page + Then I should see user "John Doe" in team list + Then I should see user "Mary Jane" in team list + When I click on the "Remove User From Group" button for "Mary Jane" + When I visit group "Owned" members page + Then I should see user "John Doe" in team list + Then I should not see user "Mary Jane" in team list + + Scenario: Guest should not be able to remove other users from group + Given "Mary Jane" is guest of group "Guest" + When I visit group "Guest" members page + Then I should see user "John Doe" in team list + Then I should see user "Mary Jane" in team list + Then I should not see the "Remove User From Group" button for "Mary Jane" + + Scenario: Search member by name + Given "Mary Jane" is guest of group "Guest" + And I visit group "Guest" members page + When I search for 'Mary' member + Then I should see user "Mary Jane" in team list + Then I should not see user "John Doe" in team list + + # Group milestones + + Scenario: I should see group "Owned" milestone index page with no milestones + When I visit group "Owned" page + And I click on group milestones + Then I should see group milestones index page has no milestones + + Scenario: I should see group "Owned" milestone index page with milestones + Given Group has projects with milestones + When I visit group "Owned" page + And I click on group milestones + Then I should see group milestones index page with milestones + + Scenario: I should see group "Owned" milestone show page + Given Group has projects with milestones + When I visit group "Owned" page + And I click on group milestones + And I click on one group milestone + Then I should see group milestone with descriptions and expiry date + And I should see group milestone with all issues and MRs assigned to that milestone diff --git a/features/profile/active_tab.feature b/features/profile/active_tab.feature index a99409d9fd7..7801ae5b8ca 100644 --- a/features/profile/active_tab.feature +++ b/features/profile/active_tab.feature @@ -1,5 +1,5 @@ @profile -Feature: Profile active tab +Feature: Profile Active Tab Background: Given I sign in as a user diff --git a/features/project/active_tab.feature b/features/project/active_tab.feature index ce90a086688..8d3e0bd967f 100644 --- a/features/project/active_tab.feature +++ b/features/project/active_tab.feature @@ -1,4 +1,4 @@ -Feature: Project active tab +Feature: Project Active Tab Background: Given I sign in as a user And I own a project diff --git a/features/project/commits/branches.feature b/features/project/commits/branches.feature index d124cb7eecd..65d8e48b9b3 100644 --- a/features/project/commits/branches.feature +++ b/features/project/commits/branches.feature @@ -1,4 +1,4 @@ -Feature: Project Browse branches +Feature: Project Commits Branches Background: Given I sign in as a user And I own project "Shop" diff --git a/features/project/commits/comments.feature b/features/project/commits/comments.feature index a1aa745a681..e176752cfbf 100644 --- a/features/project/commits/comments.feature +++ b/features/project/commits/comments.feature @@ -1,4 +1,4 @@ -Feature: Comments on commits +Feature: Project Commits Comments Background: Given I sign in as a user And I own project "Shop" diff --git a/features/project/commits/commits.feature b/features/project/commits/commits.feature index 8a213067548..46076b6f3e6 100644 --- a/features/project/commits/commits.feature +++ b/features/project/commits/commits.feature @@ -1,4 +1,4 @@ -Feature: Project Browse commits +Feature: Project Commits Background: Given I sign in as a user And I own a project diff --git a/features/project/commits/diff_comments.feature b/features/project/commits/diff_comments.feature index b26019f832f..a145ec84b78 100644 --- a/features/project/commits/diff_comments.feature +++ b/features/project/commits/diff_comments.feature @@ -1,4 +1,4 @@ -Feature: Comments on commit diffs +Feature: Project Commits Diff Comments Background: Given I sign in as a user And I own project "Shop" diff --git a/features/project/commits/tags.feature b/features/project/commits/tags.feature index bea463cb786..02f399f7cad 100644 --- a/features/project/commits/tags.feature +++ b/features/project/commits/tags.feature @@ -1,4 +1,4 @@ -Feature: Project Browse tags +Feature: Project Commits Tags Background: Given I sign in as a user And I own project "Shop" diff --git a/features/project/commits/user_lookup.feature b/features/project/commits/user_lookup.feature index 7b194ab9206..db51d4a6cfa 100644 --- a/features/project/commits/user_lookup.feature +++ b/features/project/commits/user_lookup.feature @@ -1,4 +1,4 @@ -Feature: Project Browse Commits User Lookup +Feature: Project Commits User Lookup Background: Given I sign in as a user And I own a project diff --git a/features/project/create.feature b/features/project/create.feature index bb8e3a368ed..e9dc4fe6b3c 100644 --- a/features/project/create.feature +++ b/features/project/create.feature @@ -1,4 +1,4 @@ -Feature: Create Project +Feature: Project Create In order to get access to project sections A user with ability to create a project Should be able to create a new one diff --git a/features/project/fork.feature b/features/project/fork.feature index dc477ca3bf3..d3d1180db04 100644 --- a/features/project/fork.feature +++ b/features/project/fork.feature @@ -1,4 +1,4 @@ -Feature: Fork Project +Feature: Project Fork Background: Given I sign in as a user And I am a member of project "Shop" diff --git a/features/project/issues/filter_labels.feature b/features/project/issues/filter_labels.feature index f4a0a7977cc..2c69a78a749 100644 --- a/features/project/issues/filter_labels.feature +++ b/features/project/issues/filter_labels.feature @@ -1,4 +1,4 @@ -Feature: Project Filter Labels +Feature: Project Issues Filter Labels Background: Given I sign in as a user And I own project "Shop" diff --git a/features/project/issues/labels.feature b/features/project/issues/labels.feature index a9fe1595fc5..039a7d83cb1 100644 --- a/features/project/issues/labels.feature +++ b/features/project/issues/labels.feature @@ -1,4 +1,4 @@ -Feature: Project Labels +Feature: Project Issues Labels Background: Given I sign in as a user And I own project "Shop" diff --git a/features/project/issues/milestones.feature b/features/project/issues/milestones.feature index e67b5d2d860..9ac65b1257c 100644 --- a/features/project/issues/milestones.feature +++ b/features/project/issues/milestones.feature @@ -1,4 +1,4 @@ -Feature: Project Milestones +Feature: Project Issues Milestones Background: Given I sign in as a user And I own project "Shop" diff --git a/features/project/network.feature b/features/project/network.feature deleted file mode 100644 index 8beb6043aff..00000000000 --- a/features/project/network.feature +++ /dev/null @@ -1,40 +0,0 @@ -Feature: Project Network Graph - Background: - Given I sign in as a user - And I own project "Shop" - And I visit project "Shop" network page - - @javascript - Scenario: I should see project network - Then page should have network graph - And page should select "master" in select box - And page should have "master" on graph - - @javascript - Scenario: I should switch "branch" and "tag" - When I switch ref to "feature" - Then page should select "feature" in select box - And page should have "feature" on graph - When I switch ref to "v1.0.0" - Then page should select "v1.0.0" in select box - And page should have "v1.0.0" on graph - - @javascript - Scenario: I should looking for a commit by SHA - When I looking for a commit by SHA of "v1.0.0" - Then page should have network graph - And page should select "master" in select box - And page should have "v1.0.0" on graph - - @javascript - Scenario: I should filter selected tag - When I switch ref to "v1.0.0" - Then page should have content not containing "v1.0.0" - When click "Show only selected branch" checkbox - Then page should not have content not containing "v1.0.0" - When click "Show only selected branch" checkbox - Then page should have content not containing "v1.0.0" - - Scenario: I should fail to look for a commit - When I look for a commit by ";" - Then page status code should be 404 diff --git a/features/project/network_graph.feature b/features/project/network_graph.feature new file mode 100644 index 00000000000..8beb6043aff --- /dev/null +++ b/features/project/network_graph.feature @@ -0,0 +1,40 @@ +Feature: Project Network Graph + Background: + Given I sign in as a user + And I own project "Shop" + And I visit project "Shop" network page + + @javascript + Scenario: I should see project network + Then page should have network graph + And page should select "master" in select box + And page should have "master" on graph + + @javascript + Scenario: I should switch "branch" and "tag" + When I switch ref to "feature" + Then page should select "feature" in select box + And page should have "feature" on graph + When I switch ref to "v1.0.0" + Then page should select "v1.0.0" in select box + And page should have "v1.0.0" on graph + + @javascript + Scenario: I should looking for a commit by SHA + When I looking for a commit by SHA of "v1.0.0" + Then page should have network graph + And page should select "master" in select box + And page should have "v1.0.0" on graph + + @javascript + Scenario: I should filter selected tag + When I switch ref to "v1.0.0" + Then page should have content not containing "v1.0.0" + When click "Show only selected branch" checkbox + Then page should not have content not containing "v1.0.0" + When click "Show only selected branch" checkbox + Then page should have content not containing "v1.0.0" + + Scenario: I should fail to look for a commit + When I look for a commit by ";" + Then page status code should be 404 diff --git a/features/project/project.feature b/features/project/project.feature index 47e9600c051..7bb24e013a9 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -1,4 +1,4 @@ -Feature: Project Feature +Feature: Project Background: Given I sign in as a user And I own project "Shop" diff --git a/features/project/shortcuts.feature b/features/project/shortcuts.feature index e5f9c103fb1..cfb68bf1f50 100644 --- a/features/project/shortcuts.feature +++ b/features/project/shortcuts.feature @@ -1,5 +1,5 @@ @dashboard -Feature: Project shortcuts +Feature: Project Shortcuts Background: Given I sign in as a user And I own a project diff --git a/features/project/source/browse_files.feature b/features/project/source/browse_files.feature index 1cd3a91667f..20ef7ac5702 100644 --- a/features/project/source/browse_files.feature +++ b/features/project/source/browse_files.feature @@ -1,4 +1,4 @@ -Feature: Project Browse files +Feature: Project Source Browse files Background: Given I sign in as a user And I own project "Shop" diff --git a/features/project/source/git_blame.feature b/features/project/source/git_blame.feature index cb993ffc639..48b1077dc6b 100644 --- a/features/project/source/git_blame.feature +++ b/features/project/source/git_blame.feature @@ -1,4 +1,4 @@ -Feature: Project Browse git repo +Feature: Project Source Git Blame Background: Given I sign in as a user And I own project "Shop" diff --git a/features/project/source/markdown_render.feature b/features/project/source/markdown_render.feature index fce351317c6..ecbd721c281 100644 --- a/features/project/source/markdown_render.feature +++ b/features/project/source/markdown_render.feature @@ -1,4 +1,4 @@ -Feature: Project markdown render +Feature: Project Source Markdown Render Background: Given I sign in as a user And I own project "Delta" diff --git a/features/project/source/multiselect_blob.feature b/features/project/source/multiselect_blob.feature index f60b646a8d9..63b7cb77a93 100644 --- a/features/project/source/multiselect_blob.feature +++ b/features/project/source/multiselect_blob.feature @@ -1,4 +1,4 @@ -Feature: Project Multiselect Blob +Feature: Project Source Multiselect Blob Background: Given I sign in as a user And I own project "Shop" diff --git a/features/project/source/search_code.feature b/features/project/source/search_code.feature index 93b326696d0..4f9dcea249f 100644 --- a/features/project/source/search_code.feature +++ b/features/project/source/search_code.feature @@ -1,4 +1,4 @@ -Feature: Project Search code +Feature: Project Source Search Code Background: Given I sign in as a user diff --git a/features/project/team_management.feature b/features/project/team_management.feature index e153978e043..86ea6cd6e91 100644 --- a/features/project/team_management.feature +++ b/features/project/team_management.feature @@ -1,4 +1,4 @@ -Feature: Project Team management +Feature: Project Team Management Background: Given I sign in as a user And I own project "Shop" diff --git a/features/snippets/discover.feature b/features/snippets/discover.feature index f0b8d3a408a..5094062c8c3 100644 --- a/features/snippets/discover.feature +++ b/features/snippets/discover.feature @@ -1,5 +1,5 @@ @snippets -Feature: Discover Snippets +Feature: Snippets Discover Background: Given I sign in as a user And I have public "Personal snippet one" snippet diff --git a/features/snippets/snippets.feature b/features/snippets/snippets.feature index 38216dd5b7b..4c4e3ee2cff 100644 --- a/features/snippets/snippets.feature +++ b/features/snippets/snippets.feature @@ -1,5 +1,5 @@ @snippets -Feature: Snippets Feature +Feature: Snippets Background: Given I sign in as a user And I have public "Personal snippet one" snippet diff --git a/features/snippets/user.feature b/features/snippets/user.feature index d032a33686b..424794f73fd 100644 --- a/features/snippets/user.feature +++ b/features/snippets/user.feature @@ -1,5 +1,5 @@ @snippets -Feature: User Snippets +Feature: Snippets User Background: Given I sign in as a user And I have public "Personal snippet one" snippet diff --git a/features/steps/dashboard/archived_projects.rb b/features/steps/dashboard/archived_projects.rb new file mode 100644 index 00000000000..969baf92287 --- /dev/null +++ b/features/steps/dashboard/archived_projects.rb @@ -0,0 +1,22 @@ +class Spinach::Features::DashboardArchivedProjects < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + When 'project "Forum" is archived' do + project = Project.find_by(name: "Forum") + project.update_attribute(:archived, true) + end + + step 'I should see "Shop" project link' do + page.should have_link "Shop" + end + + step 'I should not see "Forum" project link' do + page.should_not have_link "Forum" + end + + step 'I should see "Forum" project link' do + page.should have_link "Forum" + end +end diff --git a/features/steps/dashboard/help.rb b/features/steps/dashboard/help.rb new file mode 100644 index 00000000000..ef433c57c6e --- /dev/null +++ b/features/steps/dashboard/help.rb @@ -0,0 +1,21 @@ +class Spinach::Features::DashboardHelp < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedMarkdown + + step 'I visit the help page' do + visit help_path + end + + step 'I visit the "Rake Tasks" help page' do + visit help_page_path("raketasks", "maintenance") + end + + step 'I should see "Rake Tasks" page markdown rendered' do + page.should have_content "Gather information about GitLab and the system it runs on" + end + + step 'Header "Rebuild project satellites" should have correct ids and links' do + header_should_have_correct_id_and_link(2, '(Re-)Create satellite repositories', 're-create-satellite-repositories', '.documentation') + end +end diff --git a/features/steps/dashboard/with_archived_projects.rb b/features/steps/dashboard/with_archived_projects.rb deleted file mode 100644 index 256629382a7..00000000000 --- a/features/steps/dashboard/with_archived_projects.rb +++ /dev/null @@ -1,22 +0,0 @@ -class Spinach::Features::DashboardWithArchivedProjects < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - - When 'project "Forum" is archived' do - project = Project.find_by(name: "Forum") - project.update_attribute(:archived, true) - end - - step 'I should see "Shop" project link' do - page.should have_link "Shop" - end - - step 'I should not see "Forum" project link' do - page.should_not have_link "Forum" - end - - step 'I should see "Forum" project link' do - page.should have_link "Forum" - end -end diff --git a/features/steps/explore/groups.rb b/features/steps/explore/groups.rb new file mode 100644 index 00000000000..ccbf6cda07e --- /dev/null +++ b/features/steps/explore/groups.rb @@ -0,0 +1,92 @@ +class Spinach::Features::ExploreGroups < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedGroup + include SharedProject + + step 'group "TestGroup" has private project "Enterprise"' do + group_has_project("TestGroup", "Enterprise", Gitlab::VisibilityLevel::PRIVATE) + end + + step 'group "TestGroup" has internal project "Internal"' do + group_has_project("TestGroup", "Internal", Gitlab::VisibilityLevel::INTERNAL) + end + + step 'group "TestGroup" has public project "Community"' do + group_has_project("TestGroup", "Community", Gitlab::VisibilityLevel::PUBLIC) + end + + step '"John Doe" is owner of group "TestGroup"' do + group = Group.find_by(name: "TestGroup") || create(:group, name: "TestGroup") + user = create(:user, name: "John Doe") + group.add_user(user, Gitlab::Access::OWNER) + end + + step 'I visit group "TestGroup" page' do + visit group_path(Group.find_by(name: "TestGroup")) + end + + step 'I visit group "TestGroup" issues page' do + visit issues_group_path(Group.find_by(name: "TestGroup")) + end + + step 'I visit group "TestGroup" merge requests page' do + visit merge_requests_group_path(Group.find_by(name: "TestGroup")) + end + + step 'I visit group "TestGroup" members page' do + visit members_group_path(Group.find_by(name: "TestGroup")) + end + + step 'I should not see project "Enterprise" items' do + page.should_not have_content "Enterprise" + end + + step 'I should see project "Internal" items' do + page.should have_content "Internal" + end + + step 'I should not see project "Internal" items' do + page.should_not have_content "Internal" + end + + step 'I should see project "Community" items' do + page.should have_content "Community" + end + + step 'I change filter to Everyone\'s' do + click_link "Everyone's" + end + + step 'I should see group member "John Doe"' do + page.should have_content "John Doe" + end + + step 'I should not see member roles' do + body.should_not match(%r{owner|developer|reporter|guest}i) + end + + protected + + def group_has_project(groupname, projectname, visibility_level) + group = Group.find_by(name: groupname) || create(:group, name: groupname) + project = create(:project, + namespace: group, + name: projectname, + path: "#{groupname}-#{projectname}", + visibility_level: visibility_level + ) + create(:issue, + title: "#{projectname} feature", + project: project + ) + create(:merge_request, + title: "#{projectname} feature implemented", + source_project: project, + target_project: project + ) + create(:closed_issue_event, + project: project + ) + end +end diff --git a/features/steps/explore/groups_feature.rb b/features/steps/explore/groups_feature.rb deleted file mode 100644 index 94c918d932b..00000000000 --- a/features/steps/explore/groups_feature.rb +++ /dev/null @@ -1,92 +0,0 @@ -class Spinach::Features::ExploreGroupsFeature < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedGroup - include SharedProject - - step 'group "TestGroup" has private project "Enterprise"' do - group_has_project("TestGroup", "Enterprise", Gitlab::VisibilityLevel::PRIVATE) - end - - step 'group "TestGroup" has internal project "Internal"' do - group_has_project("TestGroup", "Internal", Gitlab::VisibilityLevel::INTERNAL) - end - - step 'group "TestGroup" has public project "Community"' do - group_has_project("TestGroup", "Community", Gitlab::VisibilityLevel::PUBLIC) - end - - step '"John Doe" is owner of group "TestGroup"' do - group = Group.find_by(name: "TestGroup") || create(:group, name: "TestGroup") - user = create(:user, name: "John Doe") - group.add_user(user, Gitlab::Access::OWNER) - end - - step 'I visit group "TestGroup" page' do - visit group_path(Group.find_by(name: "TestGroup")) - end - - step 'I visit group "TestGroup" issues page' do - visit issues_group_path(Group.find_by(name: "TestGroup")) - end - - step 'I visit group "TestGroup" merge requests page' do - visit merge_requests_group_path(Group.find_by(name: "TestGroup")) - end - - step 'I visit group "TestGroup" members page' do - visit members_group_path(Group.find_by(name: "TestGroup")) - end - - step 'I should not see project "Enterprise" items' do - page.should_not have_content "Enterprise" - end - - step 'I should see project "Internal" items' do - page.should have_content "Internal" - end - - step 'I should not see project "Internal" items' do - page.should_not have_content "Internal" - end - - step 'I should see project "Community" items' do - page.should have_content "Community" - end - - step 'I change filter to Everyone\'s' do - click_link "Everyone's" - end - - step 'I should see group member "John Doe"' do - page.should have_content "John Doe" - end - - step 'I should not see member roles' do - body.should_not match(%r{owner|developer|reporter|guest}i) - end - - protected - - def group_has_project(groupname, projectname, visibility_level) - group = Group.find_by(name: groupname) || create(:group, name: groupname) - project = create(:project, - namespace: group, - name: projectname, - path: "#{groupname}-#{projectname}", - visibility_level: visibility_level - ) - create(:issue, - title: "#{projectname} feature", - project: project - ) - create(:merge_request, - title: "#{projectname} feature implemented", - source_project: project, - target_project: project - ) - create(:closed_issue_event, - project: project - ) - end -end diff --git a/features/steps/explore/projects.rb b/features/steps/explore/projects.rb index 7248b2e8d8c..8172f7922cc 100644 --- a/features/steps/explore/projects.rb +++ b/features/steps/explore/projects.rb @@ -1,4 +1,4 @@ -class Spinach::Features::ExploreProjectsFeature < Spinach::FeatureSteps +class Spinach::Features::ExploreProjects < Spinach::FeatureSteps include SharedAuthentication include SharedPaths include SharedProject diff --git a/features/steps/group.rb b/features/steps/group.rb deleted file mode 100644 index 616a297db99..00000000000 --- a/features/steps/group.rb +++ /dev/null @@ -1,277 +0,0 @@ -class Spinach::Features::Groups < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedGroup - include SharedUser - include Select2Helper - - step 'I should see group "Owned" projects list' do - Group.find_by(name: "Owned").projects.each do |project| - page.should have_link project.name - end - end - - step 'I should see projects activity feed' do - page.should have_content 'closed issue' - end - - step 'I should see issues from group "Owned" assigned to me' do - assigned_to_me(:issues).each do |issue| - page.should have_content issue.title - end - end - - step 'I should see merge requests from group "Owned" assigned to me' do - assigned_to_me(:merge_requests).each do |issue| - page.should have_content issue.title[0..80] - end - end - - step 'I select user "Mary Jane" from list with role "Reporter"' do - user = User.find_by(name: "Mary Jane") || create(:user, name: "Mary Jane") - click_link 'Add members' - within ".users-group-form" do - select2(user.id, from: "#user_ids", multiple: true) - select "Reporter", from: "access_level" - end - click_button "Add users into group" - end - - step 'I should see user "John Doe" in team list' do - projects_with_access = find(".panel .well-list") - projects_with_access.should have_content("John Doe") - end - - step 'I should not see user "John Doe" in team list' do - projects_with_access = find(".panel .well-list") - projects_with_access.should_not have_content("John Doe") - end - - step 'I should see user "Mary Jane" in team list' do - projects_with_access = find(".panel .well-list") - projects_with_access.should have_content("Mary Jane") - end - - step 'I should not see user "Mary Jane" in team list' do - projects_with_access = find(".panel .well-list") - projects_with_access.should_not have_content("Mary Jane") - end - - step 'project from group "Owned" has issues assigned to me' do - create :issue, - project: project, - assignee: current_user, - author: current_user - end - - step 'project from group "Owned" has merge requests assigned to me' do - create :merge_request, - source_project: project, - target_project: project, - assignee: current_user, - author: current_user - end - - When 'I click new group link' do - click_link "New group" - end - - step 'submit form with new group "Samurai" info' do - fill_in 'group_name', with: 'Samurai' - fill_in 'group_description', with: 'Tokugawa Shogunate' - click_button "Create group" - end - - step 'I should be redirected to group "Samurai" page' do - current_path.should == group_path(Group.last) - end - - step 'I should see newly created group "Samurai"' do - page.should have_content "Samurai" - page.should have_content "Tokugawa Shogunate" - page.should have_content "Currently you are only seeing events from the" - end - - step 'I change group "Owned" name to "new-name"' do - fill_in 'group_name', with: 'new-name' - click_button "Save group" - end - - step 'I should see new group "Owned" name' do - within ".navbar-gitlab" do - page.should have_content "group: new-name" - end - end - - step 'I change group "Owned" avatar' do - attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png')) - click_button "Save group" - Group.find_by(name: "Owned").reload - end - - step 'I should see new group "Owned" avatar' do - Group.find_by(name: "Owned").avatar.should be_instance_of AttachmentUploader - Group.find_by(name: "Owned").avatar.url.should == "/uploads/group/avatar/#{ Group.find_by(name:"Owned").id }/gitlab_logo.png" - end - - step 'I should see the "Remove avatar" button' do - page.should have_link("Remove avatar") - end - - step 'I have group "Owned" avatar' do - attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png')) - click_button "Save group" - Group.find_by(name: "Owned").reload - end - - step 'I remove group "Owned" avatar' do - click_link "Remove avatar" - Group.find_by(name: "Owned").reload - end - - step 'I should not see group "Owned" avatar' do - Group.find_by(name: "Owned").avatar?.should be_false - end - - step 'I should not see the "Remove avatar" button' do - page.should_not have_link("Remove avatar") - end - - step 'I click on the "Remove User From Group" button for "John Doe"' do - find(:css, 'li', text: "John Doe").find(:css, 'a.btn-remove').click - # poltergeist always confirms popups. - end - - step 'I click on the "Remove User From Group" button for "Mary Jane"' do - find(:css, 'li', text: "Mary Jane").find(:css, 'a.btn-remove').click - # poltergeist always confirms popups. - end - - step 'I should not see the "Remove User From Group" button for "John Doe"' do - find(:css, 'li', text: "John Doe").should_not have_selector(:css, 'a.btn-remove') - # poltergeist always confirms popups. - end - - step 'I should not see the "Remove User From Group" button for "Mary Jane"' do - find(:css, 'li', text: "Mary Jane").should_not have_selector(:css, 'a.btn-remove') - # poltergeist always confirms popups. - end - - step 'I search for \'Mary\' member' do - within '.member-search-form' do - fill_in 'search', with: 'Mary' - click_button 'Search' - end - end - - step 'I click on group milestones' do - click_link 'Milestones' - end - - step 'I should see group milestones index page has no milestones' do - page.should have_content('No milestones to show') - end - - step 'Group has projects with milestones' do - group_milestone - end - - step 'I should see group milestones index page with milestones' do - page.should have_content('Version 7.2') - page.should have_content('GL-113') - page.should have_link('2 Issues', href: group_milestone_path("owned", "version-7-2", title: "Version 7.2")) - page.should have_link('3 Merge Requests', href: group_milestone_path("owned", "gl-113", title: "GL-113")) - end - - step 'I click on one group milestone' do - click_link 'GL-113' - end - - step 'I should see group milestone with descriptions and expiry date' do - page.should have_content('Lorem Ipsum is simply dummy text of the printing and typesetting industry') - page.should have_content('expires at Aug 20, 2114') - end - - step 'I should see group milestone with all issues and MRs assigned to that milestone' do - page.should have_content('Milestone GL-113') - page.should have_content('Progress: 0 closed – 4 open') - page.should have_link(@issue1.title, href: project_issue_path(@project1, @issue1)) - page.should have_link(@mr3.title, href: project_merge_request_path(@project3, @mr3)) - end - - protected - - def assigned_to_me(key) - project.send(key).where(assignee_id: current_user.id) - end - - def project - Group.find_by(name: "Owned").projects.first - end - - def group_milestone - group = Group.find_by(name: "Owned") - - @project1 = create :project, - group: group - project2 = create :project, - path: 'gitlab-ci', - group: group - @project3 = create :project, - path: 'cookbook-gitlab', - group: group - milestone1_project1 = create :milestone, - title: "Version 7.2", - project: @project1 - milestone1_project2 = create :milestone, - title: "Version 7.2", - project: project2 - milestone1_project3 = create :milestone, - title: "Version 7.2", - project: @project3 - milestone2_project1 = create :milestone, - title: "GL-113", - project: @project1 - milestone2_project2 = create :milestone, - title: "GL-113", - project: project2 - milestone2_project3 = create :milestone, - title: "GL-113", - project: @project3, - due_date: '2114-08-20', - description: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry' - @issue1 = create :issue, - project: @project1, - assignee: current_user, - author: current_user, - milestone: milestone2_project1 - issue2 = create :issue, - project: project2, - assignee: current_user, - author: current_user, - milestone: milestone1_project2 - issue3 = create :issue, - project: @project3, - assignee: current_user, - author: current_user, - milestone: milestone1_project1 - mr1 = create :merge_request, - source_project: @project1, - target_project: @project1, - assignee: current_user, - author: current_user, - milestone: milestone2_project1 - mr2 = create :merge_request, - source_project: project2, - target_project: project2, - assignee: current_user, - author: current_user, - milestone: milestone2_project2 - @mr3 = create :merge_request, - source_project: @project3, - target_project: @project3, - assignee: current_user, - author: current_user, - milestone: milestone2_project3 - end -end diff --git a/features/steps/groups.rb b/features/steps/groups.rb new file mode 100644 index 00000000000..616a297db99 --- /dev/null +++ b/features/steps/groups.rb @@ -0,0 +1,277 @@ +class Spinach::Features::Groups < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedGroup + include SharedUser + include Select2Helper + + step 'I should see group "Owned" projects list' do + Group.find_by(name: "Owned").projects.each do |project| + page.should have_link project.name + end + end + + step 'I should see projects activity feed' do + page.should have_content 'closed issue' + end + + step 'I should see issues from group "Owned" assigned to me' do + assigned_to_me(:issues).each do |issue| + page.should have_content issue.title + end + end + + step 'I should see merge requests from group "Owned" assigned to me' do + assigned_to_me(:merge_requests).each do |issue| + page.should have_content issue.title[0..80] + end + end + + step 'I select user "Mary Jane" from list with role "Reporter"' do + user = User.find_by(name: "Mary Jane") || create(:user, name: "Mary Jane") + click_link 'Add members' + within ".users-group-form" do + select2(user.id, from: "#user_ids", multiple: true) + select "Reporter", from: "access_level" + end + click_button "Add users into group" + end + + step 'I should see user "John Doe" in team list' do + projects_with_access = find(".panel .well-list") + projects_with_access.should have_content("John Doe") + end + + step 'I should not see user "John Doe" in team list' do + projects_with_access = find(".panel .well-list") + projects_with_access.should_not have_content("John Doe") + end + + step 'I should see user "Mary Jane" in team list' do + projects_with_access = find(".panel .well-list") + projects_with_access.should have_content("Mary Jane") + end + + step 'I should not see user "Mary Jane" in team list' do + projects_with_access = find(".panel .well-list") + projects_with_access.should_not have_content("Mary Jane") + end + + step 'project from group "Owned" has issues assigned to me' do + create :issue, + project: project, + assignee: current_user, + author: current_user + end + + step 'project from group "Owned" has merge requests assigned to me' do + create :merge_request, + source_project: project, + target_project: project, + assignee: current_user, + author: current_user + end + + When 'I click new group link' do + click_link "New group" + end + + step 'submit form with new group "Samurai" info' do + fill_in 'group_name', with: 'Samurai' + fill_in 'group_description', with: 'Tokugawa Shogunate' + click_button "Create group" + end + + step 'I should be redirected to group "Samurai" page' do + current_path.should == group_path(Group.last) + end + + step 'I should see newly created group "Samurai"' do + page.should have_content "Samurai" + page.should have_content "Tokugawa Shogunate" + page.should have_content "Currently you are only seeing events from the" + end + + step 'I change group "Owned" name to "new-name"' do + fill_in 'group_name', with: 'new-name' + click_button "Save group" + end + + step 'I should see new group "Owned" name' do + within ".navbar-gitlab" do + page.should have_content "group: new-name" + end + end + + step 'I change group "Owned" avatar' do + attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png')) + click_button "Save group" + Group.find_by(name: "Owned").reload + end + + step 'I should see new group "Owned" avatar' do + Group.find_by(name: "Owned").avatar.should be_instance_of AttachmentUploader + Group.find_by(name: "Owned").avatar.url.should == "/uploads/group/avatar/#{ Group.find_by(name:"Owned").id }/gitlab_logo.png" + end + + step 'I should see the "Remove avatar" button' do + page.should have_link("Remove avatar") + end + + step 'I have group "Owned" avatar' do + attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png')) + click_button "Save group" + Group.find_by(name: "Owned").reload + end + + step 'I remove group "Owned" avatar' do + click_link "Remove avatar" + Group.find_by(name: "Owned").reload + end + + step 'I should not see group "Owned" avatar' do + Group.find_by(name: "Owned").avatar?.should be_false + end + + step 'I should not see the "Remove avatar" button' do + page.should_not have_link("Remove avatar") + end + + step 'I click on the "Remove User From Group" button for "John Doe"' do + find(:css, 'li', text: "John Doe").find(:css, 'a.btn-remove').click + # poltergeist always confirms popups. + end + + step 'I click on the "Remove User From Group" button for "Mary Jane"' do + find(:css, 'li', text: "Mary Jane").find(:css, 'a.btn-remove').click + # poltergeist always confirms popups. + end + + step 'I should not see the "Remove User From Group" button for "John Doe"' do + find(:css, 'li', text: "John Doe").should_not have_selector(:css, 'a.btn-remove') + # poltergeist always confirms popups. + end + + step 'I should not see the "Remove User From Group" button for "Mary Jane"' do + find(:css, 'li', text: "Mary Jane").should_not have_selector(:css, 'a.btn-remove') + # poltergeist always confirms popups. + end + + step 'I search for \'Mary\' member' do + within '.member-search-form' do + fill_in 'search', with: 'Mary' + click_button 'Search' + end + end + + step 'I click on group milestones' do + click_link 'Milestones' + end + + step 'I should see group milestones index page has no milestones' do + page.should have_content('No milestones to show') + end + + step 'Group has projects with milestones' do + group_milestone + end + + step 'I should see group milestones index page with milestones' do + page.should have_content('Version 7.2') + page.should have_content('GL-113') + page.should have_link('2 Issues', href: group_milestone_path("owned", "version-7-2", title: "Version 7.2")) + page.should have_link('3 Merge Requests', href: group_milestone_path("owned", "gl-113", title: "GL-113")) + end + + step 'I click on one group milestone' do + click_link 'GL-113' + end + + step 'I should see group milestone with descriptions and expiry date' do + page.should have_content('Lorem Ipsum is simply dummy text of the printing and typesetting industry') + page.should have_content('expires at Aug 20, 2114') + end + + step 'I should see group milestone with all issues and MRs assigned to that milestone' do + page.should have_content('Milestone GL-113') + page.should have_content('Progress: 0 closed – 4 open') + page.should have_link(@issue1.title, href: project_issue_path(@project1, @issue1)) + page.should have_link(@mr3.title, href: project_merge_request_path(@project3, @mr3)) + end + + protected + + def assigned_to_me(key) + project.send(key).where(assignee_id: current_user.id) + end + + def project + Group.find_by(name: "Owned").projects.first + end + + def group_milestone + group = Group.find_by(name: "Owned") + + @project1 = create :project, + group: group + project2 = create :project, + path: 'gitlab-ci', + group: group + @project3 = create :project, + path: 'cookbook-gitlab', + group: group + milestone1_project1 = create :milestone, + title: "Version 7.2", + project: @project1 + milestone1_project2 = create :milestone, + title: "Version 7.2", + project: project2 + milestone1_project3 = create :milestone, + title: "Version 7.2", + project: @project3 + milestone2_project1 = create :milestone, + title: "GL-113", + project: @project1 + milestone2_project2 = create :milestone, + title: "GL-113", + project: project2 + milestone2_project3 = create :milestone, + title: "GL-113", + project: @project3, + due_date: '2114-08-20', + description: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry' + @issue1 = create :issue, + project: @project1, + assignee: current_user, + author: current_user, + milestone: milestone2_project1 + issue2 = create :issue, + project: project2, + assignee: current_user, + author: current_user, + milestone: milestone1_project2 + issue3 = create :issue, + project: @project3, + assignee: current_user, + author: current_user, + milestone: milestone1_project1 + mr1 = create :merge_request, + source_project: @project1, + target_project: @project1, + assignee: current_user, + author: current_user, + milestone: milestone2_project1 + mr2 = create :merge_request, + source_project: project2, + target_project: project2, + assignee: current_user, + author: current_user, + milestone: milestone2_project2 + @mr3 = create :merge_request, + source_project: @project3, + target_project: @project3, + assignee: current_user, + author: current_user, + milestone: milestone2_project3 + end +end diff --git a/features/steps/help.rb b/features/steps/help.rb deleted file mode 100644 index 0d1c9c00376..00000000000 --- a/features/steps/help.rb +++ /dev/null @@ -1,21 +0,0 @@ -class Spinach::Features::Help < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedMarkdown - - step 'I visit the help page' do - visit help_path - end - - step 'I visit the "Rake Tasks" help page' do - visit help_page_path("raketasks", "maintenance") - end - - step 'I should see "Rake Tasks" page markdown rendered' do - page.should have_content "Gather information about GitLab and the system it runs on" - end - - step 'Header "Rebuild project satellites" should have correct ids and links' do - header_should_have_correct_id_and_link(2, '(Re-)Create satellite repositories', 're-create-satellite-repositories', '.documentation') - end -end diff --git a/features/steps/project/browse_branches.rb b/features/steps/project/browse_branches.rb deleted file mode 100644 index 3b1e51f179a..00000000000 --- a/features/steps/project/browse_branches.rb +++ /dev/null @@ -1,85 +0,0 @@ -class Spinach::Features::ProjectBrowseBranches < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - step 'I click link "All"' do - click_link "All" - end - - step 'I should see "Shop" all branches list' do - page.should have_content "Branches" - page.should have_content "master" - end - - step 'I click link "Protected"' do - click_link "Protected" - end - - step 'I should see "Shop" protected branches list' do - within ".protected-branches-list" do - page.should have_content "stable" - page.should_not have_content "master" - end - end - - step 'project "Shop" has protected branches' do - project = Project.find_by(name: "Shop") - project.protected_branches.create(name: "stable") - end - - step 'I click new branch link' do - click_link "New branch" - end - - step 'I submit new branch form' do - fill_in 'branch_name', with: 'deploy_keys' - fill_in 'ref', with: 'master' - click_button 'Create branch' - end - - step 'I submit new branch form with invalid name' do - fill_in 'branch_name', with: '1.0 stable' - fill_in 'ref', with: 'master' - click_button 'Create branch' - end - - step 'I submit new branch form with invalid reference' do - fill_in 'branch_name', with: 'foo' - fill_in 'ref', with: 'foo' - click_button 'Create branch' - end - - step 'I submit new branch form with branch that already exists' do - fill_in 'branch_name', with: 'master' - fill_in 'ref', with: 'master' - click_button 'Create branch' - end - - step 'I should see new branch created' do - page.should have_content 'deploy_keys' - end - - step 'I should see new an error that branch is invalid' do - page.should have_content 'Branch name invalid' - end - - step 'I should see new an error that ref is invalid' do - page.should have_content 'Invalid reference name' - end - - step 'I should see new an error that branch already exists' do - page.should have_content 'Branch already exists' - end - - step "I click branch 'improve/awesome' delete link" do - within '.js-branch-improve\/awesome' do - find('.btn-remove').click - sleep 0.05 - end - end - - step "I should not see branch 'improve/awesome'" do - all(visible: true).should_not have_content 'improve/awesome' - end -end diff --git a/features/steps/project/browse_commits.rb b/features/steps/project/browse_commits.rb deleted file mode 100644 index 2048818e88c..00000000000 --- a/features/steps/project/browse_commits.rb +++ /dev/null @@ -1,91 +0,0 @@ -class Spinach::Features::ProjectBrowseCommits < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - include RepoHelpers - - step 'I see project commits' do - commit = @project.repository.commit - page.should have_content(@project.name) - page.should have_content(commit.message[0..20]) - page.should have_content(commit.id.to_s[0..5]) - end - - step 'I click atom feed link' do - click_link "Feed" - end - - step 'I see commits atom feed' do - commit = @project.repository.commit - response_headers['Content-Type'].should have_content("application/atom+xml") - body.should have_selector("title", text: "Recent commits to #{@project.name}") - body.should have_selector("author email", text: commit.author_email) - body.should have_selector("entry summary", text: commit.description[0..10]) - end - - step 'I click on commit link' do - visit project_commit_path(@project, sample_commit.id) - end - - step 'I see commit info' do - page.should have_content sample_commit.message - page.should have_content "Showing #{sample_commit.files_changed_count} changed files" - end - - step 'I fill compare fields with refs' do - fill_in "from", with: sample_commit.parent_id - fill_in "to", with: sample_commit.id - click_button "Compare" - end - - step 'I see compared refs' do - page.should have_content "Compare View" - page.should have_content "Commits (1)" - page.should have_content "Showing 2 changed files" - end - - step 'I see breadcrumb links' do - page.should have_selector('ul.breadcrumb') - page.should have_selector('ul.breadcrumb a', count: 4) - end - - step 'I see commits stats' do - page.should have_content 'Top 50 Committers' - page.should have_content 'Committers' - page.should have_content 'Total commits' - page.should have_content 'Authors' - end - - step 'I visit big commit page' do - Commit::DIFF_SAFE_FILES = 20 - visit project_commit_path(@project, sample_big_commit.id) - end - - step 'I see big commit warning' do - page.should have_content sample_big_commit.message - page.should have_content "Too many changes" - Commit::DIFF_SAFE_FILES = 100 - end - - step 'I visit a commit with an image that changed' do - visit project_commit_path(@project, sample_image_commit.id) - end - - step 'The diff links to both the previous and current image' do - links = all('.two-up span div a') - links[0]['href'].should =~ %r{blob/#{sample_image_commit.old_blob_id}} - links[1]['href'].should =~ %r{blob/#{sample_image_commit.new_blob_id}} - end - - step 'I click side-by-side diff button' do - click_link "Side-by-side Diff" - end - - step 'I see side-by-side diff button' do - page.should have_content "Side-by-side Diff" - end - - step 'I see inline diff button' do - page.should have_content "Inline Diff" - end -end diff --git a/features/steps/project/browse_commits_user_lookup.rb b/features/steps/project/browse_commits_user_lookup.rb deleted file mode 100644 index 196c69eda65..00000000000 --- a/features/steps/project/browse_commits_user_lookup.rb +++ /dev/null @@ -1,48 +0,0 @@ -class Spinach::Features::ProjectBrowseCommitsUserLookup < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - step 'I click on commit link' do - visit project_commit_path(@project, sample_commit.id) - end - - step 'I click on another commit link' do - visit project_commit_path(@project, sample_commit.parent_id) - end - - step 'I have user with primary email' do - user_primary - end - - step 'I have user with secondary email' do - user_secondary - end - - step 'I see author based on primary email' do - check_author_link(sample_commit.author_email, user_primary) - end - - step 'I see author based on secondary email' do - check_author_link(sample_commit.author_email, user_secondary) - end - - def check_author_link(email, user) - author_link = find('.commit-author-link') - author_link['href'].should == user_path(user) - author_link['data-original-title'].should == email - find('.commit-author-name').text.should == user.name - end - - def user_primary - @user_primary ||= create(:user, email: 'dmitriy.zaporozhets@gmail.com') - end - - def user_secondary - @user_secondary ||= begin - user = create(:user, email: 'dzaporozhets@example.com') - create(:email, { user: user, email: 'dmitriy.zaporozhets@gmail.com' }) - user - end - end -end diff --git a/features/steps/project/browse_files.rb b/features/steps/project/browse_files.rb deleted file mode 100644 index 4310f519032..00000000000 --- a/features/steps/project/browse_files.rb +++ /dev/null @@ -1,176 +0,0 @@ -class Spinach::Features::ProjectBrowseFiles < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - include RepoHelpers - - step 'I should see files from repository' do - page.should have_content "VERSION" - page.should have_content ".gitignore" - page.should have_content "LICENSE" - end - - step 'I should see files from repository for "6d39438"' do - current_path.should == project_tree_path(@project, "6d39438") - page.should have_content ".gitignore" - page.should have_content "LICENSE" - end - - step 'I see the ".gitignore"' do - page.should have_content '.gitignore' - end - - step 'I don\'t see the ".gitignore"' do - page.should_not have_content '.gitignore' - end - - step 'I click on ".gitignore" file in repo' do - click_link ".gitignore" - end - - step 'I should see its content' do - page.should have_content old_gitignore_content - end - - step 'I should see its new content' do - page.should have_content new_gitignore_content - end - - step 'I click link "Raw"' do - click_link 'Raw' - end - - step 'I should see raw file content' do - source.should == sample_blob.data - end - - step 'I click button "Edit"' do - click_link 'Edit' - end - - step 'I can edit code' do - set_new_content - evaluate_script('editor.getValue()').should == new_gitignore_content - end - - step 'I edit code' do - set_new_content - end - - step 'I fill the new file name' do - fill_in :file_name, with: new_file_name - end - - step 'I fill the commit message' do - fill_in :commit_message, with: 'Not yet a commit message.' - end - - step 'I click link "Diff"' do - click_link 'Diff' - end - - step 'I click on "Commit changes"' do - click_button 'Commit changes' - end - - step 'I click on "Remove"' do - click_link 'Remove' - end - - step 'I click on "Remove file"' do - click_button 'Remove file' - end - - step 'I see diff' do - page.should have_css '.line_holder.new' - end - - step 'I click on "new file" link in repo' do - click_link 'new-file-link' - end - - step 'I can see new file page' do - page.should have_content "New file" - page.should have_content "File name" - page.should have_content "Commit message" - end - - step 'I click on files directory' do - click_link 'files' - end - - step 'I click on History link' do - click_link 'History' - end - - step 'I see Browse dir link' do - page.should have_link 'Browse Dir »' - page.should_not have_link 'Browse Code »' - end - - step 'I click on readme file' do - within '.tree-table' do - click_link 'README.md' - end - end - - step 'I see Browse file link' do - page.should have_link 'Browse File »' - page.should_not have_link 'Browse Code »' - end - - step 'I see Browse code link' do - page.should have_link 'Browse Code »' - page.should_not have_link 'Browse File »' - page.should_not have_link 'Browse Dir »' - end - - step 'I click on Permalink' do - click_link 'Permalink' - end - - step 'I am redirected to the files URL' do - current_path.should == project_tree_path(@project, 'master') - end - - step 'I am redirected to the ".gitignore"' do - expect(current_path).to eq(project_blob_path(@project, 'master/.gitignore')) - end - - step 'I am redirected to the permalink URL' do - expect(current_path).to eq(project_blob_path( - @project, @project.repository.commit.sha + '/.gitignore')) - end - - step 'I am redirected to the new file' do - expect(current_path).to eq(project_blob_path( - @project, 'master/' + new_file_name)) - end - - step "I don't see the permalink link" do - expect(page).not_to have_link('permalink') - end - - private - - def set_new_content - execute_script("editor.setValue('#{new_gitignore_content}')") - end - - # Content of the gitignore file on the seed repository. - def old_gitignore_content - '*.rbc' - end - - # Constant value that differs from the content - # of the gitignore of the seed repository. - def new_gitignore_content - old_gitignore_content + 'a' - end - - # Constant value that is a valid filename and - # not a filename present at root of the seed repository. - def new_file_name - 'not_a_file.md' - end -end diff --git a/features/steps/project/browse_git_repo.rb b/features/steps/project/browse_git_repo.rb deleted file mode 100644 index d8703aadb81..00000000000 --- a/features/steps/project/browse_git_repo.rb +++ /dev/null @@ -1,19 +0,0 @@ -class Spinach::Features::ProjectBrowseGitRepo < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - step 'I click on ".gitignore" file in repo' do - click_link ".gitignore" - end - - step 'I click Blame button' do - click_link 'Blame' - end - - step 'I should see git file blame' do - page.should have_content "*.rb" - page.should have_content "Dmitriy Zaporozhets" - page.should have_content "Initial commit" - end -end diff --git a/features/steps/project/browse_tags.rb b/features/steps/project/browse_tags.rb deleted file mode 100644 index 722c0a91076..00000000000 --- a/features/steps/project/browse_tags.rb +++ /dev/null @@ -1,82 +0,0 @@ -class Spinach::Features::ProjectBrowseTags < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - step 'I should see "Shop" all tags list' do - page.should have_content "Tags" - page.should have_content "v1.0.0" - end - - step 'I click new tag link' do - click_link 'New tag' - end - - step 'I submit new tag form' do - fill_in 'tag_name', with: 'v7.0' - fill_in 'ref', with: 'master' - click_button 'Create tag' - end - - step 'I submit new tag form with invalid name' do - fill_in 'tag_name', with: 'v 1.0' - fill_in 'ref', with: 'master' - click_button 'Create tag' - end - - step 'I submit new tag form with invalid reference' do - fill_in 'tag_name', with: 'foo' - fill_in 'ref', with: 'foo' - click_button 'Create tag' - end - - step 'I submit new tag form with tag that already exists' do - fill_in 'tag_name', with: 'v1.0.0' - fill_in 'ref', with: 'master' - click_button 'Create tag' - end - - step 'I should see new tag created' do - page.should have_content 'v7.0' - end - - step 'I should see new an error that tag is invalid' do - page.should have_content 'Tag name invalid' - end - - step 'I should see new an error that tag ref is invalid' do - page.should have_content 'Invalid reference name' - end - - step 'I should see new an error that tag already exists' do - page.should have_content 'Tag already exists' - end - - step "I delete tag 'v1.1.0'" do - within '.tags' do - first('.btn-remove').click - sleep 0.05 - end - end - - step "I should not see tag 'v1.1.0'" do - within '.tags' do - all(visible: true).should_not have_content 'v1.1.0' - end - end - - step 'I delete all tags' do - within '.tags' do - all('.btn-remove').each do |remove| - remove.click - sleep 0.05 - end - end - end - - step 'I should see tags info message' do - within '.tags' do - page.should have_content 'Repository has no tags yet.' - end - end -end diff --git a/features/steps/project/comments_on_commit_diffs.rb b/features/steps/project/comments_on_commit_diffs.rb deleted file mode 100644 index 50b978a5d23..00000000000 --- a/features/steps/project/comments_on_commit_diffs.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Spinach::Features::CommentsOnCommitDiffs < Spinach::FeatureSteps - include SharedAuthentication - include SharedDiffNote - include SharedPaths - include SharedProject -end diff --git a/features/steps/project/comments_on_commits.rb b/features/steps/project/comments_on_commits.rb deleted file mode 100644 index 03e6867c7b1..00000000000 --- a/features/steps/project/comments_on_commits.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Spinach::Features::CommentsOnCommits < Spinach::FeatureSteps - include SharedAuthentication - include SharedNote - include SharedPaths - include SharedProject -end diff --git a/features/steps/project/commits/branches.rb b/features/steps/project/commits/branches.rb new file mode 100644 index 00000000000..07f7e5796a3 --- /dev/null +++ b/features/steps/project/commits/branches.rb @@ -0,0 +1,85 @@ +class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + step 'I click link "All"' do + click_link "All" + end + + step 'I should see "Shop" all branches list' do + page.should have_content "Branches" + page.should have_content "master" + end + + step 'I click link "Protected"' do + click_link "Protected" + end + + step 'I should see "Shop" protected branches list' do + within ".protected-branches-list" do + page.should have_content "stable" + page.should_not have_content "master" + end + end + + step 'project "Shop" has protected branches' do + project = Project.find_by(name: "Shop") + project.protected_branches.create(name: "stable") + end + + step 'I click new branch link' do + click_link "New branch" + end + + step 'I submit new branch form' do + fill_in 'branch_name', with: 'deploy_keys' + fill_in 'ref', with: 'master' + click_button 'Create branch' + end + + step 'I submit new branch form with invalid name' do + fill_in 'branch_name', with: '1.0 stable' + fill_in 'ref', with: 'master' + click_button 'Create branch' + end + + step 'I submit new branch form with invalid reference' do + fill_in 'branch_name', with: 'foo' + fill_in 'ref', with: 'foo' + click_button 'Create branch' + end + + step 'I submit new branch form with branch that already exists' do + fill_in 'branch_name', with: 'master' + fill_in 'ref', with: 'master' + click_button 'Create branch' + end + + step 'I should see new branch created' do + page.should have_content 'deploy_keys' + end + + step 'I should see new an error that branch is invalid' do + page.should have_content 'Branch name invalid' + end + + step 'I should see new an error that ref is invalid' do + page.should have_content 'Invalid reference name' + end + + step 'I should see new an error that branch already exists' do + page.should have_content 'Branch already exists' + end + + step "I click branch 'improve/awesome' delete link" do + within '.js-branch-improve\/awesome' do + find('.btn-remove').click + sleep 0.05 + end + end + + step "I should not see branch 'improve/awesome'" do + all(visible: true).should_not have_content 'improve/awesome' + end +end diff --git a/features/steps/project/commits/comments.rb b/features/steps/project/commits/comments.rb new file mode 100644 index 00000000000..3d4d8ad6368 --- /dev/null +++ b/features/steps/project/commits/comments.rb @@ -0,0 +1,6 @@ +class Spinach::Features::ProjectCommitsComments < Spinach::FeatureSteps + include SharedAuthentication + include SharedNote + include SharedPaths + include SharedProject +end diff --git a/features/steps/project/commits/commits.rb b/features/steps/project/commits/commits.rb new file mode 100644 index 00000000000..c054e0e8282 --- /dev/null +++ b/features/steps/project/commits/commits.rb @@ -0,0 +1,91 @@ +class Spinach::Features::ProjectCommits < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + include RepoHelpers + + step 'I see project commits' do + commit = @project.repository.commit + page.should have_content(@project.name) + page.should have_content(commit.message[0..20]) + page.should have_content(commit.id.to_s[0..5]) + end + + step 'I click atom feed link' do + click_link "Feed" + end + + step 'I see commits atom feed' do + commit = @project.repository.commit + response_headers['Content-Type'].should have_content("application/atom+xml") + body.should have_selector("title", text: "Recent commits to #{@project.name}") + body.should have_selector("author email", text: commit.author_email) + body.should have_selector("entry summary", text: commit.description[0..10]) + end + + step 'I click on commit link' do + visit project_commit_path(@project, sample_commit.id) + end + + step 'I see commit info' do + page.should have_content sample_commit.message + page.should have_content "Showing #{sample_commit.files_changed_count} changed files" + end + + step 'I fill compare fields with refs' do + fill_in "from", with: sample_commit.parent_id + fill_in "to", with: sample_commit.id + click_button "Compare" + end + + step 'I see compared refs' do + page.should have_content "Compare View" + page.should have_content "Commits (1)" + page.should have_content "Showing 2 changed files" + end + + step 'I see breadcrumb links' do + page.should have_selector('ul.breadcrumb') + page.should have_selector('ul.breadcrumb a', count: 4) + end + + step 'I see commits stats' do + page.should have_content 'Top 50 Committers' + page.should have_content 'Committers' + page.should have_content 'Total commits' + page.should have_content 'Authors' + end + + step 'I visit big commit page' do + Commit::DIFF_SAFE_FILES = 20 + visit project_commit_path(@project, sample_big_commit.id) + end + + step 'I see big commit warning' do + page.should have_content sample_big_commit.message + page.should have_content "Too many changes" + Commit::DIFF_SAFE_FILES = 100 + end + + step 'I visit a commit with an image that changed' do + visit project_commit_path(@project, sample_image_commit.id) + end + + step 'The diff links to both the previous and current image' do + links = all('.two-up span div a') + links[0]['href'].should =~ %r{blob/#{sample_image_commit.old_blob_id}} + links[1]['href'].should =~ %r{blob/#{sample_image_commit.new_blob_id}} + end + + step 'I click side-by-side diff button' do + click_link "Side-by-side Diff" + end + + step 'I see side-by-side diff button' do + page.should have_content "Side-by-side Diff" + end + + step 'I see inline diff button' do + page.should have_content "Inline Diff" + end +end diff --git a/features/steps/project/commits/diff_comments.rb b/features/steps/project/commits/diff_comments.rb new file mode 100644 index 00000000000..b9d8cf2c5a5 --- /dev/null +++ b/features/steps/project/commits/diff_comments.rb @@ -0,0 +1,6 @@ +class Spinach::Features::ProjectCommitsDiffComments < Spinach::FeatureSteps + include SharedAuthentication + include SharedDiffNote + include SharedPaths + include SharedProject +end diff --git a/features/steps/project/commits/tags.rb b/features/steps/project/commits/tags.rb new file mode 100644 index 00000000000..3465fcbfd07 --- /dev/null +++ b/features/steps/project/commits/tags.rb @@ -0,0 +1,82 @@ +class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + step 'I should see "Shop" all tags list' do + page.should have_content "Tags" + page.should have_content "v1.0.0" + end + + step 'I click new tag link' do + click_link 'New tag' + end + + step 'I submit new tag form' do + fill_in 'tag_name', with: 'v7.0' + fill_in 'ref', with: 'master' + click_button 'Create tag' + end + + step 'I submit new tag form with invalid name' do + fill_in 'tag_name', with: 'v 1.0' + fill_in 'ref', with: 'master' + click_button 'Create tag' + end + + step 'I submit new tag form with invalid reference' do + fill_in 'tag_name', with: 'foo' + fill_in 'ref', with: 'foo' + click_button 'Create tag' + end + + step 'I submit new tag form with tag that already exists' do + fill_in 'tag_name', with: 'v1.0.0' + fill_in 'ref', with: 'master' + click_button 'Create tag' + end + + step 'I should see new tag created' do + page.should have_content 'v7.0' + end + + step 'I should see new an error that tag is invalid' do + page.should have_content 'Tag name invalid' + end + + step 'I should see new an error that tag ref is invalid' do + page.should have_content 'Invalid reference name' + end + + step 'I should see new an error that tag already exists' do + page.should have_content 'Tag already exists' + end + + step "I delete tag 'v1.1.0'" do + within '.tags' do + first('.btn-remove').click + sleep 0.05 + end + end + + step "I should not see tag 'v1.1.0'" do + within '.tags' do + all(visible: true).should_not have_content 'v1.1.0' + end + end + + step 'I delete all tags' do + within '.tags' do + all('.btn-remove').each do |remove| + remove.click + sleep 0.05 + end + end + end + + step 'I should see tags info message' do + within '.tags' do + page.should have_content 'Repository has no tags yet.' + end + end +end diff --git a/features/steps/project/commits/user_lookup.rb b/features/steps/project/commits/user_lookup.rb new file mode 100644 index 00000000000..0622fef43bb --- /dev/null +++ b/features/steps/project/commits/user_lookup.rb @@ -0,0 +1,48 @@ +class Spinach::Features::ProjectCommitsUserLookup < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + step 'I click on commit link' do + visit project_commit_path(@project, sample_commit.id) + end + + step 'I click on another commit link' do + visit project_commit_path(@project, sample_commit.parent_id) + end + + step 'I have user with primary email' do + user_primary + end + + step 'I have user with secondary email' do + user_secondary + end + + step 'I see author based on primary email' do + check_author_link(sample_commit.author_email, user_primary) + end + + step 'I see author based on secondary email' do + check_author_link(sample_commit.author_email, user_secondary) + end + + def check_author_link(email, user) + author_link = find('.commit-author-link') + author_link['href'].should == user_path(user) + author_link['data-original-title'].should == email + find('.commit-author-name').text.should == user.name + end + + def user_primary + @user_primary ||= create(:user, email: 'dmitriy.zaporozhets@gmail.com') + end + + def user_secondary + @user_secondary ||= begin + user = create(:user, email: 'dzaporozhets@example.com') + create(:email, { user: user, email: 'dmitriy.zaporozhets@gmail.com' }) + user + end + end +end diff --git a/features/steps/project/create.rb b/features/steps/project/create.rb index bcd2524c205..e1062a6ce39 100644 --- a/features/steps/project/create.rb +++ b/features/steps/project/create.rb @@ -1,4 +1,4 @@ -class Spinach::Features::CreateProject < Spinach::FeatureSteps +class Spinach::Features::ProjectCreate < Spinach::FeatureSteps include SharedAuthentication include SharedPaths diff --git a/features/steps/project/filter_labels.rb b/features/steps/project/filter_labels.rb deleted file mode 100644 index aaa0cfe3379..00000000000 --- a/features/steps/project/filter_labels.rb +++ /dev/null @@ -1,79 +0,0 @@ -class Spinach::Features::ProjectFilterLabels < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - step 'I should see "bug" in labels filter' do - within ".labels-filter" do - page.should have_content "bug" - end - end - - step 'I should see "feature" in labels filter' do - within ".labels-filter" do - page.should have_content "feature" - end - end - - step 'I should see "enhancement" in labels filter' do - within ".labels-filter" do - page.should have_content "enhancement" - end - end - - step 'I should see "Bugfix1" in issues list' do - within ".issues-list" do - page.should have_content "Bugfix1" - end - end - - step 'I should see "Bugfix2" in issues list' do - within ".issues-list" do - page.should have_content "Bugfix2" - end - end - - step 'I should not see "Bugfix2" in issues list' do - within ".issues-list" do - page.should_not have_content "Bugfix2" - end - end - - step 'I should not see "Feature1" in issues list' do - within ".issues-list" do - page.should_not have_content "Feature1" - end - end - - step 'I click link "bug"' do - within ".labels-filter" do - click_link "bug" - end - end - - step 'I click link "feature"' do - within ".labels-filter" do - click_link "feature" - end - end - - step 'project "Shop" has issue "Bugfix1" with labels: "bug", "feature"' do - project = Project.find_by(name: "Shop") - issue = create(:issue, title: "Bugfix1", project: project) - issue.labels << project.labels.find_by(title: 'bug') - issue.labels << project.labels.find_by(title: 'feature') - end - - step 'project "Shop" has issue "Bugfix2" with labels: "bug", "enhancement"' do - project = Project.find_by(name: "Shop") - issue = create(:issue, title: "Bugfix2", project: project) - issue.labels << project.labels.find_by(title: 'bug') - issue.labels << project.labels.find_by(title: 'enhancement') - end - - step 'project "Shop" has issue "Feature1" with labels: "feature"' do - project = Project.find_by(name: "Shop") - issue = create(:issue, title: "Feature1", project: project) - issue.labels << project.labels.find_by(title: 'feature') - end -end diff --git a/features/steps/project/fork.rb b/features/steps/project/fork.rb index 791c6b1ffb9..da50ba9ced0 100644 --- a/features/steps/project/fork.rb +++ b/features/steps/project/fork.rb @@ -1,4 +1,4 @@ -class Spinach::Features::ForkProject < Spinach::FeatureSteps +class Spinach::Features::ProjectFork < Spinach::FeatureSteps include SharedAuthentication include SharedPaths include SharedProject diff --git a/features/steps/project/issues.rb b/features/steps/project/issues.rb deleted file mode 100644 index b55b3c6c8a2..00000000000 --- a/features/steps/project/issues.rb +++ /dev/null @@ -1,236 +0,0 @@ -class Spinach::Features::ProjectIssues < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedNote - include SharedPaths - include SharedMarkdown - - step 'I should see "Release 0.4" in issues' do - page.should have_content "Release 0.4" - end - - step 'I should not see "Release 0.3" in issues' do - page.should_not have_content "Release 0.3" - end - - step 'I should not see "Tweet control" in issues' do - page.should_not have_content "Tweet control" - end - - step 'I click link "Closed"' do - click_link "Closed" - end - - step 'I should see "Release 0.3" in issues' do - page.should have_content "Release 0.3" - end - - step 'I should not see "Release 0.4" in issues' do - page.should_not have_content "Release 0.4" - end - - step 'I click link "All"' do - click_link "All" - end - - step 'I click link "Release 0.4"' do - click_link "Release 0.4" - end - - step 'I should see issue "Release 0.4"' do - page.should have_content "Release 0.4" - end - - step 'I click link "New Issue"' do - click_link "New Issue" - end - - step 'I submit new issue "500 error on profile"' do - fill_in "issue_title", with: "500 error on profile" - click_button "Submit new issue" - end - - step 'I submit new issue "500 error on profile" with label \'bug\'' do - fill_in "issue_title", with: "500 error on profile" - select 'bug', from: "Labels" - click_button "Submit new issue" - end - - step 'I click link "500 error on profile"' do - click_link "500 error on profile" - end - - step 'I should see label \'bug\' with issue' do - within '.issue-show-labels' do - page.should have_content 'bug' - end - end - - step 'I should see issue "500 error on profile"' do - issue = Issue.find_by(title: "500 error on profile") - page.should have_content issue.title - page.should have_content issue.author_name - page.should have_content issue.project.name - end - - step 'I fill in issue search with "Re"' do - filter_issue "Re" - end - - step 'I fill in issue search with "Bu"' do - filter_issue "Bu" - end - - step 'I fill in issue search with ".3"' do - filter_issue ".3" - end - - step 'I fill in issue search with "Something"' do - filter_issue "Something" - end - - step 'I fill in issue search with ""' do - filter_issue "" - end - - step 'project "Shop" has milestone "v2.2"' do - - milestone = create(:milestone, title: "v2.2", project: project) - - 3.times { create(:issue, project: project, milestone: milestone) } - end - - step 'project "Shop" has milestone "v3.0"' do - - milestone = create(:milestone, title: "v3.0", project: project) - - 3.times { create(:issue, project: project, milestone: milestone) } - end - - When 'I select milestone "v3.0"' do - select "v3.0", from: "milestone_id" - end - - step 'I should see selected milestone with title "v3.0"' do - issues_milestone_selector = "#issue_milestone_id_chzn > a" - find(issues_milestone_selector).should have_content("v3.0") - end - - When 'I select first assignee from "Shop" project' do - - first_assignee = project.users.first - select first_assignee.name, from: "assignee_id" - end - - step 'I should see first assignee from "Shop" as selected assignee' do - issues_assignee_selector = "#issue_assignee_id_chzn > a" - - assignee_name = project.users.first.name - find(issues_assignee_selector).should have_content(assignee_name) - end - - step 'project "Shop" have "Release 0.4" open issue' do - - create(:issue, - title: "Release 0.4", - project: project, - author: project.users.first, - description: "# Description header" - ) - end - - step 'project "Shop" have "Tweet control" open issue' do - create(:issue, - title: "Tweet control", - project: project, - author: project.users.first) - end - - step 'project "Shop" have "Release 0.3" closed issue' do - create(:closed_issue, - title: "Release 0.3", - project: project, - author: project.users.first) - end - - step 'empty project "Empty Project"' do - create :empty_project, name: 'Empty Project', namespace: @user.namespace - end - - When 'I visit empty project page' do - project = Project.find_by(name: 'Empty Project') - visit project_path(project) - end - - step 'I see empty project details with ssh clone info' do - project = Project.find_by(name: 'Empty Project') - all(:css, '.git-empty .clone').each do |element| - element.text.should include(project.url_to_repo) - end - end - - When "I visit empty project's issues page" do - project = Project.find_by(name: 'Empty Project') - visit project_issues_path(project) - end - - step 'I leave a comment with code block' do - within(".js-main-target-form") do - fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```" - click_button "Add Comment" - sleep 0.05 - end - end - - step 'The code block should be unchanged' do - page.should have_content("```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```") - end - - step 'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\'' do - issue = create(:issue, title: 'Bugfix1', description: 'Description for issue1', project: project) - end - - step 'project \'Shop\' has issue \'Feature1\' with description: \'Feature submitted for issue1\'' do - issue = create(:issue, title: 'Feature1', description: 'Feature submitted for issue1', project: project) - end - - step 'I fill in issue search with \'Description for issue1\'' do - filter_issue 'Description for issue' - end - - step 'I fill in issue search with \'issue1\'' do - filter_issue 'issue1' - end - - step 'I fill in issue search with \'Rock and roll\'' do - filter_issue 'Description for issue' - end - - step 'I should see \'Bugfix1\' in issues' do - page.should have_content 'Bugfix1' - end - - step 'I should see \'Feature1\' in issues' do - page.should have_content 'Feature1' - end - - step 'I should not see \'Bugfix1\' in issues' do - page.should_not have_content 'Bugfix1' - end - - step 'issue \'Release 0.4\' has label \'bug\'' do - label = project.labels.create!(name: 'bug', color: '#990000') - issue = Issue.find_by!(title: 'Release 0.4') - issue.labels << label - end - - step 'I click label \'bug\'' do - within ".issues-list" do - click_link 'bug' - end - end - - def filter_issue(text) - fill_in 'issue_search', with: text - end -end diff --git a/features/steps/project/issues/filter_labels.rb b/features/steps/project/issues/filter_labels.rb new file mode 100644 index 00000000000..e62fa9c84c8 --- /dev/null +++ b/features/steps/project/issues/filter_labels.rb @@ -0,0 +1,79 @@ +class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + step 'I should see "bug" in labels filter' do + within ".labels-filter" do + page.should have_content "bug" + end + end + + step 'I should see "feature" in labels filter' do + within ".labels-filter" do + page.should have_content "feature" + end + end + + step 'I should see "enhancement" in labels filter' do + within ".labels-filter" do + page.should have_content "enhancement" + end + end + + step 'I should see "Bugfix1" in issues list' do + within ".issues-list" do + page.should have_content "Bugfix1" + end + end + + step 'I should see "Bugfix2" in issues list' do + within ".issues-list" do + page.should have_content "Bugfix2" + end + end + + step 'I should not see "Bugfix2" in issues list' do + within ".issues-list" do + page.should_not have_content "Bugfix2" + end + end + + step 'I should not see "Feature1" in issues list' do + within ".issues-list" do + page.should_not have_content "Feature1" + end + end + + step 'I click link "bug"' do + within ".labels-filter" do + click_link "bug" + end + end + + step 'I click link "feature"' do + within ".labels-filter" do + click_link "feature" + end + end + + step 'project "Shop" has issue "Bugfix1" with labels: "bug", "feature"' do + project = Project.find_by(name: "Shop") + issue = create(:issue, title: "Bugfix1", project: project) + issue.labels << project.labels.find_by(title: 'bug') + issue.labels << project.labels.find_by(title: 'feature') + end + + step 'project "Shop" has issue "Bugfix2" with labels: "bug", "enhancement"' do + project = Project.find_by(name: "Shop") + issue = create(:issue, title: "Bugfix2", project: project) + issue.labels << project.labels.find_by(title: 'bug') + issue.labels << project.labels.find_by(title: 'enhancement') + end + + step 'project "Shop" has issue "Feature1" with labels: "feature"' do + project = Project.find_by(name: "Shop") + issue = create(:issue, title: "Feature1", project: project) + issue.labels << project.labels.find_by(title: 'feature') + end +end diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb new file mode 100644 index 00000000000..b55b3c6c8a2 --- /dev/null +++ b/features/steps/project/issues/issues.rb @@ -0,0 +1,236 @@ +class Spinach::Features::ProjectIssues < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedNote + include SharedPaths + include SharedMarkdown + + step 'I should see "Release 0.4" in issues' do + page.should have_content "Release 0.4" + end + + step 'I should not see "Release 0.3" in issues' do + page.should_not have_content "Release 0.3" + end + + step 'I should not see "Tweet control" in issues' do + page.should_not have_content "Tweet control" + end + + step 'I click link "Closed"' do + click_link "Closed" + end + + step 'I should see "Release 0.3" in issues' do + page.should have_content "Release 0.3" + end + + step 'I should not see "Release 0.4" in issues' do + page.should_not have_content "Release 0.4" + end + + step 'I click link "All"' do + click_link "All" + end + + step 'I click link "Release 0.4"' do + click_link "Release 0.4" + end + + step 'I should see issue "Release 0.4"' do + page.should have_content "Release 0.4" + end + + step 'I click link "New Issue"' do + click_link "New Issue" + end + + step 'I submit new issue "500 error on profile"' do + fill_in "issue_title", with: "500 error on profile" + click_button "Submit new issue" + end + + step 'I submit new issue "500 error on profile" with label \'bug\'' do + fill_in "issue_title", with: "500 error on profile" + select 'bug', from: "Labels" + click_button "Submit new issue" + end + + step 'I click link "500 error on profile"' do + click_link "500 error on profile" + end + + step 'I should see label \'bug\' with issue' do + within '.issue-show-labels' do + page.should have_content 'bug' + end + end + + step 'I should see issue "500 error on profile"' do + issue = Issue.find_by(title: "500 error on profile") + page.should have_content issue.title + page.should have_content issue.author_name + page.should have_content issue.project.name + end + + step 'I fill in issue search with "Re"' do + filter_issue "Re" + end + + step 'I fill in issue search with "Bu"' do + filter_issue "Bu" + end + + step 'I fill in issue search with ".3"' do + filter_issue ".3" + end + + step 'I fill in issue search with "Something"' do + filter_issue "Something" + end + + step 'I fill in issue search with ""' do + filter_issue "" + end + + step 'project "Shop" has milestone "v2.2"' do + + milestone = create(:milestone, title: "v2.2", project: project) + + 3.times { create(:issue, project: project, milestone: milestone) } + end + + step 'project "Shop" has milestone "v3.0"' do + + milestone = create(:milestone, title: "v3.0", project: project) + + 3.times { create(:issue, project: project, milestone: milestone) } + end + + When 'I select milestone "v3.0"' do + select "v3.0", from: "milestone_id" + end + + step 'I should see selected milestone with title "v3.0"' do + issues_milestone_selector = "#issue_milestone_id_chzn > a" + find(issues_milestone_selector).should have_content("v3.0") + end + + When 'I select first assignee from "Shop" project' do + + first_assignee = project.users.first + select first_assignee.name, from: "assignee_id" + end + + step 'I should see first assignee from "Shop" as selected assignee' do + issues_assignee_selector = "#issue_assignee_id_chzn > a" + + assignee_name = project.users.first.name + find(issues_assignee_selector).should have_content(assignee_name) + end + + step 'project "Shop" have "Release 0.4" open issue' do + + create(:issue, + title: "Release 0.4", + project: project, + author: project.users.first, + description: "# Description header" + ) + end + + step 'project "Shop" have "Tweet control" open issue' do + create(:issue, + title: "Tweet control", + project: project, + author: project.users.first) + end + + step 'project "Shop" have "Release 0.3" closed issue' do + create(:closed_issue, + title: "Release 0.3", + project: project, + author: project.users.first) + end + + step 'empty project "Empty Project"' do + create :empty_project, name: 'Empty Project', namespace: @user.namespace + end + + When 'I visit empty project page' do + project = Project.find_by(name: 'Empty Project') + visit project_path(project) + end + + step 'I see empty project details with ssh clone info' do + project = Project.find_by(name: 'Empty Project') + all(:css, '.git-empty .clone').each do |element| + element.text.should include(project.url_to_repo) + end + end + + When "I visit empty project's issues page" do + project = Project.find_by(name: 'Empty Project') + visit project_issues_path(project) + end + + step 'I leave a comment with code block' do + within(".js-main-target-form") do + fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```" + click_button "Add Comment" + sleep 0.05 + end + end + + step 'The code block should be unchanged' do + page.should have_content("```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```") + end + + step 'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\'' do + issue = create(:issue, title: 'Bugfix1', description: 'Description for issue1', project: project) + end + + step 'project \'Shop\' has issue \'Feature1\' with description: \'Feature submitted for issue1\'' do + issue = create(:issue, title: 'Feature1', description: 'Feature submitted for issue1', project: project) + end + + step 'I fill in issue search with \'Description for issue1\'' do + filter_issue 'Description for issue' + end + + step 'I fill in issue search with \'issue1\'' do + filter_issue 'issue1' + end + + step 'I fill in issue search with \'Rock and roll\'' do + filter_issue 'Description for issue' + end + + step 'I should see \'Bugfix1\' in issues' do + page.should have_content 'Bugfix1' + end + + step 'I should see \'Feature1\' in issues' do + page.should have_content 'Feature1' + end + + step 'I should not see \'Bugfix1\' in issues' do + page.should_not have_content 'Bugfix1' + end + + step 'issue \'Release 0.4\' has label \'bug\'' do + label = project.labels.create!(name: 'bug', color: '#990000') + issue = Issue.find_by!(title: 'Release 0.4') + issue.labels << label + end + + step 'I click label \'bug\'' do + within ".issues-list" do + click_link 'bug' + end + end + + def filter_issue(text) + fill_in 'issue_search', with: text + end +end diff --git a/features/steps/project/issues/labels.rb b/features/steps/project/issues/labels.rb new file mode 100644 index 00000000000..3e3e90824b4 --- /dev/null +++ b/features/steps/project/issues/labels.rb @@ -0,0 +1,101 @@ +class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + step 'I visit \'bug\' label edit page' do + visit edit_project_label_path(project, bug_label) + end + + step 'I remove label \'bug\'' do + within "#label_#{bug_label.id}" do + click_link 'Remove' + end + end + + step 'I delete all labels' do + within '.labels' do + all('.btn-remove').each do |remove| + remove.click + sleep 0.05 + end + end + end + + step 'I should see labels help message' do + within '.labels' do + page.should have_content 'Create first label or generate default set of '\ + 'labels' + end + end + + step 'I submit new label \'support\'' do + fill_in 'Title', with: 'support' + fill_in 'Background Color', with: '#F95610' + click_button 'Save' + end + + step 'I submit new label \'bug\'' do + fill_in 'Title', with: 'bug' + fill_in 'Background Color', with: '#F95610' + click_button 'Save' + end + + step 'I submit new label with invalid color' do + fill_in 'Title', with: 'support' + fill_in 'Background Color', with: '#12' + click_button 'Save' + end + + step 'I should see label label exist error message' do + within '.label-form' do + page.should have_content 'Title has already been taken' + end + end + + step 'I should see label color error message' do + within '.label-form' do + page.should have_content 'Color is invalid' + end + end + + step 'I should see label \'feature\'' do + within '.manage-labels-list' do + page.should have_content 'feature' + end + end + + step 'I should see label \'bug\'' do + within '.manage-labels-list' do + page.should have_content 'bug' + end + end + + step 'I should not see label \'bug\'' do + within '.manage-labels-list' do + page.should_not have_content 'bug' + end + end + + step 'I should see label \'support\'' do + within '.manage-labels-list' do + page.should have_content 'support' + end + end + + step 'I change label \'bug\' to \'fix\'' do + fill_in 'Title', with: 'fix' + fill_in 'Background Color', with: '#F15610' + click_button 'Save' + end + + step 'I should see label \'fix\'' do + within '.manage-labels-list' do + page.should have_content 'fix' + end + end + + def bug_label + project.labels.find_or_create_by(title: 'bug') + end +end diff --git a/features/steps/project/issues/milestones.rb b/features/steps/project/issues/milestones.rb new file mode 100644 index 00000000000..89d7af3c9ee --- /dev/null +++ b/features/steps/project/issues/milestones.rb @@ -0,0 +1,59 @@ +class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + include SharedMarkdown + + step 'I should see milestone "v2.2"' do + milestone = @project.milestones.find_by(title: "v2.2") + page.should have_content(milestone.title[0..10]) + page.should have_content(milestone.expires_at) + page.should have_content("Browse Issues") + end + + step 'I click link "v2.2"' do + click_link "v2.2" + end + + step 'I click link "New Milestone"' do + click_link "New Milestone" + end + + step 'I submit new milestone "v2.3"' do + fill_in "milestone_title", with: "v2.3" + click_button "Create milestone" + end + + step 'I should see milestone "v2.3"' do + milestone = @project.milestones.find_by(title: "v2.3") + page.should have_content(milestone.title[0..10]) + page.should have_content(milestone.expires_at) + page.should have_content("Browse Issues") + 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 'the milestone has open and closed issues' do + project = Project.find_by(name: "Shop") + milestone = project.milestones.find_by(title: 'v2.2') + + # 3 Open issues created above; create one closed issue + create(:closed_issue, project: project, milestone: milestone) + end + + When 'I click link "All Issues"' do + click_link 'All Issues' + end + + step 'I should see 3 issues' do + page.should have_selector('#tab-issues li.issue-row', count: 4) + end +end diff --git a/features/steps/project/labels.rb b/features/steps/project/labels.rb deleted file mode 100644 index b287e183b91..00000000000 --- a/features/steps/project/labels.rb +++ /dev/null @@ -1,101 +0,0 @@ -class Spinach::Features::ProjectLabels < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - step 'I visit \'bug\' label edit page' do - visit edit_project_label_path(project, bug_label) - end - - step 'I remove label \'bug\'' do - within "#label_#{bug_label.id}" do - click_link 'Remove' - end - end - - step 'I delete all labels' do - within '.labels' do - all('.btn-remove').each do |remove| - remove.click - sleep 0.05 - end - end - end - - step 'I should see labels help message' do - within '.labels' do - page.should have_content 'Create first label or generate default set of '\ - 'labels' - end - end - - step 'I submit new label \'support\'' do - fill_in 'Title', with: 'support' - fill_in 'Background Color', with: '#F95610' - click_button 'Save' - end - - step 'I submit new label \'bug\'' do - fill_in 'Title', with: 'bug' - fill_in 'Background Color', with: '#F95610' - click_button 'Save' - end - - step 'I submit new label with invalid color' do - fill_in 'Title', with: 'support' - fill_in 'Background Color', with: '#12' - click_button 'Save' - end - - step 'I should see label label exist error message' do - within '.label-form' do - page.should have_content 'Title has already been taken' - end - end - - step 'I should see label color error message' do - within '.label-form' do - page.should have_content 'Color is invalid' - end - end - - step 'I should see label \'feature\'' do - within '.manage-labels-list' do - page.should have_content 'feature' - end - end - - step 'I should see label \'bug\'' do - within '.manage-labels-list' do - page.should have_content 'bug' - end - end - - step 'I should not see label \'bug\'' do - within '.manage-labels-list' do - page.should_not have_content 'bug' - end - end - - step 'I should see label \'support\'' do - within '.manage-labels-list' do - page.should have_content 'support' - end - end - - step 'I change label \'bug\' to \'fix\'' do - fill_in 'Title', with: 'fix' - fill_in 'Background Color', with: '#F15610' - click_button 'Save' - end - - step 'I should see label \'fix\'' do - within '.manage-labels-list' do - page.should have_content 'fix' - end - end - - def bug_label - project.labels.find_or_create_by(title: 'bug') - end -end diff --git a/features/steps/project/markdown_render.rb b/features/steps/project/markdown_render.rb deleted file mode 100644 index a8631af2e05..00000000000 --- a/features/steps/project/markdown_render.rb +++ /dev/null @@ -1,288 +0,0 @@ -# If you need to modify the existing seed repository for your tests, -# it is recommended that you make the changes on the `markdown` branch of the seed project repository, -# which should only be used by tests in this file. See `/spec/factories.rb#project` for more info. -class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedMarkdown - - step 'I own project "Delta"' do - @project = Project.find_by(name: "Delta") - @project ||= create(:project, name: "Delta", namespace: @user.namespace) - @project.team << [@user, :master] - end - - step 'I should see files from repository in markdown' do - current_path.should == project_tree_path(@project, "markdown") - page.should have_content "README.md" - page.should have_content "CHANGELOG" - end - - step 'I should see rendered README which contains correct links' do - page.should have_content "Welcome to GitLab GitLab is a free project and repository management application" - page.should have_link "GitLab API doc" - page.should have_link "GitLab API website" - page.should have_link "Rake tasks" - page.should have_link "backup and restore procedure" - page.should have_link "GitLab API doc directory" - page.should have_link "Maintenance" - end - - step 'I click on Gitlab API in README' do - click_link "GitLab API doc" - end - - step 'I should see correct document rendered' do - current_path.should == project_blob_path(@project, "markdown/doc/api/README.md") - page.should have_content "All API requests require authentication" - end - - step 'I click on Rake tasks in README' do - click_link "Rake tasks" - end - - step 'I should see correct directory rendered' do - current_path.should == project_tree_path(@project, "markdown/doc/raketasks") - page.should have_content "backup_restore.md" - page.should have_content "maintenance.md" - end - - step 'I click on GitLab API doc directory in README' do - click_link "GitLab API doc directory" - end - - step 'I should see correct doc/api directory rendered' do - current_path.should == project_tree_path(@project, "markdown/doc/api") - page.should have_content "README.md" - page.should have_content "users.md" - end - - step 'I click on Maintenance in README' do - click_link "Maintenance" - end - - step 'I should see correct maintenance file rendered' do - current_path.should == project_blob_path(@project, "markdown/doc/raketasks/maintenance.md") - page.should have_content "bundle exec rake gitlab:env:info RAILS_ENV=production" - end - - step 'I click on link "empty" in the README' do - within('.readme-holder') do - click_link "empty" - end - end - - step 'I click on link "id" in the README' do - within('.readme-holder') do - click_link "#id" - end - end - - step 'I navigate to the doc/api/README' do - within '.tree-table' do - click_link "doc" - end - - within '.tree-table' do - click_link "api" - end - - within '.tree-table' do - click_link "README.md" - end - end - - step 'I see correct file rendered' do - current_path.should == project_blob_path(@project, "markdown/doc/api/README.md") - page.should have_content "Contents" - page.should have_link "Users" - page.should have_link "Rake tasks" - end - - step 'I click on users in doc/api/README' do - click_link "Users" - end - - step 'I should see the correct document file' do - current_path.should == project_blob_path(@project, "markdown/doc/api/users.md") - page.should have_content "Get a list of users." - end - - step 'I click on raketasks in doc/api/README' do - click_link "Rake tasks" - end - - # Markdown branch - - When 'I visit markdown branch' do - visit project_tree_path(@project, "markdown") - end - - When 'I visit markdown branch "README.md" blob' do - visit project_blob_path(@project, "markdown/README.md") - end - - When 'I visit markdown branch "d" tree' do - visit project_tree_path(@project, "markdown/d") - end - - When 'I visit markdown branch "d/README.md" blob' do - visit project_blob_path(@project, "markdown/d/README.md") - end - - step 'I should see files from repository in markdown branch' do - current_path.should == project_tree_path(@project, "markdown") - page.should have_content "README.md" - page.should have_content "CHANGELOG" - end - - step 'I see correct file rendered in markdown branch' do - current_path.should == project_blob_path(@project, "markdown/doc/api/README.md") - page.should have_content "Contents" - page.should have_link "Users" - page.should have_link "Rake tasks" - end - - step 'I should see correct document rendered for markdown branch' do - current_path.should == project_blob_path(@project, "markdown/doc/api/README.md") - page.should have_content "All API requests require authentication" - end - - step 'I should see correct directory rendered for markdown branch' do - current_path.should == project_tree_path(@project, "markdown/doc/raketasks") - page.should have_content "backup_restore.md" - page.should have_content "maintenance.md" - end - - step 'I should see the users document file in markdown branch' do - current_path.should == project_blob_path(@project, "markdown/doc/api/users.md") - page.should have_content "Get a list of users." - end - - # Expected link contents - - step 'The link with text "empty" should have url "tree/markdown"' do - find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown") - end - - step 'The link with text "empty" should have url "blob/markdown/README.md"' do - find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") - end - - step 'The link with text "empty" should have url "tree/markdown/d"' do - find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown/d") - end - - step 'The link with text "empty" should have '\ - 'url "blob/markdown/d/README.md"' do - find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/d/README.md") - end - - step 'The link with text "ID" should have url "tree/markdownID"' do - find('a', text: /^#id$/)['href'] == current_host + project_tree_path(@project, "markdown") + '#id' - end - - step 'The link with text "/ID" should have url "tree/markdownID"' do - find('a', text: /^\/#id$/)['href'] == current_host + project_tree_path(@project, "markdown") + '#id' - end - - step 'The link with text "README.mdID" '\ - 'should have url "blob/markdown/README.mdID"' do - find('a', text: /^README.md#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id' - end - - step 'The link with text "d/README.mdID" should have '\ - 'url "blob/markdown/d/README.mdID"' do - find('a', text: /^d\/README.md#id$/)['href'] == current_host + project_blob_path(@project, "d/markdown/README.md") + '#id' - end - - step 'The link with text "ID" should have url "blob/markdown/README.mdID"' do - find('a', text: /^#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id' - end - - step 'The link with text "/ID" should have url "blob/markdown/README.mdID"' do - find('a', text: /^\/#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id' - end - - # Wiki - - step 'I go to wiki page' do - click_link "Wiki" - current_path.should == project_wiki_path(@project, "home") - end - - step 'I add various links to the wiki page' do - fill_in "wiki[content]", with: "[test](test)\n[GitLab API doc](api)\n[Rake tasks](raketasks)\n" - fill_in "wiki[message]", with: "Adding links to wiki" - click_button "Create page" - end - - step 'Wiki page should have added links' do - current_path.should == project_wiki_path(@project, "home") - page.should have_content "test GitLab API doc Rake tasks" - end - - step 'I add a header to the wiki page' do - fill_in "wiki[content]", with: "# Wiki header\n" - fill_in "wiki[message]", with: "Add header to wiki" - click_button "Create page" - end - - step 'Wiki header should have correct id and link' do - header_should_have_correct_id_and_link(1, 'Wiki header', 'wiki-header') - end - - step 'I click on test link' do - click_link "test" - end - - step 'I see new wiki page named test' do - current_path.should == project_wiki_path(@project, "test") - page.should have_content "Editing" - end - - When 'I go back to wiki page home' do - visit project_wiki_path(@project, "home") - current_path.should == project_wiki_path(@project, "home") - end - - step 'I click on GitLab API doc link' do - click_link "GitLab API" - end - - step 'I see Gitlab API document' do - current_path.should == project_wiki_path(@project, "api") - page.should have_content "Editing" - end - - step 'I click on Rake tasks link' do - click_link "Rake tasks" - end - - step 'I see Rake tasks directory' do - current_path.should == project_wiki_path(@project, "raketasks") - page.should have_content "Editing" - end - - step 'I go directory which contains README file' do - visit project_tree_path(@project, "markdown/doc/api") - current_path.should == project_tree_path(@project, "markdown/doc/api") - end - - step 'I click on a relative link in README' do - click_link "Users" - end - - step 'I should see the correct markdown' do - current_path.should == project_blob_path(@project, "markdown/doc/api/users.md") - page.should have_content "List users" - end - - step 'Header "Application details" should have correct id and link' do - header_should_have_correct_id_and_link(2, 'Application details', 'application-details') - end - - step 'Header "GitLab API" should have correct id and link' do - header_should_have_correct_id_and_link(1, 'GitLab API', 'gitlab-api') - end -end diff --git a/features/steps/project/milestones.rb b/features/steps/project/milestones.rb deleted file mode 100644 index 13f917a6279..00000000000 --- a/features/steps/project/milestones.rb +++ /dev/null @@ -1,59 +0,0 @@ -class Spinach::Features::ProjectMilestones < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - include SharedMarkdown - - step 'I should see milestone "v2.2"' do - milestone = @project.milestones.find_by(title: "v2.2") - page.should have_content(milestone.title[0..10]) - page.should have_content(milestone.expires_at) - page.should have_content("Browse Issues") - end - - step 'I click link "v2.2"' do - click_link "v2.2" - end - - step 'I click link "New Milestone"' do - click_link "New Milestone" - end - - step 'I submit new milestone "v2.3"' do - fill_in "milestone_title", with: "v2.3" - click_button "Create milestone" - end - - step 'I should see milestone "v2.3"' do - milestone = @project.milestones.find_by(title: "v2.3") - page.should have_content(milestone.title[0..10]) - page.should have_content(milestone.expires_at) - page.should have_content("Browse Issues") - 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 'the milestone has open and closed issues' do - project = Project.find_by(name: "Shop") - milestone = project.milestones.find_by(title: 'v2.2') - - # 3 Open issues created above; create one closed issue - create(:closed_issue, project: project, milestone: milestone) - end - - When 'I click link "All Issues"' do - click_link 'All Issues' - end - - step 'I should see 3 issues' do - page.should have_selector('#tab-issues li.issue-row', count: 4) - end -end diff --git a/features/steps/project/multiselect_blob.rb b/features/steps/project/multiselect_blob.rb deleted file mode 100644 index 611289a6162..00000000000 --- a/features/steps/project/multiselect_blob.rb +++ /dev/null @@ -1,58 +0,0 @@ -class Spinach::Features::ProjectMultiselectBlob < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - class << self - def click_line_steps(*line_numbers) - line_numbers.each do |line_number| - step "I click line #{line_number} in file" do - find("#L#{line_number}").click - end - - step "I shift-click line #{line_number} in file" do - script = "$('#L#{line_number}').trigger($.Event('click', { shiftKey: true }));" - execute_script(script) - end - end - end - - def check_state_steps(*ranges) - ranges.each do |range| - fragment = range.kind_of?(Array) ? "L#{range.first}-#{range.last}" : "L#{range}" - pluralization = range.kind_of?(Array) ? "s" : "" - - step "I should see \"#{fragment}\" as URI fragment" do - URI.parse(current_url).fragment.should == fragment - end - - step "I should see line#{pluralization} #{fragment[1..-1]} highlighted" do - ids = Array(range).map { |n| "LC#{n}" } - extra = false - - highlighted = all("#tree-content-holder .highlight .line.hll") - highlighted.each do |element| - extra ||= ids.delete(element[:id]).nil? - end - - extra.should be_false and ids.should be_empty - end - end - end - end - - click_line_steps *Array(1..5) - check_state_steps *Array(1..5), Array(1..2), Array(1..3), Array(1..4), Array(1..5), Array(3..5) - - step 'I go back in history' do - go_back - end - - step 'I go forward in history' do - go_forward - end - - step 'I click on ".gitignore" file in repo' do - click_link ".gitignore" - end -end diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index f543e47b4c2..f7fff8e64f9 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -1,4 +1,4 @@ -class Spinach::Features::ProjectFeature < Spinach::FeatureSteps +class Spinach::Features::Project < Spinach::FeatureSteps include SharedAuthentication include SharedProject include SharedPaths diff --git a/features/steps/project/search_code.rb b/features/steps/project/search_code.rb deleted file mode 100644 index 5753296251f..00000000000 --- a/features/steps/project/search_code.rb +++ /dev/null @@ -1,19 +0,0 @@ -class Spinach::Features::ProjectSearchCode < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - step 'I search for term "coffee"' do - fill_in "search", with: "coffee" - click_button "Go" - end - - step 'I should see files from repository containing "coffee"' do - page.should have_content 'coffee' - page.should have_content 'CONTRIBUTING.md' - end - - step 'I should see empty result' do - page.should have_content "We couldn't find any matching" - end -end diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb new file mode 100644 index 00000000000..0642302e797 --- /dev/null +++ b/features/steps/project/source/browse_files.rb @@ -0,0 +1,176 @@ +class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + include RepoHelpers + + step 'I should see files from repository' do + page.should have_content "VERSION" + page.should have_content ".gitignore" + page.should have_content "LICENSE" + end + + step 'I should see files from repository for "6d39438"' do + current_path.should == project_tree_path(@project, "6d39438") + page.should have_content ".gitignore" + page.should have_content "LICENSE" + end + + step 'I see the ".gitignore"' do + page.should have_content '.gitignore' + end + + step 'I don\'t see the ".gitignore"' do + page.should_not have_content '.gitignore' + end + + step 'I click on ".gitignore" file in repo' do + click_link ".gitignore" + end + + step 'I should see its content' do + page.should have_content old_gitignore_content + end + + step 'I should see its new content' do + page.should have_content new_gitignore_content + end + + step 'I click link "Raw"' do + click_link 'Raw' + end + + step 'I should see raw file content' do + source.should == sample_blob.data + end + + step 'I click button "Edit"' do + click_link 'Edit' + end + + step 'I can edit code' do + set_new_content + evaluate_script('editor.getValue()').should == new_gitignore_content + end + + step 'I edit code' do + set_new_content + end + + step 'I fill the new file name' do + fill_in :file_name, with: new_file_name + end + + step 'I fill the commit message' do + fill_in :commit_message, with: 'Not yet a commit message.' + end + + step 'I click link "Diff"' do + click_link 'Diff' + end + + step 'I click on "Commit changes"' do + click_button 'Commit changes' + end + + step 'I click on "Remove"' do + click_link 'Remove' + end + + step 'I click on "Remove file"' do + click_button 'Remove file' + end + + step 'I see diff' do + page.should have_css '.line_holder.new' + end + + step 'I click on "new file" link in repo' do + click_link 'new-file-link' + end + + step 'I can see new file page' do + page.should have_content "New file" + page.should have_content "File name" + page.should have_content "Commit message" + end + + step 'I click on files directory' do + click_link 'files' + end + + step 'I click on History link' do + click_link 'History' + end + + step 'I see Browse dir link' do + page.should have_link 'Browse Dir »' + page.should_not have_link 'Browse Code »' + end + + step 'I click on readme file' do + within '.tree-table' do + click_link 'README.md' + end + end + + step 'I see Browse file link' do + page.should have_link 'Browse File »' + page.should_not have_link 'Browse Code »' + end + + step 'I see Browse code link' do + page.should have_link 'Browse Code »' + page.should_not have_link 'Browse File »' + page.should_not have_link 'Browse Dir »' + end + + step 'I click on Permalink' do + click_link 'Permalink' + end + + step 'I am redirected to the files URL' do + current_path.should == project_tree_path(@project, 'master') + end + + step 'I am redirected to the ".gitignore"' do + expect(current_path).to eq(project_blob_path(@project, 'master/.gitignore')) + end + + step 'I am redirected to the permalink URL' do + expect(current_path).to eq(project_blob_path( + @project, @project.repository.commit.sha + '/.gitignore')) + end + + step 'I am redirected to the new file' do + expect(current_path).to eq(project_blob_path( + @project, 'master/' + new_file_name)) + end + + step "I don't see the permalink link" do + expect(page).not_to have_link('permalink') + end + + private + + def set_new_content + execute_script("editor.setValue('#{new_gitignore_content}')") + end + + # Content of the gitignore file on the seed repository. + def old_gitignore_content + '*.rbc' + end + + # Constant value that differs from the content + # of the gitignore of the seed repository. + def new_gitignore_content + old_gitignore_content + 'a' + end + + # Constant value that is a valid filename and + # not a filename present at root of the seed repository. + def new_file_name + 'not_a_file.md' + end +end diff --git a/features/steps/project/source/git_blame.rb b/features/steps/project/source/git_blame.rb new file mode 100644 index 00000000000..e29a816c51b --- /dev/null +++ b/features/steps/project/source/git_blame.rb @@ -0,0 +1,19 @@ +class Spinach::Features::ProjectSourceGitBlame < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + step 'I click on ".gitignore" file in repo' do + click_link ".gitignore" + end + + step 'I click Blame button' do + click_link 'Blame' + end + + step 'I should see git file blame' do + page.should have_content "*.rb" + page.should have_content "Dmitriy Zaporozhets" + page.should have_content "Initial commit" + end +end diff --git a/features/steps/project/source/markdown_render.rb b/features/steps/project/source/markdown_render.rb new file mode 100644 index 00000000000..53578ee5970 --- /dev/null +++ b/features/steps/project/source/markdown_render.rb @@ -0,0 +1,288 @@ +# If you need to modify the existing seed repository for your tests, +# it is recommended that you make the changes on the `markdown` branch of the seed project repository, +# which should only be used by tests in this file. See `/spec/factories.rb#project` for more info. +class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedMarkdown + + step 'I own project "Delta"' do + @project = Project.find_by(name: "Delta") + @project ||= create(:project, name: "Delta", namespace: @user.namespace) + @project.team << [@user, :master] + end + + step 'I should see files from repository in markdown' do + current_path.should == project_tree_path(@project, "markdown") + page.should have_content "README.md" + page.should have_content "CHANGELOG" + end + + step 'I should see rendered README which contains correct links' do + page.should have_content "Welcome to GitLab GitLab is a free project and repository management application" + page.should have_link "GitLab API doc" + page.should have_link "GitLab API website" + page.should have_link "Rake tasks" + page.should have_link "backup and restore procedure" + page.should have_link "GitLab API doc directory" + page.should have_link "Maintenance" + end + + step 'I click on Gitlab API in README' do + click_link "GitLab API doc" + end + + step 'I should see correct document rendered' do + current_path.should == project_blob_path(@project, "markdown/doc/api/README.md") + page.should have_content "All API requests require authentication" + end + + step 'I click on Rake tasks in README' do + click_link "Rake tasks" + end + + step 'I should see correct directory rendered' do + current_path.should == project_tree_path(@project, "markdown/doc/raketasks") + page.should have_content "backup_restore.md" + page.should have_content "maintenance.md" + end + + step 'I click on GitLab API doc directory in README' do + click_link "GitLab API doc directory" + end + + step 'I should see correct doc/api directory rendered' do + current_path.should == project_tree_path(@project, "markdown/doc/api") + page.should have_content "README.md" + page.should have_content "users.md" + end + + step 'I click on Maintenance in README' do + click_link "Maintenance" + end + + step 'I should see correct maintenance file rendered' do + current_path.should == project_blob_path(@project, "markdown/doc/raketasks/maintenance.md") + page.should have_content "bundle exec rake gitlab:env:info RAILS_ENV=production" + end + + step 'I click on link "empty" in the README' do + within('.readme-holder') do + click_link "empty" + end + end + + step 'I click on link "id" in the README' do + within('.readme-holder') do + click_link "#id" + end + end + + step 'I navigate to the doc/api/README' do + within '.tree-table' do + click_link "doc" + end + + within '.tree-table' do + click_link "api" + end + + within '.tree-table' do + click_link "README.md" + end + end + + step 'I see correct file rendered' do + current_path.should == project_blob_path(@project, "markdown/doc/api/README.md") + page.should have_content "Contents" + page.should have_link "Users" + page.should have_link "Rake tasks" + end + + step 'I click on users in doc/api/README' do + click_link "Users" + end + + step 'I should see the correct document file' do + current_path.should == project_blob_path(@project, "markdown/doc/api/users.md") + page.should have_content "Get a list of users." + end + + step 'I click on raketasks in doc/api/README' do + click_link "Rake tasks" + end + + # Markdown branch + + When 'I visit markdown branch' do + visit project_tree_path(@project, "markdown") + end + + When 'I visit markdown branch "README.md" blob' do + visit project_blob_path(@project, "markdown/README.md") + end + + When 'I visit markdown branch "d" tree' do + visit project_tree_path(@project, "markdown/d") + end + + When 'I visit markdown branch "d/README.md" blob' do + visit project_blob_path(@project, "markdown/d/README.md") + end + + step 'I should see files from repository in markdown branch' do + current_path.should == project_tree_path(@project, "markdown") + page.should have_content "README.md" + page.should have_content "CHANGELOG" + end + + step 'I see correct file rendered in markdown branch' do + current_path.should == project_blob_path(@project, "markdown/doc/api/README.md") + page.should have_content "Contents" + page.should have_link "Users" + page.should have_link "Rake tasks" + end + + step 'I should see correct document rendered for markdown branch' do + current_path.should == project_blob_path(@project, "markdown/doc/api/README.md") + page.should have_content "All API requests require authentication" + end + + step 'I should see correct directory rendered for markdown branch' do + current_path.should == project_tree_path(@project, "markdown/doc/raketasks") + page.should have_content "backup_restore.md" + page.should have_content "maintenance.md" + end + + step 'I should see the users document file in markdown branch' do + current_path.should == project_blob_path(@project, "markdown/doc/api/users.md") + page.should have_content "Get a list of users." + end + + # Expected link contents + + step 'The link with text "empty" should have url "tree/markdown"' do + find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown") + end + + step 'The link with text "empty" should have url "blob/markdown/README.md"' do + find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + end + + step 'The link with text "empty" should have url "tree/markdown/d"' do + find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown/d") + end + + step 'The link with text "empty" should have '\ + 'url "blob/markdown/d/README.md"' do + find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/d/README.md") + end + + step 'The link with text "ID" should have url "tree/markdownID"' do + find('a', text: /^#id$/)['href'] == current_host + project_tree_path(@project, "markdown") + '#id' + end + + step 'The link with text "/ID" should have url "tree/markdownID"' do + find('a', text: /^\/#id$/)['href'] == current_host + project_tree_path(@project, "markdown") + '#id' + end + + step 'The link with text "README.mdID" '\ + 'should have url "blob/markdown/README.mdID"' do + find('a', text: /^README.md#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id' + end + + step 'The link with text "d/README.mdID" should have '\ + 'url "blob/markdown/d/README.mdID"' do + find('a', text: /^d\/README.md#id$/)['href'] == current_host + project_blob_path(@project, "d/markdown/README.md") + '#id' + end + + step 'The link with text "ID" should have url "blob/markdown/README.mdID"' do + find('a', text: /^#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id' + end + + step 'The link with text "/ID" should have url "blob/markdown/README.mdID"' do + find('a', text: /^\/#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id' + end + + # Wiki + + step 'I go to wiki page' do + click_link "Wiki" + current_path.should == project_wiki_path(@project, "home") + end + + step 'I add various links to the wiki page' do + fill_in "wiki[content]", with: "[test](test)\n[GitLab API doc](api)\n[Rake tasks](raketasks)\n" + fill_in "wiki[message]", with: "Adding links to wiki" + click_button "Create page" + end + + step 'Wiki page should have added links' do + current_path.should == project_wiki_path(@project, "home") + page.should have_content "test GitLab API doc Rake tasks" + end + + step 'I add a header to the wiki page' do + fill_in "wiki[content]", with: "# Wiki header\n" + fill_in "wiki[message]", with: "Add header to wiki" + click_button "Create page" + end + + step 'Wiki header should have correct id and link' do + header_should_have_correct_id_and_link(1, 'Wiki header', 'wiki-header') + end + + step 'I click on test link' do + click_link "test" + end + + step 'I see new wiki page named test' do + current_path.should == project_wiki_path(@project, "test") + page.should have_content "Editing" + end + + When 'I go back to wiki page home' do + visit project_wiki_path(@project, "home") + current_path.should == project_wiki_path(@project, "home") + end + + step 'I click on GitLab API doc link' do + click_link "GitLab API" + end + + step 'I see Gitlab API document' do + current_path.should == project_wiki_path(@project, "api") + page.should have_content "Editing" + end + + step 'I click on Rake tasks link' do + click_link "Rake tasks" + end + + step 'I see Rake tasks directory' do + current_path.should == project_wiki_path(@project, "raketasks") + page.should have_content "Editing" + end + + step 'I go directory which contains README file' do + visit project_tree_path(@project, "markdown/doc/api") + current_path.should == project_tree_path(@project, "markdown/doc/api") + end + + step 'I click on a relative link in README' do + click_link "Users" + end + + step 'I should see the correct markdown' do + current_path.should == project_blob_path(@project, "markdown/doc/api/users.md") + page.should have_content "List users" + end + + step 'Header "Application details" should have correct id and link' do + header_should_have_correct_id_and_link(2, 'Application details', 'application-details') + end + + step 'Header "GitLab API" should have correct id and link' do + header_should_have_correct_id_and_link(1, 'GitLab API', 'gitlab-api') + end +end diff --git a/features/steps/project/source/multiselect_blob.rb b/features/steps/project/source/multiselect_blob.rb new file mode 100644 index 00000000000..b749ba49371 --- /dev/null +++ b/features/steps/project/source/multiselect_blob.rb @@ -0,0 +1,58 @@ +class Spinach::Features::ProjectSourceMultiselectBlob < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + class << self + def click_line_steps(*line_numbers) + line_numbers.each do |line_number| + step "I click line #{line_number} in file" do + find("#L#{line_number}").click + end + + step "I shift-click line #{line_number} in file" do + script = "$('#L#{line_number}').trigger($.Event('click', { shiftKey: true }));" + execute_script(script) + end + end + end + + def check_state_steps(*ranges) + ranges.each do |range| + fragment = range.kind_of?(Array) ? "L#{range.first}-#{range.last}" : "L#{range}" + pluralization = range.kind_of?(Array) ? "s" : "" + + step "I should see \"#{fragment}\" as URI fragment" do + URI.parse(current_url).fragment.should == fragment + end + + step "I should see line#{pluralization} #{fragment[1..-1]} highlighted" do + ids = Array(range).map { |n| "LC#{n}" } + extra = false + + highlighted = all("#tree-content-holder .highlight .line.hll") + highlighted.each do |element| + extra ||= ids.delete(element[:id]).nil? + end + + extra.should be_false and ids.should be_empty + end + end + end + end + + click_line_steps *Array(1..5) + check_state_steps *Array(1..5), Array(1..2), Array(1..3), Array(1..4), Array(1..5), Array(3..5) + + step 'I go back in history' do + go_back + end + + step 'I go forward in history' do + go_forward + end + + step 'I click on ".gitignore" file in repo' do + click_link ".gitignore" + end +end diff --git a/features/steps/project/source/search_code.rb b/features/steps/project/source/search_code.rb new file mode 100644 index 00000000000..9c2864cc936 --- /dev/null +++ b/features/steps/project/source/search_code.rb @@ -0,0 +1,19 @@ +class Spinach::Features::ProjectSourceSearchCode < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + step 'I search for term "coffee"' do + fill_in "search", with: "coffee" + click_button "Go" + end + + step 'I should see files from repository containing "coffee"' do + page.should have_content 'coffee' + page.should have_content 'CONTRIBUTING.md' + end + + step 'I should see empty result' do + page.should have_content "We couldn't find any matching" + end +end diff --git a/features/steps/snippets/discover.rb b/features/steps/snippets/discover.rb index da73dfc68be..42bccafcc84 100644 --- a/features/steps/snippets/discover.rb +++ b/features/steps/snippets/discover.rb @@ -1,4 +1,4 @@ -class Spinach::Features::DiscoverSnippets < Spinach::FeatureSteps +class Spinach::Features::SnippetsDiscover < Spinach::FeatureSteps include SharedAuthentication include SharedPaths include SharedSnippet diff --git a/features/steps/snippets/snippets.rb b/features/steps/snippets/snippets.rb index e8154c8ce57..dedbdd2c4f0 100644 --- a/features/steps/snippets/snippets.rb +++ b/features/steps/snippets/snippets.rb @@ -1,4 +1,4 @@ -class Spinach::Features::SnippetsFeature < Spinach::FeatureSteps +class Spinach::Features::Snippets < Spinach::FeatureSteps include SharedAuthentication include SharedPaths include SharedProject diff --git a/features/steps/snippets/user.rb b/features/steps/snippets/user.rb index 71a1952926f..ca9aa64bee6 100644 --- a/features/steps/snippets/user.rb +++ b/features/steps/snippets/user.rb @@ -1,4 +1,4 @@ -class Spinach::Features::UserSnippets < Spinach::FeatureSteps +class Spinach::Features::SnippetsUser < Spinach::FeatureSteps include SharedAuthentication include SharedPaths include SharedSnippet -- cgit v1.2.3