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

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

parent bddb3b5fff8d
......@@ -44,7 +44,7 @@ class Spinach::Features::AdminApplications < Spinach::FeatureSteps
end
step 'I click to remove application' do
within '.oauth-applications' do
page.within '.oauth-applications' do
click_on "Destroy"
end
end
......
......@@ -38,14 +38,14 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
When 'I select user "John Doe" from user list as "Reporter"' do
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"
end
click_button "Add users to group"
end
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 "Reporter"
end
......@@ -62,13 +62,13 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
end
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'
end
end
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"
end
end
......
......@@ -23,7 +23,7 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
end
step 'See username error message' do
within "#error_explanation" do
page.within "#error_explanation" do
expect(page).to have_content "Username"
end
end
......
......@@ -4,7 +4,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
include SharedProject
step 'I click "New project" link' do
within('.content') do
page.within('.content') do
click_link "New project"
end
end
......
......@@ -8,7 +8,7 @@ class Spinach::Features::DashboardStarredProjects < Spinach::FeatureSteps
end
step 'I should not see project "Shop"' do
within 'aside' do
page.within 'aside' do
expect(page).not_to have_content('Shop')
end
end
......
......@@ -35,13 +35,13 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
end
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'
end
end
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'
end
end
......
......@@ -16,7 +16,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'I select "Mike" as "Reporter"' do
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)
select "Reporter", from: "access_level"
end
......@@ -25,14 +25,14 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
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('Reporter')
end
end
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)
select "Reporter", from: "access_level"
end
......@@ -41,7 +41,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
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('invited')
expect(page).to have_content('Reporter')
......@@ -73,7 +73,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'I select user "Mary Jane" from list with role "Reporter"' do
user = User.find_by(name: "Mary Jane") || create(:user, name: "Mary Jane")
click_button 'Add members'
within ".users-group-form" do
page.within ".users-group-form" do
select2(user.id, from: "#user_ids", multiple: true)
select "Reporter", from: "access_level"
end
......@@ -122,7 +122,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
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"
end
end
......@@ -182,7 +182,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
step 'I search for \'Mary\' member' do
within '.member-search-form' do
page.within '.member-search-form' do
fill_in 'search', with: 'Mary'
click_button 'Search'
end
......
......@@ -61,7 +61,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
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_confirmation", with: "22233344"
click_button "Save"
......@@ -69,7 +69,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
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_password", with: "22233344"
fill_in "user_password_confirmation", with: "22233344"
......@@ -78,7 +78,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
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_password", with: "password"
fill_in "user_password_confirmation", with: "confirmation"
......@@ -95,7 +95,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step 'I reset my token' do
within '.update-token' do
page.within '.update-token' do
@old_token = @user.private_token
click_button "Reset"
end
......@@ -115,13 +115,13 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step "I change my application theme" do
within '.application-theme' do
page.within '.application-theme' do
choose "Violet"
end
end
step "I change my code preview theme" do
within '.code-preview-theme' do
page.within '.code-preview-theme' do
choose "Solarized dark"
end
end
......@@ -174,7 +174,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
step 'I should see my user page' do
expect(page).to have_content "User Activity"
within '.navbar-gitlab' do
page.within '.navbar-gitlab' do
expect(page).to have_content current_user.name
end
end
......@@ -233,7 +233,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step 'I click to remove application' do
within '.oauth-applications' do
page.within '.oauth-applications' do
click_on "Destroy"
end
end
......
......@@ -20,7 +20,7 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps
end
step 'I click the "Edit" tab' do
within '.project-settings-nav' do
page.within '.project-settings-nav' do
click_link('Project')
end
end
......
......@@ -17,7 +17,7 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
end
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).not_to have_content "master"
end
......@@ -73,7 +73,7 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
end
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
sleep 0.05
end
......
......@@ -45,7 +45,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end
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 "..."
end
end
......
......@@ -53,20 +53,20 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps
end
step "I delete tag 'v1.1.0'" do
within '.tags' do
page.within '.tags' do
first('.btn-remove').click
sleep 0.05
end
end
step "I should not see tag 'v1.1.0'" do
within '.tags' do
page.within '.tags' do
expect(all(visible: true)).not_to have_content 'v1.1.0'
end
end
step 'I delete all tags' do
within '.tags' do
page.within '.tags' do
all('.btn-remove').each do |remove|
remove.click
sleep 0.05
......@@ -75,7 +75,7 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps
end
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.'
end
end
......
......@@ -8,19 +8,19 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
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
end
end
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
end
end
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
end
end
......@@ -40,7 +40,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
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)
end
end
......@@ -56,7 +56,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
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)
end
end
......@@ -66,7 +66,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
step 'I click attach deploy key' do
within '.available-keys' do
page.within '.available-keys' do
click_link 'Enable'
end
end
......
......@@ -27,7 +27,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps
end
step 'I fork to my namespace' do
within '.fork-namespaces' do
page.within '.fork-namespaces' do
click_link current_user.name
end
end
......
......@@ -5,25 +5,25 @@ class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps
include Select2Helper
step 'I should see "Bugfix1" in issues list' do
within ".issues-list" do
page.within ".issues-list" do
expect(page).to have_content "Bugfix1"
end
end
step 'I should see "Bugfix2" in issues list' do
within ".issues-list" do
page.within ".issues-list" do
expect(page).to have_content "Bugfix2"
end
end
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"
end
end
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"
end
end
......@@ -33,7 +33,7 @@ class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps
end
step 'I click link "feature"' do
within ".labels-filter" do
page.within ".labels-filter" do
click_link "feature"
end
end
......
......@@ -87,7 +87,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
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'
end
end
......@@ -201,7 +201,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
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```"
click_button "Add Comment"
sleep 0.05
......@@ -209,7 +209,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
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")
end
end
......@@ -257,7 +257,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step 'I click label \'bug\'' do
within ".issues-list" do
page.within ".issues-list" do
click_link 'bug'
end
end
......
......@@ -8,13 +8,13 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
end
step 'I remove label \'bug\'' do
within "#label_#{bug_label.id}" do
page.within "#label_#{bug_label.id}" do
click_link 'Remove'
end
end
step 'I delete all labels' do
within '.labels' do
page.within '.labels' do
all('.btn-remove').each do |remove|
remove.click
sleep 0.05
......@@ -23,7 +23,7 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
end
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 '\
'labels'
end
......@@ -48,37 +48,37 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
end
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'
end
end
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'
end
end
step 'I should see label \'feature\'' do
within '.manage-labels-list' do
page.within '.manage-labels-list' do
expect(page).to have_content 'feature'
end
end
step 'I should see label \'bug\'' do
within '.manage-labels-list' do
page.within '.manage-labels-list' do
expect(page).to have_content 'bug'
end
end
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'
end
end
step 'I should see label \'support\'' do
within '.manage-labels-list' do
page.within '.manage-labels-list' do
expect(page).to have_content 'support'
end
end
......@@ -90,7 +90,7 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
end
step 'I should see label \'fix\'' do
within '.manage-labels-list' do
page.within '.manage-labels-list' do
expect(page).to have_content 'fix'
end
end
......
......@@ -24,7 +24,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
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"
end
end
......@@ -113,7 +113,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I click on the Changes tab via Javascript' do
within '.merge-request-tabs' do
page.within '.merge-request-tabs' do
click_link 'Changes'
end
......@@ -134,11 +134,11 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
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'
end
within '.commits' do
page.within '.commits' do
click_link Commit.truncate_sha(sample_commit.id)
end
end
......@@ -199,13 +199,13 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
merge!: true,
)
within '.mr-state-widget' do
page.within '.mr-state-widget' do
click_button "Accept Merge Request"
end
end
step 'I should see merged request' do
within '.issue-box' do
page.within '.issue-box' do
expect(page).to have_content "Accepted"
end
end
......@@ -215,43 +215,43 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
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"
end
end
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
end
end
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
end
end
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"
end
end
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"
end
end
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"
end
end
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"
end
end
......@@ -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
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"
click_button "Add Comment"
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"
end
end
......@@ -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
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"
click_button "Add Comment"
end
end
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