Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
transentia opened this issue Aug 28, 2015 · 2 comments
Closed
Assignees
Milestone

Comments

@transentia
Copy link

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.

@transentia
Copy link
Author

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

@erdi
Copy link
Member

erdi commented 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.

@erdi erdi added this to the 2.2 milestone Jun 13, 2018
@erdi erdi self-assigned this Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants