Skip to content

Commit

Permalink
おきなくなった
Browse files Browse the repository at this point in the history
  • Loading branch information
hoshinotsuyoshi committed Oct 20, 2024
1 parent 42f88aa commit 7792aa3
Showing 1 changed file with 34 additions and 16 deletions.
50 changes: 34 additions & 16 deletions backend/spec/system/scenarios/login_flow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,60 @@
fill_in "email", with: user.email_address
fill_in "password", with: user.password
click_button "Login"
puts __LINE__

puts page.text
Timeout.timeout(10) do
until page.send(:has_content?, user.email_address)
sleep 0.01
end
rescue Selenium::WebDriver::Error::UnknownError
puts '------'
puts :baaad1
puts __LINE__
puts '------'
#rescue Selenium::WebDriver::Error::UnknownError => e
# puts '-----'
# puts e.message
# puts '-----'
end
puts page.text
puts __LINE__

expect(page).to have_content(user.email_address)
puts __LINE__
expect(page).to have_content("hello, It's me!")
accept_alert do
click_button "Logout"
end

puts __LINE__

Timeout.timeout(10) do
until page.send(:has_content?, "Login")
sleep 0.01
end
rescue Selenium::WebDriver::Error::UnknownError
puts '------'
puts :baaad2
puts __LINE__
puts '------'
#rescue Selenium::WebDriver::Error::UnknownError => e
# puts '-----'
# puts e.message
# puts '-----'
end

# retry_once(Selenium::WebDriver::Error::UnknownError) { expect(page).to have_content("Login") }

expect(page).to have_content("Login")
expect(current_path).to eq("/login")
end

# 以下のような
# Selenium::WebDriver::Error::UnknownError:
# unknown error: unhandled inspector error:
# {"code":-32000,"message":"Node with given id does not belong to the document"}

def retry_once_s
yield
retry_once(exception_class)
end


private def retry_once(exception_class)
count = 0
yield
rescue exception_class
if count.zero?
count += 1
retry
else
raise
end
end
end

0 comments on commit 7792aa3

Please sign in to comment.