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
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
page.within '.files [id^=diff]:nth-child(1) .note-body > .note-text' do
expect(page).to have_visible_content "Line is correct"
end
end
......@@ -297,7 +297,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
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"
end
end
......@@ -329,7 +329,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
def leave_comment(message)
within(".js-discussion-note-form") do
page.within(".js-discussion-note-form") do
fill_in "note_note", with: message
click_button "Add Comment"
end
......
......@@ -24,7 +24,7 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end
step 'page should have "master" on graph' do
within '.network-graph' do
page.within '.network-graph' do
expect(page).to have_content 'master'
end
end
......@@ -45,13 +45,13 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end
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'
end
end
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'
end
end
......@@ -65,13 +65,13 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end
step 'page should have "feature" on graph' do
within '.network-graph' do
page.within '.network-graph' do
expect(page).to have_content 'feature'
end
end
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'
find('button').click
end
......@@ -79,13 +79,13 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end
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'
end
end
When 'I look for a commit by ";"' do
within ".network-form" do
page.within ".network-form" do
fill_in 'extended_sha1', with: ';'
find('button').click
end
......
......@@ -67,7 +67,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end
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'
end
end
......
......@@ -18,7 +18,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
step 'I should see project "Community" home page' do
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'
end
end
......
......@@ -42,7 +42,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
end
step 'I click link "Edit"' do
within ".file-title" do
page.within ".file-title" do
click_link "Edit"
end
end
......@@ -54,7 +54,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
step 'I submit new snippet "Snippet three"' do
fill_in "project_snippet_title", :with => "Snippet three"
fill_in "project_snippet_file_name", :with => "my_snippet.rb"
within('.file-editor') do
page.within('.file-editor') do
find(:xpath, "//input[@id='project_snippet_content']").set 'Content of snippet three'
end
click_button "Create snippet"
......@@ -75,7 +75,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
end
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!"
click_button "Add Comment"
end
......
......@@ -124,7 +124,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
step 'I click on readme file' do
within '.tree-table' do
page.within '.tree-table' do
click_link 'README.md'
end
end
......
......@@ -67,27 +67,27 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps
end
step 'I click on link "empty" in the README' do
within('.readme-holder') do
page.within('.readme-holder') do
click_link "empty"
end
end
step 'I click on link "id" in the README' do
within('.readme-holder') do
page.within('.readme-holder') do
click_link "#id"
end
end
step 'I navigate to the doc/api/README' do
within '.tree-table' do
page.within '.tree-table' do
click_link "doc"
end
within '.tree-table' do
page.within '.tree-table' do
click_link "api"
end
within '.tree-table' do
page.within '.tree-table' do
click_link "README.md"
end
end
......
......@@ -22,7 +22,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
step 'I select "Mike" as "Reporter"' do
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)
select "Reporter", from: "access_level"
end
......@@ -30,13 +30,13 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
end
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')
end
end
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)
select "Reporter", from: "access_level"
end
......@@ -44,7 +44,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
end
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('invited')
expect(page).to have_content('Reporter')
......@@ -52,7 +52,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
end
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')
end
end
......@@ -61,7 +61,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
project = Project.find_by(name: "Shop")
user = User.find_by(name: 'Dmitriy')
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"
select "Reporter", from: "project_member_access_level"
click_button "Save"
......@@ -69,7 +69,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
end
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')
end
end
......@@ -123,7 +123,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
project = Project.find_by(name: "Shop")
user = User.find_by(name: 'Dmitriy')
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')
end
end
......
......@@ -6,7 +6,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
include WikiHelper
step 'I click on the Cancel button' do
within(:css, ".form-actions") do
page.within(:css, ".form-actions") do
click_on "Cancel"
end
end
......
......@@ -24,25 +24,25 @@ class Spinach::Features::Search < Spinach::FeatureSteps
end
step 'I click "Issues" link' do
within '.search-filter' do
page.within '.search-filter' do
click_link 'Issues'
end
end
step 'I click project "Shop" link' do
within '.project-filter' do
page.within '.project-filter' do
click_link project.name_with_namespace
end
end
step 'I click "Merge requests" link' do
within '.search-filter' do
page.within '.search-filter' do
click_link 'Merge requests'
end
end
step 'I click "Wiki" link' do
within '.search-filter' do
page.within '.search-filter' do
click_link 'Wiki'
end
end
......
......@@ -3,7 +3,7 @@ module SharedDiffNote
include RepoHelpers
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
end
end
......@@ -14,14 +14,14 @@ module SharedDiffNote
end
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: ""
end
end
step 'I leave a diff comment like "Typo, please fix"' do
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"
find(".js-comment-button").trigger("click")
sleep 0.05
......@@ -30,7 +30,7 @@ module SharedDiffNote
step 'I preview a diff comment text like "Should fix it :smile:"' do
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:"
find('.js-md-preview-button').click
end
......@@ -39,7 +39,7 @@ module SharedDiffNote
step 'I preview another diff comment text like "DRY this up"' do
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"
find('.js-md-preview-button').click
end
......@@ -54,62 +54,62 @@ module SharedDiffNote
end
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"
end
end
step 'I submit the diff comment' do
within(diff_file_selector) do
page.within(diff_file_selector) do
click_button("Add Comment")
end
end
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")
end
end
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
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.within(diff_file_selector) do
expect(find('.js-note-text')).not_to be_visible
end
end
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)
end
end
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")
end
end
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")
end
end
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')
end
end
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")
end
end
......@@ -119,38 +119,38 @@ module SharedDiffNote
end
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: "")
end
end
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")
end
end
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)
end
end
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)
end
end
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
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.within(diff_file_selector) do
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')
......
......@@ -19,7 +19,7 @@ module SharedMarkdown
end
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
expect(find('.js-md-preview')).to have_content('Nothing to preview.')
end
......@@ -38,7 +38,7 @@ module SharedMarkdown
end
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
expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
end
......@@ -49,7 +49,7 @@ module SharedMarkdown
end
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:'
find('.js-md-preview-button').click
end
......
......@@ -7,13 +7,13 @@ module SharedNote
end
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: ""
end
end
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"
click_button "Add Comment"
sleep 0.05
......@@ -21,20 +21,20 @@ module SharedNote
end
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:"
find('.js-md-preview-button').click
end
end
step 'I submit the comment' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
click_button "Add Comment"
end
end
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'
end
end
......@@ -44,63 +44,63 @@ module SharedNote
end
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")
end
end
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
end
end
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
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.within(".js-main-target-form") do
expect(find('.js-note-text')).not_to be_visible
end
end
step 'I should see a comment saying "XML attached"' do
within(".note") do
page.within(".note") do
expect(page).to have_content("XML attached")
end
end
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: "")
end
end
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)
end
end
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
expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
end
end
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)
end
end
step 'I should see comment "XML attached"' do
within(".note") do
page.within(".note") do
expect(page).to have_content("XML attached")
end
end
......@@ -108,7 +108,7 @@ module SharedNote
# Markdown
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"
click_button "Add Comment"
sleep 0.05
......@@ -116,7 +116,7 @@ module SharedNote
end
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).not_to have_css("#comment-with-a-header")
end
......@@ -126,7 +126,7 @@ module SharedNote
find(".note").hover
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!'
click_button 'Save Comment'
sleep 0.05
......@@ -134,7 +134,7 @@ module SharedNote
end
step 'I should see +1 in the description' do
within(".note") do
page.within(".note") do
expect(page).to have_content("+1 Awesome!")
end
end
......
......@@ -45,7 +45,7 @@ module SharedProjectTab
end
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')
end
end
......
......@@ -13,7 +13,7 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
end
step 'I click link "Edit"' do
within ".file-title" do
page.within ".file-title" do
click_link "Edit"
end
end
......@@ -25,7 +25,7 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
step 'I submit new snippet "Personal snippet three"' do
fill_in "personal_snippet_title", :with => "Personal snippet three"
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'
end
click_button "Create snippet"
......
......@@ -32,19 +32,19 @@ class Spinach::Features::SnippetsUser < Spinach::FeatureSteps
end
step 'I click "Internal" filter' do
within('.nav-tabs') do
page.within('.nav-tabs') do
click_link "Internal"
end
end
step 'I click "Private" filter' do
within('.nav-tabs') do
page.within('.nav-tabs') do
click_link "Private"
end
end
step 'I click "Public" filter' do
within('.nav-tabs') do
page.within('.nav-tabs') do
click_link "Public"
end
end
......
......@@ -28,7 +28,7 @@ class Spinach::Features::User < Spinach::FeatureSteps
end
step 'I should see contributed projects' do
within '.contributed-projects' do
page.within '.contributed-projects' do
expect(page).to have_content(@contributed_project.name)
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