You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
withWindow() bug: Geb does not save/image the designated popped-up window #401
In my application, I have a 'main' page that pops up a window in which runs a Spring WebFlow flow.
I have a Geb/Spock test spec for this flow looking something like (slightly sanitized):
...
def 'flow: A'() {
expect:
// all this is in the scripting window that opens automatically
assert null == withWindow({ title.startsWith('A') }) {
withConfirm(true) { $('form').button().click() }
waitFor { title.startsWith('B') }
$('form').with { f ->
f.streetName = 'fake'
f.streetType = 'St'
f._eventId_accept().click()
}
}
}
def "flow: C"() {
expect:
assert null == withWindow({ title.startsWith('C') }) {
$('form').with { f ->
f._eventId_next().click()
}
}
}
...
And so on (for test methods "flow: D", etc., etc.).
This all works very nicely; the flow is progressed properly and any errors (ie incorrect titles) detected correctly.
As is normal for Geb, at the end of each test, Geb stores a page into the reports dir together with a generated PNG of the page.
Here's the bug: Geb repeatedly saves/images of only the 'main' page. Geb does not save/image the popped-up window that was the actual 'focus' of withWindow().
This is regardless of whether or not the test method ended successfully or because of an error.
I am guessing that withWindow() fails to 'update' the reporting system (somehow...)?
I can work around this by manually placing "report '...'" instructions into each test but this is not particularly nice.
Using reportGroup does not affect this either...I end up with a separate directory full of identical screenshots of the main page.
I am seeing this with Java 1.8_60, Geb 0.12.2, driver is phantomJs 2.0, on Mac OSX.
Thanks for reporting this. Geb's reporting feature was conceived before multi window support was added and hence it only takes screenshots of a single window. It should probably be changed to take as many screenshots as there are windows instead.
Activity
transentia commentedon Aug 28, 2015
BTW: the "report '...'" work-around is only effective if the statement is placed inside the withWindow 'body' closure
erdi commentedon Aug 31, 2015
Thanks for reporting this. Geb's reporting feature was conceived before multi window support was added and hence it only takes screenshots of a single window. It should probably be changed to take as many screenshots as there are windows instead.
Add MultiWindowReporter to enable taking reports for all windows if m…