By default Geb will close the window opened using withNewWindow()
. You can suppress this default behaviour using close
option:
withNewWindow(close: false, { HealthPageLink.click() }) {
...
}
The window won't be closed but you will be outside of its context in then:
block. You can use `withWindow()' for getting back into its context.
withWindow({ title.toString() == 'Patient Financing Portal }) {
...
}
You might actually consider not using withNewWindow()
in the first place in your when:
block but simply clicking the health page link and using withWindow()
in the then:
block where you would perform all the necessary assertions.
EDIT: This isn't documented anywhere but after leaving the context of withNewWindow()
(and withWindow()
as well) the page is switched back to the original one. You can use page
option to switch it back to LoginPage
:
withWindow({ title.toString() == 'Patient Financing Portal }, page: LoginPage) {
...
}