Commit 584f8601 authored by Robert Speicher's avatar Robert Speicher

Change `within` to `page.within` in feature steps

parent 69bbc413
...@@ -44,7 +44,7 @@ class Spinach::Features::AdminApplications < Spinach::FeatureSteps ...@@ -44,7 +44,7 @@ class Spinach::Features::AdminApplications < Spinach::FeatureSteps
end end
step 'I click to remove application' do step 'I click to remove application' do
within '.oauth-applications' do page.within '.oauth-applications' do
click_on "Destroy" click_on "Destroy"
end end
end end
......
...@@ -38,14 +38,14 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps ...@@ -38,14 +38,14 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
When 'I select user "John Doe" from user list as "Reporter"' do When 'I select user "John Doe" from user list as "Reporter"' do
select2(user_john.id, from: "#user_ids", multiple: true) select2(user_john.id, from: "#user_ids", multiple: true)
within "#new_project_member" do page.within "#new_project_member" do
select "Reporter", from: "access_level" select "Reporter", from: "access_level"
end end
click_button "Add users to group" click_button "Add users to group"
end end
step 'I should see "John Doe" in team list in every project as "Reporter"' do step 'I should see "John Doe" in team list in every project as "Reporter"' do
within ".group-users-list" do page.within ".group-users-list" do
expect(page).to have_content "John Doe" expect(page).to have_content "John Doe"
expect(page).to have_content "Reporter" expect(page).to have_content "Reporter"
end end
...@@ -62,13 +62,13 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps ...@@ -62,13 +62,13 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
end end
step 'I remove user "John Doe" from group' do step 'I remove user "John Doe" from group' do
within "#user_#{user_john.id}" do page.within "#user_#{user_john.id}" do
click_link 'Remove user from group' click_link 'Remove user from group'
end end
end end
step 'I should not see "John Doe" in team list' do step 'I should not see "John Doe" in team list' do
within ".group-users-list" do page.within ".group-users-list" do
expect(page).not_to have_content "John Doe" expect(page).not_to have_content "John Doe"
end end
end end
......
...@@ -23,7 +23,7 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps ...@@ -23,7 +23,7 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
end end
step 'See username error message' do step 'See username error message' do
within "#error_explanation" do page.within "#error_explanation" do
expect(page).to have_content "Username" expect(page).to have_content "Username"
end end
end end
......
...@@ -4,7 +4,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps ...@@ -4,7 +4,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
include SharedProject include SharedProject
step 'I click "New project" link' do step 'I click "New project" link' do
within('.content') do page.within('.content') do
click_link "New project" click_link "New project"
end end
end end
......
...@@ -8,7 +8,7 @@ class Spinach::Features::DashboardStarredProjects < Spinach::FeatureSteps ...@@ -8,7 +8,7 @@ class Spinach::Features::DashboardStarredProjects < Spinach::FeatureSteps
end end
step 'I should not see project "Shop"' do step 'I should not see project "Shop"' do
within 'aside' do page.within 'aside' do
expect(page).not_to have_content('Shop') expect(page).not_to have_content('Shop')
end end
end end
......
...@@ -35,13 +35,13 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps ...@@ -35,13 +35,13 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
end end
step 'I should see project "Community" home page' do step 'I should see project "Community" home page' do
within '.navbar-gitlab .title' do page.within '.navbar-gitlab .title' do
expect(page).to have_content 'Community' expect(page).to have_content 'Community'
end end
end end
step 'I should see project "Internal" home page' do step 'I should see project "Internal" home page' do
within '.navbar-gitlab .title' do page.within '.navbar-gitlab .title' do
expect(page).to have_content 'Internal' expect(page).to have_content 'Internal'
end end
end end
......
...@@ -16,7 +16,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -16,7 +16,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'I select "Mike" as "Reporter"' do step 'I select "Mike" as "Reporter"' do
user = User.find_by(name: "Mike") user = User.find_by(name: "Mike")
within ".users-group-form" do page.within ".users-group-form" do
select2(user.id, from: "#user_ids", multiple: true) select2(user.id, from: "#user_ids", multiple: true)
select "Reporter", from: "access_level" select "Reporter", from: "access_level"
end end
...@@ -25,14 +25,14 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -25,14 +25,14 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end end
step 'I should see "Mike" in team list as "Reporter"' do step 'I should see "Mike" in team list as "Reporter"' do
within '.well-list' do page.within '.well-list' do
expect(page).to have_content('Mike') expect(page).to have_content('Mike')
expect(page).to have_content('Reporter') expect(page).to have_content('Reporter')
end end
end end
step 'I select "sjobs@apple.com" as "Reporter"' do step 'I select "sjobs@apple.com" as "Reporter"' do
within ".users-group-form" do page.within ".users-group-form" do
select2("sjobs@apple.com", from: "#user_ids", multiple: true) select2("sjobs@apple.com", from: "#user_ids", multiple: true)
select "Reporter", from: "access_level" select "Reporter", from: "access_level"
end end
...@@ -41,7 +41,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -41,7 +41,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end end
step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do
within '.well-list' do page.within '.well-list' do
expect(page).to have_content('sjobs@apple.com') expect(page).to have_content('sjobs@apple.com')
expect(page).to have_content('invited') expect(page).to have_content('invited')
expect(page).to have_content('Reporter') expect(page).to have_content('Reporter')
...@@ -73,7 +73,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -73,7 +73,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'I select user "Mary Jane" from list with role "Reporter"' do step 'I select user "Mary Jane" from list with role "Reporter"' do
user = User.find_by(name: "Mary Jane") || create(:user, name: "Mary Jane") user = User.find_by(name: "Mary Jane") || create(:user, name: "Mary Jane")
click_button 'Add members' click_button 'Add members'
within ".users-group-form" do page.within ".users-group-form" do
select2(user.id, from: "#user_ids", multiple: true) select2(user.id, from: "#user_ids", multiple: true)
select "Reporter", from: "access_level" select "Reporter", from: "access_level"
end end
...@@ -122,7 +122,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -122,7 +122,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end end
step 'I should see new group "Owned" name' do step 'I should see new group "Owned" name' do
within ".navbar-gitlab" do page.within ".navbar-gitlab" do
expect(page).to have_content "new-name" expect(page).to have_content "new-name"
end end
end end
...@@ -182,7 +182,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -182,7 +182,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end end
step 'I search for \'Mary\' member' do step 'I search for \'Mary\' member' do
within '.member-search-form' do page.within '.member-search-form' do
fill_in 'search', with: 'Mary' fill_in 'search', with: 'Mary'
click_button 'Search' click_button 'Search'
end end
......
...@@ -61,7 +61,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -61,7 +61,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end end
step 'I try change my password w/o old one' do step 'I try change my password w/o old one' do
within '.update-password' do page.within '.update-password' do
fill_in "user_password", with: "22233344" fill_in "user_password", with: "22233344"
fill_in "user_password_confirmation", with: "22233344" fill_in "user_password_confirmation", with: "22233344"
click_button "Save" click_button "Save"
...@@ -69,7 +69,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -69,7 +69,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end end
step 'I change my password' do step 'I change my password' do
within '.update-password' do page.within '.update-password' do
fill_in "user_current_password", with: "12345678" fill_in "user_current_password", with: "12345678"
fill_in "user_password", with: "22233344" fill_in "user_password", with: "22233344"
fill_in "user_password_confirmation", with: "22233344" fill_in "user_password_confirmation", with: "22233344"
...@@ -78,7 +78,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -78,7 +78,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end end
step 'I unsuccessfully change my password' do step 'I unsuccessfully change my password' do
within '.update-password' do page.within '.update-password' do
fill_in "user_current_password", with: "12345678" fill_in "user_current_password", with: "12345678"
fill_in "user_password", with: "password" fill_in "user_password", with: "password"
fill_in "user_password_confirmation", with: "confirmation" fill_in "user_password_confirmation", with: "confirmation"
...@@ -95,7 +95,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -95,7 +95,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end end
step 'I reset my token' do step 'I reset my token' do
within '.update-token' do page.within '.update-token' do
@old_token = @user.private_token @old_token = @user.private_token
click_button "Reset" click_button "Reset"
end end
...@@ -115,13 +115,13 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -115,13 +115,13 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end end
step "I change my application theme" do step "I change my application theme" do
within '.application-theme' do page.within '.application-theme' do
choose "Violet" choose "Violet"
end end
end end
step "I change my code preview theme" do step "I change my code preview theme" do
within '.code-preview-theme' do page.within '.code-preview-theme' do
choose "Solarized dark" choose "Solarized dark"
end end
end end
...@@ -174,7 +174,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -174,7 +174,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
step 'I should see my user page' do step 'I should see my user page' do
expect(page).to have_content "User Activity" expect(page).to have_content "User Activity"
within '.navbar-gitlab' do page.within '.navbar-gitlab' do
expect(page).to have_content current_user.name expect(page).to have_content current_user.name
end end
end end
...@@ -233,7 +233,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -233,7 +233,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end end
step 'I click to remove application' do step 'I click to remove application' do
within '.oauth-applications' do page.within '.oauth-applications' do
click_on "Destroy" click_on "Destroy"
end end
end end
......
...@@ -20,7 +20,7 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps ...@@ -20,7 +20,7 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps
end end
step 'I click the "Edit" tab' do step 'I click the "Edit" tab' do
within '.project-settings-nav' do page.within '.project-settings-nav' do
click_link('Project') click_link('Project')
end end
end end
......
...@@ -17,7 +17,7 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps ...@@ -17,7 +17,7 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
end end
step 'I should see "Shop" protected branches list' do step 'I should see "Shop" protected branches list' do
within ".protected-branches-list" do page.within ".protected-branches-list" do
expect(page).to have_content "stable" expect(page).to have_content "stable"
expect(page).not_to have_content "master" expect(page).not_to have_content "master"
end end
...@@ -73,7 +73,7 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps ...@@ -73,7 +73,7 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
end end
step "I click branch 'improve/awesome' delete link" do step "I click branch 'improve/awesome' delete link" do
within '.js-branch-improve\/awesome' do page.within '.js-branch-improve\/awesome' do
find('.btn-remove').click find('.btn-remove').click
sleep 0.05 sleep 0.05
end end
......
...@@ -45,7 +45,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps ...@@ -45,7 +45,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end end
step 'I should see additional file lines' do step 'I should see additional file lines' do
within @diff.parent do page.within @diff.parent do
expect(first('.new_line').text).not_to have_content "..." expect(first('.new_line').text).not_to have_content "..."
end end
end end
......
...@@ -53,20 +53,20 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps ...@@ -53,20 +53,20 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps
end end
step "I delete tag 'v1.1.0'" do step "I delete tag 'v1.1.0'" do
within '.tags' do page.within '.tags' do
first('.btn-remove').click first('.btn-remove').click
sleep 0.05 sleep 0.05
end end
end end
step "I should not see tag 'v1.1.0'" do step "I should not see tag 'v1.1.0'" do
within '.tags' do page.within '.tags' do
expect(all(visible: true)).not_to have_content 'v1.1.0' expect(all(visible: true)).not_to have_content 'v1.1.0'
end end
end end
step 'I delete all tags' do step 'I delete all tags' do
within '.tags' do page.within '.tags' do
all('.btn-remove').each do |remove| all('.btn-remove').each do |remove|
remove.click remove.click
sleep 0.05 sleep 0.05
...@@ -75,7 +75,7 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps ...@@ -75,7 +75,7 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps
end end
step 'I should see tags info message' do step 'I should see tags info message' do
within '.tags' do page.within '.tags' do
expect(page).to have_content 'Repository has no tags yet.' expect(page).to have_content 'Repository has no tags yet.'
end end
end end
......
...@@ -8,19 +8,19 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps ...@@ -8,19 +8,19 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end end
step 'I should see project deploy key' do step 'I should see project deploy key' do
within '.enabled-keys' do page.within '.enabled-keys' do
expect(page).to have_content deploy_key.title expect(page).to have_content deploy_key.title
end end
end end
step 'I should see other project deploy key' do step 'I should see other project deploy key' do
within '.available-keys' do page.within '.available-keys' do
expect(page).to have_content other_deploy_key.title expect(page).to have_content other_deploy_key.title
end end
end end
step 'I should see public deploy key' do step 'I should see public deploy key' do
within '.available-keys' do page.within '.available-keys' do
expect(page).to have_content public_deploy_key.title expect(page).to have_content public_deploy_key.title
end end
end end
...@@ -40,7 +40,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps ...@@ -40,7 +40,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end end
step 'I should see newly created deploy key' do step 'I should see newly created deploy key' do
within '.enabled-keys' do page.within '.enabled-keys' do
expect(page).to have_content(deploy_key.title) expect(page).to have_content(deploy_key.title)
end end
end end
...@@ -56,7 +56,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps ...@@ -56,7 +56,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end end
step 'I should only see the same deploy key once' do step 'I should only see the same deploy key once' do
within '.available-keys' do page.within '.available-keys' do
expect(page).to have_selector('ul li', count: 1) expect(page).to have_selector('ul li', count: 1)
end end
end end
...@@ -66,7 +66,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps ...@@ -66,7 +66,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end end
step 'I click attach deploy key' do step 'I click attach deploy key' do
within '.available-keys' do page.within '.available-keys' do
click_link 'Enable' click_link 'Enable'
end end
end end
......
...@@ -27,7 +27,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps ...@@ -27,7 +27,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps
end end
step 'I fork to my namespace' do step 'I fork to my namespace' do
within '.fork-namespaces' do page.within '.fork-namespaces' do
click_link current_user.name click_link current_user.name
end end
end end
......
...@@ -5,25 +5,25 @@ class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps ...@@ -5,25 +5,25 @@ class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps
include Select2Helper include Select2Helper
step 'I should see "Bugfix1" in issues list' do step 'I should see "Bugfix1" in issues list' do
within ".issues-list" do page.within ".issues-list" do
expect(page).to have_content "Bugfix1" expect(page).to have_content "Bugfix1"
end end
end end
step 'I should see "Bugfix2" in issues list' do step 'I should see "Bugfix2" in issues list' do
within ".issues-list" do page.within ".issues-list" do
expect(page).to have_content "Bugfix2" expect(page).to have_content "Bugfix2"
end end
end end
step 'I should not see "Bugfix2" in issues list' do step 'I should not see "Bugfix2" in issues list' do
within ".issues-list" do page.within ".issues-list" do
expect(page).not_to have_content "Bugfix2" expect(page).not_to have_content "Bugfix2"
end end
end end
step 'I should not see "Feature1" in issues list' do step 'I should not see "Feature1" in issues list' do
within ".issues-list" do page.within ".issues-list" do
expect(page).not_to have_content "Feature1" expect(page).not_to have_content "Feature1"
end end
end end
...@@ -33,7 +33,7 @@ class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps ...@@ -33,7 +33,7 @@ class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps
end end
step 'I click link "feature"' do step 'I click link "feature"' do
within ".labels-filter" do page.within ".labels-filter" do
click_link "feature" click_link "feature"
end end
end end
......
...@@ -87,7 +87,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps ...@@ -87,7 +87,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end end
step 'I should see label \'bug\' with issue' do step 'I should see label \'bug\' with issue' do
within '.issue-show-labels' do page.within '.issue-show-labels' do
expect(page).to have_content 'bug' expect(page).to have_content 'bug'
end end
end end
...@@ -201,7 +201,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps ...@@ -201,7 +201,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end end
step 'I leave a comment with code block' do step 'I leave a comment with code block' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```" fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```"
click_button "Add Comment" click_button "Add Comment"
sleep 0.05 sleep 0.05
...@@ -209,7 +209,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps ...@@ -209,7 +209,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end end
step 'I should see an error alert section within the comment form' do step 'I should see an error alert section within the comment form' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
find(".error-alert") find(".error-alert")
end end
end end
...@@ -257,7 +257,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps ...@@ -257,7 +257,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end end
step 'I click label \'bug\'' do step 'I click label \'bug\'' do
within ".issues-list" do page.within ".issues-list" do
click_link 'bug' click_link 'bug'
end end
end end
......
...@@ -8,13 +8,13 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps ...@@ -8,13 +8,13 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
end end
step 'I remove label \'bug\'' do step 'I remove label \'bug\'' do
within "#label_#{bug_label.id}" do page.within "#label_#{bug_label.id}" do
click_link 'Remove' click_link 'Remove'
end end
end end
step 'I delete all labels' do step 'I delete all labels' do
within '.labels' do page.within '.labels' do
all('.btn-remove').each do |remove| all('.btn-remove').each do |remove|
remove.click remove.click
sleep 0.05 sleep 0.05
...@@ -23,7 +23,7 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps ...@@ -23,7 +23,7 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
end end
step 'I should see labels help message' do step 'I should see labels help message' do
within '.labels' do page.within '.labels' do
expect(page).to have_content 'Create first label or generate default set of '\ expect(page).to have_content 'Create first label or generate default set of '\
'labels' 'labels'
end end
...@@ -48,37 +48,37 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps ...@@ -48,37 +48,37 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
end end
step 'I should see label label exist error message' do step 'I should see label label exist error message' do
within '.label-form' do page.within '.label-form' do
expect(page).to have_content 'Title has already been taken' expect(page).to have_content 'Title has already been taken'
end end
end end
step 'I should see label color error message' do step 'I should see label color error message' do
within '.label-form' do page.within '.label-form' do
expect(page).to have_content 'Color is invalid' expect(page).to have_content 'Color is invalid'
end end
end end
step 'I should see label \'feature\'' do step 'I should see label \'feature\'' do
within '.manage-labels-list' do page.within '.manage-labels-list' do
expect(page).to have_content 'feature' expect(page).to have_content 'feature'
end end
end end
step 'I should see label \'bug\'' do step 'I should see label \'bug\'' do
within '.manage-labels-list' do page.within '.manage-labels-list' do
expect(page).to have_content 'bug' expect(page).to have_content 'bug'
end end
end end
step 'I should not see label \'bug\'' do step 'I should not see label \'bug\'' do
within '.manage-labels-list' do page.within '.manage-labels-list' do
expect(page).not_to have_content 'bug' expect(page).not_to have_content 'bug'
end end
end end
step 'I should see label \'support\'' do step 'I should see label \'support\'' do
within '.manage-labels-list' do page.within '.manage-labels-list' do
expect(page).to have_content 'support' expect(page).to have_content 'support'
end end
end end
...@@ -90,7 +90,7 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps ...@@ -90,7 +90,7 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
end end
step 'I should see label \'fix\'' do step 'I should see label \'fix\'' do
within '.manage-labels-list' do page.within '.manage-labels-list' do
expect(page).to have_content 'fix' expect(page).to have_content 'fix'
end end
end end
......
...@@ -24,7 +24,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -24,7 +24,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end end
step 'I should see merge request "Wiki Feature"' do step 'I should see merge request "Wiki Feature"' do
within '.merge-request' do page.within '.merge-request' do
expect(page).to have_content "Wiki Feature" expect(page).to have_content "Wiki Feature"
end end
end end
...@@ -113,7 +113,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -113,7 +113,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end end
step 'I click on the Changes tab via Javascript' do step 'I click on the Changes tab via Javascript' do
within '.merge-request-tabs' do page.within '.merge-request-tabs' do
click_link 'Changes' click_link 'Changes'
end end
...@@ -134,11 +134,11 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -134,11 +134,11 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end end
step 'I click on the commit in the merge request' do step 'I click on the commit in the merge request' do
within '.merge-request-tabs' do page.within '.merge-request-tabs' do
click_link 'Commits' click_link 'Commits'
end end
within '.commits' do page.within '.commits' do
click_link Commit.truncate_sha(sample_commit.id) click_link Commit.truncate_sha(sample_commit.id)
end end
end end
...@@ -199,13 +199,13 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -199,13 +199,13 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
merge!: true, merge!: true,
) )
within '.mr-state-widget' do page.within '.mr-state-widget' do
click_button "Accept Merge Request" click_button "Accept Merge Request"
end end
end end
step 'I should see merged request' do step 'I should see merged request' do
within '.issue-box' do page.within '.issue-box' do
expect(page).to have_content "Accepted" expect(page).to have_content "Accepted"
end end
end end
...@@ -215,43 +215,43 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -215,43 +215,43 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end end
step 'I should see reopened merge request "Bug NS-04"' do step 'I should see reopened merge request "Bug NS-04"' do
within '.issue-box' do page.within '.issue-box' do
expect(page).to have_content "Open" expect(page).to have_content "Open"
end end
end end
step 'I click link "Hide inline discussion" of the second file' do step 'I click link "Hide inline discussion" of the second file' do
within '.files [id^=diff]:nth-child(2)' do page.within '.files [id^=diff]:nth-child(2)' do
find('.js-toggle-diff-comments').click find('.js-toggle-diff-comments').click
end end
end end
step 'I click link "Show inline discussion" of the second file' do step 'I click link "Show inline discussion" of the second file' do
within '.files [id^=diff]:nth-child(2)' do page.within '.files [id^=diff]:nth-child(2)' do
find('.js-toggle-diff-comments').click find('.js-toggle-diff-comments').click
end end
end end
step 'I should not see a comment like "Line is wrong" in the second file' do step 'I should not see a comment like "Line is wrong" in the second file' do
within '.files [id^=diff]:nth-child(2)' do page.within '.files [id^=diff]:nth-child(2)' do
expect(page).not_to have_visible_content "Line is wrong" expect(page).not_to have_visible_content "Line is wrong"
end end
end end
step 'I should see a comment like "Line is wrong" in the second file' do step 'I should see a comment like "Line is wrong" in the second file' do
within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do page.within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do
expect(page).to have_visible_content "Line is wrong" expect(page).to have_visible_content "Line is wrong"
end end
end end
step 'I should not see a comment like "Line is wrong here" in the second file' do step 'I should not see a comment like "Line is wrong here" in the second file' do
within '.files [id^=diff]:nth-child(2)' do page.within '.files [id^=diff]:nth-child(2)' do
expect(page).not_to have_visible_content "Line is wrong here" expect(page).not_to have_visible_content "Line is wrong here"
end end
end end
step 'I should see a comment like "Line is wrong here" in the second file' do step 'I should see a comment like "Line is wrong here" in the second file' do
within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do page.within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do
expect(page).to have_visible_content "Line is wrong here" expect(page).to have_visible_content "Line is wrong here"
end end
end end
...@@ -259,12 +259,12 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -259,12 +259,12 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I leave a comment like "Line is correct" on line 12 of the first file' do step 'I leave a comment like "Line is correct" on line 12 of the first file' do
init_diff_note_first_file init_diff_note_first_file
within(".js-discussion-note-form") do page.within(".js-discussion-note-form") do
fill_in "note_note", with: "Line is correct" fill_in "note_note", with: "Line is correct"
click_button "Add Comment" click_button "Add Comment"
end end
within ".files [id^=diff]:nth-child(1) .note-body > .note-text" do page.within ".files [id^=diff]:nth-child(1) .note-body > .note-text" do
expect(page).to have_content "Line is correct" expect(page).to have_content "Line is correct"
end end
end end
...@@ -272,14 +272,14 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -272,14 +272,14 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I leave a comment like "Line is wrong" on line 39 of the second file' do step 'I leave a comment like "Line is wrong" on line 39 of the second file' do
init_diff_note_second_file init_diff_note_second_file
within(".js-discussion-note-form") do page.within(".js-discussion-note-form") do
fill_in "note_note", with: "Line is wrong on here" fill_in "note_note", with: "Line is wrong on here"
click_button "Add Comment" click_button "Add Comment"
end end
end end
step 'I should still see a comment like "Line is correct" in the first file' do step 'I should still see a comment like "Line is correct" in the first file' do
within '.files [id^=diff]:nth-child(1) .note-body > .note-text' do page.within '.files [id^=diff]:nth-child(1) .note-body > .note-text' do
expect(page).to have_visible_content "Line is correct" expect(page).to have_visible_content "Line is correct"
end end
end end
...@@ -297,7 +297,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -297,7 +297,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end end
step 'I should see comments on the side-by-side diff page' do step 'I should see comments on the side-by-side diff page' do
within '.files [id^=diff]:nth-child(1) .parallel .note-body > .note-text' do page.within '.files [id^=diff]:nth-child(1) .parallel .note-body > .note-text' do
expect(page).to have_visible_content "Line is correct" expect(page).to have_visible_content "Line is correct"
end end
end end
...@@ -329,7 +329,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -329,7 +329,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end end
def leave_comment(message) def leave_comment(message)
within(".js-discussion-note-form") do page.within(".js-discussion-note-form") do
fill_in "note_note", with: message fill_in "note_note", with: message
click_button "Add Comment" click_button "Add Comment"
end end
......
...@@ -24,7 +24,7 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -24,7 +24,7 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end end
step 'page should have "master" on graph' do step 'page should have "master" on graph' do
within '.network-graph' do page.within '.network-graph' do
expect(page).to have_content 'master' expect(page).to have_content 'master'
end end
end end
...@@ -45,13 +45,13 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -45,13 +45,13 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end end
step 'page should have content not containing "v1.0.0"' do step 'page should have content not containing "v1.0.0"' do
within '.network-graph' do page.within '.network-graph' do
expect(page).to have_content 'Change some files' expect(page).to have_content 'Change some files'
end end
end end
step 'page should not have content not containing "v1.0.0"' do step 'page should not have content not containing "v1.0.0"' do
within '.network-graph' do page.within '.network-graph' do
expect(page).not_to have_content 'Change some files' expect(page).not_to have_content 'Change some files'
end end
end end
...@@ -65,13 +65,13 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -65,13 +65,13 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end end
step 'page should have "feature" on graph' do step 'page should have "feature" on graph' do
within '.network-graph' do page.within '.network-graph' do
expect(page).to have_content 'feature' expect(page).to have_content 'feature'
end end
end end
When 'I looking for a commit by SHA of "v1.0.0"' do When 'I looking for a commit by SHA of "v1.0.0"' do
within ".network-form" do page.within ".network-form" do
fill_in 'extended_sha1', with: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9' fill_in 'extended_sha1', with: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9'
find('button').click find('button').click
end end
...@@ -79,13 +79,13 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -79,13 +79,13 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end end
step 'page should have "v1.0.0" on graph' do step 'page should have "v1.0.0" on graph' do
within '.network-graph' do page.within '.network-graph' do
expect(page).to have_content 'v1.0.0' expect(page).to have_content 'v1.0.0'
end end
end end
When 'I look for a commit by ";"' do When 'I look for a commit by ";"' do
within ".network-form" do page.within ".network-form" do
fill_in 'extended_sha1', with: ';' fill_in 'extended_sha1', with: ';'
find('button').click find('button').click
end end
......
...@@ -67,7 +67,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps ...@@ -67,7 +67,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end end
step 'I should see project "Shop" version' do step 'I should see project "Shop" version' do
within '.project-side' do page.within '.project-side' do
expect(page).to have_content '6.7.0.pre' expect(page).to have_content '6.7.0.pre'
end end
end end
......
...@@ -18,7 +18,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps ...@@ -18,7 +18,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
step 'I should see project "Community" home page' do step 'I should see project "Community" home page' do
Gitlab.config.gitlab.should_receive(:host).and_return("www.example.com") Gitlab.config.gitlab.should_receive(:host).and_return("www.example.com")
within '.navbar-gitlab .title' do page.within '.navbar-gitlab .title' do
expect(page).to have_content 'Community' expect(page).to have_content 'Community'
end end
end end
......
...@@ -42,7 +42,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps ...@@ -42,7 +42,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
end end
step 'I click link "Edit"' do step 'I click link "Edit"' do
within ".file-title" do page.within ".file-title" do
click_link "Edit" click_link "Edit"
end end
end end
...@@ -54,7 +54,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps ...@@ -54,7 +54,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
step 'I submit new snippet "Snippet three"' do step 'I submit new snippet "Snippet three"' do
fill_in "project_snippet_title", :with => "Snippet three" fill_in "project_snippet_title", :with => "Snippet three"
fill_in "project_snippet_file_name", :with => "my_snippet.rb" fill_in "project_snippet_file_name", :with => "my_snippet.rb"
within('.file-editor') do page.within('.file-editor') do
find(:xpath, "//input[@id='project_snippet_content']").set 'Content of snippet three' find(:xpath, "//input[@id='project_snippet_content']").set 'Content of snippet three'
end end
click_button "Create snippet" click_button "Create snippet"
...@@ -75,7 +75,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps ...@@ -75,7 +75,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
end end
step 'I leave a comment like "Good snippet!"' do step 'I leave a comment like "Good snippet!"' do
within('.js-main-target-form') do page.within('.js-main-target-form') do
fill_in "note_note", with: "Good snippet!" fill_in "note_note", with: "Good snippet!"
click_button "Add Comment" click_button "Add Comment"
end end
......
...@@ -124,7 +124,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps ...@@ -124,7 +124,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end end
step 'I click on readme file' do step 'I click on readme file' do
within '.tree-table' do page.within '.tree-table' do
click_link 'README.md' click_link 'README.md'
end end
end end
......
...@@ -67,27 +67,27 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps ...@@ -67,27 +67,27 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps
end end
step 'I click on link "empty" in the README' do step 'I click on link "empty" in the README' do
within('.readme-holder') do page.within('.readme-holder') do
click_link "empty" click_link "empty"
end end
end end
step 'I click on link "id" in the README' do step 'I click on link "id" in the README' do
within('.readme-holder') do page.within('.readme-holder') do
click_link "#id" click_link "#id"
end end
end end
step 'I navigate to the doc/api/README' do step 'I navigate to the doc/api/README' do
within '.tree-table' do page.within '.tree-table' do
click_link "doc" click_link "doc"
end end
within '.tree-table' do page.within '.tree-table' do
click_link "api" click_link "api"
end end
within '.tree-table' do page.within '.tree-table' do
click_link "README.md" click_link "README.md"
end end
end end
......
...@@ -22,7 +22,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps ...@@ -22,7 +22,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
step 'I select "Mike" as "Reporter"' do step 'I select "Mike" as "Reporter"' do
user = User.find_by(name: "Mike") user = User.find_by(name: "Mike")
within ".users-project-form" do page.within ".users-project-form" do
select2(user.id, from: "#user_ids", multiple: true) select2(user.id, from: "#user_ids", multiple: true)
select "Reporter", from: "access_level" select "Reporter", from: "access_level"
end end
...@@ -30,13 +30,13 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps ...@@ -30,13 +30,13 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
end end
step 'I should see "Mike" in team list as "Reporter"' do step 'I should see "Mike" in team list as "Reporter"' do
within ".access-reporter" do page.within ".access-reporter" do
expect(page).to have_content('Mike') expect(page).to have_content('Mike')
end end
end end
step 'I select "sjobs@apple.com" as "Reporter"' do step 'I select "sjobs@apple.com" as "Reporter"' do
within ".users-project-form" do page.within ".users-project-form" do
select2("sjobs@apple.com", from: "#user_ids", multiple: true) select2("sjobs@apple.com", from: "#user_ids", multiple: true)
select "Reporter", from: "access_level" select "Reporter", from: "access_level"
end end
...@@ -44,7 +44,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps ...@@ -44,7 +44,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
end end
step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do
within ".access-reporter" do page.within ".access-reporter" do
expect(page).to have_content('sjobs@apple.com') expect(page).to have_content('sjobs@apple.com')
expect(page).to have_content('invited') expect(page).to have_content('invited')
expect(page).to have_content('Reporter') expect(page).to have_content('Reporter')
...@@ -52,7 +52,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps ...@@ -52,7 +52,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
end end
step 'I should see "Dmitriy" in team list as "Developer"' do step 'I should see "Dmitriy" in team list as "Developer"' do
within ".access-developer" do page.within ".access-developer" do
expect(page).to have_content('Dmitriy') expect(page).to have_content('Dmitriy')
end end
end end
...@@ -61,7 +61,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps ...@@ -61,7 +61,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
project = Project.find_by(name: "Shop") project = Project.find_by(name: "Shop")
user = User.find_by(name: 'Dmitriy') user = User.find_by(name: 'Dmitriy')
project_member = project.project_members.find_by(user_id: user.id) project_member = project.project_members.find_by(user_id: user.id)
within "#project_member_#{project_member.id}" do page.within "#project_member_#{project_member.id}" do
click_button "Edit access level" click_button "Edit access level"
select "Reporter", from: "project_member_access_level" select "Reporter", from: "project_member_access_level"
click_button "Save" click_button "Save"
...@@ -69,7 +69,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps ...@@ -69,7 +69,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
end end
step 'I should see "Dmitriy" in team list as "Reporter"' do step 'I should see "Dmitriy" in team list as "Reporter"' do
within ".access-reporter" do page.within ".access-reporter" do
expect(page).to have_content('Dmitriy') expect(page).to have_content('Dmitriy')
end end
end end
...@@ -123,7 +123,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps ...@@ -123,7 +123,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
project = Project.find_by(name: "Shop") project = Project.find_by(name: "Shop")
user = User.find_by(name: 'Dmitriy') user = User.find_by(name: 'Dmitriy')
project_member = project.project_members.find_by(user_id: user.id) project_member = project.project_members.find_by(user_id: user.id)
within "#project_member_#{project_member.id}" do page.within "#project_member_#{project_member.id}" do
click_link('Remove user from team') click_link('Remove user from team')
end end
end end
......
...@@ -6,7 +6,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps ...@@ -6,7 +6,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
include WikiHelper include WikiHelper
step 'I click on the Cancel button' do step 'I click on the Cancel button' do
within(:css, ".form-actions") do page.within(:css, ".form-actions") do
click_on "Cancel" click_on "Cancel"
end end
end end
......
...@@ -24,25 +24,25 @@ class Spinach::Features::Search < Spinach::FeatureSteps ...@@ -24,25 +24,25 @@ class Spinach::Features::Search < Spinach::FeatureSteps
end end
step 'I click "Issues" link' do step 'I click "Issues" link' do
within '.search-filter' do page.within '.search-filter' do
click_link 'Issues' click_link 'Issues'
end end
end end
step 'I click project "Shop" link' do step 'I click project "Shop" link' do
within '.project-filter' do page.within '.project-filter' do
click_link project.name_with_namespace click_link project.name_with_namespace
end end
end end
step 'I click "Merge requests" link' do step 'I click "Merge requests" link' do
within '.search-filter' do page.within '.search-filter' do
click_link 'Merge requests' click_link 'Merge requests'
end end
end end
step 'I click "Wiki" link' do step 'I click "Wiki" link' do
within '.search-filter' do page.within '.search-filter' do
click_link 'Wiki' click_link 'Wiki'
end end
end end
......
...@@ -3,7 +3,7 @@ module SharedDiffNote ...@@ -3,7 +3,7 @@ module SharedDiffNote
include RepoHelpers include RepoHelpers
step 'I cancel the diff comment' do step 'I cancel the diff comment' do
within(diff_file_selector) do page.within(diff_file_selector) do
find(".js-close-discussion-note-form").click find(".js-close-discussion-note-form").click
end end
end end
...@@ -14,14 +14,14 @@ module SharedDiffNote ...@@ -14,14 +14,14 @@ module SharedDiffNote
end end
step 'I haven\'t written any diff comment text' do step 'I haven\'t written any diff comment text' do
within(diff_file_selector) do page.within(diff_file_selector) do
fill_in "note[note]", with: "" fill_in "note[note]", with: ""
end end
end end
step 'I leave a diff comment like "Typo, please fix"' do step 'I leave a diff comment like "Typo, please fix"' do
click_diff_line(sample_commit.line_code) click_diff_line(sample_commit.line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do page.within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Typo, please fix" fill_in "note[note]", with: "Typo, please fix"
find(".js-comment-button").trigger("click") find(".js-comment-button").trigger("click")
sleep 0.05 sleep 0.05
...@@ -30,7 +30,7 @@ module SharedDiffNote ...@@ -30,7 +30,7 @@ module SharedDiffNote
step 'I preview a diff comment text like "Should fix it :smile:"' do step 'I preview a diff comment text like "Should fix it :smile:"' do
click_diff_line(sample_commit.line_code) click_diff_line(sample_commit.line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do page.within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Should fix it :smile:" fill_in "note[note]", with: "Should fix it :smile:"
find('.js-md-preview-button').click find('.js-md-preview-button').click
end end
...@@ -39,7 +39,7 @@ module SharedDiffNote ...@@ -39,7 +39,7 @@ module SharedDiffNote
step 'I preview another diff comment text like "DRY this up"' do step 'I preview another diff comment text like "DRY this up"' do
click_diff_line(sample_commit.del_line_code) click_diff_line(sample_commit.del_line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do page.within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do
fill_in "note[note]", with: "DRY this up" fill_in "note[note]", with: "DRY this up"
find('.js-md-preview-button').click find('.js-md-preview-button').click
end end
...@@ -54,62 +54,62 @@ module SharedDiffNote ...@@ -54,62 +54,62 @@ module SharedDiffNote
end end
step 'I write a diff comment like ":-1: I don\'t like this"' do step 'I write a diff comment like ":-1: I don\'t like this"' do
within(diff_file_selector) do page.within(diff_file_selector) do
fill_in "note[note]", with: ":-1: I don\'t like this" fill_in "note[note]", with: ":-1: I don\'t like this"
end end
end end
step 'I submit the diff comment' do step 'I submit the diff comment' do
within(diff_file_selector) do page.within(diff_file_selector) do
click_button("Add Comment") click_button("Add Comment")
end end
end end
step 'I should not see the diff comment form' do step 'I should not see the diff comment form' do
within(diff_file_selector) do page.within(diff_file_selector) do
expect(page).not_to have_css("form.new_note") expect(page).not_to have_css("form.new_note")
end end
end end
step 'The diff comment preview tab should say there is nothing to do' do step 'The diff comment preview tab should say there is nothing to do' do
within(diff_file_selector) do page.within(diff_file_selector) do
find('.js-md-preview-button').click find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_content('Nothing to preview.') expect(find('.js-md-preview')).to have_content('Nothing to preview.')
end end
end end
step 'I should not see the diff comment text field' do step 'I should not see the diff comment text field' do
within(diff_file_selector) do page.within(diff_file_selector) do
expect(find('.js-note-text')).not_to be_visible expect(find('.js-note-text')).not_to be_visible
end end
end end
step 'I should only see one diff form' do step 'I should only see one diff form' do
within(diff_file_selector) do page.within(diff_file_selector) do
expect(page).to have_css("form.new_note", count: 1) expect(page).to have_css("form.new_note", count: 1)
end end
end end
step 'I should see a diff comment form with ":-1: I don\'t like this"' do step 'I should see a diff comment form with ":-1: I don\'t like this"' do
within(diff_file_selector) do page.within(diff_file_selector) do
expect(page).to have_field("note[note]", with: ":-1: I don\'t like this") expect(page).to have_field("note[note]", with: ":-1: I don\'t like this")
end end
end end
step 'I should see a diff comment saying "Typo, please fix"' do step 'I should see a diff comment saying "Typo, please fix"' do
within("#{diff_file_selector} .note") do page.within("#{diff_file_selector} .note") do
expect(page).to have_content("Typo, please fix") expect(page).to have_content("Typo, please fix")
end end
end end
step 'I should see a discussion reply button' do step 'I should see a discussion reply button' do
within(diff_file_selector) do page.within(diff_file_selector) do
expect(page).to have_button('Reply') expect(page).to have_button('Reply')
end end
end end
step 'I should see a temporary diff comment form' do step 'I should see a temporary diff comment form' do
within(diff_file_selector) do page.within(diff_file_selector) do
expect(page).to have_css(".js-temp-notes-holder form.new_note") expect(page).to have_css(".js-temp-notes-holder form.new_note")
end end
end end
...@@ -119,38 +119,38 @@ module SharedDiffNote ...@@ -119,38 +119,38 @@ module SharedDiffNote
end end
step 'I should see an empty diff comment form' do step 'I should see an empty diff comment form' do
within(diff_file_selector) do page.within(diff_file_selector) do
expect(page).to have_field("note[note]", with: "") expect(page).to have_field("note[note]", with: "")
end end
end end
step 'I should see the cancel comment button' do step 'I should see the cancel comment button' do
within("#{diff_file_selector} form") do page.within("#{diff_file_selector} form") do
expect(page).to have_css(".js-close-discussion-note-form", text: "Cancel") expect(page).to have_css(".js-close-discussion-note-form", text: "Cancel")
end end
end end
step 'I should see the diff comment preview' do step 'I should see the diff comment preview' do
within("#{diff_file_selector} form") do page.within("#{diff_file_selector} form") do
expect(page).to have_css('.js-md-preview', visible: true) expect(page).to have_css('.js-md-preview', visible: true)
end end
end end
step 'I should see the diff comment write tab' do step 'I should see the diff comment write tab' do
within(diff_file_selector) do page.within(diff_file_selector) do
expect(page).to have_css('.js-md-write-button', visible: true) expect(page).to have_css('.js-md-write-button', visible: true)
end end
end end
step 'The diff comment preview tab should display rendered Markdown' do step 'The diff comment preview tab should display rendered Markdown' do
within(diff_file_selector) do page.within(diff_file_selector) do
find('.js-md-preview-button').click find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
end end
end end
step 'I should see two separate previews' do step 'I should see two separate previews' do
within(diff_file_selector) do page.within(diff_file_selector) do
expect(page).to have_css('.js-md-preview', visible: true, count: 2) 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('Should fix it')
expect(page).to have_content('DRY this up') expect(page).to have_content('DRY this up')
......
...@@ -19,7 +19,7 @@ module SharedMarkdown ...@@ -19,7 +19,7 @@ module SharedMarkdown
end end
step 'The Markdown preview tab should say there is nothing to do' do step 'The Markdown preview tab should say there is nothing to do' do
within('.gfm-form') do page.within('.gfm-form') do
find('.js-md-preview-button').click find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_content('Nothing to preview.') expect(find('.js-md-preview')).to have_content('Nothing to preview.')
end end
...@@ -38,7 +38,7 @@ module SharedMarkdown ...@@ -38,7 +38,7 @@ module SharedMarkdown
end end
step 'The Markdown preview tab should display rendered Markdown' do step 'The Markdown preview tab should display rendered Markdown' do
within('.gfm-form') do page.within('.gfm-form') do
find('.js-md-preview-button').click find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
end end
...@@ -49,7 +49,7 @@ module SharedMarkdown ...@@ -49,7 +49,7 @@ module SharedMarkdown
end end
step 'I preview a description text like "Bug fixed :smile:"' do step 'I preview a description text like "Bug fixed :smile:"' do
within('.gfm-form') do page.within('.gfm-form') do
fill_in 'Description', with: 'Bug fixed :smile:' fill_in 'Description', with: 'Bug fixed :smile:'
find('.js-md-preview-button').click find('.js-md-preview-button').click
end end
......
...@@ -7,13 +7,13 @@ module SharedNote ...@@ -7,13 +7,13 @@ module SharedNote
end end
step 'I haven\'t written any comment text' do step 'I haven\'t written any comment text' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
fill_in "note[note]", with: "" fill_in "note[note]", with: ""
end end
end end
step 'I leave a comment like "XML attached"' do step 'I leave a comment like "XML attached"' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
fill_in "note[note]", with: "XML attached" fill_in "note[note]", with: "XML attached"
click_button "Add Comment" click_button "Add Comment"
sleep 0.05 sleep 0.05
...@@ -21,20 +21,20 @@ module SharedNote ...@@ -21,20 +21,20 @@ module SharedNote
end end
step 'I preview a comment text like "Bug fixed :smile:"' do step 'I preview a comment text like "Bug fixed :smile:"' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
fill_in "note[note]", with: "Bug fixed :smile:" fill_in "note[note]", with: "Bug fixed :smile:"
find('.js-md-preview-button').click find('.js-md-preview-button').click
end end
end end
step 'I submit the comment' do step 'I submit the comment' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
click_button "Add Comment" click_button "Add Comment"
end end
end end
step 'I write a comment like ":+1: Nice"' do step 'I write a comment like ":+1: Nice"' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
fill_in 'note[note]', with: ':+1: Nice' fill_in 'note[note]', with: ':+1: Nice'
end end
end end
...@@ -44,63 +44,63 @@ module SharedNote ...@@ -44,63 +44,63 @@ module SharedNote
end end
step 'I should not see the cancel comment button' do step 'I should not see the cancel comment button' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
should_not have_link("Cancel") should_not have_link("Cancel")
end end
end end
step 'I should not see the comment preview' do step 'I should not see the comment preview' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
expect(find('.js-md-preview')).not_to be_visible expect(find('.js-md-preview')).not_to be_visible
end end
end end
step 'The comment preview tab should say there is nothing to do' do step 'The comment preview tab should say there is nothing to do' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
find('.js-md-preview-button').click find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_content('Nothing to preview.') expect(find('.js-md-preview')).to have_content('Nothing to preview.')
end end
end end
step 'I should not see the comment text field' do step 'I should not see the comment text field' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
expect(find('.js-note-text')).not_to be_visible expect(find('.js-note-text')).not_to be_visible
end end
end end
step 'I should see a comment saying "XML attached"' do step 'I should see a comment saying "XML attached"' do
within(".note") do page.within(".note") do
expect(page).to have_content("XML attached") expect(page).to have_content("XML attached")
end end
end end
step 'I should see an empty comment text field' do step 'I should see an empty comment text field' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
expect(page).to have_field("note[note]", with: "") expect(page).to have_field("note[note]", with: "")
end end
end end
step 'I should see the comment write tab' do step 'I should see the comment write tab' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
expect(page).to have_css('.js-md-write-button', visible: true) expect(page).to have_css('.js-md-write-button', visible: true)
end end
end end
step 'The comment preview tab should be display rendered Markdown' do step 'The comment preview tab should be display rendered Markdown' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
find('.js-md-preview-button').click find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
end end
end end
step 'I should see the comment preview' do step 'I should see the comment preview' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
expect(page).to have_css('.js-md-preview', visible: true) expect(page).to have_css('.js-md-preview', visible: true)
end end
end end
step 'I should see comment "XML attached"' do step 'I should see comment "XML attached"' do
within(".note") do page.within(".note") do
expect(page).to have_content("XML attached") expect(page).to have_content("XML attached")
end end
end end
...@@ -108,7 +108,7 @@ module SharedNote ...@@ -108,7 +108,7 @@ module SharedNote
# Markdown # Markdown
step 'I leave a comment with a header containing "Comment with a header"' do step 'I leave a comment with a header containing "Comment with a header"' do
within(".js-main-target-form") do page.within(".js-main-target-form") do
fill_in "note[note]", with: "# Comment with a header" fill_in "note[note]", with: "# Comment with a header"
click_button "Add Comment" click_button "Add Comment"
sleep 0.05 sleep 0.05
...@@ -116,7 +116,7 @@ module SharedNote ...@@ -116,7 +116,7 @@ module SharedNote
end end
step 'The comment with the header should not have an ID' do step 'The comment with the header should not have an ID' do
within(".note-body > .note-text") do page.within(".note-body > .note-text") do
expect(page).to have_content("Comment with a header") expect(page).to have_content("Comment with a header")
expect(page).not_to have_css("#comment-with-a-header") expect(page).not_to have_css("#comment-with-a-header")
end end
...@@ -126,7 +126,7 @@ module SharedNote ...@@ -126,7 +126,7 @@ module SharedNote
find(".note").hover find(".note").hover
find('.js-note-edit').click find('.js-note-edit').click
within(".current-note-edit-form") do page.within(".current-note-edit-form") do
fill_in 'note[note]', with: '+1 Awesome!' fill_in 'note[note]', with: '+1 Awesome!'
click_button 'Save Comment' click_button 'Save Comment'
sleep 0.05 sleep 0.05
...@@ -134,7 +134,7 @@ module SharedNote ...@@ -134,7 +134,7 @@ module SharedNote
end end
step 'I should see +1 in the description' do step 'I should see +1 in the description' do
within(".note") do page.within(".note") do
expect(page).to have_content("+1 Awesome!") expect(page).to have_content("+1 Awesome!")
end end
end end
......
...@@ -45,7 +45,7 @@ module SharedProjectTab ...@@ -45,7 +45,7 @@ module SharedProjectTab
end end
step 'the active main tab should be Settings' do step 'the active main tab should be Settings' do
within '.nav-sidebar' do page.within '.nav-sidebar' do
expect(page).to have_content('Back to project') expect(page).to have_content('Back to project')
end end
end end
......
...@@ -13,7 +13,7 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps ...@@ -13,7 +13,7 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
end end
step 'I click link "Edit"' do step 'I click link "Edit"' do
within ".file-title" do page.within ".file-title" do
click_link "Edit" click_link "Edit"
end end
end end
...@@ -25,7 +25,7 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps ...@@ -25,7 +25,7 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
step 'I submit new snippet "Personal snippet three"' do step 'I submit new snippet "Personal snippet three"' do
fill_in "personal_snippet_title", :with => "Personal snippet three" fill_in "personal_snippet_title", :with => "Personal snippet three"
fill_in "personal_snippet_file_name", :with => "my_snippet.rb" fill_in "personal_snippet_file_name", :with => "my_snippet.rb"
within('.file-editor') do page.within('.file-editor') do
find(:xpath, "//input[@id='personal_snippet_content']").set 'Content of snippet three' find(:xpath, "//input[@id='personal_snippet_content']").set 'Content of snippet three'
end end
click_button "Create snippet" click_button "Create snippet"
......
...@@ -32,19 +32,19 @@ class Spinach::Features::SnippetsUser < Spinach::FeatureSteps ...@@ -32,19 +32,19 @@ class Spinach::Features::SnippetsUser < Spinach::FeatureSteps
end end
step 'I click "Internal" filter' do step 'I click "Internal" filter' do
within('.nav-tabs') do page.within('.nav-tabs') do
click_link "Internal" click_link "Internal"
end end
end end
step 'I click "Private" filter' do step 'I click "Private" filter' do
within('.nav-tabs') do page.within('.nav-tabs') do
click_link "Private" click_link "Private"
end end
end end
step 'I click "Public" filter' do step 'I click "Public" filter' do
within('.nav-tabs') do page.within('.nav-tabs') do
click_link "Public" click_link "Public"
end end
end end
......
...@@ -28,7 +28,7 @@ class Spinach::Features::User < Spinach::FeatureSteps ...@@ -28,7 +28,7 @@ class Spinach::Features::User < Spinach::FeatureSteps
end end
step 'I should see contributed projects' do step 'I should see contributed projects' do
within '.contributed-projects' do page.within '.contributed-projects' do
expect(page).to have_content(@contributed_project.name) expect(page).to have_content(@contributed_project.name)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment