diff options
author | Jan-Willem van der Meer <mail@jewilmeer.nl> | 2014-09-11 11:46:08 +0200 |
---|---|---|
committer | Jan-Willem van der Meer <mail@jewilmeer.nl> | 2014-09-11 11:46:08 +0200 |
commit | bf0de1a500e7a9aecc7c8bbf623ad39b75c6433b (patch) | |
tree | 382df65e2b17c91e03278d58bce8dce0129a6a7b /features/steps | |
parent | b18d1c2786c2a385d6b797734a1afad7a01ddf35 (diff) | |
parent | 78ec7d9c9d156fe556d165c1c096bf5534d62d25 (diff) | |
download | gitlab-ce-bf0de1a500e7a9aecc7c8bbf623ad39b75c6433b.tar.gz |
Merge remote-tracking branch 'origin/master' into feature-oauth-refactoring
Diffstat (limited to 'features/steps')
-rw-r--r-- | features/steps/project/browse_branches.rb | 34 | ||||
-rw-r--r-- | features/steps/project/browse_files.rb | 13 | ||||
-rw-r--r-- | features/steps/project/browse_tags.rb | 46 | ||||
-rw-r--r-- | features/steps/project/issues.rb | 41 | ||||
-rw-r--r-- | features/steps/project/labels.rb | 16 | ||||
-rw-r--r-- | features/steps/shared/paths.rb | 6 | ||||
-rw-r--r-- | features/steps/shared/project_tab.rb | 2 | ||||
-rw-r--r-- | features/steps/shared/search.rb | 11 | ||||
-rw-r--r-- | features/steps/shared/snippet.rb | 23 | ||||
-rw-r--r-- | features/steps/snippet_search.rb | 56 |
10 files changed, 227 insertions, 21 deletions
diff --git a/features/steps/project/browse_branches.rb b/features/steps/project/browse_branches.rb index c00a95a62fd..cfc88bdad22 100644 --- a/features/steps/project/browse_branches.rb +++ b/features/steps/project/browse_branches.rb @@ -38,10 +38,38 @@ class ProjectBrowseBranches < Spinach::FeatureSteps click_button 'Create branch' end + step 'I submit new branch form with invalid name' do + fill_in 'branch_name', with: '1.0 stable' + fill_in 'ref', with: 'master' + click_button 'Create branch' + end + + step 'I submit new branch form with invalid reference' do + fill_in 'branch_name', with: 'foo' + fill_in 'ref', with: 'foo' + click_button 'Create branch' + end + + step 'I submit new branch form with branch that already exists' do + fill_in 'branch_name', with: 'master' + fill_in 'ref', with: 'master' + click_button 'Create branch' + end + step 'I should see new branch created' do - within '.tree-ref-holder' do - page.should have_content 'deploy_keys' - end + page.should have_content 'deploy_keys' + end + + step 'I should see new an error that branch is invalid' do + page.should have_content 'Branch name invalid' + end + + step 'I should see new an error that ref is invalid' do + page.should have_content 'Invalid reference name' + end + + step 'I should see new an error that branch already exists' do + page.should have_content 'Branch already exists' end step "I click branch 'improve/awesome' delete link" do diff --git a/features/steps/project/browse_files.rb b/features/steps/project/browse_files.rb index 6fd0c2c2ded..bd395a0d26e 100644 --- a/features/steps/project/browse_files.rb +++ b/features/steps/project/browse_files.rb @@ -90,4 +90,17 @@ class ProjectBrowseFiles < Spinach::FeatureSteps page.should_not have_link 'Browse File »' page.should_not have_link 'Browse Dir »' end + + step 'I click on permalink' do + click_link 'permalink' + end + + step 'I am redirected to the permalink URL' do + expect(current_path).to eq(project_blob_path( + @project, @project.repository.commit.sha + '/.gitignore')) + end + + step "I don't see the permalink link" do + expect(page).not_to have_link('permalink') + end end diff --git a/features/steps/project/browse_tags.rb b/features/steps/project/browse_tags.rb index 7c679911e00..64c0c284f6c 100644 --- a/features/steps/project/browse_tags.rb +++ b/features/steps/project/browse_tags.rb @@ -3,8 +3,52 @@ class ProjectBrowseTags < Spinach::FeatureSteps include SharedProject include SharedPaths - Then 'I should see "Shop" all tags list' do + step 'I should see "Shop" all tags list' do page.should have_content "Tags" page.should have_content "v1.0.0" end + + step 'I click new tag link' do + click_link 'New tag' + end + + step 'I submit new tag form' do + fill_in 'tag_name', with: 'v7.0' + fill_in 'ref', with: 'master' + click_button 'Create tag' + end + + step 'I submit new tag form with invalid name' do + fill_in 'tag_name', with: 'v 1.0' + fill_in 'ref', with: 'master' + click_button 'Create tag' + end + + step 'I submit new tag form with invalid reference' do + fill_in 'tag_name', with: 'foo' + fill_in 'ref', with: 'foo' + click_button 'Create tag' + end + + step 'I submit new tag form with tag that already exists' do + fill_in 'tag_name', with: 'v1.0.0' + fill_in 'ref', with: 'master' + click_button 'Create tag' + end + + step 'I should see new tag created' do + page.should have_content 'v7.0' + end + + step 'I should see new an error that tag is invalid' do + page.should have_content 'Tag name invalid' + end + + step 'I should see new an error that tag ref is invalid' do + page.should have_content 'Invalid reference name' + end + + step 'I should see new an error that tag already exists' do + page.should have_content 'Tag already exists' + end end diff --git a/features/steps/project/issues.rb b/features/steps/project/issues.rb index ab2d7cee2e3..32a3a0d3f56 100644 --- a/features/steps/project/issues.rb +++ b/features/steps/project/issues.rb @@ -74,34 +74,34 @@ class ProjectIssues < Spinach::FeatureSteps end Given 'I fill in issue search with "Re"' do - fill_in 'issue_search', with: "Re" + filter_issue "Re" end Given 'I fill in issue search with "Bu"' do - fill_in 'issue_search', with: "Bu" + filter_issue "Bu" end And 'I fill in issue search with ".3"' do - fill_in 'issue_search', with: ".3" + filter_issue ".3" end And 'I fill in issue search with "Something"' do - fill_in 'issue_search', with: "Something" + filter_issue "Something" end And 'I fill in issue search with ""' do - fill_in 'issue_search', with: "" + filter_issue "" 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) } @@ -117,20 +117,20 @@ class ProjectIssues < Spinach::FeatureSteps 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, @@ -140,7 +140,6 @@ class ProjectIssues < Spinach::FeatureSteps end And 'project "Shop" have "Tweet control" open issue' do - project = Project.find_by(name: "Shop") create(:issue, title: "Tweet control", project: project, @@ -148,7 +147,6 @@ class ProjectIssues < Spinach::FeatureSteps 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, @@ -189,25 +187,23 @@ class ProjectIssues < Spinach::FeatureSteps end step 'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\'' do - project = Project.find_by(name: 'Shop') issue = create(:issue, title: 'Bugfix1', description: 'Description for issue1', project: project) end step 'project \'Shop\' has issue \'Feature1\' with description: \'Feature submitted for issue1\'' do - project = Project.find_by(name: 'Shop') issue = create(:issue, title: 'Feature1', description: 'Feature submitted for issue1', project: project) end step 'I fill in issue search with \'Description for issue1\'' do - fill_in 'issue_search', with: 'Description for issue' + filter_issue 'Description for issue' end step 'I fill in issue search with \'issue1\'' do - fill_in 'issue_search', with: 'issue1' + filter_issue 'issue1' end step 'I fill in issue search with \'Rock and roll\'' do - fill_in 'issue_search', with: 'Description for issue' + filter_issue 'Description for issue' end step 'I should see \'Bugfix1\' in issues' do @@ -221,4 +217,15 @@ class ProjectIssues < Spinach::FeatureSteps step 'I should not see \'Bugfix1\' in issues' do page.should_not have_content 'Bugfix1' end + + def filter_issue(text) + fill_in 'issue_search', with: text + + # make sure AJAX request finished + URI.parse(current_url).request_uri == project_issues_path(project, issue_search: text) + end + + def project + @project ||= Project.find_by(name: 'Shop') + end end diff --git a/features/steps/project/labels.rb b/features/steps/project/labels.rb index 8320405e096..6dd4df8a1ad 100644 --- a/features/steps/project/labels.rb +++ b/features/steps/project/labels.rb @@ -25,6 +25,22 @@ class ProjectLabels < Spinach::FeatureSteps end end + step 'I delete all labels' do + within '.labels' do + all('.btn-remove').each do |remove| + remove.click + sleep 0.05 + end + end + end + + step 'I should see labels help message' do + within '.labels' do + page.should have_content 'Create first label or generate default set of '\ + 'labels' + end + end + step 'I submit new label \'support\'' do fill_in 'Title', with: 'support' fill_in 'Background Color', with: '#F95610' diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index 0d06383509f..276947dc060 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -269,6 +269,12 @@ module SharedPaths visit project_tree_path(@project, "6d39438") end + step 'I visit project source page for' \ + ' "6d394385cf567f80a8fd85055db1ab4c5295806f"' do + visit project_tree_path(@project, + '6d394385cf567f80a8fd85055db1ab4c5295806f') + end + step 'I visit project tags page' do visit project_tags_path(@project) end diff --git a/features/steps/shared/project_tab.rb b/features/steps/shared/project_tab.rb index 498a173e9a5..6aa4f1b20df 100644 --- a/features/steps/shared/project_tab.rb +++ b/features/steps/shared/project_tab.rb @@ -1,3 +1,5 @@ +require_relative 'active_tab' + module SharedProjectTab include Spinach::DSL include SharedActiveTab diff --git a/features/steps/shared/search.rb b/features/steps/shared/search.rb new file mode 100644 index 00000000000..6c3d601763d --- /dev/null +++ b/features/steps/shared/search.rb @@ -0,0 +1,11 @@ +module SharedSearch + include Spinach::DSL + + def search_snippet_contents(query) + visit "/search?search=#{URI::encode(query)}&snippets=true&scope=snippet_blobs" + end + + def search_snippet_titles(query) + visit "/search?search=#{URI::encode(query)}&snippets=true&scope=snippet_titles" + end +end diff --git a/features/steps/shared/snippet.rb b/features/steps/shared/snippet.rb index 543e43196a5..c64299ae6f3 100644 --- a/features/steps/shared/snippet.rb +++ b/features/steps/shared/snippet.rb @@ -18,4 +18,27 @@ module SharedSnippet private: true, author: current_user) end + And 'I have a public many lined snippet' do + create(:personal_snippet, + title: 'Many lined snippet', + content: <<-END.gsub(/^\s+\|/, ''), + |line one + |line two + |line three + |line four + |line five + |line six + |line seven + |line eight + |line nine + |line ten + |line eleven + |line twelve + |line thirteen + |line fourteen + END + file_name: 'many_lined_snippet.rb', + private: true, + author: current_user) + end end diff --git a/features/steps/snippet_search.rb b/features/steps/snippet_search.rb new file mode 100644 index 00000000000..fe03b847c56 --- /dev/null +++ b/features/steps/snippet_search.rb @@ -0,0 +1,56 @@ +class Spinach::Features::SnippetSearch < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedSnippet + include SharedUser + include SharedSearch + + step 'I search for "snippet" in snippet titles' do + search_snippet_titles 'snippet' + end + + step 'I search for "snippet private" in snippet titles' do + search_snippet_titles 'snippet private' + end + + step 'I search for "line seven" in snippet contents' do + search_snippet_contents 'line seven' + end + + step 'I should see "line seven" in results' do + page.should have_content 'line seven' + end + + step 'I should see "line four" in results' do + page.should have_content 'line four' + end + + step 'I should see "line ten" in results' do + page.should have_content 'line ten' + end + + step 'I should not see "line eleven" in results' do + page.should_not have_content 'line eleven' + end + + step 'I should not see "line three" in results' do + page.should_not have_content 'line three' + end + + Then 'I should see "Personal snippet one" in results' do + page.should have_content 'Personal snippet one' + end + + And 'I should see "Personal snippet private" in results' do + page.should have_content 'Personal snippet private' + end + + Then 'I should not see "Personal snippet one" in results' do + page.should_not have_content 'Personal snippet one' + end + + And 'I should not see "Personal snippet private" in results' do + page.should_not have_content 'Personal snippet private' + end + +end |