summaryrefslogtreecommitdiff
path: root/features/steps/shared
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-27 13:01:57 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-27 13:01:57 -0800
commit0d22b75b03496ced3d783f8fee9584098602ea1c (patch)
treec7ddec6072c716fd63a8703f2dfeb0e4234a633f /features/steps/shared
parent5f682094d9b7c985ad62ebe29664bb6fe87b54be (diff)
parentd4aab6528cb80b0f41bdac2240dd9cc32543481d (diff)
downloadgitlab-ce-0d22b75b03496ced3d783f8fee9584098602ea1c.tar.gz
Merge branch 'master' into mmonaco/gitlab-ce-api-user-noconfirm
Conflicts: lib/api/users.rb
Diffstat (limited to 'features/steps/shared')
-rw-r--r--features/steps/shared/active_tab.rb8
-rw-r--r--features/steps/shared/diff_note.rb30
-rw-r--r--features/steps/shared/issuable.rb15
-rw-r--r--features/steps/shared/markdown.rb45
-rw-r--r--features/steps/shared/note.rb30
-rw-r--r--features/steps/shared/paths.rb133
-rw-r--r--features/steps/shared/project.rb11
-rw-r--r--features/steps/shared/project_tab.rb4
8 files changed, 185 insertions, 91 deletions
diff --git a/features/steps/shared/active_tab.rb b/features/steps/shared/active_tab.rb
index f41b59a6f2b..c229864bc83 100644
--- a/features/steps/shared/active_tab.rb
+++ b/features/steps/shared/active_tab.rb
@@ -2,7 +2,7 @@ module SharedActiveTab
include Spinach::DSL
def ensure_active_main_tab(content)
- find('.main-nav li.active').should have_content(content)
+ find('.nav-sidebar > li.active').should have_content(content)
end
def ensure_active_sub_tab(content)
@@ -10,11 +10,11 @@ module SharedActiveTab
end
def ensure_active_sub_nav(content)
- find('div.content ul.nav-stacked-menu li.active').should have_content(content)
+ find('.sidebar-subnav > li.active').should have_content(content)
end
step 'no other main tabs should be active' do
- page.should have_selector('.main-nav li.active', count: 1)
+ page.should have_selector('.nav-sidebar > li.active', count: 1)
end
step 'no other sub tabs should be active' do
@@ -22,7 +22,7 @@ module SharedActiveTab
end
step 'no other sub navs should be active' do
- page.should have_selector('div.content ul.nav-stacked-menu li.active', count: 1)
+ page.should have_selector('.sidebar-subnav > li.active', count: 1)
end
step 'the active main tab should be Home' do
diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb
index 10f3ed90b56..510e0f0f938 100644
--- a/features/steps/shared/diff_note.rb
+++ b/features/steps/shared/diff_note.rb
@@ -32,7 +32,7 @@ module SharedDiffNote
click_diff_line(sample_commit.line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Should fix it :smile:"
- find(".js-note-preview-button").trigger("click")
+ find('.js-md-preview-button').click
end
end
@@ -41,7 +41,7 @@ module SharedDiffNote
within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do
fill_in "note[note]", with: "DRY this up"
- find(".js-note-preview-button").trigger("click")
+ find('.js-md-preview-button').click
end
end
@@ -71,15 +71,16 @@ module SharedDiffNote
end
end
- step 'I should not see the diff comment preview button' do
+ step 'The diff comment preview tab should say there is nothing to do' do
within(diff_file_selector) do
- page.should have_css(".js-note-preview-button", visible: false)
+ find('.js-md-preview-button').click
+ expect(find('.js-md-preview')).to have_content('Nothing to preview.')
end
end
step 'I should not see the diff comment text field' do
within(diff_file_selector) do
- page.should have_css(".js-note-text", visible: false)
+ expect(find('.js-note-text')).not_to be_visible
end
end
@@ -114,7 +115,7 @@ module SharedDiffNote
end
step 'I should see add a diff comment button' do
- page.should have_css(".js-add-diff-note-button", visible: false)
+ page.should have_css('.js-add-diff-note-button', visible: true)
end
step 'I should see an empty diff comment form' do
@@ -131,27 +132,28 @@ module SharedDiffNote
step 'I should see the diff comment preview' do
within("#{diff_file_selector} form") do
- page.should have_css(".js-note-preview", visible: false)
+ expect(page).to have_css('.js-md-preview', visible: true)
end
end
- step 'I should see the diff comment edit button' do
+ step 'I should see the diff comment write tab' do
within(diff_file_selector) do
- page.should have_css(".js-note-write-button", visible: true)
+ expect(page).to have_css('.js-md-write-button', visible: true)
end
end
- step 'I should see the diff comment preview button' do
+ step 'The diff comment preview tab should display rendered Markdown' do
within(diff_file_selector) do
- page.should have_css(".js-note-preview-button", visible: true)
+ find('.js-md-preview-button').click
+ expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
end
end
step 'I should see two separate previews' do
within(diff_file_selector) do
- page.should have_css(".js-note-preview", visible: true, count: 2)
- page.should have_content("Should fix it")
- page.should have_content("DRY this up")
+ expect(page).to have_css('.js-md-preview', visible: true, count: 2)
+ expect(page).to have_content('Should fix it')
+ expect(page).to have_content('DRY this up')
end
end
diff --git a/features/steps/shared/issuable.rb b/features/steps/shared/issuable.rb
new file mode 100644
index 00000000000..41db2612f26
--- /dev/null
+++ b/features/steps/shared/issuable.rb
@@ -0,0 +1,15 @@
+module SharedIssuable
+ include Spinach::DSL
+
+ def edit_issuable
+ find(:css, '.issuable-edit').click
+ end
+
+ step 'I click link "Edit" for the merge request' do
+ edit_issuable
+ end
+
+ step 'I click link "Edit" for the issue' do
+ edit_issuable
+ end
+end
diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb
index 8bf138065b0..e71700880cd 100644
--- a/features/steps/shared/markdown.rb
+++ b/features/steps/shared/markdown.rb
@@ -54,4 +54,49 @@ EOT
'div.description li.task-list-item input[type="checkbox"]:disabled'
)
end
+
+ step 'I should not see the Markdown preview' do
+ expect(find('.gfm-form .js-md-preview')).not_to be_visible
+ end
+
+ step 'The Markdown preview tab should say there is nothing to do' do
+ within('.gfm-form') do
+ find('.js-md-preview-button').click
+ expect(find('.js-md-preview')).to have_content('Nothing to preview.')
+ end
+ end
+
+ step 'I should not see the Markdown text field' do
+ expect(find('.gfm-form textarea')).not_to be_visible
+ end
+
+ step 'I should see the Markdown write tab' do
+ expect(find('.gfm-form')).to have_css('.js-md-write-button', visible: true)
+ end
+
+ step 'I should see the Markdown preview' do
+ expect(find('.gfm-form')).to have_css('.js-md-preview', visible: true)
+ end
+
+ step 'The Markdown preview tab should display rendered Markdown' do
+ within('.gfm-form') do
+ find('.js-md-preview-button').click
+ expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
+ end
+ end
+
+ step 'I write a description like ":+1: Nice"' do
+ find('.gfm-form').fill_in 'Description', with: ':+1: Nice'
+ end
+
+ step 'I preview a description text like "Bug fixed :smile:"' do
+ within('.gfm-form') do
+ fill_in 'Description', with: 'Bug fixed :smile:'
+ find('.js-md-preview-button').click
+ end
+ end
+
+ step 'I haven\'t written any description text' do
+ find('.gfm-form').fill_in 'Description', with: ''
+ end
end
diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb
index 2b2cb47a715..45773056953 100644
--- a/features/steps/shared/note.rb
+++ b/features/steps/shared/note.rb
@@ -23,7 +23,7 @@ module SharedNote
step 'I preview a comment text like "Bug fixed :smile:"' do
within(".js-main-target-form") do
fill_in "note[note]", with: "Bug fixed :smile:"
- find(".js-note-preview-button").trigger("click")
+ find('.js-md-preview-button').click
end
end
@@ -33,9 +33,9 @@ module SharedNote
end
end
- step 'I write a comment like "Nice"' do
+ step 'I write a comment like ":+1: Nice"' do
within(".js-main-target-form") do
- fill_in "note[note]", with: "Nice"
+ fill_in 'note[note]', with: ':+1: Nice'
end
end
@@ -51,19 +51,20 @@ module SharedNote
step 'I should not see the comment preview' do
within(".js-main-target-form") do
- page.should have_css(".js-note-preview", visible: false)
+ expect(find('.js-md-preview')).not_to be_visible
end
end
- step 'I should not see the comment preview button' do
+ step 'The comment preview tab should say there is nothing to do' do
within(".js-main-target-form") do
- page.should have_css(".js-note-preview-button", visible: false)
+ find('.js-md-preview-button').click
+ expect(find('.js-md-preview')).to have_content('Nothing to preview.')
end
end
step 'I should not see the comment text field' do
within(".js-main-target-form") do
- page.should have_css(".js-note-text", visible: false)
+ expect(find('.js-note-text')).not_to be_visible
end
end
@@ -79,21 +80,22 @@ module SharedNote
end
end
- step 'I should see the comment edit button' do
+ step 'I should see the comment write tab' do
within(".js-main-target-form") do
- page.should have_css(".js-note-write-button", visible: true)
+ expect(page).to have_css('.js-md-write-button', visible: true)
end
end
- step 'I should see the comment preview' do
+ step 'The comment preview tab should be display rendered Markdown' do
within(".js-main-target-form") do
- page.should have_css(".js-note-preview", visible: true)
+ find('.js-md-preview-button').click
+ expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
end
end
- step 'I should see the comment preview button' do
+ step 'I should see the comment preview' do
within(".js-main-target-form") do
- page.should have_css(".js-note-preview-button", visible: true)
+ expect(page).to have_css('.js-md-preview', visible: true)
end
end
@@ -114,7 +116,7 @@ module SharedNote
end
step 'The comment with the header should not have an ID' do
- within(".note-text") do
+ within(".note-body > .note-text") do
page.should have_content("Comment with a header")
page.should_not have_css("#comment-with-a-header")
end
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index 5f292255ce1..835b644e6c7 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -1,6 +1,7 @@
module SharedPaths
include Spinach::DSL
include RepoHelpers
+ include DashboardHelper
step 'I visit new project page' do
visit new_project_path
@@ -71,11 +72,11 @@ module SharedPaths
end
step 'I visit dashboard issues page' do
- visit issues_dashboard_path
+ visit assigned_issues_dashboard_path
end
step 'I visit dashboard merge requests page' do
- visit merge_requests_dashboard_path
+ visit assigned_mrs_dashboard_path
end
step 'I visit dashboard search page' do
@@ -94,6 +95,10 @@ module SharedPaths
visit profile_path
end
+ step 'I visit profile applications page' do
+ visit applications_profile_path
+ end
+
step 'I visit profile password page' do
visit edit_profile_password_path
end
@@ -131,7 +136,7 @@ module SharedPaths
end
step 'I visit admin projects page' do
- visit admin_projects_path
+ visit admin_namespaces_projects_path
end
step 'I visit admin users page' do
@@ -162,59 +167,72 @@ module SharedPaths
visit admin_teams_path
end
+ step 'I visit admin settings page' do
+ visit admin_application_settings_path
+ end
+
+ step 'I visit applications page' do
+ visit admin_applications_path
+ end
+
# ----------------------------------------
# Generic Project
# ----------------------------------------
step "I visit my project's home page" do
- visit project_path(@project)
+ visit namespace_project_path(@project.namespace, @project)
end
step "I visit my project's settings page" do
- visit edit_project_path(@project)
+ visit edit_namespace_project_path(@project.namespace, @project)
end
step "I visit my project's files page" do
- visit project_tree_path(@project, root_ref)
+ visit namespace_project_tree_path(@project.namespace, @project, root_ref)
+ end
+
+ step 'I visit a binary file in the repo' do
+ visit namespace_project_blob_path(@project.namespace, @project, File.join(
+ root_ref, 'files/images/logo-black.png'))
end
step "I visit my project's commits page" do
- visit project_commits_path(@project, root_ref, {limit: 5})
+ visit namespace_project_commits_path(@project.namespace, @project, root_ref, {limit: 5})
end
step "I visit my project's commits page for a specific path" do
- visit project_commits_path(@project, root_ref + "/app/models/project.rb", {limit: 5})
+ visit namespace_project_commits_path(@project.namespace, @project, root_ref + "/app/models/project.rb", {limit: 5})
end
step 'I visit my project\'s commits stats page' do
- visit stats_project_repository_path(@project)
+ visit stats_namespace_project_repository_path(@project.namespace, @project)
end
step "I visit my project's network page" do
# Stub Graph max_size to speed up test (10 commits vs. 650)
Network::Graph.stub(max_count: 10)
- visit project_network_path(@project, root_ref)
+ visit namespace_project_network_path(@project.namespace, @project, root_ref)
end
step "I visit my project's issues page" do
- visit project_issues_path(@project)
+ visit namespace_project_issues_path(@project.namespace, @project)
end
step "I visit my project's merge requests page" do
- visit project_merge_requests_path(@project)
+ visit namespace_project_merge_requests_path(@project.namespace, @project)
end
step "I visit my project's wiki page" do
- visit project_wiki_path(@project, :home)
+ visit namespace_project_wiki_path(@project.namespace, @project, :home)
end
step 'I visit project hooks page' do
- visit project_hooks_path(@project)
+ visit namespace_project_hooks_path(@project.namespace, @project)
end
step 'I visit project deploy keys page' do
- visit project_deploy_keys_path(@project)
+ visit namespace_project_deploy_keys_path(@project.namespace, @project)
end
# ----------------------------------------
@@ -222,153 +240,153 @@ module SharedPaths
# ----------------------------------------
step 'I visit project "Shop" page' do
- visit project_path(project)
+ visit namespace_project_path(project.namespace, project)
end
step 'I visit project "Forked Shop" merge requests page' do
- visit project_merge_requests_path(@forked_project)
+ visit namespace_project_merge_requests_path(@forked_project.namespace, @forked_project)
end
step 'I visit edit project "Shop" page' do
- visit edit_project_path(project)
+ visit edit_namespace_project_path(project.namespace, project)
end
step 'I visit project branches page' do
- visit project_branches_path(@project)
+ visit namespace_project_branches_path(@project.namespace, @project)
end
step 'I visit project protected branches page' do
- visit project_protected_branches_path(@project)
+ visit namespace_project_protected_branches_path(@project.namespace, @project)
end
step 'I visit compare refs page' do
- visit project_compare_index_path(@project)
+ visit namespace_project_compare_index_path(@project.namespace, @project)
end
step 'I visit project commits page' do
- visit project_commits_path(@project, root_ref, {limit: 5})
+ visit namespace_project_commits_path(@project.namespace, @project, root_ref, {limit: 5})
end
step 'I visit project commits page for stable branch' do
- visit project_commits_path(@project, 'stable', {limit: 5})
+ visit namespace_project_commits_path(@project.namespace, @project, 'stable', {limit: 5})
end
step 'I visit project source page' do
- visit project_tree_path(@project, root_ref)
+ visit namespace_project_tree_path(@project.namespace, @project, root_ref)
end
step 'I visit blob file from repo' do
- visit project_blob_path(@project, File.join(sample_commit.id, sample_blob.path))
+ visit namespace_project_blob_path(@project.namespace, @project, File.join(sample_commit.id, sample_blob.path))
end
step 'I visit ".gitignore" file in repo' do
- visit project_blob_path(@project, File.join(root_ref, '.gitignore'))
+ visit namespace_project_blob_path(@project.namespace, @project, File.join(root_ref, '.gitignore'))
end
step 'I am on the new file page' do
- current_path.should eq(project_new_tree_path(@project, root_ref))
+ current_path.should eq(namespace_project_create_blob_path(@project.namespace, @project, root_ref))
end
step 'I am on the ".gitignore" edit file page' do
- current_path.should eq(project_edit_tree_path(
- @project, File.join(root_ref, '.gitignore')))
+ current_path.should eq(namespace_project_edit_blob_path(
+ @project.namespace, @project, File.join(root_ref, '.gitignore')))
end
step 'I visit project source page for "6d39438"' do
- visit project_tree_path(@project, "6d39438")
+ visit namespace_project_tree_path(@project.namespace, @project, "6d39438")
end
step 'I visit project source page for' \
' "6d394385cf567f80a8fd85055db1ab4c5295806f"' do
- visit project_tree_path(@project,
+ visit namespace_project_tree_path(@project.namespace, @project,
'6d394385cf567f80a8fd85055db1ab4c5295806f')
end
step 'I visit project tags page' do
- visit project_tags_path(@project)
+ visit namespace_project_tags_path(@project.namespace, @project)
end
step 'I visit project commit page' do
- visit project_commit_path(@project, sample_commit.id)
+ visit namespace_project_commit_path(@project.namespace, @project, sample_commit.id)
end
step 'I visit project "Shop" issues page' do
- visit project_issues_path(project)
+ visit namespace_project_issues_path(project.namespace, project)
end
step 'I visit issue page "Release 0.4"' do
issue = Issue.find_by(title: "Release 0.4")
- visit project_issue_path(issue.project, issue)
+ visit namespace_project_issue_path(issue.project.namespace, issue.project, issue)
end
step 'I visit issue page "Tasks-open"' do
issue = Issue.find_by(title: 'Tasks-open')
- visit project_issue_path(issue.project, issue)
+ visit namespace_project_issue_path(issue.project.namespace, issue.project, issue)
end
step 'I visit issue page "Tasks-closed"' do
issue = Issue.find_by(title: 'Tasks-closed')
- visit project_issue_path(issue.project, issue)
+ visit namespace_project_issue_path(issue.project.namespace, issue.project, issue)
end
step 'I visit project "Shop" labels page' do
project = Project.find_by(name: 'Shop')
- visit project_labels_path(project)
+ visit namespace_project_labels_path(project.namespace, project)
end
step 'I visit project "Forum" labels page' do
project = Project.find_by(name: 'Forum')
- visit project_labels_path(project)
+ visit namespace_project_labels_path(project.namespace, project)
end
step 'I visit project "Shop" new label page' do
project = Project.find_by(name: 'Shop')
- visit new_project_label_path(project)
+ visit new_namespace_project_label_path(project.namespace, project)
end
step 'I visit project "Forum" new label page' do
project = Project.find_by(name: 'Forum')
- visit new_project_label_path(project)
+ visit new_namespace_project_label_path(project.namespace, project)
end
step 'I visit merge request page "Bug NS-04"' do
mr = MergeRequest.find_by(title: "Bug NS-04")
- visit project_merge_request_path(mr.target_project, mr)
+ visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr)
end
step 'I visit merge request page "Bug NS-05"' do
mr = MergeRequest.find_by(title: "Bug NS-05")
- visit project_merge_request_path(mr.target_project, mr)
+ visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr)
end
step 'I visit merge request page "MR-task-open"' do
mr = MergeRequest.find_by(title: 'MR-task-open')
- visit project_merge_request_path(mr.target_project, mr)
+ visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr)
end
step 'I visit merge request page "MR-task-closed"' do
mr = MergeRequest.find_by(title: 'MR-task-closed')
- visit project_merge_request_path(mr.target_project, mr)
+ visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr)
end
step 'I visit project "Shop" merge requests page' do
- visit project_merge_requests_path(project)
+ visit namespace_project_merge_requests_path(project.namespace, project)
end
step 'I visit forked project "Shop" merge requests page' do
- visit project_merge_requests_path(project)
+ visit namespace_project_merge_requests_path(project.namespace, project)
end
step 'I visit project "Shop" milestones page' do
- visit project_milestones_path(project)
+ visit namespace_project_milestones_path(project.namespace, project)
end
step 'I visit project "Shop" team page' do
- visit project_team_index_path(project)
+ visit namespace_project_team_index_path(project.namespace, project)
end
step 'I visit project wiki page' do
- visit project_wiki_path(@project, :home)
+ visit namespace_project_wiki_path(@project.namespace, @project, :home)
end
# ----------------------------------------
@@ -377,17 +395,22 @@ module SharedPaths
step 'I visit project "Community" page' do
project = Project.find_by(name: "Community")
- visit project_path(project)
+ visit namespace_project_path(project.namespace, project)
+ end
+
+ step 'I visit project "Community" source page' do
+ project = Project.find_by(name: 'Community')
+ visit namespace_project_tree_path(project.namespace, project, root_ref)
end
step 'I visit project "Internal" page' do
project = Project.find_by(name: "Internal")
- visit project_path(project)
+ visit namespace_project_path(project.namespace, project)
end
step 'I visit project "Enterprise" page' do
project = Project.find_by(name: "Enterprise")
- visit project_path(project)
+ visit namespace_project_path(project.namespace, project)
end
# ----------------------------------------
@@ -396,7 +419,7 @@ module SharedPaths
step "I visit empty project page" do
project = Project.find_by(name: "Empty Public Project")
- visit project_path(project)
+ visit namespace_project_path(project.namespace, project)
end
# ----------------------------------------
@@ -424,7 +447,7 @@ module SharedPaths
# ----------------------------------------
step 'I visit project "Shop" snippets page' do
- visit project_snippets_path(project)
+ visit namespace_project_snippets_path(project.namespace, project)
end
step 'I visit snippets page' do
diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb
index 4b833850a1c..41f71ae29cb 100644
--- a/features/steps/shared/project.rb
+++ b/features/steps/shared/project.rb
@@ -28,11 +28,16 @@ module SharedProject
@project.team << [@user, :master]
end
+ step 'I visit my empty project page' do
+ project = Project.find_by(name: 'Empty Project')
+ visit namespace_project_path(project.namespace, project)
+ end
+
step 'project "Shop" has push event' do
@project = Project.find_by(name: "Shop")
data = {
- before: "0000000000000000000000000000000000000000",
+ before: Gitlab::Git::BLANK_SHA,
after: "6d394385cf567f80a8fd85055db1ab4c5295806f",
ref: "refs/heads/fix",
user_id: @user.id,
@@ -60,7 +65,7 @@ module SharedProject
end
step 'I should see project settings' do
- current_path.should == edit_project_path(@project)
+ current_path.should == edit_namespace_project_path(@project.namespace, @project)
page.should have_content("Project name")
page.should have_content("Features:")
end
@@ -131,7 +136,7 @@ module SharedProject
end
step 'public empty project "Empty Public Project"' do
- create :empty_project, :public, name: "Empty Public Project"
+ create :project_empty_repo, :public, name: "Empty Public Project"
end
step 'project "Community" has comments' do
diff --git a/features/steps/shared/project_tab.rb b/features/steps/shared/project_tab.rb
index 6aa4f1b20df..c5aed19331c 100644
--- a/features/steps/shared/project_tab.rb
+++ b/features/steps/shared/project_tab.rb
@@ -41,6 +41,8 @@ module SharedProjectTab
end
step 'the active main tab should be Settings' do
- ensure_active_main_tab('Settings')
+ within '.nav-sidebar' do
+ page.should have_content('Back to project')
+ end
end
end