sclevine / agouti

A WebDriver client and acceptance testing library for Go
MIT License
821 stars 105 forks source link

using Eventually for wait. but error #141

Open se9958 opened 6 years ago

se9958 commented 6 years ago

Eventually(page.Find("#rank_list"), "10s").Should(BeVisible())

get this message

You are trying to make an assertion, but Gomega's fail handler is nil. If you're using Ginkgo then you probably forgot to put your assertion in an It(). Alternatively, you may have forgotten to register a fail handler with RegisterFailHandler() or RegisterTestingT().

have no idea i need to wait for ajax render element finish Is this possible?

sclevine commented 6 years ago

Hi @se9958,

If you're using Agouti with Gomega, you need to provide Gomega with a way to fail tests. If you're using the standard library testing package without a test runner like Ginkgo, see: https://onsi.github.io/gomega/#using-gomega-with-golangs-xunit-style-tests

If you aren't using Agouti to run tests (or if you'd just like to avoid using Gomega), you can manually poll page.Find("#rank_list").Visible().

Alternatively, if you're just trying to wait for the page to load and the element to appear, it might be easier to rely on you're webdriver to accomplish this. The three timeout methods here can be set to non-zero values to make any Selection method block until the element is available. I've found that this is less reliable for writing acceptance tests that pass consistently with a variety of webdrivers, but it may be more appropriate for your use case.