Commit afec5efc authored by Robert Speicher's avatar Robert Speicher Committed by Dmitriy Zaporozhets

Fix features syntax

parent d6cd2e6a
...@@ -39,6 +39,7 @@ Feature: Project Commits Comments ...@@ -39,6 +39,7 @@ Feature: Project Commits Comments
@javascript @javascript
Scenario: I can delete a comment Scenario: I can delete a comment
Given I leave a comment like "XML attached" Given I leave a comment like "XML attached"
Then I should see a comment saying "XML attached"
And I delete a comment And I delete a comment
Then I should not see a comment saying "XML attached" Then I should not see a comment saying "XML attached"
......
...@@ -69,7 +69,7 @@ Feature: Project Wiki ...@@ -69,7 +69,7 @@ Feature: Project Wiki
And I click on the "Pages" button And I click on the "Pages" button
Then I should see non-escaped link in the pages list Then I should see non-escaped link in the pages list
@javascript @focus @javascript
Scenario: Creating an invalid new page Scenario: Creating an invalid new page
Given I create a New page with an invalid name Given I create a New page with an invalid name
Then I should see an error message Then I should see an error message
......
...@@ -36,6 +36,6 @@ class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps ...@@ -36,6 +36,6 @@ class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps
step 'I should see a customized broadcast message' do step 'I should see a customized broadcast message' do
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST' expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
expect(page).to have_selector %(div[style="background-color:#f2dede;color:#b94a48"]) expect(page).to have_selector %(div[style="background-color: #f2dede; color: #b94a48"])
end end
end end
...@@ -11,9 +11,9 @@ class Spinach::Features::AdminSettings < Spinach::FeatureSteps ...@@ -11,9 +11,9 @@ class Spinach::Features::AdminSettings < Spinach::FeatureSteps
end end
step 'I should see application settings saved' do step 'I should see application settings saved' do
expect(current_application_settings.gravatar_enabled).to be_false expect(current_application_settings.gravatar_enabled).to be_falsey
expect(current_application_settings.home_page_url).to eq 'https://about.gitlab.com/' expect(current_application_settings.home_page_url).to eq "https://about.gitlab.com/"
expect(page).to have_content 'Application settings saved successfully' expect(page).to have_content "Application settings saved successfully"
end end
step 'I click on "Service Templates"' do step 'I click on "Service Templates"' do
......
...@@ -10,7 +10,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps ...@@ -10,7 +10,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
end end
step 'I see "New project" page' do step 'I see "New project" page' do
expect(page).to have_content("Project path") expect(page).to have_content('Project path')
end end
step 'I click on "Import project from GitHub"' do step 'I click on "Import project from GitHub"' do
......
...@@ -154,7 +154,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -154,7 +154,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end end
step 'I should not see group "Owned" avatar' do step 'I should not see group "Owned" avatar' do
expect(Group.find_by(name: "Owned").avatar?).to be_false expect(Group.find_by(name: "Owned").avatar?).to eq false
end end
step 'I should not see the "Remove avatar" button' do step 'I should not see the "Remove avatar" button' do
......
...@@ -53,7 +53,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -53,7 +53,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end end
step 'I should see my gravatar' do step 'I should see my gravatar' do
expect(@user.avatar?).to be_false expect(@user.avatar?).to eq false
end end
step 'I should not see the "Remove avatar" button' do step 'I should not see the "Remove avatar" button' do
...@@ -87,12 +87,16 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -87,12 +87,16 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end end
step "I should see a missing password error message" do step "I should see a missing password error message" do
page.within ".flash-container" do
expect(page).to have_content "You must provide a valid current password" expect(page).to have_content "You must provide a valid current password"
end end
end
step "I should see a password error message" do step "I should see a password error message" do
page.within '.alert' do
expect(page).to have_content "Password confirmation doesn't match" expect(page).to have_content "Password confirmation doesn't match"
end end
end
step 'I reset my token' do step 'I reset my token' do
page.within '.update-token' do page.within '.update-token' do
...@@ -120,7 +124,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -120,7 +124,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
step "I am not an ldap user" do step "I am not an ldap user" do
current_user.identities.delete current_user.identities.delete
expect(current_user.ldap_user?).to be_false expect(current_user.ldap_user?).to eq false
end end
step 'I redirected to expired password page' do step 'I redirected to expired password page' do
......
...@@ -31,8 +31,8 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -31,8 +31,8 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I should see closed merge request "Bug NS-04"' do step 'I should see closed merge request "Bug NS-04"' do
merge_request = MergeRequest.find_by!(title: "Bug NS-04") merge_request = MergeRequest.find_by!(title: "Bug NS-04")
expect(merge_request.closed?).to be_true expect(merge_request).to be_closed
expect(page).to have_content "Rejected by" expect(page).to have_content 'Rejected by'
end end
step 'I should see merge request "Bug NS-04"' do step 'I should see merge request "Bug NS-04"' do
...@@ -125,7 +125,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -125,7 +125,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
expect(buttons.count).to eq(2) expect(buttons.count).to eq(2)
buttons.each do |b| buttons.each do |b|
expect(expect(b['href'])).not_to have_content('json') expect(b['href']).not_to have_content('json')
end end
end end
...@@ -164,20 +164,26 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -164,20 +164,26 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end end
step 'I should see a discussion has started on diff' do step 'I should see a discussion has started on diff' do
expect(page).to have_content "#{current_user.name} started a discussion" page.within(".notes .discussion") do
expect(page).to have_content sample_commit.line_code_path page.should have_content "#{current_user.name} started a discussion"
expect(page).to have_content "Line is wrong" page.should have_content sample_commit.line_code_path
page.should have_content "Line is wrong"
end
end end
step 'I should see a discussion has started on commit diff' do step 'I should see a discussion has started on commit diff' do
expect(page).to have_content "#{current_user.name} started a discussion on commit" page.within(".notes .discussion") do
expect(page).to have_content sample_commit.line_code_path page.should have_content "#{current_user.name} started a discussion on commit"
expect(page).to have_content "Line is wrong" page.should have_content sample_commit.line_code_path
page.should have_content "Line is wrong"
end
end end
step 'I should see a discussion has started on commit' do step 'I should see a discussion has started on commit' do
expect(page).to have_content "#{current_user.name} started a discussion on commit" page.within(".notes .discussion") do
expect(page).to have_content "One comment to rule them all" page.should have_content "#{current_user.name} started a discussion on commit"
page.should have_content "One comment to rule them all"
end
end end
step 'merge request is mergeable' do step 'merge request is mergeable' do
...@@ -329,13 +335,14 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -329,13 +335,14 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end end
def leave_comment(message) def leave_comment(message)
page.within(".js-discussion-note-form") do page.within(".js-discussion-note-form", visible: true) do
fill_in "note_note", with: message fill_in "note_note", with: message
click_button "Add Comment" click_button "Add Comment"
end end
page.within(".notes_holder", visible: true) do
expect(page).to have_content message expect(page).to have_content message
end end
end
def init_diff_note_first_file def init_diff_note_first_file
click_diff_line(sample_compare.changes[0][:line_code]) click_diff_line(sample_compare.changes[0][:line_code])
......
...@@ -59,7 +59,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps ...@@ -59,7 +59,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end end
step 'I should see the default project avatar' do step 'I should see the default project avatar' do
expect(@project.avatar?).to be_false expect(@project.avatar?).to eq false
end end
step 'I should not see the "Remove avatar" button' do step 'I should not see the "Remove avatar" button' do
......
...@@ -52,7 +52,9 @@ class Spinach::Features::Search < Spinach::FeatureSteps ...@@ -52,7 +52,9 @@ class Spinach::Features::Search < Spinach::FeatureSteps
end end
step 'I should see code results for project "Shop"' do step 'I should see code results for project "Shop"' do
expect(page).to have_content 'Update capybara, rspec-rails, poltergeist to recent versions' page.within('.results') do
page.should have_content 'Update capybara, rspec-rails, poltergeist to recent versions'
end
end end
step 'I search for "Contibuting"' do step 'I search for "Contibuting"' do
...@@ -71,7 +73,9 @@ class Spinach::Features::Search < Spinach::FeatureSteps ...@@ -71,7 +73,9 @@ class Spinach::Features::Search < Spinach::FeatureSteps
end end
step 'I should see "Foo" link in the search results' do step 'I should see "Foo" link in the search results' do
expect(find(:css, '.search-results')).to have_link 'Foo' page.within('.results') do
find(:css, '.search-results').should have_link 'Foo'
end
end end
step 'I should not see "Bar" link in the search results' do step 'I should not see "Bar" link in the search results' do
...@@ -79,7 +83,9 @@ class Spinach::Features::Search < Spinach::FeatureSteps ...@@ -79,7 +83,9 @@ class Spinach::Features::Search < Spinach::FeatureSteps
end end
step 'I should see "test_wiki" link in the search results' do step 'I should see "test_wiki" link in the search results' do
expect(find(:css, '.search-results')).to have_link 'test_wiki.md' page.within('.results') do
find(:css, '.search-results').should have_link 'test_wiki.md'
end
end end
step 'project has Wiki content' do step 'project has Wiki content' do
......
...@@ -20,13 +20,16 @@ module SharedDiffNote ...@@ -20,13 +20,16 @@ module SharedDiffNote
end end
step 'I leave a diff comment like "Typo, please fix"' do step 'I leave a diff comment like "Typo, please fix"' do
page.within(diff_file_selector) do
click_diff_line(sample_commit.line_code) click_diff_line(sample_commit.line_code)
page.within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
page.within("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
end end
end end
end
step 'I leave a diff comment in a parallel view on the left side like "Old comment"' do step 'I leave a diff comment in a parallel view on the left side like "Old comment"' do
click_parallel_diff_line(sample_commit.line_code, 'old') click_parallel_diff_line(sample_commit.line_code, 'old')
...@@ -45,29 +48,38 @@ module SharedDiffNote ...@@ -45,29 +48,38 @@ module SharedDiffNote
end end
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
page.within(diff_file_selector) do
click_diff_line(sample_commit.line_code) click_diff_line(sample_commit.line_code)
page.within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
page.within("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
end end
end
step 'I preview another diff comment text like "DRY this up"' do step 'I preview another diff comment text like "DRY this up"' do
page.within(diff_file_selector) do
click_diff_line(sample_commit.del_line_code) click_diff_line(sample_commit.del_line_code)
page.within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do page.within("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
end end
end
step 'I open a diff comment form' do step 'I open a diff comment form' do
page.within(diff_file_selector) do
click_diff_line(sample_commit.line_code) click_diff_line(sample_commit.line_code)
end end
end
step 'I open another diff comment form' do step 'I open another diff comment form' do
page.within(diff_file_selector) do
click_diff_line(sample_commit.del_line_code) click_diff_line(sample_commit.del_line_code)
end 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
page.within(diff_file_selector) do page.within(diff_file_selector) do
...@@ -194,7 +206,7 @@ module SharedDiffNote ...@@ -194,7 +206,7 @@ module SharedDiffNote
end end
def diff_file_selector def diff_file_selector
".diff-file:nth-of-type(1)" '.diff-file:nth-of-type(1)'
end end
def click_diff_line(code) def click_diff_line(code)
......
...@@ -2,9 +2,11 @@ module SharedNote ...@@ -2,9 +2,11 @@ module SharedNote
include Spinach::DSL include Spinach::DSL
step 'I delete a comment' do step 'I delete a comment' do
page.within('.notes') do
find('.note').hover find('.note').hover
find(".js-note-delete").click find(".js-note-delete").click
end end
end
step 'I haven\'t written any comment text' do step 'I haven\'t written any comment text' do
page.within(".js-main-target-form") do page.within(".js-main-target-form") do
...@@ -16,7 +18,6 @@ module SharedNote ...@@ -16,7 +18,6 @@ module SharedNote
page.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
end end
end end
...@@ -123,13 +124,14 @@ module SharedNote ...@@ -123,13 +124,14 @@ module SharedNote
end end
step 'I edit the last comment with a +1' do step 'I edit the last comment with a +1' do
page.within(".notes") do
find(".note").hover find(".note").hover
find('.js-note-edit').click find('.js-note-edit').click
end
page.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
end end
end end
......
...@@ -75,7 +75,7 @@ describe 'Profile > Preferences' do ...@@ -75,7 +75,7 @@ describe 'Profile > Preferences' do
end end
def expect_preferences_saved_message def expect_preferences_saved_message
within('.flash-container') do page.within('.flash-container') do
expect(page).to have_content('Preferences saved.') expect(page).to have_content('Preferences saved.')
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