Hello.
While I am testing with Hound library(using phantomjs). I have some error.
it is really simple integration test. something like.
test code is like this
hound_session()
test "correct header title? " do
navigate_to("/")
h2_text = find_element(:tag, "h2") |> visible_text()
assert h2_text == "Welcome to Phoenix!"
end
and Error says like this.
test correct header title? (MtextingWeb.Acceptance.HomePageTest)
test/mtexting_web/acceptance/home_page_test.exs:7
** (RuntimeError) Webdriver call status code 404 for post request http://localhost:8910/session/94798eb0-902a-11e7-a87c-b3a11c5c7b73/element.
Check if webdriver server is running. Make sure it supports the feature being requested.
I have hound library installed.
I put
config :hound, driver: “phantomjs” in test.exs
Application.ensure_all_started(:hound) in test_helper.exs at the top.
Have you added server: true to you Endpoint config in in config/test.exs? I believe this is necessary to run hound.
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :mango, MangoWeb.Endpoint,
http: [port: 4001],
server: true
config :hound, driver: "phantomjs"
So, since it seems to work in a basic variant, we need to test something else…
Lets stepwise increase complexity:
First only find element:
test "correct header title? " do
navigate_to("/")
find_element(:tag, "h2")
assert true
end
Second, try to get the visible stuff out of it:
test "correct header title? " do
navigate_to("/")
find_element(:tag, "h2") |> visible_text()
assert true
end
Third, your original test.
Please report which one is the first to break… (Actually I omitted even one step, but you already confirmed a simple navigate with asserting truth as working)
Interesting, I’ve had my own issues in Hound where using find_element() causes an error but the regex matching with =~ works. It was a different error though so possibly not related.