Skip to content

withWindow() bug: Geb does not save/image the designated popped-up window #401

Closed

Description

@transentia

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.

Activity

  1. transentia commented on Aug 28, 2015

    @transentia
    Author

    BTW: the "report '...'" work-around is only effective if the statement is placed inside the withWindow 'body' closure

  2. erdi commented on Aug 31, 2015

    @erdi
    Member

    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.

  3. added this to the 2.2 milestone on Jun 13, 2018
  4. self-assigned this
    on Jun 13, 2018
  5. added a commit that references this issue on May 7, 2025
    ec25b52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions