Just a quick gotcha I found tonight.
I was trying to get Selenium running in a project using Ortus Solution’s fork of CFSelenium. Here’s the test for the login page:
I thought it would be neat and clean to write the setup for the tests after the
when sections. Only one problem.
This was confusing to me. Dumping the variables scope in the
beforeAll method showed Selenium, but not in my
Turns out this is due to how TestBox packages specs and when it runs its lifecycle methods like
beforeAll. The new spec keywords —
when — are just aliases to
describe blocks are executed before the test lifecycle in order to find all the actual specs — the
then blocks. That’s why Selenium was not available there.
Moving all the login to the
then block fixed this up nice and quick:
An opportunity might exist here for a Pull Request to instead run the
beforeAll before any
describe blocks, but I’m not sure if it matters all that much. For now, I’m content to just be aware of the fact and start testing with Selenium.