Stabilize mobile close account cukes
This commit is contained in:
parent
b3c535bab4
commit
d6d1e38ba1
4 changed files with 59 additions and 50 deletions
|
|
@ -8,7 +8,8 @@ Feature: Close account
|
|||
Given I am signed in
|
||||
When I go to the users edit page
|
||||
And I click on selector "#close_account"
|
||||
Then I should see "Hey, please don’t go!" within "#closeAccountModal"
|
||||
Then I should see a modal
|
||||
And I should see "Hey, please don’t go!" within "#closeAccountModal"
|
||||
When I put in my password in "close_account_password"
|
||||
And I press "close_account_confirm"
|
||||
And I confirm the alert
|
||||
|
|
|
|||
|
|
@ -8,12 +8,13 @@ Feature: Close account
|
|||
Given I am signed in
|
||||
When I go to the users edit page
|
||||
And I click on selector "#close_account"
|
||||
Then I should see "Hey, please don’t go!" within "#closeAccountModal"
|
||||
When I put in my password in "close_account_password"
|
||||
Then I should see a modal
|
||||
And I should see "Hey, please don’t go!" within "#closeAccountModal"
|
||||
When I put in my password in the close account modal
|
||||
And I press "close_account_confirm"
|
||||
And I confirm the alert
|
||||
Then I should be on the mobile new user session page
|
||||
|
||||
When I am on the new user session page
|
||||
And I try to sign in manually
|
||||
When I try to sign in manually
|
||||
Then I should be on the new user session page
|
||||
And I should see a flash message with a warning
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
Then /I should see the mention modal/ do
|
||||
Then /^I should see a modal$/ do
|
||||
step %{I should see a ".modal.in"}
|
||||
end
|
||||
|
||||
Then /^I should see the mention modal$/ do
|
||||
step %{I should see a "#mentionModal.in"}
|
||||
end
|
||||
|
||||
When /^I put in my password in the close account modal$/ do
|
||||
# Capybara helpers fill_in, set and send_keys currently don't work
|
||||
# inside of Bootstrap modals on Travis CI
|
||||
execute_script("$(\"#closeAccountModal input#close_account_password\").val(\"#{@me.password}\")")
|
||||
expect(find("#closeAccountModal input#close_account_password").value).to eq(@me.password)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,47 +1,43 @@
|
|||
module NavigationHelpers
|
||||
def path_to(page_name)
|
||||
case page_name
|
||||
when /^person_photos page$/
|
||||
person_photos_path(@me.person)
|
||||
when /^the home(?: )?page$/
|
||||
stream_path
|
||||
when /^step (\d)$/
|
||||
if $1.to_i == 1
|
||||
getting_started_path
|
||||
else
|
||||
getting_started_path(:step => $1)
|
||||
end
|
||||
when /^the tag page for "([^\"]*)"$/
|
||||
tag_path($1)
|
||||
when /^its ([\w ]+) page$/
|
||||
send("#{$1.gsub(/\W+/, '_')}_path", @it)
|
||||
when /^the ([\w ]+) page$/
|
||||
send("#{$1.gsub(/\W+/, '_')}_path")
|
||||
when /^my edit profile page$/
|
||||
edit_profile_path
|
||||
when /^my profile page$/
|
||||
person_path(@me.person)
|
||||
when /^my acceptance form page$/
|
||||
invite_code_path(InvitationCode.first)
|
||||
when /^the requestors profile$/
|
||||
person_path(Request.where(:recipient_id => @me.person.id).first.sender)
|
||||
when /^"([^\"]*)"'s page$/
|
||||
p = User.find_by_email($1).person
|
||||
{ path: person_path(p),
|
||||
# '#diaspora_handle' on desktop, '.description' on mobile
|
||||
special_elem: { selector: '#diaspora_handle, .description', text: p.diaspora_handle }
|
||||
}
|
||||
when /^"([^\"]*)"'s photos page$/
|
||||
p = User.find_by_email($1).person
|
||||
person_photos_path p
|
||||
when /^my account settings page$/
|
||||
edit_user_path
|
||||
when /^forgot password page$/
|
||||
new_user_password_path
|
||||
when /^"(\/.*)"/
|
||||
$1
|
||||
else
|
||||
raise "Can't find mapping from \"#{page_name}\" to a path."
|
||||
when /^person_photos page$/
|
||||
person_photos_path(@me.person)
|
||||
when /^the home(?: )?page$/
|
||||
stream_path
|
||||
when /^the tag page for "([^\"]*)"$/
|
||||
tag_path(Regexp.last_match(1))
|
||||
when /^its ([\w ]+) page$/
|
||||
send("#{Regexp.last_match(1).gsub(/\W+/, '_')}_path", @it)
|
||||
when /^the mobile ([\w ]+) page$/
|
||||
public_send("#{Regexp.last_match(1).gsub(/\W+/, '_')}_path", format: "mobile")
|
||||
when /^the ([\w ]+) page$/
|
||||
public_send("#{Regexp.last_match(1).gsub(/\W+/, '_')}_path")
|
||||
when /^my edit profile page$/
|
||||
edit_profile_path
|
||||
when /^my profile page$/
|
||||
person_path(@me.person)
|
||||
when /^my acceptance form page$/
|
||||
invite_code_path(InvitationCode.first)
|
||||
when /^the requestors profile$/
|
||||
person_path(Request.where(recipient_id: @me.person.id).first.sender)
|
||||
when /^"([^\"]*)"'s page$/
|
||||
p = User.find_by_email(Regexp.last_match(1)).person
|
||||
{path: person_path(p),
|
||||
# '#diaspora_handle' on desktop, '.description' on mobile
|
||||
special_elem: {selector: "#diaspora_handle, .description", text: p.diaspora_handle}
|
||||
}
|
||||
when /^"([^\"]*)"'s photos page$/
|
||||
p = User.find_by_email(Regexp.last_match(1)).person
|
||||
person_photos_path p
|
||||
when /^my account settings page$/
|
||||
edit_user_path
|
||||
when /^forgot password page$/
|
||||
new_user_password_path
|
||||
when %r{^"(/.*)"}
|
||||
Regexp.last_match(1)
|
||||
else
|
||||
raise "Can't find mapping from \"#{page_name}\" to a path."
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -56,12 +52,12 @@ module NavigationHelpers
|
|||
|
||||
def navigate_to(page_name)
|
||||
path = path_to(page_name)
|
||||
unless path.is_a?(Hash)
|
||||
visit(path)
|
||||
else
|
||||
if path.is_a?(Hash)
|
||||
visit(path[:path])
|
||||
await_elem = path[:special_elem]
|
||||
find(await_elem.delete(:selector), await_elem)
|
||||
else
|
||||
visit(path)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue