diff --git a/features/project/archived.feature b/features/project/archived.feature new file mode 100644 index 0000000..9aac293 --- /dev/null +++ b/features/project/archived.feature @@ -0,0 +1,39 @@ +Feature: Project Archived + Background: + Given I sign in as a user + And I own project "Shop" + And I own project "Forum" + + Scenario: I should not see archived on project page of not-archive project + And project "Forum" is archived + And I visit project "Shop" page + Then I should not see "Archived" + + Scenario: I should see archived on project page of archive project + And project "Forum" is archived + And I visit project "Forum" page + Then I should see "Archived" + + Scenario: I should not see archived on projects page with no archived projects + And I visit dashboard projects page + Then I should not see "Archived" + + Scenario: I should see archived on projects page with archived projects + And project "Forum" is archived + And I visit dashboard projects page + Then I should see "Archived" + + Scenario: I archive project + When project "Shop" has push event + And I visit project "Shop" page + And I visit edit project "Shop" page + And I set project archived + Then I should see "Archived" + + Scenario: I unarchive project + When project "Shop" has push event + And project "Shop" is archived + And I visit project "Shop" page + And I visit edit project "Shop" page + And I set project unarchived + Then I should not see "Archived" diff --git a/features/project/archived_projects.feature b/features/project/archived_projects.feature deleted file mode 100644 index 9aac293..0000000 --- a/features/project/archived_projects.feature +++ /dev/null @@ -1,39 +0,0 @@ -Feature: Project Archived - Background: - Given I sign in as a user - And I own project "Shop" - And I own project "Forum" - - Scenario: I should not see archived on project page of not-archive project - And project "Forum" is archived - And I visit project "Shop" page - Then I should not see "Archived" - - Scenario: I should see archived on project page of archive project - And project "Forum" is archived - And I visit project "Forum" page - Then I should see "Archived" - - Scenario: I should not see archived on projects page with no archived projects - And I visit dashboard projects page - Then I should not see "Archived" - - Scenario: I should see archived on projects page with archived projects - And project "Forum" is archived - And I visit dashboard projects page - Then I should see "Archived" - - Scenario: I archive project - When project "Shop" has push event - And I visit project "Shop" page - And I visit edit project "Shop" page - And I set project archived - Then I should see "Archived" - - Scenario: I unarchive project - When project "Shop" has push event - And project "Shop" is archived - And I visit project "Shop" page - And I visit edit project "Shop" page - And I set project unarchived - Then I should not see "Archived" diff --git a/features/project/commits/comments.feature b/features/project/commits/comments.feature new file mode 100644 index 0000000..a1aa745 --- /dev/null +++ b/features/project/commits/comments.feature @@ -0,0 +1,48 @@ +Feature: Comments on commits + Background: + Given I sign in as a user + And I own project "Shop" + And I visit project commit page + + @javascript + Scenario: I can comment on a commit + Given I leave a comment like "XML attached" + Then I should see a comment saying "XML attached" + + @javascript + Scenario: I can't cancel the main form + Then I should not see the cancel comment button + + @javascript + Scenario: I can't preview without text + Given I haven't written any comment text + Then I should not see the comment preview button + + @javascript + Scenario: I can preview with text + Given I write a comment like "Nice" + Then I should see the comment preview button + + @javascript + Scenario: I preview a comment + Given I preview a comment text like "Bug fixed :smile:" + Then I should see the comment preview + And I should not see the comment text field + + @javascript + Scenario: I can edit after preview + Given I preview a comment text like "Bug fixed :smile:" + Then I should see the comment edit button + + @javascript + Scenario: I have a reset form after posting from preview + Given I preview a comment text like "Bug fixed :smile:" + And I submit the comment + Then I should see an empty comment text field + And I should not see the comment preview + + @javascript + Scenario: I can delete a comment + Given I leave a comment like "XML attached" + And I delete a comment + Then I should not see a comment saying "XML attached" diff --git a/features/project/commits/commit_comments.feature b/features/project/commits/commit_comments.feature deleted file mode 100644 index a1aa745..0000000 --- a/features/project/commits/commit_comments.feature +++ /dev/null @@ -1,48 +0,0 @@ -Feature: Comments on commits - Background: - Given I sign in as a user - And I own project "Shop" - And I visit project commit page - - @javascript - Scenario: I can comment on a commit - Given I leave a comment like "XML attached" - Then I should see a comment saying "XML attached" - - @javascript - Scenario: I can't cancel the main form - Then I should not see the cancel comment button - - @javascript - Scenario: I can't preview without text - Given I haven't written any comment text - Then I should not see the comment preview button - - @javascript - Scenario: I can preview with text - Given I write a comment like "Nice" - Then I should see the comment preview button - - @javascript - Scenario: I preview a comment - Given I preview a comment text like "Bug fixed :smile:" - Then I should see the comment preview - And I should not see the comment text field - - @javascript - Scenario: I can edit after preview - Given I preview a comment text like "Bug fixed :smile:" - Then I should see the comment edit button - - @javascript - Scenario: I have a reset form after posting from preview - Given I preview a comment text like "Bug fixed :smile:" - And I submit the comment - Then I should see an empty comment text field - And I should not see the comment preview - - @javascript - Scenario: I can delete a comment - Given I leave a comment like "XML attached" - And I delete a comment - Then I should not see a comment saying "XML attached" diff --git a/features/project/commits/commit_diff_comments.feature b/features/project/commits/commit_diff_comments.feature deleted file mode 100644 index b26019f..0000000 --- a/features/project/commits/commit_diff_comments.feature +++ /dev/null @@ -1,85 +0,0 @@ -Feature: Comments on commit diffs - Background: - Given I sign in as a user - And I own project "Shop" - And I visit project commit page - - @javascript - Scenario: I can access add diff comment buttons - Then I should see add a diff comment button - - @javascript - Scenario: I can comment on a commit diff - Given I leave a diff comment like "Typo, please fix" - Then I should see a diff comment saying "Typo, please fix" - - @javascript - Scenario: I get a temporary form for the first comment on a diff line - Given I open a diff comment form - Then I should see a temporary diff comment form - - @javascript - Scenario: I have a cancel button on the diff form - Given I open a diff comment form - Then I should see the cancel comment button - - @javascript - Scenario: I can cancel a diff form - Given I open a diff comment form - And I cancel the diff comment - Then I should not see the diff comment form - - @javascript - Scenario: I can't open a second form for a diff line - Given I open a diff comment form - And I open a diff comment form - Then I should only see one diff form - - @javascript - Scenario: I can have multiple forms - Given I open a diff comment form - And I write a diff comment like ":-1: I don't like this" - And I open another diff comment form - Then I should see a diff comment form with ":-1: I don't like this" - And I should see an empty diff comment form - - @javascript - Scenario: I can preview multiple forms separately - Given I preview a diff comment text like "Should fix it :smile:" - And I preview another diff comment text like "DRY this up" - Then I should see two separate previews - - @javascript - Scenario: I have a reply button in discussions - Given I leave a diff comment like "Typo, please fix" - Then I should see a discussion reply button - - @javascript - Scenario: I can't preview without text - Given I open a diff comment form - And I haven't written any diff comment text - Then I should not see the diff comment preview button - - @javascript - Scenario: I can preview with text - Given I open a diff comment form - And I write a diff comment like ":-1: I don't like this" - Then I should see the diff comment preview button - - @javascript - Scenario: I preview a diff comment - Given I preview a diff comment text like "Should fix it :smile:" - Then I should see the diff comment preview - And I should not see the diff comment text field - - @javascript - Scenario: I can edit after preview - Given I preview a diff comment text like "Should fix it :smile:" - Then I should see the diff comment edit button - - @javascript - Scenario: The form gets removed after posting - Given I preview a diff comment text like "Should fix it :smile:" - And I submit the diff comment - Then I should not see the diff comment form - And I should see a discussion reply button diff --git a/features/project/commits/commits_user_lookup.feature b/features/project/commits/commits_user_lookup.feature deleted file mode 100644 index f3864c0..0000000 --- a/features/project/commits/commits_user_lookup.feature +++ /dev/null @@ -1,14 +0,0 @@ -Feature: Project Browse Commits User Lookup - Background: - Given I sign in as a user - And I own a project - And I have the user that authored the commits - And I visit my project's commits page - - Scenario: I browse commit from list - Given I click on commit link - Then I see commit info - - Scenario: I browse another commit from list - Given I click on another commit link - Then I see other commit info \ No newline at end of file diff --git a/features/project/commits/diff_comments.feature b/features/project/commits/diff_comments.feature new file mode 100644 index 0000000..b26019f --- /dev/null +++ b/features/project/commits/diff_comments.feature @@ -0,0 +1,85 @@ +Feature: Comments on commit diffs + Background: + Given I sign in as a user + And I own project "Shop" + And I visit project commit page + + @javascript + Scenario: I can access add diff comment buttons + Then I should see add a diff comment button + + @javascript + Scenario: I can comment on a commit diff + Given I leave a diff comment like "Typo, please fix" + Then I should see a diff comment saying "Typo, please fix" + + @javascript + Scenario: I get a temporary form for the first comment on a diff line + Given I open a diff comment form + Then I should see a temporary diff comment form + + @javascript + Scenario: I have a cancel button on the diff form + Given I open a diff comment form + Then I should see the cancel comment button + + @javascript + Scenario: I can cancel a diff form + Given I open a diff comment form + And I cancel the diff comment + Then I should not see the diff comment form + + @javascript + Scenario: I can't open a second form for a diff line + Given I open a diff comment form + And I open a diff comment form + Then I should only see one diff form + + @javascript + Scenario: I can have multiple forms + Given I open a diff comment form + And I write a diff comment like ":-1: I don't like this" + And I open another diff comment form + Then I should see a diff comment form with ":-1: I don't like this" + And I should see an empty diff comment form + + @javascript + Scenario: I can preview multiple forms separately + Given I preview a diff comment text like "Should fix it :smile:" + And I preview another diff comment text like "DRY this up" + Then I should see two separate previews + + @javascript + Scenario: I have a reply button in discussions + Given I leave a diff comment like "Typo, please fix" + Then I should see a discussion reply button + + @javascript + Scenario: I can't preview without text + Given I open a diff comment form + And I haven't written any diff comment text + Then I should not see the diff comment preview button + + @javascript + Scenario: I can preview with text + Given I open a diff comment form + And I write a diff comment like ":-1: I don't like this" + Then I should see the diff comment preview button + + @javascript + Scenario: I preview a diff comment + Given I preview a diff comment text like "Should fix it :smile:" + Then I should see the diff comment preview + And I should not see the diff comment text field + + @javascript + Scenario: I can edit after preview + Given I preview a diff comment text like "Should fix it :smile:" + Then I should see the diff comment edit button + + @javascript + Scenario: The form gets removed after posting + Given I preview a diff comment text like "Should fix it :smile:" + And I submit the diff comment + Then I should not see the diff comment form + And I should see a discussion reply button diff --git a/features/project/commits/user_lookup.feature b/features/project/commits/user_lookup.feature new file mode 100644 index 0000000..f3864c0 --- /dev/null +++ b/features/project/commits/user_lookup.feature @@ -0,0 +1,14 @@ +Feature: Project Browse Commits User Lookup + Background: + Given I sign in as a user + And I own a project + And I have the user that authored the commits + And I visit my project's commits page + + Scenario: I browse commit from list + Given I click on commit link + Then I see commit info + + Scenario: I browse another commit from list + Given I click on another commit link + Then I see other commit info \ No newline at end of file diff --git a/features/project/create.feature b/features/project/create.feature new file mode 100644 index 0000000..395a321 --- /dev/null +++ b/features/project/create.feature @@ -0,0 +1,22 @@ +Feature: Create Project + In order to get access to project sections + A user with ability to create a project + Should be able to create a new one + + Scenario: User create a project + Given I sign in as a user + When I visit new project page + And fill project form with valid data + Then I should see project page + And I should see empty project instuctions + + @javascript + Scenario: Empty project instructions + Given I sign in as a user + When I visit new project page + And fill project form with valid data + Then I see empty project instuctions + And I click on HTTP + Then Remote url should update to http link + And If I click on SSH + Then Remote url should update to ssh link \ No newline at end of file diff --git a/features/project/create_project.feature b/features/project/create_project.feature deleted file mode 100644 index 395a321..0000000 --- a/features/project/create_project.feature +++ /dev/null @@ -1,22 +0,0 @@ -Feature: Create Project - In order to get access to project sections - A user with ability to create a project - Should be able to create a new one - - Scenario: User create a project - Given I sign in as a user - When I visit new project page - And fill project form with valid data - Then I should see project page - And I should see empty project instuctions - - @javascript - Scenario: Empty project instructions - Given I sign in as a user - When I visit new project page - And fill project form with valid data - Then I see empty project instuctions - And I click on HTTP - Then Remote url should update to http link - And If I click on SSH - Then Remote url should update to ssh link \ No newline at end of file diff --git a/features/project/fork.feature b/features/project/fork.feature new file mode 100644 index 0000000..dc477ca --- /dev/null +++ b/features/project/fork.feature @@ -0,0 +1,14 @@ +Feature: Fork Project + Background: + Given I sign in as a user + And I am a member of project "Shop" + When I visit project "Shop" page + + Scenario: User fork a project + Given I click link "Fork" + Then I should see the forked project page + + Scenario: User already has forked the project + Given I already have a project named "Shop" in my namespace + And I click link "Fork" + Then I should see a "Name has already been taken" warning diff --git a/features/project/fork_project.feature b/features/project/fork_project.feature deleted file mode 100644 index dc477ca..0000000 --- a/features/project/fork_project.feature +++ /dev/null @@ -1,14 +0,0 @@ -Feature: Fork Project - Background: - Given I sign in as a user - And I am a member of project "Shop" - When I visit project "Shop" page - - Scenario: User fork a project - Given I click link "Fork" - Then I should see the forked project page - - Scenario: User already has forked the project - Given I already have a project named "Shop" in my namespace - And I click link "Fork" - Then I should see a "Name has already been taken" warning diff --git a/features/project/public.feature b/features/project/public.feature new file mode 100644 index 0000000..c5a9da1 --- /dev/null +++ b/features/project/public.feature @@ -0,0 +1,8 @@ +Feature: Public Projects + Background: + Given I sign in as a user + + Scenario: I should see the list of public projects + When I visit the public projects area + Then I should see the list of public projects + diff --git a/features/project/public_projects.feature b/features/project/public_projects.feature deleted file mode 100644 index c5a9da1..0000000 --- a/features/project/public_projects.feature +++ /dev/null @@ -1,8 +0,0 @@ -Feature: Public Projects - Background: - Given I sign in as a user - - Scenario: I should see the list of public projects - When I visit the public projects area - Then I should see the list of public projects - diff --git a/features/public/projects.feature b/features/public/projects.feature new file mode 100644 index 0000000..57fe834 --- /dev/null +++ b/features/public/projects.feature @@ -0,0 +1,101 @@ +Feature: Public Projects Feature + Background: + Given public project "Community" + And internal project "Internal" + And private project "Enterprise" + + Scenario: I visit public area + When I visit the public projects area + Then I should see project "Community" + And I should not see project "Internal" + And I should not see project "Enterprise" + + Scenario: I visit public project page + When I visit project "Community" page + Then I should see project "Community" home page + + Scenario: I visit internal project page + When I visit project "Internal" page + Then I should be redirected to sign in page + + Scenario: I visit private project page + When I visit project "Enterprise" page + Then I should be redirected to sign in page + + Scenario: I visit an empty public project page + Given public empty project "Empty Public Project" + When I visit empty project page + Then I should see empty public project details + And I should see empty public project details with http clone info + + Scenario: I visit an empty public project page as user + Given I sign in as a user + And public empty project "Empty Public Project" + When I visit empty project page + Then I should see empty public project details + And I should see empty public project details with ssh clone info + + Scenario: I visit public area as user + Given I sign in as a user + When I visit the public projects area + Then I should see project "Community" + And I should see project "Internal" + And I should not see project "Enterprise" + + Scenario: I visit internal project page as user + Given I sign in as a user + When I visit project "Internal" page + Then I should see project "Internal" home page + + Scenario: I visit public project page + When I visit project "Community" page + Then I should see project "Community" home page + And I should see an http link to the repository + + Scenario: I visit public project page as user + Given I sign in as a user + When I visit project "Community" page + Then I should see project "Community" home page + And I should see an ssh link to the repository + + Scenario: I visit an empty public project page + Given public empty project "Empty Public Project" + When I visit empty project page + Then I should see empty public project details + + Scenario: I visit public project issues page as a non authorized user + Given I visit project "Community" page + And I visit "Community" issues page + Then I should see list of issues for "Community" project + + Scenario: I visit public project issues page as authorized user + Given I sign in as a user + Given I visit project "Community" page + And I visit "Community" issues page + Then I should see list of issues for "Community" project + + Scenario: I visit internal project issues page as authorized user + Given I sign in as a user + Given I visit project "Internal" page + And I visit "Internal" issues page + Then I should see list of issues for "Internal" project + + Scenario: I visit public project merge requests page as an authorized user + Given I sign in as a user + Given I visit project "Community" page + And I visit "Community" merge requests page + And project "Community" has "Bug fix" open merge request + Then I should see list of merge requests for "Community" project + + Scenario: I visit public project merge requests page as a non authorized user + Given I visit project "Community" page + And I visit "Community" merge requests page + And project "Community" has "Bug fix" open merge request + Then I should see list of merge requests for "Community" project + + Scenario: I visit internal project merge requests page as an authorized user + Given I sign in as a user + Given I visit project "Internal" page + And I visit "Internal" merge requests page + And project "Internal" has "Feature implemented" open merge request + Then I should see list of merge requests for "Internal" project diff --git a/features/public/public_projects.feature b/features/public/public_projects.feature deleted file mode 100644 index 57fe834..0000000 --- a/features/public/public_projects.feature +++ /dev/null @@ -1,101 +0,0 @@ -Feature: Public Projects Feature - Background: - Given public project "Community" - And internal project "Internal" - And private project "Enterprise" - - Scenario: I visit public area - When I visit the public projects area - Then I should see project "Community" - And I should not see project "Internal" - And I should not see project "Enterprise" - - Scenario: I visit public project page - When I visit project "Community" page - Then I should see project "Community" home page - - Scenario: I visit internal project page - When I visit project "Internal" page - Then I should be redirected to sign in page - - Scenario: I visit private project page - When I visit project "Enterprise" page - Then I should be redirected to sign in page - - Scenario: I visit an empty public project page - Given public empty project "Empty Public Project" - When I visit empty project page - Then I should see empty public project details - And I should see empty public project details with http clone info - - Scenario: I visit an empty public project page as user - Given I sign in as a user - And public empty project "Empty Public Project" - When I visit empty project page - Then I should see empty public project details - And I should see empty public project details with ssh clone info - - Scenario: I visit public area as user - Given I sign in as a user - When I visit the public projects area - Then I should see project "Community" - And I should see project "Internal" - And I should not see project "Enterprise" - - Scenario: I visit internal project page as user - Given I sign in as a user - When I visit project "Internal" page - Then I should see project "Internal" home page - - Scenario: I visit public project page - When I visit project "Community" page - Then I should see project "Community" home page - And I should see an http link to the repository - - Scenario: I visit public project page as user - Given I sign in as a user - When I visit project "Community" page - Then I should see project "Community" home page - And I should see an ssh link to the repository - - Scenario: I visit an empty public project page - Given public empty project "Empty Public Project" - When I visit empty project page - Then I should see empty public project details - - Scenario: I visit public project issues page as a non authorized user - Given I visit project "Community" page - And I visit "Community" issues page - Then I should see list of issues for "Community" project - - Scenario: I visit public project issues page as authorized user - Given I sign in as a user - Given I visit project "Community" page - And I visit "Community" issues page - Then I should see list of issues for "Community" project - - Scenario: I visit internal project issues page as authorized user - Given I sign in as a user - Given I visit project "Internal" page - And I visit "Internal" issues page - Then I should see list of issues for "Internal" project - - Scenario: I visit public project merge requests page as an authorized user - Given I sign in as a user - Given I visit project "Community" page - And I visit "Community" merge requests page - And project "Community" has "Bug fix" open merge request - Then I should see list of merge requests for "Community" project - - Scenario: I visit public project merge requests page as a non authorized user - Given I visit project "Community" page - And I visit "Community" merge requests page - And project "Community" has "Bug fix" open merge request - Then I should see list of merge requests for "Community" project - - Scenario: I visit internal project merge requests page as an authorized user - Given I sign in as a user - Given I visit project "Internal" page - And I visit "Internal" merge requests page - And project "Internal" has "Feature implemented" open merge request - Then I should see list of merge requests for "Internal" project diff --git a/features/snippets/discover.feature b/features/snippets/discover.feature new file mode 100644 index 0000000..d6fd2cd --- /dev/null +++ b/features/snippets/discover.feature @@ -0,0 +1,10 @@ +Feature: Discover Snippets + Background: + Given I sign in as a user + And I have public "Personal snippet one" snippet + And I have private "Personal snippet private" snippet + + Scenario: I should see snippets + Given I visit snippets page + Then I should see "Personal snippet one" in snippets + And I should not see "Personal snippet private" in snippets diff --git a/features/snippets/discover_snippets.feature b/features/snippets/discover_snippets.feature deleted file mode 100644 index d6fd2cd..0000000 --- a/features/snippets/discover_snippets.feature +++ /dev/null @@ -1,10 +0,0 @@ -Feature: Discover Snippets - Background: - Given I sign in as a user - And I have public "Personal snippet one" snippet - And I have private "Personal snippet private" snippet - - Scenario: I should see snippets - Given I visit snippets page - Then I should see "Personal snippet one" in snippets - And I should not see "Personal snippet private" in snippets diff --git a/features/snippets/user.feature b/features/snippets/user.feature new file mode 100644 index 0000000..4c8a915 --- /dev/null +++ b/features/snippets/user.feature @@ -0,0 +1,22 @@ +Feature: User Snippets + Background: + Given I sign in as a user + And I have public "Personal snippet one" snippet + And I have private "Personal snippet private" snippet + + Scenario: I should see all my snippets + Given I visit my snippets page + Then I should see "Personal snippet one" in snippets + And I should see "Personal snippet private" in snippets + + Scenario: I can see only my private snippets + Given I visit my snippets page + And I click "Private" filter + Then I should not see "Personal snippet one" in snippets + And I should see "Personal snippet private" in snippets + + Scenario: I can see only my public snippets + Given I visit my snippets page + And I click "Public" filter + Then I should see "Personal snippet one" in snippets + And I should not see "Personal snippet private" in snippets diff --git a/features/snippets/user_snippets.feature b/features/snippets/user_snippets.feature deleted file mode 100644 index 4c8a915..0000000 --- a/features/snippets/user_snippets.feature +++ /dev/null @@ -1,22 +0,0 @@ -Feature: User Snippets - Background: - Given I sign in as a user - And I have public "Personal snippet one" snippet - And I have private "Personal snippet private" snippet - - Scenario: I should see all my snippets - Given I visit my snippets page - Then I should see "Personal snippet one" in snippets - And I should see "Personal snippet private" in snippets - - Scenario: I can see only my private snippets - Given I visit my snippets page - And I click "Private" filter - Then I should not see "Personal snippet one" in snippets - And I should see "Personal snippet private" in snippets - - Scenario: I can see only my public snippets - Given I visit my snippets page - And I click "Public" filter - Then I should see "Personal snippet one" in snippets - And I should not see "Personal snippet private" in snippets diff --git a/features/steps/admin/active_tab.rb b/features/steps/admin/active_tab.rb new file mode 100644 index 0000000..ccafe09 --- /dev/null +++ b/features/steps/admin/active_tab.rb @@ -0,0 +1,37 @@ +class AdminActiveTab < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedActiveTab + + Then 'the active main tab should be Home' do + ensure_active_main_tab('Home') + end + + Then 'the active main tab should be Projects' do + ensure_active_main_tab('Projects') + end + + Then 'the active main tab should be Groups' do + ensure_active_main_tab('Groups') + end + + Then 'the active main tab should be Users' do + ensure_active_main_tab('Users') + end + + Then 'the active main tab should be Logs' do + ensure_active_main_tab('Logs') + end + + Then 'the active main tab should be Hooks' do + ensure_active_main_tab('Hooks') + end + + Then 'the active main tab should be Resque' do + ensure_active_main_tab('Background Jobs') + end + + Then 'the active main tab should be Messages' do + ensure_active_main_tab('Messages') + end +end diff --git a/features/steps/admin/admin_active_tab.rb b/features/steps/admin/admin_active_tab.rb deleted file mode 100644 index ccafe09..0000000 --- a/features/steps/admin/admin_active_tab.rb +++ /dev/null @@ -1,37 +0,0 @@ -class AdminActiveTab < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedActiveTab - - Then 'the active main tab should be Home' do - ensure_active_main_tab('Home') - end - - Then 'the active main tab should be Projects' do - ensure_active_main_tab('Projects') - end - - Then 'the active main tab should be Groups' do - ensure_active_main_tab('Groups') - end - - Then 'the active main tab should be Users' do - ensure_active_main_tab('Users') - end - - Then 'the active main tab should be Logs' do - ensure_active_main_tab('Logs') - end - - Then 'the active main tab should be Hooks' do - ensure_active_main_tab('Hooks') - end - - Then 'the active main tab should be Resque' do - ensure_active_main_tab('Background Jobs') - end - - Then 'the active main tab should be Messages' do - ensure_active_main_tab('Messages') - end -end diff --git a/features/steps/admin/admin_broadcast_messages.rb b/features/steps/admin/admin_broadcast_messages.rb deleted file mode 100644 index a35fa34..0000000 --- a/features/steps/admin/admin_broadcast_messages.rb +++ /dev/null @@ -1,41 +0,0 @@ -class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - - step 'application already has admin messages' do - FactoryGirl.create(:broadcast_message, message: "Migration to new server") - end - - step 'I should be all broadcast messages' do - page.should have_content "Migration to new server" - end - - step 'submit form with new broadcast message' do - fill_in 'broadcast_message_message', with: 'Application update from 4:00 CST to 5:00 CST' - select '2018', from: "broadcast_message_ends_at_1i" - click_button "Add broadcast message" - end - - step 'I should be redirected to admin messages page' do - current_path.should == admin_broadcast_messages_path - end - - step 'I should see newly created broadcast message' do - page.should have_content 'Application update from 4:00 CST to 5:00 CST' - end - - step 'submit form with new customized broadcast message' do - fill_in 'broadcast_message_message', with: 'Application update from 4:00 CST to 5:00 CST' - click_link "Customize colors" - fill_in 'broadcast_message_color', with: '#f2dede' - fill_in 'broadcast_message_font', with: '#b94a48' - select '2018', from: "broadcast_message_ends_at_1i" - click_button "Add broadcast message" - end - - step 'I should see a customized broadcast message' do - page.should have_content 'Application update from 4:00 CST to 5:00 CST' - page.should have_selector %(div[style="background-color:#f2dede;color:#b94a48"]) - end -end diff --git a/features/steps/admin/admin_groups.rb b/features/steps/admin/admin_groups.rb deleted file mode 100644 index 9c1bcfe..0000000 --- a/features/steps/admin/admin_groups.rb +++ /dev/null @@ -1,66 +0,0 @@ -class AdminGroups < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedUser - include SharedActiveTab - include Select2Helper - - When 'I visit admin group page' do - visit admin_group_path(current_group) - end - - When 'I click new group link' do - click_link "New Group" - end - - And 'I have group with projects' do - @group = create(:group) - @project = create(:project, group: @group) - @event = create(:closed_issue_event, project: @project) - - @project.team << [current_user, :master] - end - - And 'submit form with new group info' do - fill_in 'group_name', with: 'gitlab' - fill_in 'group_description', with: 'Group description' - click_button "Create group" - end - - Then 'I should see newly created group' do - page.should have_content "Group: gitlab" - page.should have_content "Group description" - end - - Then 'I should be redirected to group page' do - current_path.should == admin_group_path(Group.last) - end - - When 'I select user "John Doe" from user list as "Reporter"' do - user = User.find_by(name: "John Doe") - select2(user.id, from: "#user_ids", multiple: true) - within "#new_team_member" do - select "Reporter", from: "group_access" - end - click_button "Add users into group" - end - - Then 'I should see "John Doe" in team list in every project as "Reporter"' do - within ".group-users-list" do - page.should have_content "John Doe" - page.should have_content "Reporter" - end - end - - step 'I should be all groups' do - Group.all.each do |group| - page.should have_content group.name - end - end - - protected - - def current_group - @group ||= Group.first - end -end diff --git a/features/steps/admin/admin_logs.rb b/features/steps/admin/admin_logs.rb deleted file mode 100644 index 8395854..0000000 --- a/features/steps/admin/admin_logs.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AdminLogs < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - - Then 'I should see tabs with available logs' do - page.should have_content 'production.log' - page.should have_content 'githost.log' - page.should have_content 'application.log' - end -end diff --git a/features/steps/admin/admin_projects.rb b/features/steps/admin/admin_projects.rb deleted file mode 100644 index b410b23..0000000 --- a/features/steps/admin/admin_projects.rb +++ /dev/null @@ -1,22 +0,0 @@ -class AdminProjects < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - - And 'I should see all projects' do - Project.all.each do |p| - page.should have_content p.name_with_namespace - end - end - - And 'I click on first project' do - click_link Project.first.name_with_namespace - end - - Then 'I should see project details' do - project = Project.first - current_path.should == admin_project_path(project) - page.should have_content(project.name_with_namespace) - page.should have_content(project.creator.name) - end -end diff --git a/features/steps/admin/admin_users.rb b/features/steps/admin/admin_users.rb deleted file mode 100644 index 33c1344..0000000 --- a/features/steps/admin/admin_users.rb +++ /dev/null @@ -1,34 +0,0 @@ -class AdminUsers < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - - Then 'I should see all users' do - User.all.each do |user| - page.should have_content user.name - end - end - - And 'Click edit' do - @user = User.first - find("#edit_user_#{@user.id}").click - end - - And 'Input non ascii char in username' do - fill_in 'user_username', with: "\u3042\u3044" - end - - And 'Click save' do - click_button("Save") - end - - Then 'See username error message' do - within "#error_explanation" do - page.should have_content "Username" - end - end - - And 'Not changed form action url' do - page.should have_selector %(form[action="/admin/users/#{@user.username}"]) - end -end diff --git a/features/steps/admin/broadcast_messages.rb b/features/steps/admin/broadcast_messages.rb new file mode 100644 index 0000000..a35fa34 --- /dev/null +++ b/features/steps/admin/broadcast_messages.rb @@ -0,0 +1,41 @@ +class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedAdmin + + step 'application already has admin messages' do + FactoryGirl.create(:broadcast_message, message: "Migration to new server") + end + + step 'I should be all broadcast messages' do + page.should have_content "Migration to new server" + end + + step 'submit form with new broadcast message' do + fill_in 'broadcast_message_message', with: 'Application update from 4:00 CST to 5:00 CST' + select '2018', from: "broadcast_message_ends_at_1i" + click_button "Add broadcast message" + end + + step 'I should be redirected to admin messages page' do + current_path.should == admin_broadcast_messages_path + end + + step 'I should see newly created broadcast message' do + page.should have_content 'Application update from 4:00 CST to 5:00 CST' + end + + step 'submit form with new customized broadcast message' do + fill_in 'broadcast_message_message', with: 'Application update from 4:00 CST to 5:00 CST' + click_link "Customize colors" + fill_in 'broadcast_message_color', with: '#f2dede' + fill_in 'broadcast_message_font', with: '#b94a48' + select '2018', from: "broadcast_message_ends_at_1i" + click_button "Add broadcast message" + end + + step 'I should see a customized broadcast message' do + page.should have_content 'Application update from 4:00 CST to 5:00 CST' + page.should have_selector %(div[style="background-color:#f2dede;color:#b94a48"]) + end +end diff --git a/features/steps/admin/groups.rb b/features/steps/admin/groups.rb new file mode 100644 index 0000000..9c1bcfe --- /dev/null +++ b/features/steps/admin/groups.rb @@ -0,0 +1,66 @@ +class AdminGroups < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedUser + include SharedActiveTab + include Select2Helper + + When 'I visit admin group page' do + visit admin_group_path(current_group) + end + + When 'I click new group link' do + click_link "New Group" + end + + And 'I have group with projects' do + @group = create(:group) + @project = create(:project, group: @group) + @event = create(:closed_issue_event, project: @project) + + @project.team << [current_user, :master] + end + + And 'submit form with new group info' do + fill_in 'group_name', with: 'gitlab' + fill_in 'group_description', with: 'Group description' + click_button "Create group" + end + + Then 'I should see newly created group' do + page.should have_content "Group: gitlab" + page.should have_content "Group description" + end + + Then 'I should be redirected to group page' do + current_path.should == admin_group_path(Group.last) + end + + When 'I select user "John Doe" from user list as "Reporter"' do + user = User.find_by(name: "John Doe") + select2(user.id, from: "#user_ids", multiple: true) + within "#new_team_member" do + select "Reporter", from: "group_access" + end + click_button "Add users into group" + end + + Then 'I should see "John Doe" in team list in every project as "Reporter"' do + within ".group-users-list" do + page.should have_content "John Doe" + page.should have_content "Reporter" + end + end + + step 'I should be all groups' do + Group.all.each do |group| + page.should have_content group.name + end + end + + protected + + def current_group + @group ||= Group.first + end +end diff --git a/features/steps/admin/logs.rb b/features/steps/admin/logs.rb new file mode 100644 index 0000000..8395854 --- /dev/null +++ b/features/steps/admin/logs.rb @@ -0,0 +1,11 @@ +class AdminLogs < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedAdmin + + Then 'I should see tabs with available logs' do + page.should have_content 'production.log' + page.should have_content 'githost.log' + page.should have_content 'application.log' + end +end diff --git a/features/steps/admin/projects.rb b/features/steps/admin/projects.rb new file mode 100644 index 0000000..b410b23 --- /dev/null +++ b/features/steps/admin/projects.rb @@ -0,0 +1,22 @@ +class AdminProjects < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedAdmin + + And 'I should see all projects' do + Project.all.each do |p| + page.should have_content p.name_with_namespace + end + end + + And 'I click on first project' do + click_link Project.first.name_with_namespace + end + + Then 'I should see project details' do + project = Project.first + current_path.should == admin_project_path(project) + page.should have_content(project.name_with_namespace) + page.should have_content(project.creator.name) + end +end diff --git a/features/steps/admin/users.rb b/features/steps/admin/users.rb new file mode 100644 index 0000000..33c1344 --- /dev/null +++ b/features/steps/admin/users.rb @@ -0,0 +1,34 @@ +class AdminUsers < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedAdmin + + Then 'I should see all users' do + User.all.each do |user| + page.should have_content user.name + end + end + + And 'Click edit' do + @user = User.first + find("#edit_user_#{@user.id}").click + end + + And 'Input non ascii char in username' do + fill_in 'user_username', with: "\u3042\u3044" + end + + And 'Click save' do + click_button("Save") + end + + Then 'See username error message' do + within "#error_explanation" do + page.should have_content "Username" + end + end + + And 'Not changed form action url' do + page.should have_selector %(form[action="/admin/users/#{@user.username}"]) + end +end diff --git a/features/steps/dashboard/active_tab.rb b/features/steps/dashboard/active_tab.rb new file mode 100644 index 0000000..8f5f0ee --- /dev/null +++ b/features/steps/dashboard/active_tab.rb @@ -0,0 +1,21 @@ +class DashboardActiveTab < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedActiveTab + + Then 'the active main tab should be Home' do + ensure_active_main_tab('Home') + end + + Then 'the active main tab should be Issues' do + ensure_active_main_tab('Issues') + end + + Then 'the active main tab should be Merge Requests' do + ensure_active_main_tab('Merge Requests') + end + + Then 'the active main tab should be Help' do + ensure_active_main_tab('Help') + end +end diff --git a/features/steps/dashboard/dashboard_active_tab.rb b/features/steps/dashboard/dashboard_active_tab.rb deleted file mode 100644 index 8f5f0ee..0000000 --- a/features/steps/dashboard/dashboard_active_tab.rb +++ /dev/null @@ -1,21 +0,0 @@ -class DashboardActiveTab < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedActiveTab - - Then 'the active main tab should be Home' do - ensure_active_main_tab('Home') - end - - Then 'the active main tab should be Issues' do - ensure_active_main_tab('Issues') - end - - Then 'the active main tab should be Merge Requests' do - ensure_active_main_tab('Merge Requests') - end - - Then 'the active main tab should be Help' do - ensure_active_main_tab('Help') - end -end diff --git a/features/steps/dashboard/dashboard_event_filters.rb b/features/steps/dashboard/dashboard_event_filters.rb deleted file mode 100644 index d0fe5c9..0000000 --- a/features/steps/dashboard/dashboard_event_filters.rb +++ /dev/null @@ -1,87 +0,0 @@ -class EventFilters < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - - Then 'I should see push event' do - page.should have_selector('span.pushed') - end - - Then 'I should not see push event' do - page.should_not have_selector('span.pushed') - end - - Then 'I should see new member event' do - page.should have_selector('span.joined') - end - - And 'I should not see new member event' do - page.should_not have_selector('span.joined') - end - - Then 'I should see merge request event' do - page.should have_selector('span.accepted') - end - - And 'I should not see merge request event' do - page.should_not have_selector('span.accepted') - end - - And 'this project has push event' do - data = { - before: "0000000000000000000000000000000000000000", - after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", - ref: "refs/heads/new_design", - user_id: @user.id, - user_name: @user.name, - repository: { - name: @project.name, - url: "localhost/rubinius", - description: "", - homepage: "localhost/rubinius", - private: true - } - } - - @event = Event.create( - project: @project, - action: Event::PUSHED, - data: data, - author_id: @user.id - ) - end - - And 'this project has new member event' do - user = create(:user, {name: "John Doe"}) - Event.create( - project: @project, - author_id: user.id, - action: Event::JOINED - ) - end - - And 'this project has merge request event' do - merge_request = create :merge_request, author: @user, source_project: @project, target_project: @project - Event.create( - project: @project, - action: Event::MERGED, - target_id: merge_request.id, - target_type: "MergeRequest", - author_id: @user.id - ) - end - - When 'I click "push" event filter' do - click_link("push_event_filter") - end - - When 'I click "team" event filter' do - click_link("team_event_filter") - end - - When 'I click "merge" event filter' do - click_link("merged_event_filter") - end - -end - diff --git a/features/steps/dashboard/dashboard_issues.rb b/features/steps/dashboard/dashboard_issues.rb deleted file mode 100644 index 1344edf..0000000 --- a/features/steps/dashboard/dashboard_issues.rb +++ /dev/null @@ -1,74 +0,0 @@ -class DashboardIssues < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - - step 'I should see issues assigned to me' do - should_see(assigned_issue) - should_not_see(authored_issue) - should_not_see(other_issue) - end - - step 'I should see issues authored by me' do - should_see(authored_issue) - should_not_see(assigned_issue) - should_not_see(other_issue) - end - - step 'I should see all issues' do - should_see(authored_issue) - should_see(assigned_issue) - should_see(other_issue) - end - - step 'I have authored issues' do - authored_issue - end - - step 'I have assigned issues' do - assigned_issue - end - - step 'I have other issues' do - other_issue - end - - step 'I click "Authored by me" link' do - within ".scope-filter" do - click_link 'Created by me' - end - end - - step 'I click "All" link' do - within ".scope-filter" do - click_link "Everyone's" - end - end - - def should_see(issue) - page.should have_content(issue.title[0..10]) - end - - def should_not_see(issue) - page.should_not have_content(issue.title[0..10]) - end - - def assigned_issue - @assigned_issue ||= create :issue, assignee: current_user, project: project - end - - def authored_issue - @authored_issue ||= create :issue, author: current_user, project: project - end - - def other_issue - @other_issue ||= create :issue, project: project - end - - def project - @project ||= begin - project =create :project - project.team << [current_user, :master] - project - end - end -end diff --git a/features/steps/dashboard/dashboard_merge_requests.rb b/features/steps/dashboard/dashboard_merge_requests.rb deleted file mode 100644 index 62d8450..0000000 --- a/features/steps/dashboard/dashboard_merge_requests.rb +++ /dev/null @@ -1,74 +0,0 @@ -class DashboardMergeRequests < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - - step 'I should see merge requests assigned to me' do - should_see(assigned_merge_request) - should_not_see(authored_merge_request) - should_not_see(other_merge_request) - end - - step 'I should see merge requests authored by me' do - should_see(authored_merge_request) - should_not_see(assigned_merge_request) - should_not_see(other_merge_request) - end - - step 'I should see all merge requests' do - should_see(authored_merge_request) - should_see(assigned_merge_request) - should_see(other_merge_request) - end - - step 'I have authored merge requests' do - authored_merge_request - end - - step 'I have assigned merge requests' do - assigned_merge_request - end - - step 'I have other merge requests' do - other_merge_request - end - - step 'I click "Authored by me" link' do - within ".scope-filter" do - click_link 'Created by me' - end - end - - step 'I click "All" link' do - within ".scope-filter" do - click_link "Everyone's" - end - end - - def should_see(merge_request) - page.should have_content(merge_request.title[0..10]) - end - - def should_not_see(merge_request) - page.should_not have_content(merge_request.title[0..10]) - end - - def assigned_merge_request - @assigned_merge_request ||= create :merge_request, assignee: current_user, target_project: project - end - - def authored_merge_request - @authored_merge_request ||= create :merge_request, author: current_user, target_project: project - end - - def other_merge_request - @other_merge_request ||= create :merge_request, target_project: project - end - - def project - @project ||= begin - project =create :project - project.team << [current_user, :master] - project - end - end -end diff --git a/features/steps/dashboard/dashboard_projects.rb b/features/steps/dashboard/dashboard_projects.rb deleted file mode 100644 index 8525156..0000000 --- a/features/steps/dashboard/dashboard_projects.rb +++ /dev/null @@ -1,11 +0,0 @@ -class DashboardProjects < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - - Then 'I should see projects list' do - @user.authorized_projects.all.each do |project| - page.should have_link project.name_with_namespace - end - end -end diff --git a/features/steps/dashboard/dashboard_search.rb b/features/steps/dashboard/dashboard_search.rb deleted file mode 100644 index 32966a8..0000000 --- a/features/steps/dashboard/dashboard_search.rb +++ /dev/null @@ -1,19 +0,0 @@ -class DashboardSearch < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - - Given 'I search for "Sho"' do - fill_in "dashboard_search", with: "Sho" - click_button "Search" - end - - Then 'I should see "Shop" project link' do - page.should have_link "Shop" - end - - Given 'I search for "Contibuting"' do - fill_in "dashboard_search", with: "Contibuting" - click_button "Search" - end -end diff --git a/features/steps/dashboard/dashboard_with_archived_projects.rb b/features/steps/dashboard/dashboard_with_archived_projects.rb deleted file mode 100644 index 1bc6955..0000000 --- a/features/steps/dashboard/dashboard_with_archived_projects.rb +++ /dev/null @@ -1,22 +0,0 @@ -class 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 - - Then 'I should see "Shop" project link' do - page.should have_link "Shop" - end - - Then 'I should not see "Forum" project link' do - page.should_not have_link "Forum" - end - - Then 'I should see "Forum" project link' do - page.should have_link "Forum" - end -end diff --git a/features/steps/dashboard/event_filters.rb b/features/steps/dashboard/event_filters.rb new file mode 100644 index 0000000..d0fe5c9 --- /dev/null +++ b/features/steps/dashboard/event_filters.rb @@ -0,0 +1,87 @@ +class EventFilters < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + Then 'I should see push event' do + page.should have_selector('span.pushed') + end + + Then 'I should not see push event' do + page.should_not have_selector('span.pushed') + end + + Then 'I should see new member event' do + page.should have_selector('span.joined') + end + + And 'I should not see new member event' do + page.should_not have_selector('span.joined') + end + + Then 'I should see merge request event' do + page.should have_selector('span.accepted') + end + + And 'I should not see merge request event' do + page.should_not have_selector('span.accepted') + end + + And 'this project has push event' do + data = { + before: "0000000000000000000000000000000000000000", + after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", + ref: "refs/heads/new_design", + user_id: @user.id, + user_name: @user.name, + repository: { + name: @project.name, + url: "localhost/rubinius", + description: "", + homepage: "localhost/rubinius", + private: true + } + } + + @event = Event.create( + project: @project, + action: Event::PUSHED, + data: data, + author_id: @user.id + ) + end + + And 'this project has new member event' do + user = create(:user, {name: "John Doe"}) + Event.create( + project: @project, + author_id: user.id, + action: Event::JOINED + ) + end + + And 'this project has merge request event' do + merge_request = create :merge_request, author: @user, source_project: @project, target_project: @project + Event.create( + project: @project, + action: Event::MERGED, + target_id: merge_request.id, + target_type: "MergeRequest", + author_id: @user.id + ) + end + + When 'I click "push" event filter' do + click_link("push_event_filter") + end + + When 'I click "team" event filter' do + click_link("team_event_filter") + end + + When 'I click "merge" event filter' do + click_link("merged_event_filter") + end + +end + diff --git a/features/steps/dashboard/issues.rb b/features/steps/dashboard/issues.rb new file mode 100644 index 0000000..1344edf --- /dev/null +++ b/features/steps/dashboard/issues.rb @@ -0,0 +1,74 @@ +class DashboardIssues < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + + step 'I should see issues assigned to me' do + should_see(assigned_issue) + should_not_see(authored_issue) + should_not_see(other_issue) + end + + step 'I should see issues authored by me' do + should_see(authored_issue) + should_not_see(assigned_issue) + should_not_see(other_issue) + end + + step 'I should see all issues' do + should_see(authored_issue) + should_see(assigned_issue) + should_see(other_issue) + end + + step 'I have authored issues' do + authored_issue + end + + step 'I have assigned issues' do + assigned_issue + end + + step 'I have other issues' do + other_issue + end + + step 'I click "Authored by me" link' do + within ".scope-filter" do + click_link 'Created by me' + end + end + + step 'I click "All" link' do + within ".scope-filter" do + click_link "Everyone's" + end + end + + def should_see(issue) + page.should have_content(issue.title[0..10]) + end + + def should_not_see(issue) + page.should_not have_content(issue.title[0..10]) + end + + def assigned_issue + @assigned_issue ||= create :issue, assignee: current_user, project: project + end + + def authored_issue + @authored_issue ||= create :issue, author: current_user, project: project + end + + def other_issue + @other_issue ||= create :issue, project: project + end + + def project + @project ||= begin + project =create :project + project.team << [current_user, :master] + project + end + end +end diff --git a/features/steps/dashboard/merge_requests.rb b/features/steps/dashboard/merge_requests.rb new file mode 100644 index 0000000..62d8450 --- /dev/null +++ b/features/steps/dashboard/merge_requests.rb @@ -0,0 +1,74 @@ +class DashboardMergeRequests < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + + step 'I should see merge requests assigned to me' do + should_see(assigned_merge_request) + should_not_see(authored_merge_request) + should_not_see(other_merge_request) + end + + step 'I should see merge requests authored by me' do + should_see(authored_merge_request) + should_not_see(assigned_merge_request) + should_not_see(other_merge_request) + end + + step 'I should see all merge requests' do + should_see(authored_merge_request) + should_see(assigned_merge_request) + should_see(other_merge_request) + end + + step 'I have authored merge requests' do + authored_merge_request + end + + step 'I have assigned merge requests' do + assigned_merge_request + end + + step 'I have other merge requests' do + other_merge_request + end + + step 'I click "Authored by me" link' do + within ".scope-filter" do + click_link 'Created by me' + end + end + + step 'I click "All" link' do + within ".scope-filter" do + click_link "Everyone's" + end + end + + def should_see(merge_request) + page.should have_content(merge_request.title[0..10]) + end + + def should_not_see(merge_request) + page.should_not have_content(merge_request.title[0..10]) + end + + def assigned_merge_request + @assigned_merge_request ||= create :merge_request, assignee: current_user, target_project: project + end + + def authored_merge_request + @authored_merge_request ||= create :merge_request, author: current_user, target_project: project + end + + def other_merge_request + @other_merge_request ||= create :merge_request, target_project: project + end + + def project + @project ||= begin + project =create :project + project.team << [current_user, :master] + project + end + end +end diff --git a/features/steps/dashboard/projects.rb b/features/steps/dashboard/projects.rb new file mode 100644 index 0000000..8525156 --- /dev/null +++ b/features/steps/dashboard/projects.rb @@ -0,0 +1,11 @@ +class DashboardProjects < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + Then 'I should see projects list' do + @user.authorized_projects.all.each do |project| + page.should have_link project.name_with_namespace + end + end +end diff --git a/features/steps/dashboard/search.rb b/features/steps/dashboard/search.rb new file mode 100644 index 0000000..32966a8 --- /dev/null +++ b/features/steps/dashboard/search.rb @@ -0,0 +1,19 @@ +class DashboardSearch < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + Given 'I search for "Sho"' do + fill_in "dashboard_search", with: "Sho" + click_button "Search" + end + + Then 'I should see "Shop" project link' do + page.should have_link "Shop" + end + + Given 'I search for "Contibuting"' do + fill_in "dashboard_search", with: "Contibuting" + click_button "Search" + end +end diff --git a/features/steps/dashboard/with_archived_projects.rb b/features/steps/dashboard/with_archived_projects.rb new file mode 100644 index 0000000..1bc6955 --- /dev/null +++ b/features/steps/dashboard/with_archived_projects.rb @@ -0,0 +1,22 @@ +class 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 + + Then 'I should see "Shop" project link' do + page.should have_link "Shop" + end + + Then 'I should not see "Forum" project link' do + page.should_not have_link "Forum" + end + + Then 'I should see "Forum" project link' do + page.should have_link "Forum" + end +end diff --git a/features/steps/profile/active_tab.rb b/features/steps/profile/active_tab.rb new file mode 100644 index 0000000..ee9f5f2 --- /dev/null +++ b/features/steps/profile/active_tab.rb @@ -0,0 +1,25 @@ +class ProfileActiveTab < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedActiveTab + + Then 'the active main tab should be Home' do + ensure_active_main_tab('Home') + end + + Then 'the active main tab should be Account' do + ensure_active_main_tab('Account') + end + + Then 'the active main tab should be SSH Keys' do + ensure_active_main_tab('SSH Keys') + end + + Then 'the active main tab should be Design' do + ensure_active_main_tab('Design') + end + + Then 'the active main tab should be History' do + ensure_active_main_tab('History') + end +end diff --git a/features/steps/profile/emails.rb b/features/steps/profile/emails.rb new file mode 100644 index 0000000..99588c8 --- /dev/null +++ b/features/steps/profile/emails.rb @@ -0,0 +1,48 @@ +class ProfileEmails < Spinach::FeatureSteps + include SharedAuthentication + + Then 'I visit profile emails page' do + visit profile_emails_path + end + + Then 'I should see my emails' do + page.should have_content(@user.email) + @user.emails.each do |email| + page.should have_content(email.email) + end + end + + And 'I submit new email "my@email.com"' do + fill_in "email_email", with: "my@email.com" + click_button "Add" + end + + Then 'I should see new email "my@email.com"' do + email = @user.emails.find_by(email: "my@email.com") + email.should_not be_nil + page.should have_content("my@email.com") + end + + Then 'I should not see email "my@email.com"' do + email = @user.emails.find_by(email: "my@email.com") + email.should be_nil + page.should_not have_content("my@email.com") + end + + Then 'I click link "Remove" for "my@email.com"' do + # there should only be one remove button at this time + click_link "Remove" + # force these to reload as they have been cached + @user.emails.reload + end + + And 'I submit duplicate email @user.email' do + fill_in "email_email", with: @user.email + click_button "Add" + end + + Then 'I should not have @user.email added' do + email = @user.emails.find_by(email: @user.email) + email.should be_nil + end +end diff --git a/features/steps/profile/notifications.rb b/features/steps/profile/notifications.rb new file mode 100644 index 0000000..e884df3 --- /dev/null +++ b/features/steps/profile/notifications.rb @@ -0,0 +1,12 @@ +class ProfileNotifications < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + + step 'I visit profile notifications page' do + visit profile_notifications_path + end + + step 'I should see global notifications settings' do + page.should have_content "Notifications settings" + end +end diff --git a/features/steps/profile/profile_active_tab.rb b/features/steps/profile/profile_active_tab.rb deleted file mode 100644 index ee9f5f2..0000000 --- a/features/steps/profile/profile_active_tab.rb +++ /dev/null @@ -1,25 +0,0 @@ -class ProfileActiveTab < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedActiveTab - - Then 'the active main tab should be Home' do - ensure_active_main_tab('Home') - end - - Then 'the active main tab should be Account' do - ensure_active_main_tab('Account') - end - - Then 'the active main tab should be SSH Keys' do - ensure_active_main_tab('SSH Keys') - end - - Then 'the active main tab should be Design' do - ensure_active_main_tab('Design') - end - - Then 'the active main tab should be History' do - ensure_active_main_tab('History') - end -end diff --git a/features/steps/profile/profile_emails.rb b/features/steps/profile/profile_emails.rb deleted file mode 100644 index 99588c8..0000000 --- a/features/steps/profile/profile_emails.rb +++ /dev/null @@ -1,48 +0,0 @@ -class ProfileEmails < Spinach::FeatureSteps - include SharedAuthentication - - Then 'I visit profile emails page' do - visit profile_emails_path - end - - Then 'I should see my emails' do - page.should have_content(@user.email) - @user.emails.each do |email| - page.should have_content(email.email) - end - end - - And 'I submit new email "my@email.com"' do - fill_in "email_email", with: "my@email.com" - click_button "Add" - end - - Then 'I should see new email "my@email.com"' do - email = @user.emails.find_by(email: "my@email.com") - email.should_not be_nil - page.should have_content("my@email.com") - end - - Then 'I should not see email "my@email.com"' do - email = @user.emails.find_by(email: "my@email.com") - email.should be_nil - page.should_not have_content("my@email.com") - end - - Then 'I click link "Remove" for "my@email.com"' do - # there should only be one remove button at this time - click_link "Remove" - # force these to reload as they have been cached - @user.emails.reload - end - - And 'I submit duplicate email @user.email' do - fill_in "email_email", with: @user.email - click_button "Add" - end - - Then 'I should not have @user.email added' do - email = @user.emails.find_by(email: @user.email) - email.should be_nil - end -end diff --git a/features/steps/profile/profile_notifications.rb b/features/steps/profile/profile_notifications.rb deleted file mode 100644 index e884df3..0000000 --- a/features/steps/profile/profile_notifications.rb +++ /dev/null @@ -1,12 +0,0 @@ -class ProfileNotifications < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - - step 'I visit profile notifications page' do - visit profile_notifications_path - end - - step 'I should see global notifications settings' do - page.should have_content "Notifications settings" - end -end diff --git a/features/steps/profile/profile_ssh_keys.rb b/features/steps/profile/profile_ssh_keys.rb deleted file mode 100644 index 65ca824..0000000 --- a/features/steps/profile/profile_ssh_keys.rb +++ /dev/null @@ -1,48 +0,0 @@ -class ProfileSshKeys < Spinach::FeatureSteps - include SharedAuthentication - - Then 'I should see my ssh keys' do - @user.keys.each do |key| - page.should have_content(key.title) - end - end - - Given 'I click link "Add new"' do - click_link "Add SSH Key" - end - - And 'I submit new ssh key "Laptop"' do - fill_in "key_title", with: "Laptop" - fill_in "key_key", with: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop" - click_button "Add key" - end - - Then 'I should see new ssh key "Laptop"' do - key = Key.find_by(title: "Laptop") - page.should have_content(key.title) - page.should have_content(key.key) - current_path.should == profile_key_path(key) - end - - Given 'I click link "Work"' do - click_link "Work" - end - - And 'I click link "Remove"' do - click_link "Remove" - end - - Then 'I visit profile keys page' do - visit profile_keys_path - end - - And 'I should not see "Work" ssh key' do - within "#keys-table" do - page.should_not have_content "Work" - end - end - - And 'I have ssh key "ssh-rsa Work"' do - create(:key, user: @user, title: "ssh-rsa Work", key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+L3TbFegm3k8QjejSwemk4HhlRh+DuN679Pc5ckqE/MPhVtE/+kZQDYCTB284GiT2aIoGzmZ8ee9TkaoejAsBwlA+Wz2Q3vhz65X6sMgalRwpdJx8kSEUYV8ZPV3MZvPo8KdNg993o4jL6G36GDW4BPIyO6FPZhfsawdf6liVD0Xo5kibIK7B9VoE178cdLQtLpS2YolRwf5yy6XR6hbbBGQR+6xrGOdP16eGZDb1CE2bMvvJijjloFqPscGktWOqW+nfh5txwFfBzlfARDTBsS8WZtg3Yoj1kn33kPsWRlgHfNutFRAIynDuDdQzQq8tTtVwm+Yi75RfcPHW8y3P Work") - end -end diff --git a/features/steps/profile/ssh_keys.rb b/features/steps/profile/ssh_keys.rb new file mode 100644 index 0000000..65ca824 --- /dev/null +++ b/features/steps/profile/ssh_keys.rb @@ -0,0 +1,48 @@ +class ProfileSshKeys < Spinach::FeatureSteps + include SharedAuthentication + + Then 'I should see my ssh keys' do + @user.keys.each do |key| + page.should have_content(key.title) + end + end + + Given 'I click link "Add new"' do + click_link "Add SSH Key" + end + + And 'I submit new ssh key "Laptop"' do + fill_in "key_title", with: "Laptop" + fill_in "key_key", with: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop" + click_button "Add key" + end + + Then 'I should see new ssh key "Laptop"' do + key = Key.find_by(title: "Laptop") + page.should have_content(key.title) + page.should have_content(key.key) + current_path.should == profile_key_path(key) + end + + Given 'I click link "Work"' do + click_link "Work" + end + + And 'I click link "Remove"' do + click_link "Remove" + end + + Then 'I visit profile keys page' do + visit profile_keys_path + end + + And 'I should not see "Work" ssh key' do + within "#keys-table" do + page.should_not have_content "Work" + end + end + + And 'I have ssh key "ssh-rsa Work"' do + create(:key, user: @user, title: "ssh-rsa Work", key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+L3TbFegm3k8QjejSwemk4HhlRh+DuN679Pc5ckqE/MPhVtE/+kZQDYCTB284GiT2aIoGzmZ8ee9TkaoejAsBwlA+Wz2Q3vhz65X6sMgalRwpdJx8kSEUYV8ZPV3MZvPo8KdNg993o4jL6G36GDW4BPIyO6FPZhfsawdf6liVD0Xo5kibIK7B9VoE178cdLQtLpS2YolRwf5yy6XR6hbbBGQR+6xrGOdP16eGZDb1CE2bMvvJijjloFqPscGktWOqW+nfh5txwFfBzlfARDTBsS8WZtg3Yoj1kn33kPsWRlgHfNutFRAIynDuDdQzQq8tTtVwm+Yi75RfcPHW8y3P Work") + end +end diff --git a/features/steps/project/active_tab.rb b/features/steps/project/active_tab.rb new file mode 100644 index 0000000..dcc252f --- /dev/null +++ b/features/steps/project/active_tab.rb @@ -0,0 +1,140 @@ +class ProjectActiveTab < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + include SharedActiveTab + + # Main Tabs + + Then 'the active main tab should be Home' do + ensure_active_main_tab('Home') + end + + Then 'the active main tab should be Settings' do + ensure_active_main_tab('Settings') + end + + Then 'the active main tab should be Files' do + ensure_active_main_tab('Files') + end + + Then 'the active main tab should be Commits' do + ensure_active_main_tab('Commits') + end + + Then 'the active main tab should be Network' do + ensure_active_main_tab('Network') + end + + Then 'the active main tab should be Issues' do + ensure_active_main_tab('Issues') + end + + Then 'the active main tab should be Merge Requests' do + ensure_active_main_tab('Merge Requests') + end + + Then 'the active main tab should be Wall' do + ensure_active_main_tab('Wall') + end + + Then 'the active main tab should be Wiki' do + ensure_active_main_tab('Wiki') + end + + # Sub Tabs: Home + + Given 'I click the "Team" tab' do + click_link('Members') + end + + Given 'I click the "Attachments" tab' do + click_link('Attachments') + end + + Given 'I click the "Snippets" tab' do + click_link('Snippets') + end + + Given 'I click the "Edit" tab' do + within '.project-settings-nav' do + click_link('Project') + end + end + + Given 'I click the "Hooks" tab' do + click_link('Web Hooks') + end + + Given 'I click the "Deploy Keys" tab' do + click_link('Deploy Keys') + end + + Then 'the active sub nav should be Team' do + ensure_active_sub_nav('Members') + end + + Then 'the active sub nav should be Edit' do + ensure_active_sub_nav('Project') + end + + Then 'the active sub nav should be Hooks' do + ensure_active_sub_nav('Web Hooks') + end + + Then 'the active sub nav should be Deploy Keys' do + ensure_active_sub_nav('Deploy Keys') + end + + # Sub Tabs: Commits + + Given 'I click the "Compare" tab' do + click_link('Compare') + end + + Given 'I click the "Branches" tab' do + click_link('Branches') + end + + Given 'I click the "Tags" tab' do + click_link('Tags') + end + + Then 'the active sub tab should be Commits' do + ensure_active_sub_tab('Commits') + end + + Then 'the active sub tab should be Compare' do + ensure_active_sub_tab('Compare') + end + + Then 'the active sub tab should be Branches' do + ensure_active_sub_tab('Branches') + end + + Then 'the active sub tab should be Tags' do + ensure_active_sub_tab('Tags') + end + + # Sub Tabs: Issues + + Given 'I click the "Milestones" tab' do + click_link('Milestones') + end + + Given 'I click the "Labels" tab' do + click_link('Labels') + end + + Then 'the active sub tab should be Browse Issues' do + ensure_active_sub_tab('Browse Issues') + end + + Then 'the active sub tab should be Milestones' do + ensure_active_sub_tab('Milestones') + end + + Then 'the active sub tab should be Labels' do + ensure_active_sub_tab('Labels') + end +end diff --git a/features/steps/project/archived.rb b/features/steps/project/archived.rb new file mode 100644 index 0000000..dfbe762 --- /dev/null +++ b/features/steps/project/archived.rb @@ -0,0 +1,37 @@ +class ProjectArchived < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + When 'project "Forum" is archived' do + project = Project.find_by(name: "Forum") + project.update_attribute(:archived, true) + end + + When 'project "Shop" is archived' do + project = Project.find_by(name: "Shop") + project.update_attribute(:archived, true) + end + + When 'I visit project "Forum" page' do + project = Project.find_by(name: "Forum") + visit project_path(project) + end + + Then 'I should not see "Archived"' do + page.should_not have_content "Archived" + end + + Then 'I should see "Archived"' do + page.should have_content "Archived" + end + + When 'I set project archived' do + click_link "Archive" + end + + When 'I set project unarchived' do + click_link "Unarchive" + end + +end \ No newline at end of file diff --git a/features/steps/project/browse_branches.rb b/features/steps/project/browse_branches.rb new file mode 100644 index 0000000..ef29cc6 --- /dev/null +++ b/features/steps/project/browse_branches.rb @@ -0,0 +1,35 @@ +class ProjectBrowseBranches < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Then 'I should see "Shop" recent branches list' do + page.should have_content "Branches" + page.should have_content "master" + end + + Given 'I click link "All"' do + click_link "All" + end + + Then 'I should see "Shop" all branches list' do + page.should have_content "Branches" + page.should have_content "master" + end + + Given 'I click link "Protected"' do + click_link "Protected" + end + + Then '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 + + And 'project "Shop" has protected branches' do + project = Project.find_by(name: "Shop") + project.protected_branches.create(name: "stable") + end +end diff --git a/features/steps/project/browse_commits.rb b/features/steps/project/browse_commits.rb new file mode 100644 index 0000000..d667b58 --- /dev/null +++ b/features/steps/project/browse_commits.rb @@ -0,0 +1,104 @@ +class ProjectBrowseCommits < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Then 'I see project commits' do + commit = @project.repository.commit + page.should have_content(@project.name) + page.should have_content(commit.message) + page.should have_content(commit.id.to_s[0..5]) + end + + Given 'I click atom feed link' do + click_link "Feed" + end + + Then 'I see commits atom feed' do + commit = @project.repository.commit + page.response_headers['Content-Type'].should have_content("application/atom+xml") + page.body.should have_selector("title", text: "Recent commits to #{@project.name}") + page.body.should have_selector("author email", text: commit.author_email) + page.body.should have_selector("entry summary", text: commit.description) + end + + Given 'I click on commit link' do + visit project_commit_path(@project, ValidCommit::ID) + end + + Then 'I see commit info' do + page.should have_content ValidCommit::MESSAGE + page.should have_content "Showing 1 changed file" + end + + And 'I fill compare fields with refs' do + fill_in "from", with: "8716fc78f3c65bbf7bcf7b574febd583bc5d2812" + fill_in "to", with: "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a" + click_button "Compare" + end + + Then '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 + + Then 'I see breadcrumb links' do + page.should have_selector('ul.breadcrumb') + page.should have_selector('ul.breadcrumb span.divider', count: 3) + page.should have_selector('ul.breadcrumb a', count: 4) + + find('ul.breadcrumb li:nth-child(2) a')['href'].should match(/#{@project.path_with_namespace}\/commits\/master\z/) + find('ul.breadcrumb li:last a')['href'].should match(%r{master/app/models/project\.rb\z}) + end + + Then '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 + + Given 'I visit big commit page' do + visit project_commit_path(@project, BigCommits::BIG_COMMIT_ID) + end + + Then 'I see big commit warning' do + page.should have_content BigCommits::BIG_COMMIT_MESSAGE + page.should have_content "Warning! This is a large diff" + page.should have_content "If you still want to see the diff" + end + + Given 'I visit huge commit page' do + visit project_commit_path(@project, BigCommits::HUGE_COMMIT_ID) + end + + Then 'I see huge commit message' do + page.should have_content BigCommits::HUGE_COMMIT_MESSAGE + page.should have_content "Warning! This is a large diff" + page.should_not have_content "If you still want to see the diff" + end + + Given 'I visit a commit with an image that changed' do + visit project_commit_path(@project, 'cc1ba255d6c5ffdce87a357ba7ccc397a4f4026b') + end + + Then 'The diff links to both the previous and current image' do + links = page.all('.two-up span div a') + links[0]['href'].should =~ %r{blob/bc3735004cb45cec5e0e4fa92710897a910a5957} + links[1]['href'].should =~ %r{blob/cc1ba255d6c5ffdce87a357ba7ccc397a4f4026b} + end + + Given 'I click side-by-side diff button' do + click_link "Side-by-side Diff" + end + + Then 'I see side-by-side diff button' do + page.should have_content "Side-by-side Diff" + end + + Then '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 new file mode 100644 index 0000000..328be37 --- /dev/null +++ b/features/steps/project/browse_commits_user_lookup.rb @@ -0,0 +1,35 @@ +class ProjectBrowseCommitsUserLookup < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Given 'I have the user that authored the commits' do + @user = create(:user, email: 'dmitriy.zaporozhets@gmail.com') + create(:email, { user: @user, email: 'dzaporozhets@sphereconsultinginc.com' }) + end + + Given 'I click on commit link' do + visit project_commit_path(@project, ValidCommit::ID) + end + + Given 'I click on another commit link' do + visit project_commit_path(@project, ValidCommitWithAltEmail::ID) + end + + Then 'I see commit info' do + page.should have_content ValidCommit::MESSAGE + check_author_link(ValidCommit::AUTHOR_EMAIL) + end + + Then 'I see other commit info' do + page.should have_content ValidCommitWithAltEmail::MESSAGE + check_author_link(ValidCommitWithAltEmail::AUTHOR_EMAIL) + end + + def check_author_link(email) + 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 +end diff --git a/features/steps/project/browse_files.rb b/features/steps/project/browse_files.rb new file mode 100644 index 0000000..069086d --- /dev/null +++ b/features/steps/project/browse_files.rb @@ -0,0 +1,53 @@ +class ProjectBrowseFiles < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + step 'I should see files from repository' do + page.should have_content "app" + page.should have_content "history" + page.should have_content "Gemfile" + end + + step 'I should see files from repository for "8470d70"' do + current_path.should == project_tree_path(@project, "8470d70") + page.should have_content "app" + page.should have_content "history" + page.should have_content "Gemfile" + end + + step 'I click on "Gemfile.lock" file in repo' do + click_link "Gemfile.lock" + end + + step 'I should see it content' do + page.should have_content "DEPENDENCIES" + end + + step 'I click link "raw"' do + click_link "raw" + end + + step 'I should see raw file content' do + page.source.should == ValidCommit::BLOB_FILE + end + + step 'I click button "edit"' do + click_link 'edit' + end + + step 'I can edit code' do + page.execute_script('editor.setValue("GitlabFileEditor")') + page.evaluate_script('editor.getValue()').should == "GitlabFileEditor" + 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 +end diff --git a/features/steps/project/browse_git_repo.rb b/features/steps/project/browse_git_repo.rb new file mode 100644 index 0000000..cd9a60f --- /dev/null +++ b/features/steps/project/browse_git_repo.rb @@ -0,0 +1,19 @@ +class ProjectBrowseGitRepo < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Given 'I click on "Gemfile.lock" file in repo' do + click_link "Gemfile.lock" + end + + And 'I click blame button' do + click_link "blame" + end + + Then 'I should see git file blame' do + page.should have_content "DEPENDENCIES" + page.should have_content "Dmitriy Zaporozhets" + page.should have_content "Moving to rails 3.2" + end +end diff --git a/features/steps/project/browse_tags.rb b/features/steps/project/browse_tags.rb new file mode 100644 index 0000000..0cbfa0d --- /dev/null +++ b/features/steps/project/browse_tags.rb @@ -0,0 +1,10 @@ +class ProjectBrowseTags < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Then 'I should see "Shop" all tags list' do + page.should have_content "Tags" + page.should have_content "v1.2.1" + end +end diff --git a/features/steps/project/create.rb b/features/steps/project/create.rb new file mode 100644 index 0000000..b59345e --- /dev/null +++ b/features/steps/project/create.rb @@ -0,0 +1,42 @@ +class CreateProject < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + + And 'fill project form with valid data' do + fill_in 'project_name', with: 'Empty' + click_button "Create project" + end + + Then 'I should see project page' do + current_path.should == project_path(Project.last) + page.should have_content "Empty" + end + + And 'I should see empty project instuctions' do + page.should have_content "git init" + page.should have_content "git remote" + page.should have_content Project.last.url_to_repo + end + + Then 'I see empty project instuctions' do + page.should have_content "git init" + page.should have_content "git remote" + page.should have_content Project.last.url_to_repo + end + + And 'I click on HTTP' do + click_button 'HTTP' + end + + Then 'Remote url should update to http link' do + page.should have_content "git remote add origin #{Project.last.http_url_to_repo}" + end + + And 'If I click on SSH' do + click_button 'SSH' + end + + Then 'Remote url should update to ssh link' do + page.should have_content "git remote add origin #{Project.last.url_to_repo}" + end +end diff --git a/features/steps/project/create_project.rb b/features/steps/project/create_project.rb deleted file mode 100644 index b59345e..0000000 --- a/features/steps/project/create_project.rb +++ /dev/null @@ -1,42 +0,0 @@ -class CreateProject < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - - And 'fill project form with valid data' do - fill_in 'project_name', with: 'Empty' - click_button "Create project" - end - - Then 'I should see project page' do - current_path.should == project_path(Project.last) - page.should have_content "Empty" - end - - And 'I should see empty project instuctions' do - page.should have_content "git init" - page.should have_content "git remote" - page.should have_content Project.last.url_to_repo - end - - Then 'I see empty project instuctions' do - page.should have_content "git init" - page.should have_content "git remote" - page.should have_content Project.last.url_to_repo - end - - And 'I click on HTTP' do - click_button 'HTTP' - end - - Then 'Remote url should update to http link' do - page.should have_content "git remote add origin #{Project.last.http_url_to_repo}" - end - - And 'If I click on SSH' do - click_button 'SSH' - end - - Then 'Remote url should update to ssh link' do - page.should have_content "git remote add origin #{Project.last.url_to_repo}" - end -end diff --git a/features/steps/project/filter_labels.rb b/features/steps/project/filter_labels.rb new file mode 100644 index 0000000..5926d69 --- /dev/null +++ b/features/steps/project/filter_labels.rb @@ -0,0 +1,70 @@ +class ProjectFilterLabels < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Then 'I should see "bug" in labels filter' do + within ".labels-filter" do + page.should have_content "bug" + end + end + + And 'I should see "feature" in labels filter' do + within ".labels-filter" do + page.should have_content "feature" + end + end + + And 'I should see "enhancement" in labels filter' do + within ".labels-filter" do + page.should have_content "enhancement" + end + end + + Then 'I should see "Bugfix1" in issues list' do + within ".issues-list" do + page.should have_content "Bugfix1" + end + end + + And 'I should see "Bugfix2" in issues list' do + within ".issues-list" do + page.should have_content "Bugfix2" + end + end + + And 'I should not see "Bugfix2" in issues list' do + within ".issues-list" do + page.should_not have_content "Bugfix2" + end + end + + And 'I should not see "Feature1" in issues list' do + within ".issues-list" do + page.should_not have_content "Feature1" + end + end + + Given 'I click link "bug"' do + click_link "bug" + end + + Given 'I click link "feature"' do + click_link "feature" + end + + And 'project "Shop" has issue "Bugfix1" with tags: "bug", "feature"' do + project = Project.find_by(name: "Shop") + create(:issue, title: "Bugfix1", project: project, label_list: ['bug', 'feature']) + end + + And 'project "Shop" has issue "Bugfix2" with tags: "bug", "enhancement"' do + project = Project.find_by(name: "Shop") + create(:issue, title: "Bugfix2", project: project, label_list: ['bug', 'enhancement']) + end + + And 'project "Shop" has issue "Feature1" with tags: "feature"' do + project = Project.find_by(name: "Shop") + create(:issue, title: "Feature1", project: project, label_list: 'feature') + end +end diff --git a/features/steps/project/fork.rb b/features/steps/project/fork.rb new file mode 100644 index 0000000..c00d901 --- /dev/null +++ b/features/steps/project/fork.rb @@ -0,0 +1,36 @@ +class ForkProject < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + step 'I click link "Fork"' do + page.should have_content "Shop" + page.should have_content "Fork" + Gitlab::Shell.any_instance.stub(:fork_repository).and_return(true) + click_link "Fork" + end + + step 'I am a member of project "Shop"' do + @project = Project.find_by(name: "Shop") + @project ||= create(:project, name: "Shop", group: create(:group)) + @project.team << [@user, :reporter] + end + + step 'I should see the forked project page' do + page.should have_content "Project was successfully forked." + current_path.should include current_user.namespace.path + @forked_project = Project.find_by(namespace_id: current_user.namespace.path) + end + + step 'I already have a project named "Shop" in my namespace' do + current_user.namespace ||= create(:namespace) + current_user.namespace.should_not be_nil + current_user.namespace.path.should_not be_nil + @my_project = create(:project, name: "Shop", namespace: current_user.namespace) + end + + step 'I should see a "Name has already been taken" warning' do + page.should have_content "Name has already been taken" + end + +end diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb new file mode 100644 index 0000000..4cc99f8 --- /dev/null +++ b/features/steps/project/forked_merge_requests.rb @@ -0,0 +1,183 @@ +class ProjectForkedMergeRequests < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedNote + include SharedPaths + include Select2Helper + + step 'I am a member of project "Shop"' do + @project = Project.find_by(name: "Shop") + @project ||= create(:project, name: "Shop") + @project.team << [@user, :reporter] + end + + step 'I have a project forked off of "Shop" called "Forked Shop"' do + @forking_user = @user + forked_project_link = build(:forked_project_link) + @forked_project = Project.find_by(name: "Forked Shop") + @forked_project ||= create(:project, name: "Forked Shop", forked_project_link: forked_project_link, creator_id: @forking_user.id , namespace: @forking_user.namespace) + + forked_project_link.forked_from_project = @project + forked_project_link.forked_to_project = @forked_project + @forked_project.team << [@forking_user , :master] + forked_project_link.save! + end + + step 'I click link "New Merge Request"' do + click_link "New Merge Request" + end + + step 'I should see merge request "Merge Request On Forked Project"' do + @project.merge_requests.size.should >= 1 + @merge_request = @project.merge_requests.last + current_path.should == project_merge_request_path(@project, @merge_request) + @merge_request.title.should == "Merge Request On Forked Project" + @merge_request.source_project.should == @forked_project + @merge_request.source_branch.should == "master" + @merge_request.target_branch.should == "stable" + page.should have_content @forked_project.path_with_namespace + page.should have_content @project.path_with_namespace + page.should have_content @merge_request.source_branch + page.should have_content @merge_request.target_branch + end + + step 'I fill out a "Merge Request On Forked Project" merge request' do + select2 @forked_project.id, from: "#merge_request_source_project_id" + select2 @project.id, from: "#merge_request_target_project_id" + + find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s + find(:select, "merge_request_target_project_id", {}).value.should == @project.id.to_s + + select2 "master", from: "#merge_request_source_branch" + select2 "stable", from: "#merge_request_target_branch" + + find(:select, "merge_request_source_branch", {}).value.should == 'master' + find(:select, "merge_request_target_branch", {}).value.should == 'stable' + + fill_in "merge_request_title", with: "Merge Request On Forked Project" + end + + step 'I submit the merge request' do + click_button "Submit merge request" + end + + step 'I follow the target commit link' do + commit = @project.repository.commit + click_link commit.short_id(8) + end + + step 'I should see the commit under the forked from project' do + commit = @project.repository.commit + page.should have_content(commit.message) + end + + step 'I click "Create Merge Request on fork" link' do + click_link "Create Merge Request on fork" + end + + step 'I see prefilled new Merge Request page for the forked project' do + current_path.should == new_project_merge_request_path(@forked_project) + find("#merge_request_source_project_id").value.should == @forked_project.id.to_s + find("#merge_request_target_project_id").value.should == @project.id.to_s + find("#merge_request_source_branch").value.should have_content "new_design" + find("#merge_request_target_branch").value.should have_content "master" + find("#merge_request_title").value.should == "New Design" + verify_commit_link(".mr_target_commit",@project) + verify_commit_link(".mr_source_commit",@forked_project) + end + + step 'I update the merge request title' do + fill_in "merge_request_title", with: "An Edited Forked Merge Request" + end + + step 'I save the merge request' do + click_button "Save changes" + end + + step 'I should see the edited merge request' do + page.should have_content "An Edited Forked Merge Request" + @project.merge_requests.size.should >= 1 + @merge_request = @project.merge_requests.last + current_path.should == project_merge_request_path(@project, @merge_request) + @merge_request.source_project.should == @forked_project + @merge_request.source_branch.should == "master" + @merge_request.target_branch.should == "stable" + page.should have_content @forked_project.path_with_namespace + page.should have_content @project.path_with_namespace + page.should have_content @merge_request.source_branch + page.should have_content @merge_request.target_branch + end + + step 'I should see last push widget' do + page.should have_content "You pushed to new_design" + page.should have_link "Create Merge Request" + end + + step 'project "Forked Shop" has push event' do + @forked_project = Project.find_by(name: "Forked Shop") + + data = { + before: "0000000000000000000000000000000000000000", + after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", + ref: "refs/heads/new_design", + user_id: @user.id, + user_name: @user.name, + repository: { + name: @forked_project.name, + url: "localhost/rubinius", + description: "", + homepage: "localhost/rubinius", + private: true + } + } + + @event = Event.create( + project: @forked_project, + action: Event::PUSHED, + data: data, + author_id: @user.id + ) + end + + + step 'I click link edit "Merge Request On Forked Project"' do + find("#edit_merge_request").click + end + + step 'I see the edit page prefilled for "Merge Request On Forked Project"' do + current_path.should == edit_project_merge_request_path(@project, @merge_request) + page.should have_content "Edit merge request ##{@merge_request.id}" + find("#merge_request_title").value.should == "Merge Request On Forked Project" + find("#merge_request_source_project_id").value.should == @forked_project.id.to_s + find("#merge_request_target_project_id").value.should == @project.id.to_s + find("#merge_request_source_branch").value.should have_content "master" + verify_commit_link(".mr_source_commit",@forked_project) + find("#merge_request_target_branch").value.should have_content "stable" + verify_commit_link(".mr_target_commit",@project) + end + + step 'I fill out an invalid "Merge Request On Forked Project" merge request' do + #If this isn't filled in the rest of the validations won't be triggered + fill_in "merge_request_title", with: "Merge Request On Forked Project" + find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s + find(:select, "merge_request_target_project_id", {}).value.should == @forked_project.id.to_s + find(:select, "merge_request_source_branch", {}).value.should == "" + find(:select, "merge_request_target_branch", {}).value.should == "" + end + + step 'I should see validation errors' do + page.should have_content "Source branch can't be blank" + page.should have_content "Target branch can't be blank" + page.should have_content "Branch conflict You can not use same project/branch for source and target" + end + + def project + @project ||= Project.find_by!(name: "Shop") + end + + # Verify a link is generated against the correct project + def verify_commit_link(container_div, container_project) + # This should force a wait for the javascript to execute + find(:div,container_div).find(".commit_short_id")['href'].should have_content "#{container_project.path_with_namespace}/commit" + end +end diff --git a/features/steps/project/graph.rb b/features/steps/project/graph.rb new file mode 100644 index 0000000..89fe5fd --- /dev/null +++ b/features/steps/project/graph.rb @@ -0,0 +1,13 @@ +class ProjectGraph < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + + Then 'page should have graphs' do + page.should have_selector ".stat-graph" + end + + When 'I visit project "Shop" graph page' do + project = Project.find_by(name: "Shop") + visit project_graph_path(project, "master") + end +end diff --git a/features/steps/project/hooks.rb b/features/steps/project/hooks.rb new file mode 100644 index 0000000..19ff324 --- /dev/null +++ b/features/steps/project/hooks.rb @@ -0,0 +1,38 @@ +require 'webmock' + +class ProjectHooks < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + include RSpec::Matchers + include RSpec::Mocks::ExampleMethods + include WebMock::API + + Given 'project has hook' do + @hook = create(:project_hook, project: current_project) + end + + Then 'I should see project hook' do + page.should have_content @hook.url + end + + When 'I submit new hook' do + @url = Faker::Internet.uri("http") + fill_in "hook_url", with: @url + expect { click_button "Add Web Hook" }.to change(ProjectHook, :count).by(1) + end + + Then 'I should see newly created hook' do + page.current_path.should == project_hooks_path(current_project) + page.should have_content(@url) + end + + When 'I click test hook button' do + stub_request(:post, @hook.url).to_return(status: 200) + click_link 'Test Hook' + end + + Then 'hook should be triggered' do + page.current_path.should == project_hooks_path(current_project) + end +end diff --git a/features/steps/project/issue_tracker.rb b/features/steps/project/issue_tracker.rb new file mode 100644 index 0000000..c2fd4e1 --- /dev/null +++ b/features/steps/project/issue_tracker.rb @@ -0,0 +1,31 @@ +class ProjectIssueTracker < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + step 'project "Shop" has issues enabled' do + @project = Project.find_by(name: "Shop") + @project ||= create(:project, name: "Shop", namespace: @user.namespace) + @project.issues_enabled = true + end + + step 'change the issue tracker to "GitLab"' do + select 'GitLab', from: 'project_issues_tracker' + end + + step 'I the project should have "GitLab" as issue tracker' do + find_field('project_issues_tracker').value.should == 'gitlab' + end + + step 'change the issue tracker to "Redmine"' do + select 'Redmine', from: 'project_issues_tracker' + end + + step 'I the project should have "Redmine" as issue tracker' do + find_field('project_issues_tracker').value.should == 'redmine' + end + + And 'I save project' do + click_button 'Save changes' + end +end diff --git a/features/steps/project/issues.rb b/features/steps/project/issues.rb new file mode 100644 index 0000000..a92fd50 --- /dev/null +++ b/features/steps/project/issues.rb @@ -0,0 +1,145 @@ +class ProjectIssues < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedNote + include SharedPaths + include SharedMarkdown + + Given 'I should see "Release 0.4" in issues' do + page.should have_content "Release 0.4" + end + + And 'I should not see "Release 0.3" in issues' do + page.should_not have_content "Release 0.3" + end + + And 'I should not see "Tweet control" in issues' do + page.should_not have_content "Tweet control" + end + + Given 'I click link "Closed"' do + click_link "Closed" + end + + Then 'I should see "Release 0.3" in issues' do + page.should have_content "Release 0.3" + end + + And 'I should not see "Release 0.4" in issues' do + page.should_not have_content "Release 0.4" + end + + Given 'I click link "All"' do + click_link "All" + end + + Given 'I click link "Release 0.4"' do + click_link "Release 0.4" + end + + Then 'I should see issue "Release 0.4"' do + page.should have_content "Release 0.4" + end + + Given 'I click link "New Issue"' do + click_link "New Issue" + end + + And 'I submit new issue "500 error on profile"' do + fill_in "issue_title", with: "500 error on profile" + click_button "Submit new issue" + end + + Given 'I click link "500 error on profile"' do + click_link "500 error on profile" + end + + Then '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 + + Given 'I fill in issue search with "Re"' do + fill_in 'issue_search', with: "Re" + end + + Given 'I fill in issue search with "Bu"' do + fill_in 'issue_search', with: "Bu" + end + + And 'I fill in issue search with ".3"' do + fill_in 'issue_search', with: ".3" + end + + And 'I fill in issue search with "Something"' do + fill_in 'issue_search', with: "Something" + end + + And 'I fill in issue search with ""' do + fill_in 'issue_search', with: "" + end + + Given 'project "Shop" has milestone "v2.2"' do + project = Project.find_by(name: "Shop") + milestone = create(:milestone, title: "v2.2", project: project) + + 3.times { create(:issue, project: project, milestone: milestone) } + end + + And 'project "Shop" has milestone "v3.0"' do + project = Project.find_by(name: "Shop") + 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 + + Then 'I should see selected milestone with title "v3.0"' do + issues_milestone_selector = "#issue_milestone_id_chzn > a" + page.find(issues_milestone_selector).should have_content("v3.0") + end + + When 'I select first assignee from "Shop" project' do + project = Project.find_by(name: "Shop") + first_assignee = project.users.first + select first_assignee.name, from: "assignee_id" + end + + Then 'I should see first assignee from "Shop" as selected assignee' do + issues_assignee_selector = "#issue_assignee_id_chzn > a" + project = Project.find_by(name: "Shop") + assignee_name = project.users.first.name + page.find(issues_assignee_selector).should have_content(assignee_name) + end + + And 'project "Shop" have "Release 0.4" open issue' do + project = Project.find_by(name: "Shop") + create(:issue, + title: "Release 0.4", + project: project, + author: project.users.first, + description: "# Description header" + ) + end + + And 'project "Shop" have "Tweet control" open issue' do + project = Project.find_by(name: "Shop") + create(:issue, + title: "Tweet control", + project: project, + author: project.users.first) + end + + And 'project "Shop" have "Release 0.3" closed issue' do + project = Project.find_by(name: "Shop") + create(:closed_issue, + title: "Release 0.3", + project: project, + author: project.users.first) + end +end diff --git a/features/steps/project/labels.rb b/features/steps/project/labels.rb new file mode 100644 index 0000000..0907cdb --- /dev/null +++ b/features/steps/project/labels.rb @@ -0,0 +1,24 @@ +class ProjectLabels < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Then 'I should see label "bug"' do + within ".labels-table" do + page.should have_content "bug" + end + end + + And 'I should see label "feature"' do + within ".labels-table" do + page.should have_content "feature" + end + end + + And 'project "Shop" have issues tags: "bug", "feature"' do + project = Project.find_by(name: "Shop") + ['bug', 'feature'].each do |label| + create(:issue, project: project, label_list: label) + end + end +end diff --git a/features/steps/project/markdown_render.rb b/features/steps/project/markdown_render.rb new file mode 100644 index 0000000..89fbb74 --- /dev/null +++ b/features/steps/project/markdown_render.rb @@ -0,0 +1,207 @@ +class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedMarkdown + + And 'I own project "Delta"' do + @project = Project.find_by(name: "Delta") + @project ||= create(:project, name: "Delta", namespace: @user.namespace) + @project.team << [@user, :master] + end + + Then 'I should see files from repository in master' do + current_path.should == project_tree_path(@project, "master") + page.should have_content "Gemfile" + page.should have_content "app" + page.should have_content "README" + end + + And '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 + + And 'I click on Gitlab API in README' do + click_link "GitLab API doc" + end + + Then 'I should see correct document rendered' do + current_path.should == project_blob_path(@project, "master/doc/api/README.md") + page.should have_content "All API requests require authentication" + end + + And 'I click on Rake tasks in README' do + click_link "Rake tasks" + end + + Then 'I should see correct directory rendered' do + current_path.should == project_tree_path(@project, "master/doc/raketasks") + page.should have_content "backup_restore.md" + page.should have_content "maintenance.md" + end + + And 'I click on GitLab API doc directory in README' do + click_link "GitLab API doc directory" + end + + Then 'I should see correct doc/api directory rendered' do + current_path.should == project_tree_path(@project, "master/doc/api/") + page.should have_content "README.md" + page.should have_content "users.md" + end + + And 'I click on Maintenance in README' do + click_link "Maintenance" + end + + Then 'I should see correct maintenance file rendered' do + current_path.should == project_blob_path(@project, "master/doc/raketasks/maintenance.md") + page.should have_content "bundle exec rake gitlab:env:info RAILS_ENV=production" + end + + And 'I navigate to the doc/api/README' do + click_link "doc" + click_link "api" + click_link "README.md" + end + + And 'I see correct file rendered' do + current_path.should == project_blob_path(@project, "master/doc/api/README.md") + page.should have_content "Contents" + page.should have_link "Users" + page.should have_link "Rake tasks" + end + + And 'I click on users in doc/api/README' do + click_link "Users" + end + + Then 'I should see the correct document file' do + current_path.should == project_blob_path(@project, "master/doc/api/users.md") + page.should have_content "Get a list of users." + end + + And 'I click on raketasks in doc/api/README' do + click_link "Rake tasks" + end + + When 'I visit markdown branch' do + visit project_tree_path(@project, "markdown") + end + + Then 'I should see files from repository in markdown branch' do + current_path.should == project_tree_path(@project, "markdown") + page.should have_content "Gemfile" + page.should have_content "app" + page.should have_content "README" + end + + And '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 + + Then '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 + + Then '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 + + Then '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 + + Given 'I go to wiki page' do + click_link "Wiki" + current_path.should == project_wiki_path(@project, "home") + end + + And 'I add various links to the wiki page' do + fill_in "wiki[content]", with: "[test](test)\n[GitLab API doc](doc/api/README.md)\n[Rake tasks](doc/raketasks)\n" + fill_in "wiki[message]", with: "Adding links to wiki" + click_button "Create page" + end + + Then '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 + + And 'I click on test link' do + click_link "test" + end + + Then '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 + + And 'I click on GitLab API doc link' do + click_link "GitLab API" + end + + Then 'I see Gitlab API document' do + current_path.should == project_blob_path(@project, "master/doc/api/README.md") + page.should have_content "Status codes" + end + + And 'I click on Rake tasks link' do + click_link "Rake tasks" + end + + Then 'I see Rake tasks directory' do + current_path.should == project_tree_path(@project, "master/doc/raketasks") + page.should have_content "backup_restore.md" + page.should have_content "maintenance.md" + end + + Given 'I go directory which contains README file' do + visit project_tree_path(@project, "master/doc/api") + current_path.should == project_tree_path(@project, "master/doc/api") + end + + And 'I click on a relative link in README' do + click_link "Users" + end + + Then 'I should see the correct markdown' do + current_path.should == project_blob_path(@project, "master/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/merge_requests.rb b/features/steps/project/merge_requests.rb new file mode 100644 index 0000000..adf9e77 --- /dev/null +++ b/features/steps/project/merge_requests.rb @@ -0,0 +1,195 @@ +class ProjectMergeRequests < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedNote + include SharedPaths + include SharedMarkdown + + step 'I click link "New Merge Request"' do + click_link "New Merge Request" + end + + step 'I click link "Bug NS-04"' do + click_link "Bug NS-04" + end + + step 'I click link "All"' do + click_link "All" + end + + step 'I click link "Closed"' do + click_link "Closed" + end + + step 'I should see merge request "Wiki Feature"' do + within '.merge-request' do + page.should have_content "Wiki Feature" + end + end + + step 'I should see closed merge request "Bug NS-04"' do + merge_request = MergeRequest.find_by!(title: "Bug NS-04") + merge_request.closed?.should be_true + page.should have_content "Closed by" + end + + step 'I should see merge request "Bug NS-04"' do + page.should have_content "Bug NS-04" + end + + step 'I should see "Bug NS-04" in merge requests' do + page.should have_content "Bug NS-04" + end + + step 'I should see "Feature NS-03" in merge requests' do + page.should have_content "Feature NS-03" + end + + step 'I should not see "Feature NS-03" in merge requests' do + page.should_not have_content "Feature NS-03" + end + + + step 'I should not see "Bug NS-04" in merge requests' do + page.should_not have_content "Bug NS-04" + end + + step 'I click link "Close"' do + within '.page-title' do + click_link "Close" + end + end + + step 'I submit new merge request "Wiki Feature"' do + fill_in "merge_request_title", with: "Wiki Feature" + select "master", from: "merge_request_source_branch" + select "notes_refactoring", from: "merge_request_target_branch" + click_button "Submit merge request" + end + + step 'project "Shop" have "Bug NS-04" open merge request' do + create(:merge_request, + title: "Bug NS-04", + source_project: project, + target_project: project, + source_branch: 'stable', + target_branch: 'master', + author: project.users.first, + description: "# Description header" + ) + end + + step 'project "Shop" have "Bug NS-05" open merge request with diffs inside' do + create(:merge_request_with_diffs, + title: "Bug NS-05", + source_project: project, + target_project: project, + author: project.users.first) + end + + step 'project "Shop" have "Feature NS-03" closed merge request' do + create(:closed_merge_request, + title: "Feature NS-03", + source_project: project, + target_project: project, + author: project.users.first) + end + + step 'I switch to the diff tab' do + visit diffs_project_merge_request_path(project, merge_request) + end + + step 'I switch to the merge request\'s comments tab' do + visit project_merge_request_path(project, merge_request) + end + + step 'I click on the first commit in the merge request' do + within '.first-commits' do + click_link merge_request.commits.first.short_id(8) + end + end + + step 'I leave a comment on the diff page' do + init_diff_note + leave_comment "One comment to rule them all" + end + + step 'I leave a comment on the diff page in commit' do + find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click + leave_comment "One comment to rule them all" + end + + step 'I leave a comment like "Line is wrong" on line 185 of the first file' do + init_diff_note + leave_comment "Line is wrong" + end + + step 'I leave a comment like "Line is wrong" on line 185 of the first file in commit' do + find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click + leave_comment "Line is wrong" + end + + step 'I should see a discussion has started on line 185' do + page.should have_content "#{current_user.name} started a discussion on this merge request diff" + page.should have_content "app/assets/stylesheets/tree.scss:L185" + page.should have_content "Line is wrong" + end + + step 'I should see a discussion has started on commit b1e6a9dbf1:L185' do + page.should have_content "#{current_user.name} started a discussion on commit" + page.should have_content "app/assets/stylesheets/tree.scss:L185" + page.should have_content "Line is wrong" + end + + step 'I should see a discussion has started on commit b1e6a9dbf1' do + page.should have_content "#{current_user.name} started a discussion on commit" + page.should have_content "One comment to rule them all" + page.should have_content "app/assets/stylesheets/tree.scss:L185" + end + + step 'merge request is mergeable' do + page.should have_content 'You can accept this request automatically' + end + + step 'I modify merge commit message' do + find('.modify-merge-commit-link').click + fill_in 'merge_commit_message', with: "wow such merge" + end + + step 'merge request "Bug NS-05" is mergeable' do + merge_request.mark_as_mergeable + end + + step 'I accept this merge request' do + click_button "Accept Merge Request" + end + + step 'I should see merged request' do + within '.issue-box' do + page.should have_content "Merged" + end + end + + def project + @project ||= Project.find_by!(name: "Shop") + end + + def merge_request + @merge_request ||= MergeRequest.find_by!(title: "Bug NS-05") + end + + def init_diff_note + find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_172_185"]').click + end + + def leave_comment(message) + within(".js-discussion-note-form") do + fill_in "note_note", with: message + click_button "Add Comment" + end + + within ".note-text" do + page.should have_content message + end + end +end diff --git a/features/steps/project/milestones.rb b/features/steps/project/milestones.rb new file mode 100644 index 0000000..9ce18fb --- /dev/null +++ b/features/steps/project/milestones.rb @@ -0,0 +1,59 @@ +class ProjectMilestones < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + include SharedMarkdown + + Then '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 + + Given 'I click link "v2.2"' do + click_link "v2.2" + end + + Given 'I click link "New Milestone"' do + click_link "New Milestone" + end + + And 'I submit new milestone "v2.3"' do + fill_in "milestone_title", with: "v2.3" + click_button "Create milestone" + end + + Then '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 + + And '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 + + Given '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 + + Then "I should see 3 issues" do + page.should have_selector('#tab-issues li', count: 4) + end +end diff --git a/features/steps/project/multiselect_blob.rb b/features/steps/project/multiselect_blob.rb new file mode 100644 index 0000000..3d330e8 --- /dev/null +++ b/features/steps/project/multiselect_blob.rb @@ -0,0 +1,58 @@ +class 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 }));" + page.evaluate_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 + page.evaluate_script("window.history.back()") + end + + step 'I go forward in history' do + page.evaluate_script("window.history.forward()") + end + + step 'I click on "Gemfile.lock" file in repo' do + click_link "Gemfile.lock" + end +end \ No newline at end of file diff --git a/features/steps/project/network_graph.rb b/features/steps/project/network_graph.rb new file mode 100644 index 0000000..1c5cfcc --- /dev/null +++ b/features/steps/project/network_graph.rb @@ -0,0 +1,93 @@ +class ProjectNetworkGraph < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + Then 'page should have network graph' do + page.should have_selector ".network-graph" + end + + When 'I visit project "Shop" network page' do + # Stub Graph max_size to speed up test (10 commits vs. 650) + Network::Graph.stub(max_count: 10) + + project = Project.find_by(name: "Shop") + visit project_network_path(project, "master") + end + + And 'page should select "master" in select box' do + page.should have_selector '.select2-chosen', text: "master" + end + + And 'page should select "v2.1.0" in select box' do + page.should have_selector '.select2-chosen', text: "v2.1.0" + end + + And 'page should have "master" on graph' do + within '.network-graph' do + page.should have_content 'master' + end + end + + When 'I switch ref to "stable"' do + page.select 'stable', from: 'ref' + sleep 2 + end + + When 'I switch ref to "v2.1.0"' do + page.select 'v2.1.0', from: 'ref' + sleep 2 + end + + When 'click "Show only selected branch" checkbox' do + find('#filter_ref').click + sleep 2 + end + + Then 'page should have content not containing "v2.1.0"' do + within '.network-graph' do + page.should have_content 'cleaning' + end + end + + Then 'page should not have content not containing "v2.1.0"' do + within '.network-graph' do + page.should_not have_content 'cleaning' + end + end + + And 'page should select "stable" in select box' do + page.should have_selector '.select2-chosen', text: "stable" + end + + And 'page should select "v2.1.0" in select box' do + page.should have_selector '.select2-chosen', text: "v2.1.0" + end + + And 'page should have "stable" on graph' do + within '.network-graph' do + page.should have_content 'stable' + end + end + + When 'I looking for a commit by SHA of "v2.1.0"' do + within ".network-form" do + fill_in 'extended_sha1', with: '98d6492' + find('button').click + end + sleep 2 + end + + And 'page should have "v2.1.0" on graph' do + within '.network-graph' do + page.should have_content 'v2.1.0' + end + end + + When 'I look for a commit by ";"' do + within ".network-form" do + fill_in 'extended_sha1', with: ';' + find('button').click + end + end +end diff --git a/features/steps/project/project_active_tab.rb b/features/steps/project/project_active_tab.rb deleted file mode 100644 index dcc252f..0000000 --- a/features/steps/project/project_active_tab.rb +++ /dev/null @@ -1,140 +0,0 @@ -class ProjectActiveTab < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - include SharedActiveTab - - # Main Tabs - - Then 'the active main tab should be Home' do - ensure_active_main_tab('Home') - end - - Then 'the active main tab should be Settings' do - ensure_active_main_tab('Settings') - end - - Then 'the active main tab should be Files' do - ensure_active_main_tab('Files') - end - - Then 'the active main tab should be Commits' do - ensure_active_main_tab('Commits') - end - - Then 'the active main tab should be Network' do - ensure_active_main_tab('Network') - end - - Then 'the active main tab should be Issues' do - ensure_active_main_tab('Issues') - end - - Then 'the active main tab should be Merge Requests' do - ensure_active_main_tab('Merge Requests') - end - - Then 'the active main tab should be Wall' do - ensure_active_main_tab('Wall') - end - - Then 'the active main tab should be Wiki' do - ensure_active_main_tab('Wiki') - end - - # Sub Tabs: Home - - Given 'I click the "Team" tab' do - click_link('Members') - end - - Given 'I click the "Attachments" tab' do - click_link('Attachments') - end - - Given 'I click the "Snippets" tab' do - click_link('Snippets') - end - - Given 'I click the "Edit" tab' do - within '.project-settings-nav' do - click_link('Project') - end - end - - Given 'I click the "Hooks" tab' do - click_link('Web Hooks') - end - - Given 'I click the "Deploy Keys" tab' do - click_link('Deploy Keys') - end - - Then 'the active sub nav should be Team' do - ensure_active_sub_nav('Members') - end - - Then 'the active sub nav should be Edit' do - ensure_active_sub_nav('Project') - end - - Then 'the active sub nav should be Hooks' do - ensure_active_sub_nav('Web Hooks') - end - - Then 'the active sub nav should be Deploy Keys' do - ensure_active_sub_nav('Deploy Keys') - end - - # Sub Tabs: Commits - - Given 'I click the "Compare" tab' do - click_link('Compare') - end - - Given 'I click the "Branches" tab' do - click_link('Branches') - end - - Given 'I click the "Tags" tab' do - click_link('Tags') - end - - Then 'the active sub tab should be Commits' do - ensure_active_sub_tab('Commits') - end - - Then 'the active sub tab should be Compare' do - ensure_active_sub_tab('Compare') - end - - Then 'the active sub tab should be Branches' do - ensure_active_sub_tab('Branches') - end - - Then 'the active sub tab should be Tags' do - ensure_active_sub_tab('Tags') - end - - # Sub Tabs: Issues - - Given 'I click the "Milestones" tab' do - click_link('Milestones') - end - - Given 'I click the "Labels" tab' do - click_link('Labels') - end - - Then 'the active sub tab should be Browse Issues' do - ensure_active_sub_tab('Browse Issues') - end - - Then 'the active sub tab should be Milestones' do - ensure_active_sub_tab('Milestones') - end - - Then 'the active sub tab should be Labels' do - ensure_active_sub_tab('Labels') - end -end diff --git a/features/steps/project/project_archived.rb b/features/steps/project/project_archived.rb deleted file mode 100644 index dfbe762..0000000 --- a/features/steps/project/project_archived.rb +++ /dev/null @@ -1,37 +0,0 @@ -class ProjectArchived < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - When 'project "Forum" is archived' do - project = Project.find_by(name: "Forum") - project.update_attribute(:archived, true) - end - - When 'project "Shop" is archived' do - project = Project.find_by(name: "Shop") - project.update_attribute(:archived, true) - end - - When 'I visit project "Forum" page' do - project = Project.find_by(name: "Forum") - visit project_path(project) - end - - Then 'I should not see "Archived"' do - page.should_not have_content "Archived" - end - - Then 'I should see "Archived"' do - page.should have_content "Archived" - end - - When 'I set project archived' do - click_link "Archive" - end - - When 'I set project unarchived' do - click_link "Unarchive" - end - -end \ No newline at end of file diff --git a/features/steps/project/project_browse_branches.rb b/features/steps/project/project_browse_branches.rb deleted file mode 100644 index ef29cc6..0000000 --- a/features/steps/project/project_browse_branches.rb +++ /dev/null @@ -1,35 +0,0 @@ -class ProjectBrowseBranches < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - Then 'I should see "Shop" recent branches list' do - page.should have_content "Branches" - page.should have_content "master" - end - - Given 'I click link "All"' do - click_link "All" - end - - Then 'I should see "Shop" all branches list' do - page.should have_content "Branches" - page.should have_content "master" - end - - Given 'I click link "Protected"' do - click_link "Protected" - end - - Then '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 - - And 'project "Shop" has protected branches' do - project = Project.find_by(name: "Shop") - project.protected_branches.create(name: "stable") - end -end diff --git a/features/steps/project/project_browse_commits.rb b/features/steps/project/project_browse_commits.rb deleted file mode 100644 index d667b58..0000000 --- a/features/steps/project/project_browse_commits.rb +++ /dev/null @@ -1,104 +0,0 @@ -class ProjectBrowseCommits < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - Then 'I see project commits' do - commit = @project.repository.commit - page.should have_content(@project.name) - page.should have_content(commit.message) - page.should have_content(commit.id.to_s[0..5]) - end - - Given 'I click atom feed link' do - click_link "Feed" - end - - Then 'I see commits atom feed' do - commit = @project.repository.commit - page.response_headers['Content-Type'].should have_content("application/atom+xml") - page.body.should have_selector("title", text: "Recent commits to #{@project.name}") - page.body.should have_selector("author email", text: commit.author_email) - page.body.should have_selector("entry summary", text: commit.description) - end - - Given 'I click on commit link' do - visit project_commit_path(@project, ValidCommit::ID) - end - - Then 'I see commit info' do - page.should have_content ValidCommit::MESSAGE - page.should have_content "Showing 1 changed file" - end - - And 'I fill compare fields with refs' do - fill_in "from", with: "8716fc78f3c65bbf7bcf7b574febd583bc5d2812" - fill_in "to", with: "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a" - click_button "Compare" - end - - Then '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 - - Then 'I see breadcrumb links' do - page.should have_selector('ul.breadcrumb') - page.should have_selector('ul.breadcrumb span.divider', count: 3) - page.should have_selector('ul.breadcrumb a', count: 4) - - find('ul.breadcrumb li:nth-child(2) a')['href'].should match(/#{@project.path_with_namespace}\/commits\/master\z/) - find('ul.breadcrumb li:last a')['href'].should match(%r{master/app/models/project\.rb\z}) - end - - Then '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 - - Given 'I visit big commit page' do - visit project_commit_path(@project, BigCommits::BIG_COMMIT_ID) - end - - Then 'I see big commit warning' do - page.should have_content BigCommits::BIG_COMMIT_MESSAGE - page.should have_content "Warning! This is a large diff" - page.should have_content "If you still want to see the diff" - end - - Given 'I visit huge commit page' do - visit project_commit_path(@project, BigCommits::HUGE_COMMIT_ID) - end - - Then 'I see huge commit message' do - page.should have_content BigCommits::HUGE_COMMIT_MESSAGE - page.should have_content "Warning! This is a large diff" - page.should_not have_content "If you still want to see the diff" - end - - Given 'I visit a commit with an image that changed' do - visit project_commit_path(@project, 'cc1ba255d6c5ffdce87a357ba7ccc397a4f4026b') - end - - Then 'The diff links to both the previous and current image' do - links = page.all('.two-up span div a') - links[0]['href'].should =~ %r{blob/bc3735004cb45cec5e0e4fa92710897a910a5957} - links[1]['href'].should =~ %r{blob/cc1ba255d6c5ffdce87a357ba7ccc397a4f4026b} - end - - Given 'I click side-by-side diff button' do - click_link "Side-by-side Diff" - end - - Then 'I see side-by-side diff button' do - page.should have_content "Side-by-side Diff" - end - - Then 'I see inline diff button' do - page.should have_content "Inline Diff" - end - -end diff --git a/features/steps/project/project_browse_commits_user_lookup.rb b/features/steps/project/project_browse_commits_user_lookup.rb deleted file mode 100644 index 328be37..0000000 --- a/features/steps/project/project_browse_commits_user_lookup.rb +++ /dev/null @@ -1,35 +0,0 @@ -class ProjectBrowseCommitsUserLookup < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - Given 'I have the user that authored the commits' do - @user = create(:user, email: 'dmitriy.zaporozhets@gmail.com') - create(:email, { user: @user, email: 'dzaporozhets@sphereconsultinginc.com' }) - end - - Given 'I click on commit link' do - visit project_commit_path(@project, ValidCommit::ID) - end - - Given 'I click on another commit link' do - visit project_commit_path(@project, ValidCommitWithAltEmail::ID) - end - - Then 'I see commit info' do - page.should have_content ValidCommit::MESSAGE - check_author_link(ValidCommit::AUTHOR_EMAIL) - end - - Then 'I see other commit info' do - page.should have_content ValidCommitWithAltEmail::MESSAGE - check_author_link(ValidCommitWithAltEmail::AUTHOR_EMAIL) - end - - def check_author_link(email) - 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 -end diff --git a/features/steps/project/project_browse_files.rb b/features/steps/project/project_browse_files.rb deleted file mode 100644 index 069086d..0000000 --- a/features/steps/project/project_browse_files.rb +++ /dev/null @@ -1,53 +0,0 @@ -class ProjectBrowseFiles < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - step 'I should see files from repository' do - page.should have_content "app" - page.should have_content "history" - page.should have_content "Gemfile" - end - - step 'I should see files from repository for "8470d70"' do - current_path.should == project_tree_path(@project, "8470d70") - page.should have_content "app" - page.should have_content "history" - page.should have_content "Gemfile" - end - - step 'I click on "Gemfile.lock" file in repo' do - click_link "Gemfile.lock" - end - - step 'I should see it content' do - page.should have_content "DEPENDENCIES" - end - - step 'I click link "raw"' do - click_link "raw" - end - - step 'I should see raw file content' do - page.source.should == ValidCommit::BLOB_FILE - end - - step 'I click button "edit"' do - click_link 'edit' - end - - step 'I can edit code' do - page.execute_script('editor.setValue("GitlabFileEditor")') - page.evaluate_script('editor.getValue()').should == "GitlabFileEditor" - 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 -end diff --git a/features/steps/project/project_browse_git_repo.rb b/features/steps/project/project_browse_git_repo.rb deleted file mode 100644 index cd9a60f..0000000 --- a/features/steps/project/project_browse_git_repo.rb +++ /dev/null @@ -1,19 +0,0 @@ -class ProjectBrowseGitRepo < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - Given 'I click on "Gemfile.lock" file in repo' do - click_link "Gemfile.lock" - end - - And 'I click blame button' do - click_link "blame" - end - - Then 'I should see git file blame' do - page.should have_content "DEPENDENCIES" - page.should have_content "Dmitriy Zaporozhets" - page.should have_content "Moving to rails 3.2" - end -end diff --git a/features/steps/project/project_browse_tags.rb b/features/steps/project/project_browse_tags.rb deleted file mode 100644 index 0cbfa0d..0000000 --- a/features/steps/project/project_browse_tags.rb +++ /dev/null @@ -1,10 +0,0 @@ -class ProjectBrowseTags < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - Then 'I should see "Shop" all tags list' do - page.should have_content "Tags" - page.should have_content "v1.2.1" - end -end diff --git a/features/steps/project/project_filter_labels.rb b/features/steps/project/project_filter_labels.rb deleted file mode 100644 index 5926d69..0000000 --- a/features/steps/project/project_filter_labels.rb +++ /dev/null @@ -1,70 +0,0 @@ -class ProjectFilterLabels < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - Then 'I should see "bug" in labels filter' do - within ".labels-filter" do - page.should have_content "bug" - end - end - - And 'I should see "feature" in labels filter' do - within ".labels-filter" do - page.should have_content "feature" - end - end - - And 'I should see "enhancement" in labels filter' do - within ".labels-filter" do - page.should have_content "enhancement" - end - end - - Then 'I should see "Bugfix1" in issues list' do - within ".issues-list" do - page.should have_content "Bugfix1" - end - end - - And 'I should see "Bugfix2" in issues list' do - within ".issues-list" do - page.should have_content "Bugfix2" - end - end - - And 'I should not see "Bugfix2" in issues list' do - within ".issues-list" do - page.should_not have_content "Bugfix2" - end - end - - And 'I should not see "Feature1" in issues list' do - within ".issues-list" do - page.should_not have_content "Feature1" - end - end - - Given 'I click link "bug"' do - click_link "bug" - end - - Given 'I click link "feature"' do - click_link "feature" - end - - And 'project "Shop" has issue "Bugfix1" with tags: "bug", "feature"' do - project = Project.find_by(name: "Shop") - create(:issue, title: "Bugfix1", project: project, label_list: ['bug', 'feature']) - end - - And 'project "Shop" has issue "Bugfix2" with tags: "bug", "enhancement"' do - project = Project.find_by(name: "Shop") - create(:issue, title: "Bugfix2", project: project, label_list: ['bug', 'enhancement']) - end - - And 'project "Shop" has issue "Feature1" with tags: "feature"' do - project = Project.find_by(name: "Shop") - create(:issue, title: "Feature1", project: project, label_list: 'feature') - end -end diff --git a/features/steps/project/project_fork.rb b/features/steps/project/project_fork.rb deleted file mode 100644 index c00d901..0000000 --- a/features/steps/project/project_fork.rb +++ /dev/null @@ -1,36 +0,0 @@ -class ForkProject < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - - step 'I click link "Fork"' do - page.should have_content "Shop" - page.should have_content "Fork" - Gitlab::Shell.any_instance.stub(:fork_repository).and_return(true) - click_link "Fork" - end - - step 'I am a member of project "Shop"' do - @project = Project.find_by(name: "Shop") - @project ||= create(:project, name: "Shop", group: create(:group)) - @project.team << [@user, :reporter] - end - - step 'I should see the forked project page' do - page.should have_content "Project was successfully forked." - current_path.should include current_user.namespace.path - @forked_project = Project.find_by(namespace_id: current_user.namespace.path) - end - - step 'I already have a project named "Shop" in my namespace' do - current_user.namespace ||= create(:namespace) - current_user.namespace.should_not be_nil - current_user.namespace.path.should_not be_nil - @my_project = create(:project, name: "Shop", namespace: current_user.namespace) - end - - step 'I should see a "Name has already been taken" warning' do - page.should have_content "Name has already been taken" - end - -end diff --git a/features/steps/project/project_forked_merge_requests.rb b/features/steps/project/project_forked_merge_requests.rb deleted file mode 100644 index 4cc99f8..0000000 --- a/features/steps/project/project_forked_merge_requests.rb +++ /dev/null @@ -1,183 +0,0 @@ -class ProjectForkedMergeRequests < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedNote - include SharedPaths - include Select2Helper - - step 'I am a member of project "Shop"' do - @project = Project.find_by(name: "Shop") - @project ||= create(:project, name: "Shop") - @project.team << [@user, :reporter] - end - - step 'I have a project forked off of "Shop" called "Forked Shop"' do - @forking_user = @user - forked_project_link = build(:forked_project_link) - @forked_project = Project.find_by(name: "Forked Shop") - @forked_project ||= create(:project, name: "Forked Shop", forked_project_link: forked_project_link, creator_id: @forking_user.id , namespace: @forking_user.namespace) - - forked_project_link.forked_from_project = @project - forked_project_link.forked_to_project = @forked_project - @forked_project.team << [@forking_user , :master] - forked_project_link.save! - end - - step 'I click link "New Merge Request"' do - click_link "New Merge Request" - end - - step 'I should see merge request "Merge Request On Forked Project"' do - @project.merge_requests.size.should >= 1 - @merge_request = @project.merge_requests.last - current_path.should == project_merge_request_path(@project, @merge_request) - @merge_request.title.should == "Merge Request On Forked Project" - @merge_request.source_project.should == @forked_project - @merge_request.source_branch.should == "master" - @merge_request.target_branch.should == "stable" - page.should have_content @forked_project.path_with_namespace - page.should have_content @project.path_with_namespace - page.should have_content @merge_request.source_branch - page.should have_content @merge_request.target_branch - end - - step 'I fill out a "Merge Request On Forked Project" merge request' do - select2 @forked_project.id, from: "#merge_request_source_project_id" - select2 @project.id, from: "#merge_request_target_project_id" - - find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s - find(:select, "merge_request_target_project_id", {}).value.should == @project.id.to_s - - select2 "master", from: "#merge_request_source_branch" - select2 "stable", from: "#merge_request_target_branch" - - find(:select, "merge_request_source_branch", {}).value.should == 'master' - find(:select, "merge_request_target_branch", {}).value.should == 'stable' - - fill_in "merge_request_title", with: "Merge Request On Forked Project" - end - - step 'I submit the merge request' do - click_button "Submit merge request" - end - - step 'I follow the target commit link' do - commit = @project.repository.commit - click_link commit.short_id(8) - end - - step 'I should see the commit under the forked from project' do - commit = @project.repository.commit - page.should have_content(commit.message) - end - - step 'I click "Create Merge Request on fork" link' do - click_link "Create Merge Request on fork" - end - - step 'I see prefilled new Merge Request page for the forked project' do - current_path.should == new_project_merge_request_path(@forked_project) - find("#merge_request_source_project_id").value.should == @forked_project.id.to_s - find("#merge_request_target_project_id").value.should == @project.id.to_s - find("#merge_request_source_branch").value.should have_content "new_design" - find("#merge_request_target_branch").value.should have_content "master" - find("#merge_request_title").value.should == "New Design" - verify_commit_link(".mr_target_commit",@project) - verify_commit_link(".mr_source_commit",@forked_project) - end - - step 'I update the merge request title' do - fill_in "merge_request_title", with: "An Edited Forked Merge Request" - end - - step 'I save the merge request' do - click_button "Save changes" - end - - step 'I should see the edited merge request' do - page.should have_content "An Edited Forked Merge Request" - @project.merge_requests.size.should >= 1 - @merge_request = @project.merge_requests.last - current_path.should == project_merge_request_path(@project, @merge_request) - @merge_request.source_project.should == @forked_project - @merge_request.source_branch.should == "master" - @merge_request.target_branch.should == "stable" - page.should have_content @forked_project.path_with_namespace - page.should have_content @project.path_with_namespace - page.should have_content @merge_request.source_branch - page.should have_content @merge_request.target_branch - end - - step 'I should see last push widget' do - page.should have_content "You pushed to new_design" - page.should have_link "Create Merge Request" - end - - step 'project "Forked Shop" has push event' do - @forked_project = Project.find_by(name: "Forked Shop") - - data = { - before: "0000000000000000000000000000000000000000", - after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", - ref: "refs/heads/new_design", - user_id: @user.id, - user_name: @user.name, - repository: { - name: @forked_project.name, - url: "localhost/rubinius", - description: "", - homepage: "localhost/rubinius", - private: true - } - } - - @event = Event.create( - project: @forked_project, - action: Event::PUSHED, - data: data, - author_id: @user.id - ) - end - - - step 'I click link edit "Merge Request On Forked Project"' do - find("#edit_merge_request").click - end - - step 'I see the edit page prefilled for "Merge Request On Forked Project"' do - current_path.should == edit_project_merge_request_path(@project, @merge_request) - page.should have_content "Edit merge request ##{@merge_request.id}" - find("#merge_request_title").value.should == "Merge Request On Forked Project" - find("#merge_request_source_project_id").value.should == @forked_project.id.to_s - find("#merge_request_target_project_id").value.should == @project.id.to_s - find("#merge_request_source_branch").value.should have_content "master" - verify_commit_link(".mr_source_commit",@forked_project) - find("#merge_request_target_branch").value.should have_content "stable" - verify_commit_link(".mr_target_commit",@project) - end - - step 'I fill out an invalid "Merge Request On Forked Project" merge request' do - #If this isn't filled in the rest of the validations won't be triggered - fill_in "merge_request_title", with: "Merge Request On Forked Project" - find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s - find(:select, "merge_request_target_project_id", {}).value.should == @forked_project.id.to_s - find(:select, "merge_request_source_branch", {}).value.should == "" - find(:select, "merge_request_target_branch", {}).value.should == "" - end - - step 'I should see validation errors' do - page.should have_content "Source branch can't be blank" - page.should have_content "Target branch can't be blank" - page.should have_content "Branch conflict You can not use same project/branch for source and target" - end - - def project - @project ||= Project.find_by!(name: "Shop") - end - - # Verify a link is generated against the correct project - def verify_commit_link(container_div, container_project) - # This should force a wait for the javascript to execute - find(:div,container_div).find(".commit_short_id")['href'].should have_content "#{container_project.path_with_namespace}/commit" - end -end diff --git a/features/steps/project/project_graph.rb b/features/steps/project/project_graph.rb deleted file mode 100644 index 89fe5fd..0000000 --- a/features/steps/project/project_graph.rb +++ /dev/null @@ -1,13 +0,0 @@ -class ProjectGraph < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - - Then 'page should have graphs' do - page.should have_selector ".stat-graph" - end - - When 'I visit project "Shop" graph page' do - project = Project.find_by(name: "Shop") - visit project_graph_path(project, "master") - end -end diff --git a/features/steps/project/project_hooks.rb b/features/steps/project/project_hooks.rb deleted file mode 100644 index 19ff324..0000000 --- a/features/steps/project/project_hooks.rb +++ /dev/null @@ -1,38 +0,0 @@ -require 'webmock' - -class ProjectHooks < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - include RSpec::Matchers - include RSpec::Mocks::ExampleMethods - include WebMock::API - - Given 'project has hook' do - @hook = create(:project_hook, project: current_project) - end - - Then 'I should see project hook' do - page.should have_content @hook.url - end - - When 'I submit new hook' do - @url = Faker::Internet.uri("http") - fill_in "hook_url", with: @url - expect { click_button "Add Web Hook" }.to change(ProjectHook, :count).by(1) - end - - Then 'I should see newly created hook' do - page.current_path.should == project_hooks_path(current_project) - page.should have_content(@url) - end - - When 'I click test hook button' do - stub_request(:post, @hook.url).to_return(status: 200) - click_link 'Test Hook' - end - - Then 'hook should be triggered' do - page.current_path.should == project_hooks_path(current_project) - end -end diff --git a/features/steps/project/project_issue_tracker.rb b/features/steps/project/project_issue_tracker.rb deleted file mode 100644 index c2fd4e1..0000000 --- a/features/steps/project/project_issue_tracker.rb +++ /dev/null @@ -1,31 +0,0 @@ -class ProjectIssueTracker < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - step 'project "Shop" has issues enabled' do - @project = Project.find_by(name: "Shop") - @project ||= create(:project, name: "Shop", namespace: @user.namespace) - @project.issues_enabled = true - end - - step 'change the issue tracker to "GitLab"' do - select 'GitLab', from: 'project_issues_tracker' - end - - step 'I the project should have "GitLab" as issue tracker' do - find_field('project_issues_tracker').value.should == 'gitlab' - end - - step 'change the issue tracker to "Redmine"' do - select 'Redmine', from: 'project_issues_tracker' - end - - step 'I the project should have "Redmine" as issue tracker' do - find_field('project_issues_tracker').value.should == 'redmine' - end - - And 'I save project' do - click_button 'Save changes' - end -end diff --git a/features/steps/project/project_issues.rb b/features/steps/project/project_issues.rb deleted file mode 100644 index a92fd50..0000000 --- a/features/steps/project/project_issues.rb +++ /dev/null @@ -1,145 +0,0 @@ -class ProjectIssues < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedNote - include SharedPaths - include SharedMarkdown - - Given 'I should see "Release 0.4" in issues' do - page.should have_content "Release 0.4" - end - - And 'I should not see "Release 0.3" in issues' do - page.should_not have_content "Release 0.3" - end - - And 'I should not see "Tweet control" in issues' do - page.should_not have_content "Tweet control" - end - - Given 'I click link "Closed"' do - click_link "Closed" - end - - Then 'I should see "Release 0.3" in issues' do - page.should have_content "Release 0.3" - end - - And 'I should not see "Release 0.4" in issues' do - page.should_not have_content "Release 0.4" - end - - Given 'I click link "All"' do - click_link "All" - end - - Given 'I click link "Release 0.4"' do - click_link "Release 0.4" - end - - Then 'I should see issue "Release 0.4"' do - page.should have_content "Release 0.4" - end - - Given 'I click link "New Issue"' do - click_link "New Issue" - end - - And 'I submit new issue "500 error on profile"' do - fill_in "issue_title", with: "500 error on profile" - click_button "Submit new issue" - end - - Given 'I click link "500 error on profile"' do - click_link "500 error on profile" - end - - Then '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 - - Given 'I fill in issue search with "Re"' do - fill_in 'issue_search', with: "Re" - end - - Given 'I fill in issue search with "Bu"' do - fill_in 'issue_search', with: "Bu" - end - - And 'I fill in issue search with ".3"' do - fill_in 'issue_search', with: ".3" - end - - And 'I fill in issue search with "Something"' do - fill_in 'issue_search', with: "Something" - end - - And 'I fill in issue search with ""' do - fill_in 'issue_search', with: "" - end - - Given 'project "Shop" has milestone "v2.2"' do - project = Project.find_by(name: "Shop") - milestone = create(:milestone, title: "v2.2", project: project) - - 3.times { create(:issue, project: project, milestone: milestone) } - end - - And 'project "Shop" has milestone "v3.0"' do - project = Project.find_by(name: "Shop") - 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 - - Then 'I should see selected milestone with title "v3.0"' do - issues_milestone_selector = "#issue_milestone_id_chzn > a" - page.find(issues_milestone_selector).should have_content("v3.0") - end - - When 'I select first assignee from "Shop" project' do - project = Project.find_by(name: "Shop") - first_assignee = project.users.first - select first_assignee.name, from: "assignee_id" - end - - Then 'I should see first assignee from "Shop" as selected assignee' do - issues_assignee_selector = "#issue_assignee_id_chzn > a" - project = Project.find_by(name: "Shop") - assignee_name = project.users.first.name - page.find(issues_assignee_selector).should have_content(assignee_name) - end - - And 'project "Shop" have "Release 0.4" open issue' do - project = Project.find_by(name: "Shop") - create(:issue, - title: "Release 0.4", - project: project, - author: project.users.first, - description: "# Description header" - ) - end - - And 'project "Shop" have "Tweet control" open issue' do - project = Project.find_by(name: "Shop") - create(:issue, - title: "Tweet control", - project: project, - author: project.users.first) - end - - And 'project "Shop" have "Release 0.3" closed issue' do - project = Project.find_by(name: "Shop") - create(:closed_issue, - title: "Release 0.3", - project: project, - author: project.users.first) - end -end diff --git a/features/steps/project/project_labels.rb b/features/steps/project/project_labels.rb deleted file mode 100644 index 0907cdb..0000000 --- a/features/steps/project/project_labels.rb +++ /dev/null @@ -1,24 +0,0 @@ -class ProjectLabels < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - Then 'I should see label "bug"' do - within ".labels-table" do - page.should have_content "bug" - end - end - - And 'I should see label "feature"' do - within ".labels-table" do - page.should have_content "feature" - end - end - - And 'project "Shop" have issues tags: "bug", "feature"' do - project = Project.find_by(name: "Shop") - ['bug', 'feature'].each do |label| - create(:issue, project: project, label_list: label) - end - end -end diff --git a/features/steps/project/project_markdown_render.rb b/features/steps/project/project_markdown_render.rb deleted file mode 100644 index 89fbb74..0000000 --- a/features/steps/project/project_markdown_render.rb +++ /dev/null @@ -1,207 +0,0 @@ -class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedMarkdown - - And 'I own project "Delta"' do - @project = Project.find_by(name: "Delta") - @project ||= create(:project, name: "Delta", namespace: @user.namespace) - @project.team << [@user, :master] - end - - Then 'I should see files from repository in master' do - current_path.should == project_tree_path(@project, "master") - page.should have_content "Gemfile" - page.should have_content "app" - page.should have_content "README" - end - - And '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 - - And 'I click on Gitlab API in README' do - click_link "GitLab API doc" - end - - Then 'I should see correct document rendered' do - current_path.should == project_blob_path(@project, "master/doc/api/README.md") - page.should have_content "All API requests require authentication" - end - - And 'I click on Rake tasks in README' do - click_link "Rake tasks" - end - - Then 'I should see correct directory rendered' do - current_path.should == project_tree_path(@project, "master/doc/raketasks") - page.should have_content "backup_restore.md" - page.should have_content "maintenance.md" - end - - And 'I click on GitLab API doc directory in README' do - click_link "GitLab API doc directory" - end - - Then 'I should see correct doc/api directory rendered' do - current_path.should == project_tree_path(@project, "master/doc/api/") - page.should have_content "README.md" - page.should have_content "users.md" - end - - And 'I click on Maintenance in README' do - click_link "Maintenance" - end - - Then 'I should see correct maintenance file rendered' do - current_path.should == project_blob_path(@project, "master/doc/raketasks/maintenance.md") - page.should have_content "bundle exec rake gitlab:env:info RAILS_ENV=production" - end - - And 'I navigate to the doc/api/README' do - click_link "doc" - click_link "api" - click_link "README.md" - end - - And 'I see correct file rendered' do - current_path.should == project_blob_path(@project, "master/doc/api/README.md") - page.should have_content "Contents" - page.should have_link "Users" - page.should have_link "Rake tasks" - end - - And 'I click on users in doc/api/README' do - click_link "Users" - end - - Then 'I should see the correct document file' do - current_path.should == project_blob_path(@project, "master/doc/api/users.md") - page.should have_content "Get a list of users." - end - - And 'I click on raketasks in doc/api/README' do - click_link "Rake tasks" - end - - When 'I visit markdown branch' do - visit project_tree_path(@project, "markdown") - end - - Then 'I should see files from repository in markdown branch' do - current_path.should == project_tree_path(@project, "markdown") - page.should have_content "Gemfile" - page.should have_content "app" - page.should have_content "README" - end - - And '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 - - Then '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 - - Then '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 - - Then '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 - - Given 'I go to wiki page' do - click_link "Wiki" - current_path.should == project_wiki_path(@project, "home") - end - - And 'I add various links to the wiki page' do - fill_in "wiki[content]", with: "[test](test)\n[GitLab API doc](doc/api/README.md)\n[Rake tasks](doc/raketasks)\n" - fill_in "wiki[message]", with: "Adding links to wiki" - click_button "Create page" - end - - Then '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 - - And 'I click on test link' do - click_link "test" - end - - Then '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 - - And 'I click on GitLab API doc link' do - click_link "GitLab API" - end - - Then 'I see Gitlab API document' do - current_path.should == project_blob_path(@project, "master/doc/api/README.md") - page.should have_content "Status codes" - end - - And 'I click on Rake tasks link' do - click_link "Rake tasks" - end - - Then 'I see Rake tasks directory' do - current_path.should == project_tree_path(@project, "master/doc/raketasks") - page.should have_content "backup_restore.md" - page.should have_content "maintenance.md" - end - - Given 'I go directory which contains README file' do - visit project_tree_path(@project, "master/doc/api") - current_path.should == project_tree_path(@project, "master/doc/api") - end - - And 'I click on a relative link in README' do - click_link "Users" - end - - Then 'I should see the correct markdown' do - current_path.should == project_blob_path(@project, "master/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/project_merge_requests.rb b/features/steps/project/project_merge_requests.rb deleted file mode 100644 index adf9e77..0000000 --- a/features/steps/project/project_merge_requests.rb +++ /dev/null @@ -1,195 +0,0 @@ -class ProjectMergeRequests < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedNote - include SharedPaths - include SharedMarkdown - - step 'I click link "New Merge Request"' do - click_link "New Merge Request" - end - - step 'I click link "Bug NS-04"' do - click_link "Bug NS-04" - end - - step 'I click link "All"' do - click_link "All" - end - - step 'I click link "Closed"' do - click_link "Closed" - end - - step 'I should see merge request "Wiki Feature"' do - within '.merge-request' do - page.should have_content "Wiki Feature" - end - end - - step 'I should see closed merge request "Bug NS-04"' do - merge_request = MergeRequest.find_by!(title: "Bug NS-04") - merge_request.closed?.should be_true - page.should have_content "Closed by" - end - - step 'I should see merge request "Bug NS-04"' do - page.should have_content "Bug NS-04" - end - - step 'I should see "Bug NS-04" in merge requests' do - page.should have_content "Bug NS-04" - end - - step 'I should see "Feature NS-03" in merge requests' do - page.should have_content "Feature NS-03" - end - - step 'I should not see "Feature NS-03" in merge requests' do - page.should_not have_content "Feature NS-03" - end - - - step 'I should not see "Bug NS-04" in merge requests' do - page.should_not have_content "Bug NS-04" - end - - step 'I click link "Close"' do - within '.page-title' do - click_link "Close" - end - end - - step 'I submit new merge request "Wiki Feature"' do - fill_in "merge_request_title", with: "Wiki Feature" - select "master", from: "merge_request_source_branch" - select "notes_refactoring", from: "merge_request_target_branch" - click_button "Submit merge request" - end - - step 'project "Shop" have "Bug NS-04" open merge request' do - create(:merge_request, - title: "Bug NS-04", - source_project: project, - target_project: project, - source_branch: 'stable', - target_branch: 'master', - author: project.users.first, - description: "# Description header" - ) - end - - step 'project "Shop" have "Bug NS-05" open merge request with diffs inside' do - create(:merge_request_with_diffs, - title: "Bug NS-05", - source_project: project, - target_project: project, - author: project.users.first) - end - - step 'project "Shop" have "Feature NS-03" closed merge request' do - create(:closed_merge_request, - title: "Feature NS-03", - source_project: project, - target_project: project, - author: project.users.first) - end - - step 'I switch to the diff tab' do - visit diffs_project_merge_request_path(project, merge_request) - end - - step 'I switch to the merge request\'s comments tab' do - visit project_merge_request_path(project, merge_request) - end - - step 'I click on the first commit in the merge request' do - within '.first-commits' do - click_link merge_request.commits.first.short_id(8) - end - end - - step 'I leave a comment on the diff page' do - init_diff_note - leave_comment "One comment to rule them all" - end - - step 'I leave a comment on the diff page in commit' do - find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click - leave_comment "One comment to rule them all" - end - - step 'I leave a comment like "Line is wrong" on line 185 of the first file' do - init_diff_note - leave_comment "Line is wrong" - end - - step 'I leave a comment like "Line is wrong" on line 185 of the first file in commit' do - find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click - leave_comment "Line is wrong" - end - - step 'I should see a discussion has started on line 185' do - page.should have_content "#{current_user.name} started a discussion on this merge request diff" - page.should have_content "app/assets/stylesheets/tree.scss:L185" - page.should have_content "Line is wrong" - end - - step 'I should see a discussion has started on commit b1e6a9dbf1:L185' do - page.should have_content "#{current_user.name} started a discussion on commit" - page.should have_content "app/assets/stylesheets/tree.scss:L185" - page.should have_content "Line is wrong" - end - - step 'I should see a discussion has started on commit b1e6a9dbf1' do - page.should have_content "#{current_user.name} started a discussion on commit" - page.should have_content "One comment to rule them all" - page.should have_content "app/assets/stylesheets/tree.scss:L185" - end - - step 'merge request is mergeable' do - page.should have_content 'You can accept this request automatically' - end - - step 'I modify merge commit message' do - find('.modify-merge-commit-link').click - fill_in 'merge_commit_message', with: "wow such merge" - end - - step 'merge request "Bug NS-05" is mergeable' do - merge_request.mark_as_mergeable - end - - step 'I accept this merge request' do - click_button "Accept Merge Request" - end - - step 'I should see merged request' do - within '.issue-box' do - page.should have_content "Merged" - end - end - - def project - @project ||= Project.find_by!(name: "Shop") - end - - def merge_request - @merge_request ||= MergeRequest.find_by!(title: "Bug NS-05") - end - - def init_diff_note - find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_172_185"]').click - end - - def leave_comment(message) - within(".js-discussion-note-form") do - fill_in "note_note", with: message - click_button "Add Comment" - end - - within ".note-text" do - page.should have_content message - end - end -end diff --git a/features/steps/project/project_milestones.rb b/features/steps/project/project_milestones.rb deleted file mode 100644 index 9ce18fb..0000000 --- a/features/steps/project/project_milestones.rb +++ /dev/null @@ -1,59 +0,0 @@ -class ProjectMilestones < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - include SharedMarkdown - - Then '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 - - Given 'I click link "v2.2"' do - click_link "v2.2" - end - - Given 'I click link "New Milestone"' do - click_link "New Milestone" - end - - And 'I submit new milestone "v2.3"' do - fill_in "milestone_title", with: "v2.3" - click_button "Create milestone" - end - - Then '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 - - And '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 - - Given '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 - - Then "I should see 3 issues" do - page.should have_selector('#tab-issues li', count: 4) - end -end diff --git a/features/steps/project/project_multiselect_blob.rb b/features/steps/project/project_multiselect_blob.rb deleted file mode 100644 index 3d330e8..0000000 --- a/features/steps/project/project_multiselect_blob.rb +++ /dev/null @@ -1,58 +0,0 @@ -class 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 }));" - page.evaluate_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 - page.evaluate_script("window.history.back()") - end - - step 'I go forward in history' do - page.evaluate_script("window.history.forward()") - end - - step 'I click on "Gemfile.lock" file in repo' do - click_link "Gemfile.lock" - end -end \ No newline at end of file diff --git a/features/steps/project/project_network_graph.rb b/features/steps/project/project_network_graph.rb deleted file mode 100644 index 1c5cfcc..0000000 --- a/features/steps/project/project_network_graph.rb +++ /dev/null @@ -1,93 +0,0 @@ -class ProjectNetworkGraph < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - - Then 'page should have network graph' do - page.should have_selector ".network-graph" - end - - When 'I visit project "Shop" network page' do - # Stub Graph max_size to speed up test (10 commits vs. 650) - Network::Graph.stub(max_count: 10) - - project = Project.find_by(name: "Shop") - visit project_network_path(project, "master") - end - - And 'page should select "master" in select box' do - page.should have_selector '.select2-chosen', text: "master" - end - - And 'page should select "v2.1.0" in select box' do - page.should have_selector '.select2-chosen', text: "v2.1.0" - end - - And 'page should have "master" on graph' do - within '.network-graph' do - page.should have_content 'master' - end - end - - When 'I switch ref to "stable"' do - page.select 'stable', from: 'ref' - sleep 2 - end - - When 'I switch ref to "v2.1.0"' do - page.select 'v2.1.0', from: 'ref' - sleep 2 - end - - When 'click "Show only selected branch" checkbox' do - find('#filter_ref').click - sleep 2 - end - - Then 'page should have content not containing "v2.1.0"' do - within '.network-graph' do - page.should have_content 'cleaning' - end - end - - Then 'page should not have content not containing "v2.1.0"' do - within '.network-graph' do - page.should_not have_content 'cleaning' - end - end - - And 'page should select "stable" in select box' do - page.should have_selector '.select2-chosen', text: "stable" - end - - And 'page should select "v2.1.0" in select box' do - page.should have_selector '.select2-chosen', text: "v2.1.0" - end - - And 'page should have "stable" on graph' do - within '.network-graph' do - page.should have_content 'stable' - end - end - - When 'I looking for a commit by SHA of "v2.1.0"' do - within ".network-form" do - fill_in 'extended_sha1', with: '98d6492' - find('button').click - end - sleep 2 - end - - And 'page should have "v2.1.0" on graph' do - within '.network-graph' do - page.should have_content 'v2.1.0' - end - end - - When 'I look for a commit by ";"' do - within ".network-form" do - fill_in 'extended_sha1', with: ';' - find('button').click - end - end -end diff --git a/features/steps/project/project_search_code.rb b/features/steps/project/project_search_code.rb deleted file mode 100644 index d117b01..0000000 --- a/features/steps/project/project_search_code.rb +++ /dev/null @@ -1,17 +0,0 @@ -class ProjectSearchCode < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - When 'I search for term "Welcome to GitLab"' do - fill_in "search", with: "Welcome to GitLab" - click_button "Go" - click_link 'Repository Code' - end - - Then 'I should see files from repository containing "Welcome to GitLab"' do - page.should have_content "Welcome to GitLab" - page.should have_content "GitLab is a free project and repository management application" - end - -end diff --git a/features/steps/project/project_services.rb b/features/steps/project/project_services.rb deleted file mode 100644 index 54b3f18..0000000 --- a/features/steps/project/project_services.rb +++ /dev/null @@ -1,103 +0,0 @@ -class ProjectServices < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - step 'I visit project "Shop" services page' do - visit project_services_path(@project) - end - - step 'I should see list of available services' do - page.should have_content 'Project services' - page.should have_content 'Campfire' - page.should have_content 'Hipchat' - page.should have_content 'GitLab CI' - page.should have_content 'Assembla' - end - - step 'I click gitlab-ci service link' do - click_link 'GitLab CI' - end - - step 'I fill gitlab-ci settings' do - check 'Active' - fill_in 'Project url', with: 'http://ci.gitlab.org/projects/3' - fill_in 'Token', with: 'verySecret' - click_button 'Save' - end - - step 'I should see service settings saved' do - find_field('Project url').value.should == 'http://ci.gitlab.org/projects/3' - end - - step 'I click hipchat service link' do - click_link 'Hipchat' - end - - step 'I fill hipchat settings' do - check 'Active' - fill_in 'Room', with: 'gitlab' - fill_in 'Token', with: 'verySecret' - click_button 'Save' - end - - step 'I should see hipchat service settings saved' do - find_field('Room').value.should == 'gitlab' - end - - - step 'I click pivotaltracker service link' do - click_link 'PivotalTracker' - end - - step 'I fill pivotaltracker settings' do - check 'Active' - fill_in 'Token', with: 'verySecret' - click_button 'Save' - end - - step 'I should see pivotaltracker service settings saved' do - find_field('Token').value.should == 'verySecret' - end - - step 'I click Flowdock service link' do - click_link 'Flowdock' - end - - step 'I fill Flowdock settings' do - check 'Active' - fill_in 'Token', with: 'verySecret' - click_button 'Save' - end - - step 'I should see Flowdock service settings saved' do - find_field('Token').value.should == 'verySecret' - end - - step 'I click Assembla service link' do - click_link 'Assembla' - end - - step 'I fill Assembla settings' do - check 'Active' - fill_in 'Token', with: 'verySecret' - click_button 'Save' - end - - step 'I should see Assembla service settings saved' do - find_field('Token').value.should == 'verySecret' - end - - step 'I click email on push service link' do - click_link 'Emails on push' - end - - step 'I fill email on push settings' do - fill_in 'Recipients', with: 'qa@company.name' - click_button 'Save' - end - - step 'I should see email on push service settings saved' do - find_field('Recipients').value.should == 'qa@company.name' - end -end diff --git a/features/steps/project/project_snippets.rb b/features/steps/project/project_snippets.rb deleted file mode 100644 index c3a76be..0000000 --- a/features/steps/project/project_snippets.rb +++ /dev/null @@ -1,99 +0,0 @@ -class ProjectSnippets < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedNote - include SharedPaths - - And 'project "Shop" have "Snippet one" snippet' do - create(:project_snippet, - title: "Snippet one", - content: "Test content", - file_name: "snippet.rb", - project: project, - author: project.users.first) - end - - And 'project "Shop" have no "Snippet two" snippet' do - create(:snippet, - title: "Snippet two", - content: "Test content", - file_name: "snippet.rb", - author: project.users.first) - end - - Given 'I click link "New Snippet"' do - click_link "Add new snippet" - end - - Given 'I click link "Snippet one"' do - click_link "Snippet one" - end - - Then 'I should see "Snippet one" in snippets' do - page.should have_content "Snippet one" - end - - And 'I should not see "Snippet two" in snippets' do - page.should_not have_content "Snippet two" - end - - And 'I should not see "Snippet one" in snippets' do - page.should_not have_content "Snippet one" - end - - And 'I click link "Edit"' do - within ".file-title" do - click_link "Edit" - end - end - - And 'I click link "Remove Snippet"' do - click_link "Remove snippet" - end - - And 'I submit new snippet "Snippet three"' do - fill_in "project_snippet_title", :with => "Snippet three" - fill_in "project_snippet_file_name", :with => "my_snippet.rb" - within('.file-editor') do - find(:xpath, "//input[@id='project_snippet_content']").set 'Content of snippet three' - end - click_button "Create snippet" - end - - Then 'I should see snippet "Snippet three"' do - page.should have_content "Snippet three" - page.should have_content "Content of snippet three" - end - - And 'I submit new title "Snippet new title"' do - fill_in "project_snippet_title", :with => "Snippet new title" - click_button "Save" - end - - Then 'I should see "Snippet new title"' do - page.should have_content "Snippet new title" - end - - And 'I leave a comment like "Good snippet!"' do - within('.js-main-target-form') do - fill_in "note_note", with: "Good snippet!" - click_button "Add Comment" - end - end - - Then 'I should see comment "Good snippet!"' do - page.should have_content "Good snippet!" - end - - And 'I visit snippet page "Snippet one"' do - visit project_snippet_path(project, project_snippet) - end - - def project - @project ||= Project.find_by!(name: "Shop") - end - - def project_snippet - @project_snippet ||= ProjectSnippet.find_by!(title: "Snippet one") - end -end diff --git a/features/steps/project/project_team_management.rb b/features/steps/project/project_team_management.rb deleted file mode 100644 index ffc5016..0000000 --- a/features/steps/project/project_team_management.rb +++ /dev/null @@ -1,107 +0,0 @@ -class ProjectTeamManagement < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - include Select2Helper - - Then 'I should be able to see myself in team' do - page.should have_content(@user.name) - page.should have_content(@user.username) - end - - And 'I should see "Sam" in team list' do - user = User.find_by(name: "Sam") - page.should have_content(user.name) - page.should have_content(user.username) - end - - Given 'I click link "New Team Member"' do - click_link "New project member" - end - - And 'I select "Mike" as "Reporter"' do - user = User.find_by(name: "Mike") - - select2(user.id, from: "#user_ids", multiple: true) - within "#new_team_member" do - select "Reporter", from: "project_access" - end - click_button "Add users" - end - - Then 'I should see "Mike" in team list as "Reporter"' do - within ".access-reporter" do - page.should have_content('Mike') - end - end - - Given 'I should see "Sam" in team list as "Developer"' do - within ".access-developer" do - page.should have_content('Sam') - end - end - - And 'I change "Sam" role to "Reporter"' do - user = User.find_by(name: "Sam") - within "#user_#{user.id}" do - select "Reporter", from: "team_member_project_access" - end - end - - And 'I should see "Sam" in team list as "Reporter"' do - within ".access-reporter" do - page.should have_content('Sam') - end - end - - And 'I click link "Remove from team"' do - click_link "Remove from team" - end - - And 'I should not see "Sam" in team list' do - user = User.find_by(name: "Sam") - page.should_not have_content(user.name) - page.should_not have_content(user.username) - end - - And 'gitlab user "Mike"' do - create(:user, name: "Mike") - end - - And 'gitlab user "Sam"' do - create(:user, name: "Sam") - end - - And '"Sam" is "Shop" developer' do - user = User.find_by(name: "Sam") - project = Project.find_by(name: "Shop") - project.team << [user, :developer] - end - - Given 'I own project "Website"' do - @project = create(:empty_project, name: "Website", namespace: @user.namespace) - @project.team << [@user, :master] - end - - And '"Mike" is "Website" reporter' do - user = User.find_by(name: "Mike") - project = Project.find_by(name: "Website") - project.team << [user, :reporter] - end - - And 'I click link "Import team from another project"' do - click_link "Import members from another project" - end - - When 'I submit "Website" project for import team' do - project = Project.find_by(name: "Website") - select project.name_with_namespace, from: 'source_project_id' - click_button 'Import' - end - - step 'I click cancel link for "Sam"' do - within "#user_#{User.find_by(name: 'Sam').id}" do - click_link('Remove user from team') - end - end -end diff --git a/features/steps/project/project_wall.rb b/features/steps/project/project_wall.rb deleted file mode 100644 index 7c61580..0000000 --- a/features/steps/project/project_wall.rb +++ /dev/null @@ -1,18 +0,0 @@ -class ProjectWall < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedNote - include SharedPaths - - - Given 'I write new comment "my special test message"' do - within(".wall-note-form") do - fill_in "note[note]", with: "my special test message" - click_button "Add Comment" - end - end - - Then 'I should see project wall note "my special test message"' do - page.should have_content "my special test message" - end -end diff --git a/features/steps/project/project_wiki.rb b/features/steps/project/project_wiki.rb deleted file mode 100644 index 6146599..0000000 --- a/features/steps/project/project_wiki.rb +++ /dev/null @@ -1,92 +0,0 @@ -class ProjectWiki < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedNote - include SharedPaths - - Given 'I click on the Cancel button' do - within(:css, ".form-actions") do - click_on "Cancel" - end - end - - Then 'I should be redirected back to the Edit Home Wiki page' do - url = URI.parse(current_url) - url.path.should == project_wiki_path(project, :home) - end - - Given 'I create the Wiki Home page' do - fill_in "Content", with: '[link test](test)' - click_on "Create page" - end - - Then 'I should see the newly created wiki page' do - page.should have_content "Home" - page.should have_content "link test" - - click_link "link test" - page.should have_content "Editing" - end - - Given 'I have an existing Wiki page' do - wiki.create_page("existing", "content", :markdown, "first commit") - @page = wiki.find_page("existing") - end - - And 'I browse to that Wiki page' do - visit project_wiki_path(project, @page) - end - - And 'I click on the Edit button' do - click_on "Edit" - end - - And 'I change the content' do - fill_in "Content", with: 'Updated Wiki Content' - click_on "Save changes" - end - - Then 'I should see the updated content' do - page.should have_content "Updated Wiki Content" - end - - Then 'I should be redirected back to that Wiki page' do - url = URI.parse(current_url) - url.path.should == project_wiki_path(project, @page) - end - - And 'That page has two revisions' do - @page.update("new content", :markdown, "second commit") - end - - And 'I click the History button' do - click_on "History" - end - - Then 'I should see both revisions' do - page.should have_content current_user.name - page.should have_content "first commit" - page.should have_content "second commit" - end - - And 'I click on the "Delete this page" button' do - click_on "Delete this page" - end - - Then 'The page should be deleted' do - page.should have_content "Page was successfully deleted" - end - - And 'I click on the "Pages" button' do - click_on "Pages" - end - - Then 'I should see the existing page in the pages list' do - page.should have_content current_user.name - page.should have_content @page.title.titleize - end - - def wiki - @gollum_wiki = GollumWiki.new(project, current_user) - end -end diff --git a/features/steps/project/public.rb b/features/steps/project/public.rb new file mode 100644 index 0000000..7063e7d --- /dev/null +++ b/features/steps/project/public.rb @@ -0,0 +1,9 @@ +class PublicProjects < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + Then 'I should see the list of public projects' do + page.should have_content "Public Projects" + end +end diff --git a/features/steps/project/public_projects.rb b/features/steps/project/public_projects.rb deleted file mode 100644 index 7063e7d..0000000 --- a/features/steps/project/public_projects.rb +++ /dev/null @@ -1,9 +0,0 @@ -class PublicProjects < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - Then 'I should see the list of public projects' do - page.should have_content "Public Projects" - end -end diff --git a/features/steps/project/search_code.rb b/features/steps/project/search_code.rb new file mode 100644 index 0000000..d117b01 --- /dev/null +++ b/features/steps/project/search_code.rb @@ -0,0 +1,17 @@ +class ProjectSearchCode < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + When 'I search for term "Welcome to GitLab"' do + fill_in "search", with: "Welcome to GitLab" + click_button "Go" + click_link 'Repository Code' + end + + Then 'I should see files from repository containing "Welcome to GitLab"' do + page.should have_content "Welcome to GitLab" + page.should have_content "GitLab is a free project and repository management application" + end + +end diff --git a/features/steps/project/services.rb b/features/steps/project/services.rb new file mode 100644 index 0000000..54b3f18 --- /dev/null +++ b/features/steps/project/services.rb @@ -0,0 +1,103 @@ +class ProjectServices < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + step 'I visit project "Shop" services page' do + visit project_services_path(@project) + end + + step 'I should see list of available services' do + page.should have_content 'Project services' + page.should have_content 'Campfire' + page.should have_content 'Hipchat' + page.should have_content 'GitLab CI' + page.should have_content 'Assembla' + end + + step 'I click gitlab-ci service link' do + click_link 'GitLab CI' + end + + step 'I fill gitlab-ci settings' do + check 'Active' + fill_in 'Project url', with: 'http://ci.gitlab.org/projects/3' + fill_in 'Token', with: 'verySecret' + click_button 'Save' + end + + step 'I should see service settings saved' do + find_field('Project url').value.should == 'http://ci.gitlab.org/projects/3' + end + + step 'I click hipchat service link' do + click_link 'Hipchat' + end + + step 'I fill hipchat settings' do + check 'Active' + fill_in 'Room', with: 'gitlab' + fill_in 'Token', with: 'verySecret' + click_button 'Save' + end + + step 'I should see hipchat service settings saved' do + find_field('Room').value.should == 'gitlab' + end + + + step 'I click pivotaltracker service link' do + click_link 'PivotalTracker' + end + + step 'I fill pivotaltracker settings' do + check 'Active' + fill_in 'Token', with: 'verySecret' + click_button 'Save' + end + + step 'I should see pivotaltracker service settings saved' do + find_field('Token').value.should == 'verySecret' + end + + step 'I click Flowdock service link' do + click_link 'Flowdock' + end + + step 'I fill Flowdock settings' do + check 'Active' + fill_in 'Token', with: 'verySecret' + click_button 'Save' + end + + step 'I should see Flowdock service settings saved' do + find_field('Token').value.should == 'verySecret' + end + + step 'I click Assembla service link' do + click_link 'Assembla' + end + + step 'I fill Assembla settings' do + check 'Active' + fill_in 'Token', with: 'verySecret' + click_button 'Save' + end + + step 'I should see Assembla service settings saved' do + find_field('Token').value.should == 'verySecret' + end + + step 'I click email on push service link' do + click_link 'Emails on push' + end + + step 'I fill email on push settings' do + fill_in 'Recipients', with: 'qa@company.name' + click_button 'Save' + end + + step 'I should see email on push service settings saved' do + find_field('Recipients').value.should == 'qa@company.name' + end +end diff --git a/features/steps/project/snippets.rb b/features/steps/project/snippets.rb new file mode 100644 index 0000000..c3a76be --- /dev/null +++ b/features/steps/project/snippets.rb @@ -0,0 +1,99 @@ +class ProjectSnippets < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedNote + include SharedPaths + + And 'project "Shop" have "Snippet one" snippet' do + create(:project_snippet, + title: "Snippet one", + content: "Test content", + file_name: "snippet.rb", + project: project, + author: project.users.first) + end + + And 'project "Shop" have no "Snippet two" snippet' do + create(:snippet, + title: "Snippet two", + content: "Test content", + file_name: "snippet.rb", + author: project.users.first) + end + + Given 'I click link "New Snippet"' do + click_link "Add new snippet" + end + + Given 'I click link "Snippet one"' do + click_link "Snippet one" + end + + Then 'I should see "Snippet one" in snippets' do + page.should have_content "Snippet one" + end + + And 'I should not see "Snippet two" in snippets' do + page.should_not have_content "Snippet two" + end + + And 'I should not see "Snippet one" in snippets' do + page.should_not have_content "Snippet one" + end + + And 'I click link "Edit"' do + within ".file-title" do + click_link "Edit" + end + end + + And 'I click link "Remove Snippet"' do + click_link "Remove snippet" + end + + And 'I submit new snippet "Snippet three"' do + fill_in "project_snippet_title", :with => "Snippet three" + fill_in "project_snippet_file_name", :with => "my_snippet.rb" + within('.file-editor') do + find(:xpath, "//input[@id='project_snippet_content']").set 'Content of snippet three' + end + click_button "Create snippet" + end + + Then 'I should see snippet "Snippet three"' do + page.should have_content "Snippet three" + page.should have_content "Content of snippet three" + end + + And 'I submit new title "Snippet new title"' do + fill_in "project_snippet_title", :with => "Snippet new title" + click_button "Save" + end + + Then 'I should see "Snippet new title"' do + page.should have_content "Snippet new title" + end + + And 'I leave a comment like "Good snippet!"' do + within('.js-main-target-form') do + fill_in "note_note", with: "Good snippet!" + click_button "Add Comment" + end + end + + Then 'I should see comment "Good snippet!"' do + page.should have_content "Good snippet!" + end + + And 'I visit snippet page "Snippet one"' do + visit project_snippet_path(project, project_snippet) + end + + def project + @project ||= Project.find_by!(name: "Shop") + end + + def project_snippet + @project_snippet ||= ProjectSnippet.find_by!(title: "Snippet one") + end +end diff --git a/features/steps/project/team_management.rb b/features/steps/project/team_management.rb new file mode 100644 index 0000000..ffc5016 --- /dev/null +++ b/features/steps/project/team_management.rb @@ -0,0 +1,107 @@ +class ProjectTeamManagement < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + include Select2Helper + + Then 'I should be able to see myself in team' do + page.should have_content(@user.name) + page.should have_content(@user.username) + end + + And 'I should see "Sam" in team list' do + user = User.find_by(name: "Sam") + page.should have_content(user.name) + page.should have_content(user.username) + end + + Given 'I click link "New Team Member"' do + click_link "New project member" + end + + And 'I select "Mike" as "Reporter"' do + user = User.find_by(name: "Mike") + + select2(user.id, from: "#user_ids", multiple: true) + within "#new_team_member" do + select "Reporter", from: "project_access" + end + click_button "Add users" + end + + Then 'I should see "Mike" in team list as "Reporter"' do + within ".access-reporter" do + page.should have_content('Mike') + end + end + + Given 'I should see "Sam" in team list as "Developer"' do + within ".access-developer" do + page.should have_content('Sam') + end + end + + And 'I change "Sam" role to "Reporter"' do + user = User.find_by(name: "Sam") + within "#user_#{user.id}" do + select "Reporter", from: "team_member_project_access" + end + end + + And 'I should see "Sam" in team list as "Reporter"' do + within ".access-reporter" do + page.should have_content('Sam') + end + end + + And 'I click link "Remove from team"' do + click_link "Remove from team" + end + + And 'I should not see "Sam" in team list' do + user = User.find_by(name: "Sam") + page.should_not have_content(user.name) + page.should_not have_content(user.username) + end + + And 'gitlab user "Mike"' do + create(:user, name: "Mike") + end + + And 'gitlab user "Sam"' do + create(:user, name: "Sam") + end + + And '"Sam" is "Shop" developer' do + user = User.find_by(name: "Sam") + project = Project.find_by(name: "Shop") + project.team << [user, :developer] + end + + Given 'I own project "Website"' do + @project = create(:empty_project, name: "Website", namespace: @user.namespace) + @project.team << [@user, :master] + end + + And '"Mike" is "Website" reporter' do + user = User.find_by(name: "Mike") + project = Project.find_by(name: "Website") + project.team << [user, :reporter] + end + + And 'I click link "Import team from another project"' do + click_link "Import members from another project" + end + + When 'I submit "Website" project for import team' do + project = Project.find_by(name: "Website") + select project.name_with_namespace, from: 'source_project_id' + click_button 'Import' + end + + step 'I click cancel link for "Sam"' do + within "#user_#{User.find_by(name: 'Sam').id}" do + click_link('Remove user from team') + end + end +end diff --git a/features/steps/project/wall.rb b/features/steps/project/wall.rb new file mode 100644 index 0000000..7c61580 --- /dev/null +++ b/features/steps/project/wall.rb @@ -0,0 +1,18 @@ +class ProjectWall < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedNote + include SharedPaths + + + Given 'I write new comment "my special test message"' do + within(".wall-note-form") do + fill_in "note[note]", with: "my special test message" + click_button "Add Comment" + end + end + + Then 'I should see project wall note "my special test message"' do + page.should have_content "my special test message" + end +end diff --git a/features/steps/project/wiki.rb b/features/steps/project/wiki.rb new file mode 100644 index 0000000..6146599 --- /dev/null +++ b/features/steps/project/wiki.rb @@ -0,0 +1,92 @@ +class ProjectWiki < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedNote + include SharedPaths + + Given 'I click on the Cancel button' do + within(:css, ".form-actions") do + click_on "Cancel" + end + end + + Then 'I should be redirected back to the Edit Home Wiki page' do + url = URI.parse(current_url) + url.path.should == project_wiki_path(project, :home) + end + + Given 'I create the Wiki Home page' do + fill_in "Content", with: '[link test](test)' + click_on "Create page" + end + + Then 'I should see the newly created wiki page' do + page.should have_content "Home" + page.should have_content "link test" + + click_link "link test" + page.should have_content "Editing" + end + + Given 'I have an existing Wiki page' do + wiki.create_page("existing", "content", :markdown, "first commit") + @page = wiki.find_page("existing") + end + + And 'I browse to that Wiki page' do + visit project_wiki_path(project, @page) + end + + And 'I click on the Edit button' do + click_on "Edit" + end + + And 'I change the content' do + fill_in "Content", with: 'Updated Wiki Content' + click_on "Save changes" + end + + Then 'I should see the updated content' do + page.should have_content "Updated Wiki Content" + end + + Then 'I should be redirected back to that Wiki page' do + url = URI.parse(current_url) + url.path.should == project_wiki_path(project, @page) + end + + And 'That page has two revisions' do + @page.update("new content", :markdown, "second commit") + end + + And 'I click the History button' do + click_on "History" + end + + Then 'I should see both revisions' do + page.should have_content current_user.name + page.should have_content "first commit" + page.should have_content "second commit" + end + + And 'I click on the "Delete this page" button' do + click_on "Delete this page" + end + + Then 'The page should be deleted' do + page.should have_content "Page was successfully deleted" + end + + And 'I click on the "Pages" button' do + click_on "Pages" + end + + Then 'I should see the existing page in the pages list' do + page.should have_content current_user.name + page.should have_content @page.title.titleize + end + + def wiki + @gollum_wiki = GollumWiki.new(project, current_user) + end +end diff --git a/features/steps/public/projects.rb b/features/steps/public/projects.rb new file mode 100644 index 0000000..eb1d235 --- /dev/null +++ b/features/steps/public/projects.rb @@ -0,0 +1,172 @@ +class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + step 'public empty project "Empty Public Project"' do + create :empty_project, name: 'Empty Public Project', visibility_level: Gitlab::VisibilityLevel::PUBLIC + end + + step 'I should see project "Empty Public Project"' do + page.should have_content "Empty Public Project" + end + + step 'I should see public project details' do + page.should have_content '32 branches' + page.should have_content '16 tags' + end + + step 'I should see project readme' do + page.should have_content 'README.md' + end + + step 'I visit empty project page' do + project = Project.find_by(name: 'Empty Public Project') + visit project_path(project) + end + + step 'I visit project "Community" page' do + project = Project.find_by(name: 'Community') + visit project_path(project) + end + + step 'I should see empty public project details' do + page.should have_content 'Git global setup' + end + + step 'I should see empty public project details with http clone info' do + project = Project.find_by(name: 'Empty Public Project') + page.all(:css, '.git-empty .clone').each do |element| + element.text.should include(project.http_url_to_repo) + end + end + + step 'I should see empty public project details with ssh clone info' do + project = Project.find_by(name: 'Empty Public Project') + page.all(:css, '.git-empty .clone').each do |element| + element.text.should include(project.url_to_repo) + end + end + + step 'I visit project "Enterprise" page' do + project = Project.find_by(name: 'Enterprise') + visit project_path(project) + end + + step 'I should see project "Community" home page' do + within '.project-home-title' do + page.should have_content 'Community' + end + end + + step 'I visit project "Internal" page' do + project = Project.find_by(name: 'Internal') + visit project_path(project) + end + + step 'I should see project "Internal" home page' do + within '.project-home-title' do + page.should have_content 'Internal' + end + end + + step 'I should see an http link to the repository' do + project = Project.find_by(name: 'Community') + page.should have_field('project_clone', with: project.http_url_to_repo) + end + + step 'I should see an ssh link to the repository' do + project = Project.find_by(name: 'Community') + page.should have_field('project_clone', with: project.url_to_repo) + end + + step 'I visit "Community" issues page' do + create(:issue, + title: "Bug", + project: public_project + ) + create(:issue, + title: "New feature", + project: public_project + ) + visit project_issues_path(public_project) + end + + + step 'I should see list of issues for "Community" project' do + page.should have_content "Bug" + page.should have_content public_project.name + page.should have_content "New feature" + end + + step 'I visit "Internal" issues page' do + create(:issue, + title: "Internal Bug", + project: internal_project + ) + create(:issue, + title: "New internal feature", + project: internal_project + ) + visit project_issues_path(internal_project) + end + + + step 'I should see list of issues for "Internal" project' do + page.should have_content "Internal Bug" + page.should have_content internal_project.name + page.should have_content "New internal feature" + end + + step 'I visit "Community" merge requests page' do + visit project_merge_requests_path(public_project) + end + + step 'project "Community" has "Bug fix" open merge request' do + create(:merge_request, + title: "Bug fix for public project", + source_project: public_project, + target_project: public_project, + ) + end + + step 'I should see list of merge requests for "Community" project' do + page.should have_content public_project.name + page.should have_content public_merge_request.source_project.name + end + + step 'I visit "Internal" merge requests page' do + visit project_merge_requests_path(internal_project) + end + + step 'project "Internal" has "Feature implemented" open merge request' do + create(:merge_request, + title: "Feature implemented", + source_project: internal_project, + target_project: internal_project + ) + end + + step 'I should see list of merge requests for "Internal" project' do + page.should have_content internal_project.name + page.should have_content internal_merge_request.source_project.name + end + + def internal_project + @internal_project ||= Project.find_by!(name: 'Internal') + end + + def public_project + @public_project ||= Project.find_by!(name: 'Community') + end + + + def internal_merge_request + @internal_merge_request ||= MergeRequest.find_by!(title: 'Feature implemented') + end + + def public_merge_request + @public_merge_request ||= MergeRequest.find_by!(title: 'Bug fix for public project') + end +end + diff --git a/features/steps/public/projects_feature.rb b/features/steps/public/projects_feature.rb deleted file mode 100644 index eb1d235..0000000 --- a/features/steps/public/projects_feature.rb +++ /dev/null @@ -1,172 +0,0 @@ -class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - - step 'public empty project "Empty Public Project"' do - create :empty_project, name: 'Empty Public Project', visibility_level: Gitlab::VisibilityLevel::PUBLIC - end - - step 'I should see project "Empty Public Project"' do - page.should have_content "Empty Public Project" - end - - step 'I should see public project details' do - page.should have_content '32 branches' - page.should have_content '16 tags' - end - - step 'I should see project readme' do - page.should have_content 'README.md' - end - - step 'I visit empty project page' do - project = Project.find_by(name: 'Empty Public Project') - visit project_path(project) - end - - step 'I visit project "Community" page' do - project = Project.find_by(name: 'Community') - visit project_path(project) - end - - step 'I should see empty public project details' do - page.should have_content 'Git global setup' - end - - step 'I should see empty public project details with http clone info' do - project = Project.find_by(name: 'Empty Public Project') - page.all(:css, '.git-empty .clone').each do |element| - element.text.should include(project.http_url_to_repo) - end - end - - step 'I should see empty public project details with ssh clone info' do - project = Project.find_by(name: 'Empty Public Project') - page.all(:css, '.git-empty .clone').each do |element| - element.text.should include(project.url_to_repo) - end - end - - step 'I visit project "Enterprise" page' do - project = Project.find_by(name: 'Enterprise') - visit project_path(project) - end - - step 'I should see project "Community" home page' do - within '.project-home-title' do - page.should have_content 'Community' - end - end - - step 'I visit project "Internal" page' do - project = Project.find_by(name: 'Internal') - visit project_path(project) - end - - step 'I should see project "Internal" home page' do - within '.project-home-title' do - page.should have_content 'Internal' - end - end - - step 'I should see an http link to the repository' do - project = Project.find_by(name: 'Community') - page.should have_field('project_clone', with: project.http_url_to_repo) - end - - step 'I should see an ssh link to the repository' do - project = Project.find_by(name: 'Community') - page.should have_field('project_clone', with: project.url_to_repo) - end - - step 'I visit "Community" issues page' do - create(:issue, - title: "Bug", - project: public_project - ) - create(:issue, - title: "New feature", - project: public_project - ) - visit project_issues_path(public_project) - end - - - step 'I should see list of issues for "Community" project' do - page.should have_content "Bug" - page.should have_content public_project.name - page.should have_content "New feature" - end - - step 'I visit "Internal" issues page' do - create(:issue, - title: "Internal Bug", - project: internal_project - ) - create(:issue, - title: "New internal feature", - project: internal_project - ) - visit project_issues_path(internal_project) - end - - - step 'I should see list of issues for "Internal" project' do - page.should have_content "Internal Bug" - page.should have_content internal_project.name - page.should have_content "New internal feature" - end - - step 'I visit "Community" merge requests page' do - visit project_merge_requests_path(public_project) - end - - step 'project "Community" has "Bug fix" open merge request' do - create(:merge_request, - title: "Bug fix for public project", - source_project: public_project, - target_project: public_project, - ) - end - - step 'I should see list of merge requests for "Community" project' do - page.should have_content public_project.name - page.should have_content public_merge_request.source_project.name - end - - step 'I visit "Internal" merge requests page' do - visit project_merge_requests_path(internal_project) - end - - step 'project "Internal" has "Feature implemented" open merge request' do - create(:merge_request, - title: "Feature implemented", - source_project: internal_project, - target_project: internal_project - ) - end - - step 'I should see list of merge requests for "Internal" project' do - page.should have_content internal_project.name - page.should have_content internal_merge_request.source_project.name - end - - def internal_project - @internal_project ||= Project.find_by!(name: 'Internal') - end - - def public_project - @public_project ||= Project.find_by!(name: 'Community') - end - - - def internal_merge_request - @internal_merge_request ||= MergeRequest.find_by!(title: 'Feature implemented') - end - - def public_merge_request - @public_merge_request ||= MergeRequest.find_by!(title: 'Bug fix for public project') - end -end - diff --git a/features/steps/snippets/discover.rb b/features/steps/snippets/discover.rb new file mode 100644 index 0000000..0933793 --- /dev/null +++ b/features/steps/snippets/discover.rb @@ -0,0 +1,17 @@ +class DiscoverSnippets < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedSnippet + + Then 'I should see "Personal snippet one" in snippets' do + page.should have_content "Personal snippet one" + end + + And 'I should not see "Personal snippet private" in snippets' do + page.should_not have_content "Personal snippet private" + end + + def snippet + @snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one") + end +end diff --git a/features/steps/snippets/discover_snippets.rb b/features/steps/snippets/discover_snippets.rb deleted file mode 100644 index 0933793..0000000 --- a/features/steps/snippets/discover_snippets.rb +++ /dev/null @@ -1,17 +0,0 @@ -class DiscoverSnippets < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedSnippet - - Then 'I should see "Personal snippet one" in snippets' do - page.should have_content "Personal snippet one" - end - - And 'I should not see "Personal snippet private" in snippets' do - page.should_not have_content "Personal snippet private" - end - - def snippet - @snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one") - end -end diff --git a/features/steps/snippets/user.rb b/features/steps/snippets/user.rb new file mode 100644 index 0000000..2d7ffc8 --- /dev/null +++ b/features/steps/snippets/user.rb @@ -0,0 +1,41 @@ +class UserSnippets < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedSnippet + + Given 'I visit my snippets page' do + visit user_snippets_path(current_user) + end + + Then 'I should see "Personal snippet one" in snippets' do + page.should have_content "Personal snippet one" + end + + And 'I should see "Personal snippet private" in snippets' do + page.should have_content "Personal snippet private" + end + + Then 'I should not see "Personal snippet one" in snippets' do + page.should_not have_content "Personal snippet one" + end + + And 'I should not see "Personal snippet private" in snippets' do + page.should_not have_content "Personal snippet private" + end + + Given 'I click "Public" filter' do + within('.nav-stacked') do + click_link "Public" + end + end + + Given 'I click "Private" filter' do + within('.nav-stacked') do + click_link "Private" + end + end + + def snippet + @snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one") + end +end diff --git a/features/steps/snippets/user_snippets.rb b/features/steps/snippets/user_snippets.rb deleted file mode 100644 index 2d7ffc8..0000000 --- a/features/steps/snippets/user_snippets.rb +++ /dev/null @@ -1,41 +0,0 @@ -class UserSnippets < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedSnippet - - Given 'I visit my snippets page' do - visit user_snippets_path(current_user) - end - - Then 'I should see "Personal snippet one" in snippets' do - page.should have_content "Personal snippet one" - end - - And 'I should see "Personal snippet private" in snippets' do - page.should have_content "Personal snippet private" - end - - Then 'I should not see "Personal snippet one" in snippets' do - page.should_not have_content "Personal snippet one" - end - - And 'I should not see "Personal snippet private" in snippets' do - page.should_not have_content "Personal snippet private" - end - - Given 'I click "Public" filter' do - within('.nav-stacked') do - click_link "Public" - end - end - - Given 'I click "Private" filter' do - within('.nav-stacked') do - click_link "Private" - end - end - - def snippet - @snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one") - end -end -- libgit2 0.21.2