[geb-user] [ANN] Geb 7.0 has been released

2023-01-02 Thread Marcin Erdmann
Hi,

Version 7.0 of Geb has been released and is available from Maven Central.

The major change in this version is switching over to Groovy 4.

The full list of changes is as usual available in the Book of Geb at
https://gebish.org/manual/7.0/#7-0.

Thanks,
Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQ%2BNZi3MU6b3X7n97Ris38q7ZV5Y-d7cBkzL8URC%2ByoNA%40mail.gmail.com.


Re: [geb-user] Under Geb 6, Driver is never recreated after quit()

2022-10-24 Thread Marcin Erdmann
Steve,

Thanks for providing more context, it made things clearer for me.

I believe that if you use the workaround which amounts to modifying the
common base class and which I provided previously but without modifying
cacheDriver configuration setting then things will work as expected if you
use CachingDriverFactory.clearCacheAndQuitDriver() in some of the tests
like you did prior to the attempted upgrade.

I'm not sure if you are already aware but if you need to clear cookies on
multiple domains after some of the tests then you can use
https://gebish.org/manual/current/api/geb/Browser.html#clearCookies(java.lang.String)
for that which will save you from having to restart the browser. Depending
on page load times for the domains you need to clear cookies on, how many
of these domains there are and which driver(s) you are using it might be
quicker or not compared to discarding the browser completely.

Marcin

On Mon, Oct 24, 2022 at 5:44 PM Steve Hillman 
wrote:

> Thanks, Marcin, for your detailed explanation
>
> You are, of course, right - I reviewed our code and found that we were
> previously calling CachingDriverFactory.clearCacheAndQuitDriver() from
> within an overridden resetBrowser() after *some* tests.
>
> So really, the core issue is that if we call quit() on the caching driver,
> a new driver won't be spawned for the next test, whereas it was in Geb 1,
> and the docs say it should.
>
> I'll see if I can figure out a way around that, but I'm open to ideas. I
> tried using the code snippet you suggested, which works (we do have a
> superclass so this was easy to test) - the one issue is that we only want
> to quit and relaunch the browser sometimes - not for every test.  It would
> be great if we could call quit() when needed and then do whatever is
> necessary to launch a new browser instance at that point
>
> (if you're curious, the reason we need to quit the browser is because
> we're testing using third-party logins to a site (e.g. "Login using Google,
> Login using Facebook"). When you login using a third party, it can create
> cookies in all sorts of domains, so we can't reliably delete them with
> clearCookies()).
>
> On Sun, Oct 23, 2022 at 1:34 PM Marcin Erdmann 
> wrote:
>
>> Hi Steve,
>>
>> Migrating from 1.1.1 to 6 sounds ambitious but not insurmountable. I
>> don't think there were that many significant breaking changes between these
>> versions.
>>
>> I will respond inline cause there are multiple concerns.
>>
>> On Fri, Oct 21, 2022 at 5:45 PM Steve Hillman 
>> wrote:
>>
>>> Under Geb 1, the behaviour was to quit and relaunch the browser for
>>> every test, unless resetBrowser() was overridden to do nothing. It was a
>>> bit slow, but it was effective.
>>>
>>
>> Just FWIW, this is not the default behaviour under Geb 1. Driver instance
>> has been cached in Geb since I remember and definitely prior to Geb 1 so
>> this behaviour will have to do with something specific to your project's
>> setup.
>>
>> Under Geb 6, the driver is cached and this is causing problems with some
>>> tests. I've tried numerous techniques to clear cookies but none have
>>> worked.
>>>
>>
>> Unless configured not to using autoClearCookies config property, cookies
>> are cleared after each test in Geb by default. In the latest versions it
>> happens in geb.test.GebTestManager.resetBrowser(). I have never experienced
>> this not to work so I'm wondering what makes you believe that cookies are
>> not cleared for you between tests and why you believe you need to restart
>> the browser after each test to overcome it. If your tests are not dealing
>> with multiple domains then you should not have to deal with managing
>> cookies state at all if using the default configuration which includes
>> driver instance caching.
>>
>>
>>> I tried using "quitDriverOnBrowserReset = true" and ran into this issue:
>>> https://github.com/geb/issues/issues/657 . I tried the workaround,
>>> setting "cacheDriver = false" but then ran into my final problem: when the
>>> browser is quit, it's not respawned for the next test. Instead, I get the
>>> same error as issue 657 - "Session ID is null. Using WebDriver after
>>> calling quit()?"
>>>
>>
>> So https://github.com/geb/issues/issues/657 is more of a documentation
>> issue - it's not clear that "quitDriverOnBrowserReset = true" will lead to
>> that error if driver caching is enabled. On the other hand just setting
>> "cacheDriver = false" even without modifying quitDriverOnBrowserReset
>> should in Geb 6 gi

Re: [geb-user] Under Geb 6, Driver is never recreated after quit()

2022-10-23 Thread Marcin Erdmann
Hi Steve,

Migrating from 1.1.1 to 6 sounds ambitious but not insurmountable. I don't
think there were that many significant breaking changes between these
versions.

I will respond inline cause there are multiple concerns.

On Fri, Oct 21, 2022 at 5:45 PM Steve Hillman 
wrote:

> Under Geb 1, the behaviour was to quit and relaunch the browser for every
> test, unless resetBrowser() was overridden to do nothing. It was a bit
> slow, but it was effective.
>

Just FWIW, this is not the default behaviour under Geb 1. Driver instance
has been cached in Geb since I remember and definitely prior to Geb 1 so
this behaviour will have to do with something specific to your project's
setup.

Under Geb 6, the driver is cached and this is causing problems with some
> tests. I've tried numerous techniques to clear cookies but none have
> worked.
>

Unless configured not to using autoClearCookies config property, cookies
are cleared after each test in Geb by default. In the latest versions it
happens in geb.test.GebTestManager.resetBrowser(). I have never experienced
this not to work so I'm wondering what makes you believe that cookies are
not cleared for you between tests and why you believe you need to restart
the browser after each test to overcome it. If your tests are not dealing
with multiple domains then you should not have to deal with managing
cookies state at all if using the default configuration which includes
driver instance caching.


> I tried using "quitDriverOnBrowserReset = true" and ran into this issue:
> https://github.com/geb/issues/issues/657 . I tried the workaround,
> setting "cacheDriver = false" but then ran into my final problem: when the
> browser is quit, it's not respawned for the next test. Instead, I get the
> same error as issue 657 - "Session ID is null. Using WebDriver after
> calling quit()?"
>

So https://github.com/geb/issues/issues/657 is more of a documentation
issue - it's not clear that "quitDriverOnBrowserReset = true" will lead to
that error if driver caching is enabled. On the other hand just setting
"cacheDriver = false" even without modifying quitDriverOnBrowserReset
should in Geb 6 give you the behaviour you are after of restarting the
browser after each test. Unfortunately the fix for
https://github.com/geb/issues/issues/660 which was to add configuration
script execution caching caused a bug leading to the error you are seeing.
I've therefore created https://github.com/geb/issues/issues/677.

One way to work around the bug that comes to my mind is to add the
following superclass for all of your tests:

class WorkAroundGeb677Spec extends GebReportingSpec {

private final static GebTestManager TEST_MANAGER = new
SpockGebTestManagerBuilder()
.withBrowserCreator { new Browser() }
.withReportingEnabled(true)
.build()

GebTestManager getTestManager() {
TEST_MANAGER
}
}

Depending on whether you already have a single superclass for all of your
tests this might or might not be feasible workaround for you.

Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQnbteUkh3Utz%3D%3DraqZToZvtY2XyRmd79u8XFKX%2B5-CQg%40mail.gmail.com.


[geb-user] [ANN] Geb 6.0 has been released

2022-08-21 Thread Marcin Erdmann
Hi,

Version 6.0 of Geb has been released and is available from Maven Central.

The major change in this version is switching over to Selenium 4.

The full list of changes is as usual available in the Book of Geb at
https://gebish.org/manual/6.0/#6-0.

Thanks,
Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQSf90o%3DH6SAo1nLdikzseoYkBET28ANTcMpP8nWJ%2BuJLg%40mail.gmail.com.


Re: [geb-user] When is Geb releasing version with Selenium 4 features

2022-08-21 Thread Marcin Erdmann
It took way longer than I'd ideally want (partially because I sank a
significant amount of time and effort into working around
https://github.com/SeleniumHQ/selenium/issues/9528#issuecomment-1173482917)
but this has been completed and shipped as part of the 6.0 release just now.

Marcin

On Wed, Feb 23, 2022 at 4:25 AM Alexander Kriegisch <
alexan...@kriegisch.name> wrote:

> First things first, Marcin. Take care of your work and family. I do
> understand your bandwidth problems. Looking forward to whenever the
> Selenium 4 support is ready.
>
> Kind regards
> --
> Alexander Kriegisch
> https://scrum-master.de
>
>
> Marcin Erdmann schrieb am 23.02.2022 00:27 (GMT +07:00):
>
> > With regards to Selenium 4 support, I have a significant amount of
> > work done on that locally but it’s not finished. I’ve been really
> > struggling to find time to work on Geb recently due to work and family
> > life circumstances. Things are supposed to change a bit in the middle
> > of March so I’m hoping to have more time then and complete this
> > work. FWIW, it’s likely that it will be a major version bump thus a
> > Geb 6 release as I don’t have the bandwidth to support multiple
> > combinations of Groovy, Spock and Selenium at the same time.
> >
> >
> > On Sun, 20 Feb 2022 at 07:32, Alexander Kriegisch wrote:
> >
> >> OK, I checked Geb's dependency list on mvnrepository.com, that helped
> >> me to determine that Geb up to 4.1 still works with Spock 1.3 and
> >> Groovy 2.5, so I updated my project successfully to
> >>
> >>   -- Geb 4.1,
> >>   -- Spock 1.3,
> >>   -- Groovy 2.5.14,
> >>   -- Selenium 3.141.59,
> >>   -- HtmlUnit 2.58.0.
> >>
> >> The next step would be the upgrade to Geb 5.x, Spock 2.x and Groovy 3
> >> (or optionally the new Spock 2.2 milestone supporting Groovy 4
> >> already). I am not expecting big problems there. But the actual
> >> question about Selenium 4.x remains. I just want to give you some
> >> context before replying.
> >>
> >>
> >> Alexander Kriegisch schrieb am 20.02.2022 09:31 (GMT +07:00):
> >>
> >>> Sorry to dig out this old thread, but it exists and I do not want to
> >>> start a new one.
> >>>
> >>> https://github.com/SeleniumHQ/htmlunit-driver#version-3xx says:
> >>>
> >>>> This version is compatible with Selenium 4
> >>>
> >>> I tried bumping my old Spock/Geb sandbox project (based on Spock
> >>> 1.3, Groovy 2.5.14, Geb 3.0.1, Selenium 3.14.0) naively to Selenium
> >>> 4.1.2 and Geb 5.1 (while keeping the old Spock and Groovy versions
> >>> for now), then also HtmlUnit Driver from 2.36.0 to 3.58.0. That does
> >>> not seem to work. Reverting back to Geb 3.0.1 gets me further, but
> >>> reports missing class
> >>> org.openqa.selenium.interactions.internal.Locatable - of course,
> >>> because now it is named org.openqa.selenium.interactions.Locatable
> >>> (not "internal"). I do not know if that would just be a small change
> >>> in Geb or any intermediate Geb version in between 3.0.1 and 5.1 can
> >>> deal with the new class name, depending on which Selenium version it
> >>> is running on, but out of the box it does not seem to work.
> >>>
> >>> Would you mind checking again? I was hoping that due to the switch
> >>> from JSON Wire Protocol to WebDriver W3C protocol, some flaky tests
> >>> involving double-clicks, drag'n'drop and other things might become
> >>> more stable on more combinations of OS, browser and Java version.
> >>> That is just a shot into the blue, but worth a try.
> >>>
> >>> BTW, do more recent Geb versions require specific minimum Spock and
> >>> Groovy versions? I found no obvious hints in the Geb release notes.
> >>>
> >>>
> >>> On Friday, November 5, 2021 marcin@proxerd.pl wrote:
> >>>
> >>>> unfortunately no Selenium 4 compatible htmlunit driver version has
> >>>> been released yet and Geb's test suite depends significantly on
> >>>> htmlunit driver so I'm unable to verify if Geb is compatible with
> >>>> Selenium 4 without an htmlunit-driver version compatible with it.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/20220223042501.0040578C0909%40dd19710.kasserver.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQSVZbQOi2%2B9%3D2c0sfC%3D%3DLPp0WX9AZDR0G8YkE7tb2Rnsw%40mail.gmail.com.


Re: [geb-user] geb-example-gradle fail

2022-07-01 Thread Marcin Erdmann
To be frank I have no idea. This feels like a problem with the trusted
store or SSL implementation in the JDK you are using and has most likely
nothing to do with the example project you are trying to run. As an
workaround you could just download the file in the error, put it in the
project and reconfigure this property to point at it:
https://github.com/erdi/webdriver-binaries-gradle-plugin#configuring-download-urls
.

On Wed, Jun 29, 2022 at 10:46 PM Ed Young  wrote:

> Interesting. It just ran successfully, but when I tried to run it again it
> failed. If I wait, it will work again.
> Do I have to wait for a session to expire or something?
>
>
> On Wednesday, June 29, 2022 at 2:47:40 PM UTC-6 Ed Young wrote:
>
>> HA! We had a great time, and yes, I have a lot of geb experience. It's
>> been a long long time though. Starting from scratch.
>> is this old, esoteric or modified?
>>
>> geb-example-gradle git:(master) java --version
>> openjdk 11.0.2 2019-01-15
>> OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
>> OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
>>
>> On Wednesday, June 29, 2022 at 2:37:25 PM UTC-6 marcin@proxerd.pl
>> wrote:
>>
>>> And btw, that example project builds just fine on CI, here's a
>>> successful build from about a month ago:
>>> https://app.circleci.com/pipelines/github/geb/geb-example-gradle/133/workflows/f1bb4852-81a3-4f6a-a8fd-d7da568a5917
>>> .
>>>
>>> On Wed, Jun 29, 2022 at 9:34 PM Marcin Erdmann 
>>> wrote:
>>>
>>>> On Wed, Jun 29, 2022 at 9:19 PM Ed Young  wrote:
>>>>
>>>>> (I even had beers with Luke here in Denver at a conference)
>>>>
>>>>
>>>> With that credentials I would say that you are an expert not just
>>>> semi-expert. ;)
>>>>
>>>>
>>>>> * What went wrong:
>>>>> Execution failed for task ':configureChromeDriverBinary'.
>>>>> > Could not read textResource '
>>>>> https://raw.githubusercontent.com/webdriverextensions/webdriverextensions-maven-plugin-repository/master/repository-3.0.json
>>>>> '.
>>>>>> Could not get resource '
>>>>> https://raw.githubusercontent.com/webdriverextensions/webdriverextensions-maven-plugin-repository/master/repository-3.0.json
>>>>> '.
>>>>>   > Could not HEAD '
>>>>> https://raw.githubusercontent.com/webdriverextensions/webdriverextensions-maven-plugin-repository/master/repository-3.0.json
>>>>> '.
>>>>>  > peer not authenticated
>>>>>
>>>>
>>>> A quick google of this type of error seems to suggest an SSL issue with
>>>> validating the host certificate. Are you by chance using on some old,
>>>> esoteric or modified JDK?
>>>>
>>>> Marcin
>>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/076652e7-6044-40de-8097-7dde670557a0n%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/076652e7-6044-40de-8097-7dde670557a0n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQR96rPRH%3DfQZTFmDr0Q7e49Ry3%2BiC22zP4Psbv7%2B7y7iw%40mail.gmail.com.


Re: [geb-user] geb-example-gradle fail

2022-07-01 Thread Marcin Erdmann
It sure does not look esoteric, cannot say anything about it being modified
with regards to what trusted certificates it contains but it's definitely
not the newest in the OpenJDK 11 line. According to
https://adoptium.net/temurin/releases?version=11 the newest seems to be
11.0.15 released in April 2022...

On Wed, Jun 29, 2022 at 9:47 PM Ed Young  wrote:

> HA! We had a great time, and yes, I have a lot of geb experience. It's
> been a long long time though. Starting from scratch.
> is this old, esoteric or modified?
>
> geb-example-gradle git:(master) java --version
> openjdk 11.0.2 2019-01-15
> OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
> OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
>
> On Wednesday, June 29, 2022 at 2:37:25 PM UTC-6 marcin@proxerd.pl
> wrote:
>
>> And btw, that example project builds just fine on CI, here's a successful
>> build from about a month ago:
>> https://app.circleci.com/pipelines/github/geb/geb-example-gradle/133/workflows/f1bb4852-81a3-4f6a-a8fd-d7da568a5917
>> .
>>
>> On Wed, Jun 29, 2022 at 9:34 PM Marcin Erdmann 
>> wrote:
>>
>>> On Wed, Jun 29, 2022 at 9:19 PM Ed Young  wrote:
>>>
>>>> (I even had beers with Luke here in Denver at a conference)
>>>
>>>
>>> With that credentials I would say that you are an expert not just
>>> semi-expert. ;)
>>>
>>>
>>>> * What went wrong:
>>>> Execution failed for task ':configureChromeDriverBinary'.
>>>> > Could not read textResource '
>>>> https://raw.githubusercontent.com/webdriverextensions/webdriverextensions-maven-plugin-repository/master/repository-3.0.json
>>>> '.
>>>>> Could not get resource '
>>>> https://raw.githubusercontent.com/webdriverextensions/webdriverextensions-maven-plugin-repository/master/repository-3.0.json
>>>> '.
>>>>   > Could not HEAD '
>>>> https://raw.githubusercontent.com/webdriverextensions/webdriverextensions-maven-plugin-repository/master/repository-3.0.json
>>>> '.
>>>>  > peer not authenticated
>>>>
>>>
>>> A quick google of this type of error seems to suggest an SSL issue with
>>> validating the host certificate. Are you by chance using on some old,
>>> esoteric or modified JDK?
>>>
>>> Marcin
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/d347b829-cfb2-4dd4-9331-577a5cf9f993n%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/d347b829-cfb2-4dd4-9331-577a5cf9f993n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQkHcrVCH7DQ8AtTqbRR_WZdJMau7qfXxMwVMs7D73LjA%40mail.gmail.com.


Re: [geb-user] geb-example-gradle fail

2022-06-29 Thread Marcin Erdmann
And btw, that example project builds just fine on CI, here's a successful
build from about a month ago:
https://app.circleci.com/pipelines/github/geb/geb-example-gradle/133/workflows/f1bb4852-81a3-4f6a-a8fd-d7da568a5917
.

On Wed, Jun 29, 2022 at 9:34 PM Marcin Erdmann 
wrote:

> On Wed, Jun 29, 2022 at 9:19 PM Ed Young  wrote:
>
>> (I even had beers with Luke here in Denver at a conference)
>
>
> With that credentials I would say that you are an expert not just
> semi-expert. ;)
>
>
>> * What went wrong:
>> Execution failed for task ':configureChromeDriverBinary'.
>> > Could not read textResource '
>> https://raw.githubusercontent.com/webdriverextensions/webdriverextensions-maven-plugin-repository/master/repository-3.0.json
>> '.
>>> Could not get resource '
>> https://raw.githubusercontent.com/webdriverextensions/webdriverextensions-maven-plugin-repository/master/repository-3.0.json
>> '.
>>   > Could not HEAD '
>> https://raw.githubusercontent.com/webdriverextensions/webdriverextensions-maven-plugin-repository/master/repository-3.0.json
>> '.
>>  > peer not authenticated
>>
>
> A quick google of this type of error seems to suggest an SSL issue with
> validating the host certificate. Are you by chance using on some old,
> esoteric or modified JDK?
>
> Marcin
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRo%3DWYZof7QfocS-x8JONW8GuaFpR_C4BwXYhurTCg9ng%40mail.gmail.com.


Re: [geb-user] geb-example-gradle fail

2022-06-29 Thread Marcin Erdmann
On Wed, Jun 29, 2022 at 9:19 PM Ed Young  wrote:

> (I even had beers with Luke here in Denver at a conference)


With that credentials I would say that you are an expert not just
semi-expert. ;)


> * What went wrong:
> Execution failed for task ':configureChromeDriverBinary'.
> > Could not read textResource '
> https://raw.githubusercontent.com/webdriverextensions/webdriverextensions-maven-plugin-repository/master/repository-3.0.json
> '.
>> Could not get resource '
> https://raw.githubusercontent.com/webdriverextensions/webdriverextensions-maven-plugin-repository/master/repository-3.0.json
> '.
>   > Could not HEAD '
> https://raw.githubusercontent.com/webdriverextensions/webdriverextensions-maven-plugin-repository/master/repository-3.0.json
> '.
>  > peer not authenticated
>

A quick google of this type of error seems to suggest an SSL issue with
validating the host certificate. Are you by chance using on some old,
esoteric or modified JDK?

Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTqA86PeNwJHwSoHxyPXiHv5%2BPRNWsqKuTGdgjfpArSaA%40mail.gmail.com.


Re: [geb-user] Converting Geb 3 tests to use testManager

2022-06-19 Thread Marcin Erdmann
Yeah, makes sense.

I've never used it so have no idea if it's any good but there seems to be
something called Allure (https://github.com/allure-framework/allure2) which
has Spock 1.3 support (
https://github.com/allure-framework/allure-java/tree/master/allure-spock,
for Spock 2.0 you probably could use JUnit 5 support) and it has ability to
add attachments (https://docs.qameta.io/allure-report/#_attachments). You
could probably plug into that via an implementation
of geb.report.ReportingListener (
https://gebish.org/manual/current/#listening-to-reporting).

Hope this helps,
Marcin

On Fri, Jun 17, 2022 at 4:55 PM Nick Bensema 
wrote:

> actually, it looks like geb-spock-reports is the only thing in my way,
> both for multi-window reporting, and for reporting downloaded files.
> Indeed, the custom reporter that saves a ZIP file works great, but the
> reports show links to nonexistent screenshots.  Since it's not being
> maintained, maybe I just need to switch to something else.  There's
> probably no need to add features to Geb for this case.
>
> Can you recommend a reporting extension for the geb-spock stack that
> includes links to Geb artifacts in the output?
>
> On Friday, June 17, 2022 at 2:44:09 AM UTC-7 marcin@proxerd.pl wrote:
>
>> Nick,
>>
>> So as far as I'm aware, geb-spock-reports is no longer maintained (
>> https://github.com/AOEpeople/geb-spock-reports/issues/37#issuecomment-950887176)
>> thus trying to use it will become harder and harder over time, especially
>> with newer versions of Geb. I've never been involved with geb-spock-report
>> or has been a user of it so unfortunately won't be able to help with that.
>> I can help with what reports and how are being generated from Geb but not
>> with what geb-spock-reports then does with that.
>>
>> With regards to extending GebTestManager - it's not designed to be
>> extended but it's designed to be configured via the builder you mention in
>> your email. This is because the old "test framework support is scattered in
>> base test classes" mechanism that was used prior to introduction of
>> GebTestManager lead to duplication. It also meant that users would be
>> encouraged to extend and override code from these base classes which then
>> makes it hard to track all possible use cases and makes it harder to evolve
>> the code of the framework without inadvertently introducing breaking
>> changes.
>>
>> Unfortunately GebTestManager currently does not cater for your usecase
>> of having some custom logic for generating reports upon failure but which
>> seems like a completely valid usecase. My idea would be to introduce
>>
>> GebTestManagerBuilder withReportFailure(Consumer
>> reportOnFailure) {
>> ...
>> }
>>
>> to GebTestManagerBuilder. Then you would use that in custom base classes
>> in your project, for example
>>
>> @DynamicallyDispatchesToBrowser
>> class DesignerPageReportFailureHandlingSpec extends Specification
>> implements ManagedGebTest {
>>
>> private final static GebTestManager TEST_MANAGER = new
>> SpockGebTestManagerBuilder()
>> .withReportingEnabled(true)
>> .withReportFailure { testManager ->
>> def page = testManager.browser.page
>>
>> if( page instanceOf DesignerPage ) {
>> if(page.preview.displayed) {
>> testManager.report "preview"
>> page.preview.close()
>> }
>> }
>>
>> testManager.report "failure"
>> }
>> .build()
>>
>> @Override
>> @Delegate(includes = ["getBrowser", "report"])
>> GebTestManager getTestManager() {
>> TEST_MANAGER
>> }
>> }
>>
>> I believe that would allow you to achieve what you are after. Would that
>> work for you? If that's the case then I can create an issue for this and
>> incorporate this into the upcoming Geb 6.0 release which will be based on
>> Spock 2.1 and WebDriver 4. I know that this would force you to do a big
>> version jump and will be somewhat inconvenient but I unfortunately do not
>> have capacity to backport this.
>>
>> Thanks for bearing with me on this.
>>
>> On Tue, Jun 14, 2022 at 9:55 PM Nick Bensema 
>> wrote:
>>
>>> so, I've looked at the default template in the source code, and I've
>>> even added my own listener object to confirm that both "main" and
>>> "designer" were being caught by listeners, but still only "main" appeared
>>> in the report HTML.  If I suppress the "main" window, then "designer" does
>>> show up.  I poked around the source code and think there might be a problem
>>> with  GebReportingListener in geb-spock-reports; there's a lot of strange
>>> logic in there and I can see how it might not do the right thing if
>>> findArtifactByNumber already returns something...
>>>
>>> having hit a dead end there, I took another look at how to write a
>>> GebTestManager.  I poked around the source code some more and thought I
>>> could extend GebTestManager and move my custom 

Re: [geb-user] Converting Geb 3 tests to use testManager

2022-06-17 Thread Marcin Erdmann
Nick,

So as far as I'm aware, geb-spock-reports is no longer maintained (
https://github.com/AOEpeople/geb-spock-reports/issues/37#issuecomment-950887176)
thus trying to use it will become harder and harder over time, especially
with newer versions of Geb. I've never been involved with geb-spock-report
or has been a user of it so unfortunately won't be able to help with that.
I can help with what reports and how are being generated from Geb but not
with what geb-spock-reports then does with that.

With regards to extending GebTestManager - it's not designed to be extended
but it's designed to be configured via the builder you mention in your
email. This is because the old "test framework support is scattered in base
test classes" mechanism that was used prior to introduction of
GebTestManager lead to duplication. It also meant that users would be
encouraged to extend and override code from these base classes which then
makes it hard to track all possible use cases and makes it harder to evolve
the code of the framework without inadvertently introducing breaking
changes.

Unfortunately GebTestManager currently does not cater for your usecase of
having some custom logic for generating reports upon failure but which
seems like a completely valid usecase. My idea would be to introduce

GebTestManagerBuilder withReportFailure(Consumer
reportOnFailure) {
...
}

to GebTestManagerBuilder. Then you would use that in custom base classes in
your project, for example

@DynamicallyDispatchesToBrowser
class DesignerPageReportFailureHandlingSpec extends Specification
implements ManagedGebTest {

private final static GebTestManager TEST_MANAGER = new
SpockGebTestManagerBuilder()
.withReportingEnabled(true)
.withReportFailure { testManager ->
def page = testManager.browser.page
if( page instanceOf DesignerPage ) {
if(page.preview.displayed) {
testManager.report "preview"
page.preview.close()
}
}

testManager.report "failure"
}
.build()

@Override
@Delegate(includes = ["getBrowser", "report"])
GebTestManager getTestManager() {
TEST_MANAGER
}
}

I believe that would allow you to achieve what you are after. Would that
work for you? If that's the case then I can create an issue for this and
incorporate this into the upcoming Geb 6.0 release which will be based on
Spock 2.1 and WebDriver 4. I know that this would force you to do a big
version jump and will be somewhat inconvenient but I unfortunately do not
have capacity to backport this.

Thanks for bearing with me on this.

On Tue, Jun 14, 2022 at 9:55 PM Nick Bensema 
wrote:

> so, I've looked at the default template in the source code, and I've even
> added my own listener object to confirm that both "main" and "designer"
> were being caught by listeners, but still only "main" appeared in the
> report HTML.  If I suppress the "main" window, then "designer" does show
> up.  I poked around the source code and think there might be a problem
> with  GebReportingListener in geb-spock-reports; there's a lot of strange
> logic in there and I can see how it might not do the right thing if
> findArtifactByNumber already returns something...
>
> having hit a dead end there, I took another look at how to write a
> GebTestManager.  I poked around the source code some more and thought I
> could extend GebTestManager and move my custom reportFailure() method into
> there, but there's this whole GebTestManagerBuilder thing that populates a
> private, not protected, singleton, and it doesn't seem to have a mechanism
> to just override one method. Since getTestReporter()'s return type is
> GebTestManager, I have to return a subclass of that, and I can't just write
> a one-method class and @Delegate to call the real test manager for
> everything else.  And the real test manager is a private static final
> singleton, and so I'd have to delegate everything to that specific
> instance.  does @Delegate take precedence over superclass methods or do I
> have to write a dozen @Override methods to shunt every other method call to
> the delegate?  Either way it seems fragile, and smells like the wrong way
> to do it.
>
> so, either I have to find the right way to change reportFailure(), or fix
> the bug in geb-spock-reports.  am I missing something here?
>
> On Friday, June 10, 2022 at 1:22:31 PM UTC-7 Nick Bensema wrote:
>
>> I did indeed fix that problem by moving it to just setup() -- moving it
>> to the config isn't yet appropriate because I want to report different test
>> classes differently; I have different tests for the UI and for the
>> downloads.  Maybe that will work if I can figure out how to modularize this
>> project, but that's another thread...
>>
>> Now I'm having a different problem with the MultiWindowReporter.  It's
>> writing the HTML and PNG for both windows, but only one of them is showing
>> 

Re: [geb-user] Converting Geb 3 tests to use testManager

2022-06-10 Thread Marcin Erdmann
There is a new instance of browser and config created per test, so
modifying config in setupSpec() will only have for the first test method in
a spec. You might get more luck by putting that code in setup but there
still will be cases where that code might not be applied to a browser
instance, like for example when reporting is triggered from cleanupSpec. I
would therefore consider registering your custom reporter in your config
script like I initially suggested.

Marcin

On Mon, Jun 6, 2022 at 11:05 PM Nick Bensema 
wrote:

> Thanks, you've made it a lot clearer for me, and I think I'm getting
> close. I've created a custom reporter that extends ReporterSupport, with
> its own writeReport method that does its own thing and calls
> notifyListeners.  I created a constructor where I can pass the existing
> reporter, so in my setupSpec I have something like this:
>
> browser.config.reporter = new MyReporter(browser.config.reporter)
>
> I can even call methods, like when I've downloaded the file I want to
> test, I can call browser.config.reporter.setDownloadedFile(file) and the
> log statements say it's executing.  But when I test it by introducing a
> purposeful failure, it still calls the ordinary ScreenshotReporter and
> skips my code entirely, and once again I get a png of the download page.
>
> So, what am I missing, why might my reporter not be activating?
> On Thursday, June 2, 2022 at 12:22:30 PM UTC-7 marcin@proxerd.pl
> wrote:
>
>> Hi Nick,
>>
>> Sorry for a late reply.
>>
>> So for the reporting on multiple windows you can use a built-in
>> capability - MultiWindowReporter. I don't know when it was introduced but
>> it's definitely available in 4.1 because its usage is described in the
>> manual for that version, see
>> https://gebish.org/manual/4.1/#reporting-on-multiple-windows.
>>
>> With regards to your second requirement of triggering another report
>> before performing an action and doing the report proper I would suggest
>> implementing another `geb.report.Reporter` and then plugging it in together
>> with MultiWindowReporter via configuration in a similar way to the one
>> reported in https://gebish.org/manual/4.1/#reporting-on-multiple-windows.
>> I think you should be able to get ideas how to implement that reporter from
>> looking at the sources of MultiWindowReporter (
>> https://github.com/geb/geb/blob/master/module/geb-core/src/main/groovy/geb/report/MultiWindowReporter.groovy)
>> but let me know if you struggle with it and I will help out with some code.
>>
>> Thanks,
>> Marcin
>>
>>
>>
>> On Fri, May 27, 2022 at 9:39 PM Nick Bensema 
>> wrote:
>>
>>> It looks like Geb development has come a long way, so I'm trying to keep
>>> my codebase current, and I've tried a few times to run my tests with geb
>>> 4.1 instead of 3.4.1 -- baby steps on the way to 5.1.  So far, it won't
>>> even compile, and I need some help.
>>>
>>> The first problem I have is that I have several specs, both abstract and
>>> concrete, which try to override the `reportFailure` method, which no longer
>>> compiles. I know that I'm supposed to use testManager, but it's not quite
>>> obvious how to do it; there's very little documentation about it.
>>>
>>> First of all, I have a main abstract class that also overrides
>>> reportFailure(), because those tests all have two browser windows open, and
>>> I want to make sure to screenshot both of them.
>>>
>>> But also, sometimes I override reportFailure in a concrete test class,
>>> so that I can get screenshots of dialog boxes, and close them.  That method
>>> also calls super.reportFailure(), meaning both of my custom methods will
>>> run.
>>>
>>> So, given a test class that overrides reportFailure(), how do I move
>>> that method into a test manager object that the class can use?  and will it
>>> support the kind of inheritance I had before?
>>>
>>> Example of the kind of thing my method will contain: calling the main
>>> report function, doing stuff with page content, and calling the superclass
>>> method which might also be an override:
>>>
>>> @Override
>>> void reportFailure() {
>>> if( page instanceOf DesignerPage ) {
>>> if(preview.displayed) {
>>> report "preview"
>>> preview.close()
>>> }
>>> }
>>> super.reportFailure()
>>> }
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Geb User Mailing List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to geb-user+u...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/geb-user/d3a5566a-672e-433b-a9d2-322da900e12en%40googlegroups.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group 

Re: [geb-user] Converting Geb 3 tests to use testManager

2022-06-02 Thread Marcin Erdmann
Hi Nick,

Sorry for a late reply.

So for the reporting on multiple windows you can use a built-in capability
- MultiWindowReporter. I don't know when it was introduced but it's
definitely available in 4.1 because its usage is described in the manual
for that version, see
https://gebish.org/manual/4.1/#reporting-on-multiple-windows.

With regards to your second requirement of triggering another report before
performing an action and doing the report proper I would suggest
implementing another `geb.report.Reporter` and then plugging it in together
with MultiWindowReporter via configuration in a similar way to the one
reported in https://gebish.org/manual/4.1/#reporting-on-multiple-windows. I
think you should be able to get ideas how to implement that reporter from
looking at the sources of MultiWindowReporter (
https://github.com/geb/geb/blob/master/module/geb-core/src/main/groovy/geb/report/MultiWindowReporter.groovy)
but let me know if you struggle with it and I will help out with some code.

Thanks,
Marcin



On Fri, May 27, 2022 at 9:39 PM Nick Bensema 
wrote:

> It looks like Geb development has come a long way, so I'm trying to keep
> my codebase current, and I've tried a few times to run my tests with geb
> 4.1 instead of 3.4.1 -- baby steps on the way to 5.1.  So far, it won't
> even compile, and I need some help.
>
> The first problem I have is that I have several specs, both abstract and
> concrete, which try to override the `reportFailure` method, which no longer
> compiles. I know that I'm supposed to use testManager, but it's not quite
> obvious how to do it; there's very little documentation about it.
>
> First of all, I have a main abstract class that also overrides
> reportFailure(), because those tests all have two browser windows open, and
> I want to make sure to screenshot both of them.
>
> But also, sometimes I override reportFailure in a concrete test class, so
> that I can get screenshots of dialog boxes, and close them.  That method
> also calls super.reportFailure(), meaning both of my custom methods will
> run.
>
> So, given a test class that overrides reportFailure(), how do I move that
> method into a test manager object that the class can use?  and will it
> support the kind of inheritance I had before?
>
> Example of the kind of thing my method will contain: calling the main
> report function, doing stuff with page content, and calling the superclass
> method which might also be an override:
>
> @Override
> void reportFailure() {
> if( page instanceOf DesignerPage ) {
> if(preview.displayed) {
> report "preview"
> preview.close()
> }
> }
> super.reportFailure()
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/d3a5566a-672e-433b-a9d2-322da900e12en%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQa1VOejjVNcT50c0Zii4Kageu4KH_gAbfh%3DYBFyonm4Q%40mail.gmail.com.


Re: [geb-user] Re: Trouble getting started

2022-04-26 Thread Marcin Erdmann
Or use https://github.com/erdi/webdriver-binaries-gradle-plugin if you want
to setup webdriver binaries natively in Gradle.

On Tue, Apr 12, 2022 at 3:32 PM jc  wrote:

> Use https://bonigarcia.dev/webdrivermanager/ to solve these issue,
> otherwise you are probably missing something like `System.setProperty
> ("webdriver.gecko.driver",'/path/to/driver')`
>
> On Monday, April 4, 2022 at 8:06:41 PM UTC-5 Ben Frey wrote:
>
>> It's been a while since I started up a new Geb project, and I haven't
>> done so on Windows before. I set up my dependencies via Gradle and created
>> a very short Spock test. (code:
>> https://github.com/spartanhooah/YT-music-deleter). However, the driver
>> complains "java.lang.IllegalStateException: The path to the driver
>> executable The path to the driver executable must be set by the
>> webdriver.gecko.driver system property". I tried doing so in the test
>> closure in build.gradle but evidently that isn't the correct way to do it.
>> What am I missing?
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/c72fcba6-3c3b-4e19-8e00-d10b077dd6cen%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTV1ZWbVStnnq8vQi5z8Jzom74MR6A6iMhff2EkWNicKw%40mail.gmail.com.


Re: [geb-user] Re: Did Geb 5 change the order in which GebConfig.groovy is run?

2022-04-13 Thread Marcin Erdmann
I replied on the issue. Thanks for opening it, Alexander.

Marcin

On Tue, Apr 12, 2022 at 5:21 PM Alexander Kriegisch <
alexan...@kriegisch.name> wrote:

> I can create an issue tomorrow or so. I might even create a PR, if you
> like. It might not be a great PR, given the fact that I do not know the Geb
> source code well and never have contributes to the project before, but I
> can give it a try. At least you have something to work with, or we have
> something to discuss and, if necessary, throw away and re-do better. Would
> a PR go on the current main branch or are you planning a special branch for
> the work on Geb 6?
> --
> Alexander Kriegisch
> https://scrum-master.de
>
>
> Marcin Erdmann schrieb am 12.04.2022 22:31 (GMT +07:00):
>
> But to my surprise, the Geb config is not read just once during extension
>> start, but quite often, e.g. whenever the Geb test manager calls
>> getBrowser in beforeTest, i.e. for each feature method in a Geb spec
>
>
> is not completely precise. Geb config is read whenever
> ConfigurationLoader.getConf() is called. It happens to be called via the
> parameterless constructor of Browser, which in turn is called for the
> first time getBrowser() is called on an instance of GebTestManager.
>
> All that aside, yes, Geb config is definitely read more often than it
> needs to be. There will definitely be a performance penalty to parsing and
> executing that script for every single test but this has worked like that
> since forever (I started contributing to Geb in 2010 and it's how it was
> back then) so changing this will be a breaking change. It will be fairly
> easy to change to only load the config once per GebTestManager instance
> but that would be a breaking change so would need to be done only in Geb 6
> which might be coming soon due to switching to Selenium 4 which is not
> backwards compatible. If you feel like this would be worthwhile to change,
> Alexander, then please open an issue in the tracker and I will schedule it
> for Geb 6.
>
>
> On Thu, Mar 31, 2022 at 10:17 AM Alexander Kriegisch <
> alexan...@kriegisch.name> wrote:
>
>> I am not sure you are following the Spock chat on Gitter. While talking
>> to Jeremy there, I was looking into how Geb actually works. Result (I wrote
>> much more there): It is a simple global Spock extension. But to my
>> surprise, the Geb config is not read just once during extension start,
>> but quite often, e.g. whenever the Geb test manager calls getBrowser in
>> beforeTest, i.e. for each feature method in a Geb spec. By printing
>> callstacks from the Geb config, this is easy to see.
>>
>> So my question is: What is the reason for that? Are you expecting cases
>> in which the Geb config changes during a JVM session? The driver
>> configurations for multiple environments are closures, so they can be
>> evaluated without re-reading the file. Any system properties defined there
>> should also not depend on dynamic things like time stamps, random values or
>> whatever.
>>
>>
>> Marcin Erdmann schrieb am 31.03.2022 02:45 (GMT +07:00):
>>
>> GebConfig.groovy is usually evaluated when
>> geb.ConfigurationLoader.getConf() is executed which for example happens
>> inside of the parameterless constructor for geb.Browser. If you want to
>> have GebConfig.groovy evaluated early on as part of executing tests then
>> one thing that comes to mind with the setup you describe is to put new
>> ConfigurationLoader().conf in a static initalization block of BaseTest.
>>
>> On Mon, Mar 28, 2022 at 9:34 PM jc  wrote:
>>
>>> Ok, I think I know what happened.  It's nothing Geb 5 changed.  I worked
>>> with Leonard Brünings as he helped me clean up some bad code while figuring
>>> out another issue.  One the lines I cleaned up was an unused line in the
>>> BaseTest: static Browser browse = new Browser()
>>>
>>> With this line in place, even though it is unused anywhere, it seems as
>>> thought the env variable set in GebConfig are evaluated in time.  Without
>>> this line, the GebConfig variables are not evaluated in time.  I don't
>>> fully understand it.  I definitely want to have good code (I am aware
>>> setting env variables in GebConfig is "bad", but it's working for us).   So
>>> if there is another way we can achieve these @IgnoreIf method getting
>>> evaluated at the right time I am all for it.  Any insights?
>>> On Monday, March 28, 2022 at 1:47:48 PM UTC-5 jc wrote:
>>>
>>>> I am currently in the process of trying to update our project's from
>>>> 4.0 to 5.1.  Currently on 4.0, we have a B

Re: [geb-user] Re: Did Geb 5 change the order in which GebConfig.groovy is run?

2022-04-12 Thread Marcin Erdmann
Alexander, your following statement:

But to my surprise, the Geb config is not read just once during extension
> start, but quite often, e.g. whenever the Geb test manager calls
> getBrowser in beforeTest, i.e. for each feature method in a Geb spec
>

is not completely precise. Geb config is read whenever
ConfigurationLoader.getConf() is called. It happens to be called via the
parameterless constructor of Browser, which in turn is called for the first
time getBrowser() is called on an instance of GebTestManager.

All that aside, yes, Geb config is definitely read more often than it needs
to be. There will definitely be a performance penalty to parsing and
executing that script for every single test but this has worked like that
since forever (I started contributing to Geb in 2010 and it's how it was
back then) so changing this will be a breaking change. It will be fairly
easy to change to only load the config once per GebTestManager instance but
that would be a breaking change so would need to be done only in Geb 6
which might be coming soon due to switching to Selenium 4 which is not
backwards compatible. If you feel like this would be worthwhile to change,
Alexander, then please open an issue in the tracker and I will schedule it
for Geb 6.


On Thu, Mar 31, 2022 at 10:17 AM Alexander Kriegisch <
alexan...@kriegisch.name> wrote:

> Hi Marcin.
>
> I am not sure you are following the Spock chat on Gitter. While talking to
> Jeremy there, I was looking into how Geb actually works. Result (I wrote
> much more there): It is a simple global Spock extension. But to my
> surprise, the Geb config is not read just once during extension start,
> but quite often, e.g. whenever the Geb test manager calls getBrowser in
> beforeTest, i.e. for each feature method in a Geb spec. By printing
> callstacks from the Geb config, this is easy to see.
>
> So my question is: What is the reason for that? Are you expecting cases in
> which the Geb config changes during a JVM session? The driver
> configurations for multiple environments are closures, so they can be
> evaluated without re-reading the file. Any system properties defined there
> should also not depend on dynamic things like time stamps, random values or
> whatever.
>
> Cheers
> --
> Alexander Kriegisch
> https://scrum-master.de
>
>
> Marcin Erdmann schrieb am 31.03.2022 02:45 (GMT +07:00):
>
> GebConfig.groovy is usually evaluated when
> geb.ConfigurationLoader.getConf() is executed which for example happens
> inside of the parameterless constructor for geb.Browser. If you want to
> have GebConfig.groovy evaluated early on as part of executing tests then
> one thing that comes to mind with the setup you describe is to put new
> ConfigurationLoader().conf in a static initalization block of BaseTest.
>
> On Mon, Mar 28, 2022 at 9:34 PM jc  wrote:
>
>> Ok, I think I know what happened.  It's nothing Geb 5 changed.  I worked
>> with Leonard Brünings as he helped me clean up some bad code while figuring
>> out another issue.  One the lines I cleaned up was an unused line in the
>> BaseTest: static Browser browse = new Browser()
>>
>> With this line in place, even though it is unused anywhere, it seems as
>> thought the env variable set in GebConfig are evaluated in time.  Without
>> this line, the GebConfig variables are not evaluated in time.  I don't
>> fully understand it.  I definitely want to have good code (I am aware
>> setting env variables in GebConfig is "bad", but it's working for us).   So
>> if there is another way we can achieve these @IgnoreIf method getting
>> evaluated at the right time I am all for it.  Any insights?
>> On Monday, March 28, 2022 at 1:47:48 PM UTC-5 jc wrote:
>>
>>> I am currently in the process of trying to update our project's from 4.0
>>> to 5.1.  Currently on 4.0, we have a BaseTest class that extends
>>> GebReportingSpec and then all other test classes extend BaseTest.   In
>>> GebConfig.groovy, I have some lines that set different environment
>>> variables such as "runOnGrid" which is true/false, "browserType" which is a
>>> string, "env" which is the environment, etc
>>>
>>> We have some @IgnoreIf statement in our code to prevent running on
>>> certain environments like Production.  For example, we have an entire test
>>> class "TestClassA" that can run on pre-prod but we want to ignore the whole
>>> class for Prod.  We put an @IgnoreIf annotation on the class that looks at
>>> `System.getProperty("env") == "prod"`
>>>
>>> This is currently working beautifully in 4.0.  However in 5.1 this is no
>>> longer working as  `System.ge

Re: [geb-user] Re: Did Geb 5 change the order in which GebConfig.groovy is run?

2022-03-30 Thread Marcin Erdmann
GebConfig.groovy is usually evaluated when geb.ConfigurationLoader.getConf()
is executed which for example happens inside of the parameterless
constructor for geb.Browser. If you want to have GebConfig.groovy evaluated
early on as part of executing tests then one thing that comes to mind with
the setup you describe is to put new ConfigurationLoader().conf in a static
initalization block of BaseTest.

On Mon, Mar 28, 2022 at 9:34 PM jc  wrote:

> Ok, I think I know what happened.  It's nothing Geb 5 changed.  I worked
> with Leonard Brünings as he helped me clean up some bad code while figuring
> out another issue.  One the lines I cleaned up was an unused line in the
> BaseTest: static Browser browse = new Browser()
>
> With this line in place, even though it is unused anywhere, it seems as
> thought the env variable set in GebConfig are evaluated in time.  Without
> this line, the GebConfig variables are not evaluated in time.  I don't
> fully understand it.  I definitely want to have good code (I am aware
> setting env variables in GebConfig is "bad", but it's working for us).   So
> if there is another way we can achieve these @IgnoreIf method getting
> evaluated at the right time I am all for it.  Any insights?
> On Monday, March 28, 2022 at 1:47:48 PM UTC-5 jc wrote:
>
>> I am currently in the process of trying to update our project's from 4.0
>> to 5.1.  Currently on 4.0, we have a BaseTest class that extends
>> GebReportingSpec and then all other test classes extend BaseTest.   In
>> GebConfig.groovy, I have some lines that set different environment
>> variables such as "runOnGrid" which is true/false, "browserType" which is a
>> string, "env" which is the environment, etc
>>
>> We have some @IgnoreIf statement in our code to prevent running on
>> certain environments like Production.  For example, we have an entire test
>> class "TestClassA" that can run on pre-prod but we want to ignore the whole
>> class for Prod.  We put an @IgnoreIf annotation on the class that looks at
>> `System.getProperty("env") == "prod"`
>>
>> This is currently working beautifully in 4.0.  However in 5.1 this is no
>> longer working as  `System.getProperty("env")` is coming back as null
>> along with all of the other variables we have set.  These variables are set
>> by the time we hit the setupSpec() in BaseTest, but they are null prior to
>> that when they were not before.  So it seems like before 5.0,
>> GebConfig.groovy was getting run earlier is the compilation process
>> perhaps?  I guess I don't know how it all works, but I just know now that
>> with Geb 5 this method is no longer working for us.
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/f66cd19f-fe4b-4411-817a-1c4f97d6dc24n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQR8S536Wopv0-aajsjuSvD2tdiy2Mup2LJpqsoG-ZVgnw%40mail.gmail.com.


Re: [geb-user] >>> Sponsoring GEB! <<

2022-03-23 Thread Marcin Erdmann
The link is not there because in the almost 13 years since Geb was
conceived nobody has asked for it. To be frank I don’t think that there
would be enough interest in this to set something up and check out all of
the legal/tax implications of taking donations. It’s very kind of you to
want to donate, thanks. If you really feel like donating to the ecosystem
Geb depends on then there is the open collective for Groovy at
https://opencollective.com/friends-of-groovy.

On Mon, 21 Mar 2022 at 15:52, Dan  wrote:

> >>> Sponsoring GEB! <<<
>
> This software is a masterpiece, I'm sure that many of GEB users will agree
> with this, I know it can contain issues, this is normal is not a perfect
> app, BUT it is an  extremely useful and powerful software in terms of
> automation.
> I was looking into the home page https://www.gebish.org/ to see where I
> can donate since it is an open source code and I just want to support this
> app with the little that I have, but I was not able to find any section
> mentioning anything about donations, like we can see here:
> https://junit.org/junit5/ -> Sponsoring.
> Since this section was missing I was wondering if this is on purpose and
> if it is, then can someone explain why? if not, I would like maybe like
> others to create a plan and support GEB team for their work with some
> monthly donations.
>
> >>> Sponsoring GEB! <<<
>
> Best regards,
> Dani
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/f5a4fd86-cd8d-42a5-97df-6d82ef5c0589n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRL8RAJt5JnxUuzv_W3v1fi2sQUYQz65rsjMu-ZSmLwJg%40mail.gmail.com.


Re: [geb-user] Support for Angular Material

2022-03-21 Thread Marcin Erdmann
There are currently no plans to do that. I suggest you build up a library
of Geb modules for Angular Material UI yourself if you have a need for it.

Marcin

On Thu, Mar 10, 2022 at 5:43 PM Kelly Burke  wrote:

> Hi.
>
> Does Geb plan on proving built-in support for Angular Material (Google
> Material Design) applications? So engineers would be able to use built-in
> modules like `Select` and RadioButtons`, etc.
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/916626bb-5c38-4b08-a959-8788a6a84542n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTWvO%3D5BOLA6kT4PprUS%2BwCoHK8-fruM0kY_GbpUjFN%3DQ%40mail.gmail.com.


Re: [geb-user] When is Geb releasing version with Selenium 4 features

2022-02-22 Thread Marcin Erdmann
With regards to Selenium 4 support, I have a significant amount of work
done on that locally but it’s not finished. I’ve been really struggling to
find time to work on Geb recently due to work and family life
circumstances. Things are supposed to change a bit in the middle of March
so I’m hoping to have more time then and complete this work. FWIW, it’s
likely that it will be a major version bump thus a Geb 6 release as I don’t
have the bandwidth to support multiple combinations of Groovy, Spock and
Selenium at the same time.

On Sun, 20 Feb 2022 at 07:32, Alexander Kriegisch 
wrote:

> OK, I checked Geb's dependency list on mvnrepository.com, that helped me
> to determine that Geb up to 4.1 still works with Spock 1.3 and Groovy
> 2.5, so I updated my project successfully to
>
>   -- Geb 4.1,
>   -- Spock 1.3,
>   -- Groovy 2.5.14,
>   -- Selenium 3.141.59,
>   -- HtmlUnit 2.58.0.
>
> The next step would be the upgrade to Geb 5.x, Spock 2.x and Groovy 3
> (or optionally the new Spock 2.2 milestone supporting Groovy 4 already).
> I am not expecting big problems there. But the actual question about
> Selenium 4.x remains. I just want to give you some context before
> replying.
>
> --
> Alexander Kriegisch
> https://scrum-master.de
>
>
> Alexander Kriegisch schrieb am 20.02.2022 09:31 (GMT +07:00):
>
> > Sorry to dig out this old thread, but it exists and I do not want to
> > start a new one.
> >
> > https://github.com/SeleniumHQ/htmlunit-driver#version-3xx says:
> >
> >> This version is compatible with Selenium 4
> >
> > I tried bumping my old Spock/Geb sandbox project (based on Spock 1.3,
> > Groovy 2.5.14, Geb 3.0.1, Selenium 3.14.0) naively to Selenium 4.1.2
> > and Geb 5.1 (while keeping the old Spock and Groovy versions for now),
> > then also HtmlUnit Driver from 2.36.0 to 3.58.0. That does not seem to
> > work. Reverting back to Geb 3.0.1 gets me further, but reports missing
> > class org.openqa.selenium.interactions.internal.Locatable - of course,
> > because now it is named org.openqa.selenium.interactions.Locatable
> > (not "internal"). I do not know if that would just be a small change
> > in Geb or any intermediate Geb version in between 3.0.1 and 5.1 can
> > deal with the new class name, depending on which Selenium version it
> > is running on, but out of the box it does not seem to work.
> >
> > Would you mind checking again? I was hoping that due to the switch
> > from JSON Wire Protocol to WebDriver W3C protocol, some flaky tests
> > involving double-clicks, drag'n'drop and other things might become
> > more stable on more combinations of OS, browser and Java version. That
> > is just a shot into the blue, but worth a try.
> >
> > BTW, do more recent Geb versions require specific minimum Spock and
> > Groovy versions? I found no obvious hints in the Geb release notes.
> >
> >
> > On Friday, November 5, 2021 marcin@proxerd.pl wrote:
> >
> >> unfortunately no Selenium 4 compatible htmlunit driver version has
> >> been released yet and Geb's test suite depends significantly on
> >> htmlunit driver so I'm unable to verify if Geb is compatible with
> >> Selenium 4 without an htmlunit-driver version compatible with it.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/20220220073217.E52CE78C05DE%40dd19710.kasserver.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQS3%3DGc7-2rrLA8M1%3DYc%3DbNP8X3Q7SrY5309WHUzETxpA%40mail.gmail.com.


Re: [geb-user] Re: Run single Cucumber test with Geb

2022-01-22 Thread Marcin Erdmann
Hey Sanjay,

The plugin that fails to apply is very old and unmaintained - it looks that
the last release was in 2015. I doubt that it will ever work with a modern
version of Gradle. The sample you linked to is using Gradle 4 and I've
stopped maintaining it because the low interest in using Geb with Cucumber
does not justify the effort I would need to put in to find an alternative
plugin and then update the sample.

You basically have to options:
- stick to Gradle 4
- find an alternative Gradle plugin for Cucumber and then switch to using
that

Note that as I said, the use of Geb with Cucumber seems to be fairly low so
you would be in somehow uncharted territory if you went for that
combination.

Marcin

On Fri, Jan 21, 2022 at 12:49 AM Sanjay Reddy 
wrote:

> Hi All,
>
> I am trying to implement geb cucumber for my project with gradle 6.8.3 and
> groovy 2.5.14 and geb 4.1 and using the setting from
> https://github.com/geb/geb-example-cucumber-jvm/blob/master/build.gradle
>
> *1. Getting below exception, please hlep me fixing this issue:*
>
> An exception occurred applying plugin request [id:
> 'com.github.samueltbrown.cucumber', version: '0.9']
>
> Failed to apply plugin 'com.github.samueltbrown.cucumber'.
> Could not create an instance of type
> com.excella.gradle.cucumber.CucumberJvmOptions.
> > Could not find matching constructor for:
> org.gradle.process.internal.DefaultJavaForkOptions(org.gradle.api.internal.file.BaseDirFileResolver)
>
>
> 2. If any one found the solution to execute single feature then request
> you to please share.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/cd1737c9-b69f-4bfa-8774-d0f76aa747cfn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQSDKx5J4zgx-yRw2etvJjrj36LerV3xm-irEee20Mr0pw%40mail.gmail.com.


Re: [geb-user] Reporting options

2021-11-05 Thread Marcin Erdmann
How about rather than upgrade to Geb 5.0 you just create a simple test
project with a trivial tests, say going to google.com and taking a
screenshot and then trying it out with Geb 5.0 and Geb-Spock-Reports? That
would allow you to validate if things work relatively quickly yet take on
way less risk than updating your whole suite to 5.0...

On Fri, Nov 5, 2021 at 1:12 PM jc  wrote:

>  Or even better if someone knows how to contribute to geb-spock-reports to
> update it to work with Geb 5.0 that would be absolutely amazing.
>

With regards to contributing I believe the maintainer of Geb-Spock-Reports
promised to merge PRs if you submit any in
https://github.com/AOEpeople/geb-spock-reports/issues/37#issuecomment-950887176.
If you post any incompatibilities you find here then I might be able to
help guide you in what the underlying problem is and how to fix it.

Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQT0h09bWnFYbJh6F0070zNPXtTg2FDwL_XBB5woMgRQTA%40mail.gmail.com.


[geb-user] [ANN] Geb 5.1 has been released

2021-11-05 Thread Marcin Erdmann
Hi,

Version 5.1 of Geb has been released and is available from Maven Central.

This version brings compatibility with Spock's parallel execution mode.

The full list of changes is as usual available in the Book of Geb at
https://gebish.org/manual/5.1/#5-1.

Thanks,
Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRvoD%2B6NZ%3D9T61Hhv9hzvFZeMK7%3Dwi1YjXCVQOXDPVvjA%40mail.gmail.com.


Re: [geb-user] Howto Add New Methods to a Navigator?

2021-10-12 Thread Marcin Erdmann
On 2021-10-11 15:36 , Bob Brown wrote:

> I have read the doco section: “7.2.2. Navigator factory” is this the way
> to go? Provide an extension of Navigator?
>
> I like that the doco says “..get in touch via the mailing list if you need
> help.”
>
>
>
> Here I am 
>
>
LOL

The doco does say “While not as crosscutting as using a custom navigator
> factory it’s also possible to decorate navigators with additional methods
> by creating modules based on them.”
>
> So maybe:
>
> final form = $('form').module(MyModuleWithMethodsDefined)


Yes, this would be my preference - use a module to decorate a navigator.
The biggest benefit in my eyes is that IntelliJ is able to infer types
correctly and you get autocompletion/navigation to the implementation for
methods added this way while adding them via meta classes or custom
navigator factory makes everything dynamic and opaque to IntelliJ thus
significantly hindering authoring of your Geb code. Custom navigator
factories are a mechanism for this predating addition of Navigator.module()
method (in https://github.com/geb/issues/issues/311) which allows to create
instances of modules anywhere and not just in content blocks of other
modules and pages as it was the case before. That in turn made it much
simpler and concise to decorate a navigator instance with methods defined
on a module.


On Tue, Oct 12, 2021 at 9:15 AM Bob Brown  wrote:

> I ASSUME(/hope) that this is more ‘performant’ than the metaClass-hacking
> that I did before(…?)
>
> It’s a bit cleaner code, so that’s a ‘win’, regardless…
>

I'm not sure it's that much more "performant" but it wouldn't be me
immediate concern. It's definitely cleaner and easier to understand code.
And as I said, there are benefits to authoring code using such methods if
they are added that way.


>
>
> The one ‘wrinkle’ I found: if I used ‘browser.report’ within
> FlowFormDecoratorModule, it produced different results to when I used
> ‘report’ from within withFlowViewForm.
>
>
>
> This may have something to do with the fact that I am also using
> geb-spock-reports.
>
>
>
> Outside the module (directly within withFlowViewForm for example) I would
> end up with a PNG image named very specifically, and based on more than
> just the report parameter value like:
> 001-002-EX__Cold_Water__Reason_For_Call__Normal_Path-fred.png.
>
>
>
> Within the module, I couldn’t just call ‘report’ and if I called
> “browser.report ‘fred’”, I would simply get ‘fred.PNG (which didn’t play
> well with geb-spock-reports).
>
>
>
> That’s why I pass a ‘report’ closure as parameter to the module: it lets
> me use the ‘good’ report instance…
>

This is because outside of the module you are not calling Browser.report(),
you are actually calling GebReportingSpec.report() which prepends the
report name with some counters and the name of the current test. If you're
on Geb 5 then you could pass testManager to your module and call report()
on that - testManager is an instance of geb.test.GebTestManager and
GebReportingSpec actually delegates the report() method to it.


>
>
> Thanks to J. David Beutel for planting the seed…
>

And thanks to you for reading the docs - quite a lot of effort went into
them over the years and it goods to see people making use of them!

Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRvzbPW5RFB9zm4Q7eB60jDbVuy3m9vPQi5QJRVd2zHaA%40mail.gmail.com.


Re: [geb-user] JsonException error when running regression tests on cloud selenium grid

2021-10-11 Thread Marcin Erdmann
I think that this is specific to Selenium and not Geb so you might have
better luck at getting help with this if you post to Selenium support
channels.

Marcin

On Fri, Oct 8, 2021 at 12:54 PM Kasim Ak  wrote:

> We get this error on random test every time we regression with selenium
> grid on cloud.
> and i can't find a solution to this annoying JsonException error!
> any help would be appreciated!
>
> org.openqa.selenium.json.JsonException: Unable to determine type from: <.
> Last 1 characters read: < Build info: version: ' revision: '', time: ''
> System info: host: 'jenkins-master', ip: '', os.name: 'Linux',
> os.arch: '', os.version: '-', java.version: .' Driver info:
> driver.version: RemoteWebDriver at
> org.openqa.selenium.json.JsonInput.peek(JsonInput.java:122) at
> .
> .
> .
> org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:185)
> at
> java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
> at
> java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
> at
> java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
> at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
> at
> java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
> at
> java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/4dcb8208-6c1b-4147-99bd-46c9d9a70849n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTGg9LFWsS%2ByV-H6tJcwry9vEFGgYHy3gPiyH_er4-c0Q%40mail.gmail.com.


Re: [geb-user] handling random popups

2021-10-01 Thread Marcin Erdmann
As far as I know there is no way to do that. The urls generated by the app
themselves would need to be adding that parameter from urls that already
have that. Cannot the devs provide you with a way to disable that behaviour
in a more persistent way? One things that comes to mind is to persist that
it should be disabled in a cookie or http session as soon as you go to a
page with that parameter... Cause really you don't have control over urls
the app itself sends you to...

On Thu, Sep 30, 2021 at 6:50 PM medv...@gmail.com 
wrote:

> "This will only work if you navigate to the page using the to() method,
> not when you navigate by clicking in the app"
>
> Exactly that is my problem, only some pages get this parameter added to
> the url during execution. How can I get this parameter for every page?
>
> Thank you!
>
> On Thursday, September 30, 2021 at 1:03:56 PM UTC+2 marcin@proxerd.pl
> wrote:
>
>> On Thu, Sep 30, 2021 at 11:04 AM medv...@gmail.com 
>> wrote:
>>
>>> it does not work. does this really add *?qualtrics=notest* to the url
>>> when the page is loaded?
>>>
>>
>> Can't you put a breakpoint in the test after you navigate to a page with
>> the change I suggested, execute the test and when the breakpoint is reached
>> check the url in the browser? This will only work if you navigate to the
>> page using the to() method, not when you navigate by clicking in the app...
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/99448e39-b0bf-42c6-aa20-17660827ed77n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQQ7oUsPoDpUadJFSGeoQajr9fsBJ-F05jHGqpxJfkLLA%40mail.gmail.com.


Re: [geb-user] handling random popups

2021-09-30 Thread Marcin Erdmann
On Thu, Sep 30, 2021 at 11:04 AM medv...@gmail.com 
wrote:

> it does not work. does this really add *?qualtrics=notest* to the url
> when the page is loaded?
>

Can't you put a breakpoint in the test after you navigate to a page with
the change I suggested, execute the test and when the breakpoint is reached
check the url in the browser? This will only work if you navigate to the
page using the to() method, not when you navigate by clicking in the app...

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQF-0%3Deek4eGiUNu5nHvpPMpug1Xdg9om-_bU_%3D6e%3DWMQ%40mail.gmail.com.


Re: [geb-user] Major issue - Parallel execution of tests in Spock along with Geb

2021-09-10 Thread Marcin Erdmann
Daniel,

I was convinced that running Geb specs in parallel at spec level was
supported. I was about to insist that you parallelise your execution at
spec level and not feature level because getting the latter working was
more trouble than it's worth and parallelisation at spec level should
already provide a significant performance improvement as long a you don't
have massive specs with many feature methods in them. While I was looking
at what it would take to get parallelisation at feature level working I've
realised that parallelisation at spec level cannot work with the current
implementation due to some assumptions I made and I believe that
parallelisation should at minimum work at spec level so that will need
fixing. While I'm working on that I might even look at changing
GebTestManager to have thread safe implementations of all methods apart
from beforeTestClass() and afterTestClass() which should never be called
from multiple threads even when using Spock's parallel execution and also
return a different Browser instance per thread getBrowser() is called from
which would enable parallelism at feature level.

Thanks for bringing this to my attention and raising the issue, I will
reopen it.

Cheers,
Marcin

On Mon, Sep 6, 2021 at 8:04 AM Dan  wrote:

> Hi  Erdmann,
>
> Thanks for your reply, and thanks for your clarification, however having
> this limitation is not helpful for GEB and you know why, is not the same
> thing to have a suite of tests that are running in 1h versus the same suite
> of tests running in 10 minutes.
> This is a limitation only when using Spock and GEB. I've tried a setup
> using JUnit and GEB and all the instances are successfully instantiated and
> everything is working as expected. Since Spock is based on JUnit I don't
> know why a workaround would not be possible or a logic for thread safe
> execution is not in plan. As I mentioned the potential is high because of
> the time execution. Anyway I'll not be only me that will be forced to
> decide if I continue to use GEB due to this limitation or not. I liked GEB
> because of its features but in this context most probably I'll need to drop
> it off unfortunately.
>
> Thanks,
> Daniel
>
> On Saturday, September 4, 2021 at 1:54:30 PM UTC+3 marcin@proxerd.pl
> wrote:
>
>> Hi Daniel,
>>
>> I'm not surprised that running features in parallel from a single spec
>> extending GebSpecification does not work. Browser class is not thread safe
>> and Browser instance management in GebSpec/GebTestManager is not designed
>> to work when used from multiple threads. With Spock's defaultExecutionMode
>> set to CONCURRENT you are essentially using a single instance of Browser
>> from multiple threads. This does not work by design and I do not have plans
>> to change it - the amount of problems that you would have to solve far
>> outweighs the potential benefits from supporting what you are asking for. I
>> suggest that you stick to defaultSpecificationExecutionMode = CONCURRENT
>> and defaultExecutionMode = SAME_THREAD in Spock's config which together
>> with cacheDriverPerThread = true in Geb's config should work without
>> problems.
>>
>> Cheers,
>> Marcin
>>
>> On Mon, Aug 30, 2021 at 2:12 PM Dan  wrote:
>>
>>> Hello everyone,
>>>
>>> As the summary describes there is a big issue while trying to execute
>>> parallel execution along with Spock and Geb.
>>> As you know it Spock team introduced recently this feature:
>>> https://spockframework.org/spock/docs/2.0-M4/parallel_execution.html
>>> with nice execution modes. The problem is that when you want to use that
>>> feature along with GEB it will not work properly. This is my setup:
>>> Spock Config file contains: runner { parallel { enabled true } }
>>> Geb Config file contains:
>>> cacheDriverPerThread = true
>>> System.setProperty("webdriver.chrome.driver", "path to
>>> chromedriver.exe")
>>> driver = {new ChromeDriver()}
>>>
>>> Test class is a child of a custom test manager class that extends
>>> GebReportingSpec
>>> Note: In the custom test manager class I used the go baseUrl to open a
>>> specific page.
>>> CustomPage (e.g LoginPage) class is a child of a class manager that
>>> extends Page from Geb
>>>
>>> Now everything works as expected while I try to execute a test or
>>> multiple tests from a class in the traditional way (with the parallel {
>>> enabled *false *}) however when I enable the parallel option from the
>>> config file the spock tests starts in parallel BUT the GEB does not
>>> initiate the new browser instances, *all the tests are executed
>>> simultaneously on the same instance one and only leaving the new instances
>>> empty (having in the url: data;) or with the base url  mentioned in the
>>> GebConfig*!
>>> If you have cacheDriverPerThread set on false you will have the same
>>> behavior but without opening new browser instances.
>>>
>>> The big question is: Was anyone able to execute parallel tests using
>>> Spock and GEB without having this issue?
>>>
>>> I 

Re: [geb-user] Major issue - Parallel execution of tests in Spock along with Geb

2021-09-04 Thread Marcin Erdmann
Hi Daniel,

I'm not surprised that running features in parallel from a single spec
extending GebSpecification does not work. Browser class is not thread safe
and Browser instance management in GebSpec/GebTestManager is not designed
to work when used from multiple threads. With Spock's defaultExecutionMode
set to CONCURRENT you are essentially using a single instance of Browser
from multiple threads. This does not work by design and I do not have plans
to change it - the amount of problems that you would have to solve far
outweighs the potential benefits from supporting what you are asking for. I
suggest that you stick to defaultSpecificationExecutionMode = CONCURRENT
and defaultExecutionMode = SAME_THREAD in Spock's config which together
with cacheDriverPerThread = true in Geb's config should work without
problems.

Cheers,
Marcin

On Mon, Aug 30, 2021 at 2:12 PM Dan  wrote:

> Hello everyone,
>
> As the summary describes there is a big issue while trying to execute
> parallel execution along with Spock and Geb.
> As you know it Spock team introduced recently this feature:
> https://spockframework.org/spock/docs/2.0-M4/parallel_execution.html with
> nice execution modes. The problem is that when you want to use that feature
> along with GEB it will not work properly. This is my setup:
> Spock Config file contains: runner { parallel { enabled true } }
> Geb Config file contains:
> cacheDriverPerThread = true
> System.setProperty("webdriver.chrome.driver", "path to chromedriver.exe")
> driver = {new ChromeDriver()}
>
> Test class is a child of a custom test manager class that extends
> GebReportingSpec
> Note: In the custom test manager class I used the go baseUrl to open a
> specific page.
> CustomPage (e.g LoginPage) class is a child of a class manager that
> extends Page from Geb
>
> Now everything works as expected while I try to execute a test or multiple
> tests from a class in the traditional way (with the parallel { enabled *false
> *}) however when I enable the parallel option from the config file the
> spock tests starts in parallel BUT the GEB does not initiate the new
> browser instances, *all the tests are executed simultaneously on the same
> instance one and only leaving the new instances empty (having in the url:
> data;) or with the base url  mentioned in the GebConfig*!
> If you have cacheDriverPerThread set on false you will have the same
> behavior but without opening new browser instances.
>
> The big question is: Was anyone able to execute parallel tests using Spock
> and GEB without having this issue?
>
> I tried on several devices (different configurations) with several
> parameters and configs, in the end I had the same behavior, multiple
> browser instances were opened but only one of them received the tests and
> the execution of tests was at the same time for all of them. (one test
> tring to press on the Login button, another trying to write something,
> another trying to delete something) - all this actions at the same time.
>
> I've verified all the subjects related to this from the stackoverflow and
> the most important containing similar subject was this:
> https://stackoverflow.com/questions/41897862/running-spock-tests-in-parallel
>
> I've even wrote an email to Leonard who does some work for Spock but he
> suggested me to write the issue on stackoverflow and maybe erdi from GEB
> will have a look.
>
> Well I don't want to give up using this combination and I really want to
> have my tests running in parallel not via gradle but via spock along with
> GEB :)
>
> *Note*: If I use gradle task to execute them in parallel it will work BUT
> the execution is performed per class not per feature, so you will have
> class tests running in parallel (tests from a class will run one after
> another) not tests from a class running in parallel. And you must have the
> feature of parallel set on false in the SpockConfig file otherwise you will
> run test class in parallel and also tests from a class in parallel but with
> the issue that I've already mentioned.
>
> The desired behavior is to be able to execute class tests in parallel AND
> tests from a class in parallel but the initialization should be performed
> for all new browser instances.
>
> Please have a look and please let me know if this setup works for you guys
> :)
>
> Thanks :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/b807d7fa-3b64-45b7-bf3a-1830d2162752n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from 

[geb-user] [ANN] Geb 5.0 has been released

2021-08-13 Thread Marcin Erdmann
Hi,

Version 5.0 of Geb has been released and is available from Maven Central.

This is a version which is compatible with Groovy 3 and Spock 2.

The full list of changes is as usual available in the Book of Geb at
https://gebish.org/manual/5.0/#5-0.

Thanks,
Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRS8qOpV5k26-5UUQQyi%3DbuimMjk7mutCng9VEGTk4y9w%40mail.gmail.com.


Re: [geb-user] getting browser logs

2021-07-12 Thread Marcin Erdmann
The error you got suggests to me that you forgot to import LogType.BROWSER
and Level.ALL.

Marcin

On Fri, Jul 9, 2021 at 2:06 PM medv...@gmail.com  wrote:

> hi,
>
> do you have any suggestion how to include this
> https://stackoverflow.com/questions/25431380/capturing-browser-logs-with-selenium-webdriver-using-java/26488661
> into the framework to get chrome browser console logs?
>
> as this
>
>
>
> *LoggingPreferences logPrefs = new
> LoggingPreferences();logPrefs.enable(LogType.BROWSER,
> Level.ALL);caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);*
>
> gives me an error:
>
> *Caused by: groovy.lang.MissingMethodException: No signature of method:
> org.openqa.selenium.logging.LoggingPreferences.enable() is applicable for
> argument types: (ConfigObject, ConfigObject) values: [[:], [:]]*
> *Possible solutions: enable(java.lang.String, java.util.logging.Level),
> any()*
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/3cb94fa7-e8f6-4246-91ec-64c94561ce69n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTYu4sk-Gt0DVvu-t4GFmV24YudOTzYdCNnGOGSOsgPWQ%40mail.gmail.com.


Re: [geb-user] When is Geb releasing version with Selenium 4 features

2021-05-24 Thread Marcin Erdmann
Hi Varun,

I don't anticipate any work specific to Selenium 4 being done before there
is a final release - as far as I can see on Maven Central it's still in
beta. Note that there is nothing stopping you from using
NetworkInterceptor with current Geb versions - you can always obtain an
instance of WebDriver from Browser and that's all you need to use
NetworkInterceptor from what I can see. But thanks for bringing this to my
attention, we can at some point probably add some sugar to Browser to make
using NetworkInterceptor easier.

Marcin

On Wed, May 19, 2021 at 1:42 AM varun...@gmail.com 
wrote:

> Hi Marcin and Luke
>
> Any idea when the Geb version supporting new features of Selenium 4 will
> be rolled out. I am looking forward to using NetworkInterceptor to stub out
> the backend
>
> Varun
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/496e0b3e-0bab-407a-923a-60aafc400d70n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQSdh9N9vLyvP9hn5H3gagnm03DXtzhCNk2ckTeA9tkNdg%40mail.gmail.com.


Re: [geb-user] how to apply changes according listening to Page events?

2021-05-08 Thread Marcin Erdmann
Hi,

If you don't want to follow the example from
https://gebish.org/manual/current/#listening-to-page-events showing how to
register that listener via GebConfig.groovy config script then then you can
always use
https://gebish.org/manual/4.0/api/geb/Configuration.html#setPageEventListener(geb.PageEventListener)
on an instance of Configuration obtained using
https://gebish.org/manual/4.0/api/geb/Browser.html#getConfig().

Hope this helps.

Marcin

On Mon, May 3, 2021 at 10:31 AM medv...@gmail.com 
wrote:

> hi,
>
> this changed https://gebish.org/manual/current/#listening-to-page-events
> too with the newest geb versions.
>
> we had a *registerPageChangeListener * before
> https://gebish.org/manual/1.1/api/geb/Browser.html#registerPageChangeListener(geb.PageChangeListener),
> but how can I register the new *PageEventListener*?
>
> could you please give me an example?
>
> https://gebish.org/manual/current/api/geb/Configuration.html#getPageEventListener()
> does not really help me.
>
> thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/6c217efc-3a20-41c9-bd77-d2f7d3f4adc3n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTbPuWF_AWSh0exKQbsxziSOXpOa0VO3szuTpf_k%2B%2BmMw%40mail.gmail.com.


Re: [geb-user] logging for Geb 4.0 and Selenium 4.0.0-beta-2

2021-05-08 Thread Marcin Erdmann
On Friday, April 30, 2021 at 9:10:44 AM UTC+2 thok...@gmail.com wrote:

> Not sure if I am facing the same issue, but with update to Geb 4.0, and
> subsequent fine-tuning of logging dependencies
> (removing SLF4J-Implementation), we would get a lot of logging output,
> because Logback, which is pulled in by Geb,
> apparently logs at DEBUG level by default.
>
> I solved this problem for us, by creating a basic logback.xml
> configuration file, setting the"root level" to INFO.
>
> Cheers,
> Thomas


Yes, logback has unintentionally leaked as a dependency of Geb 4.0. It was
never a conscious decision to include it - in my opinion libraries should
not bring SLF4J implementations (like logback) and it should always be up
to consumer to select one if they so wish. In Geb's case logback is a
transitive dependency of org.jodd:jodd-lagarto. This has been rectified in
Geb 4.1 and logback is no longer a dependency - it's excluded
from org.jodd:jodd-lagarto transitive dependencies in Geb's pom file.

On Fri, Apr 30, 2021 at 9:17 AM medv...@gmail.com 
wrote:

> great, thank you!
>
> I set this as you wrote, traffic log entries do not appear anymore, but
> why is this
>
> *LoggingPreferences logPrefs = new LoggingPreferences()*
>
>
>
>
>
> *logPrefs.enable(LogType.BROWSER,
> Level.ALL)logPrefs.enable(LogType.CLIENT,
> Level.SEVERE)logPrefs.enable(LogType.DRIVER,
> Level.SEVERE)logPrefs.enable(LogType.PERFORMANCE,
> Level.ALL)logPrefs.enable(LogType.SERVER,
> Level.SEVERE)caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs)*
>
> ignored at all?
>
> where does this need to be set?
>

These are two separate things. Logback, on which Thomas has picked up, is
used on the client side (inside of your test JVM) and the traffic log
entires are made by Selenium in your tests. The configuration that you are
using is for logging inside of the browser and if you want these logs
logged on the client side then you actually need to retrieve as shown in
the SO answer at https://stackoverflow.com/a/25431419/1856764 and then log
it.

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQJixHtzw7X53hC_j8ffwD_YzxopUUUXh9QPDqizhDf4w%40mail.gmail.com.


Re: [geb-user] logging for Geb 4.0 and Selenium 4.0.0-beta-2

2021-04-29 Thread Marcin Erdmann
Hi,

This is more of a Selenium question than a Geb question, to be honest, you
might be provided with better support in a Selenium specific channel. This
also might be driver/browser specific.

FWIW, this is what we successfully use in our GebConfig.groovy file on my
project for capturing javascript console logging with Chrome and Selenium
3.14.0:

def capabilities = DesiredCapabilities.chrome()
def logPrefs = new LoggingPreferences()
logPrefs.enable(BROWSER, Level.INFO)
capabilities.setCapability(LOGGING_PREFS, logPrefs)

def driver = new ChromeDriver(capabilities)

We then use the following code in a geb.report.Reporter implementation to
extract these logs:

reportState.browser.config.driver.manage().logs().get(LogType.BROWSER).all

On Tue, Apr 27, 2021 at 11:44 AM medv...@gmail.com 
wrote:

> hi,
> do you know how and where to configure logging for logging for Geb 4.0 and
> Selenium 4.0.0-beta-2?
>
> I set the following in GebConfig
>
>
>
>
>
> *LoggingPreferences logPrefs = new
> LoggingPreferences()logPrefs.enable(LogType.BROWSER,
> Level.FINE)logPrefs.enable(LogType.PERFORMANCE,
> Level.INFO)caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs)*
>
> and I get only traffic logs, everything is logged there, so many traffic
> logs nothing else can be seen.
>
> how do I set logging to get chrome console logs and "usual" logs (which
> show how the script behaves)?
>
> thank you!
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/f5a0cd40-21de-4cd3-966e-105f70beeb14n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTXqJ1guqNNm2wMMyo1q%3D_5xO_D9EwzWAKAg5ApCmZo4g%40mail.gmail.com.


[geb-user] [ANN] Geb 4.1 has been released

2021-04-12 Thread Marcin Erdmann
Hi,

Version 4.1 of Geb has been released and is available from Maven Central.

This version contains a number of minor bug fixes and improvements.

The full list of changes is as usual available in the Book of Geb at
https://gebish.org/manual/4.1/#4-1.

Thanks,
Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTkUuAFuA9onKTk%3DS06kLGfJKxb6K2%2Bn%3Dz0AxbTAUeZfw%40mail.gmail.com.


Re: [geb-user] Cannot compile after upgrade

2021-04-12 Thread Marcin Erdmann
I'm glad that you managed to get it working. :)

On Mon, Apr 12, 2021 at 5:49 PM medv...@gmail.com 
wrote:

> There was a mistake on my side, everything is working with the new
> versions.
> Thank you Marcin!
>
> On Monday, April 12, 2021 at 4:58:09 PM UTC+2 medv...@gmail.com wrote:
>
>> I managed to compile using *gradle-6.8.3* and
>>
>>
>>
>>
>>
>>
>> *groovyVersion = '2.5.13'gebVersion = '4.0'seleniumVersion =
>> '4.0.0-beta-2'chromeDriverVersion = '89.0.4389.23'firefoxDriverVersion =
>> '0.29.0'*
>> *ieDriverVersion = '3.150.0'*
>>
>> but noticed that *.present* does not work anymore, also
>> *PageChangeListener *got deprecated.
>>
>> I only changed the versions in order to compile succesfully, did not
>> change the structure.
>>
>> None of my testscripts work anymore, e.g.
>>
>> *waitFor { MasterModule.cookieButtonUserCentrics.displayed }*
>>
>> does not seem to be working, altough the element is shown on the
>> screenshot, putting *sleep* before the *waitFor* does not help.
>>
>> *condition did not pass in 15 seconds (failed with exception)*
>> *geb.waiting.WaitTimeoutException: condition did not pass in 15 seconds
>> (failed with exception)*
>> * at geb.waiting.Wait.waitFor(Wait.groovy:124)*
>> * at
>> geb.waiting.DefaultWaitingSupport.doWaitFor(DefaultWaitingSupport.groovy:50)*
>> * at
>> geb.waiting.DefaultWaitingSupport.waitFor(DefaultWaitingSupport.groovy:37)*
>> * at geb.Page.waitFor(Page.groovy:116)*
>> * at geb.Browser.methodMissing(Browser.groovy:225)*
>> * at geb.spock.GebSpec.methodMissing(GebSpec.groovy:1)*
>> * at
>> com.bechtle.test.functional.specifications.next.shared.MasterTestSpec.Test:
>> Initialization(MasterTestSpec.groovy:127)*
>> *Caused by: groovy.lang.MissingPropertyException: No such property:
>> cookieButtonUserCentrics for class:
>> com.bechtle.test.functional.modules.next.hardware.MasterModule*
>> * at
>> com.bechtle.test.functional.specifications.next.shared.MasterTestSpec.Test:
>> Initialization_closure36(MasterTestSpec.groovy:127)*
>> * at
>> com.bechtle.test.functional.specifications.next.shared.MasterTestSpec.Test:
>> Initialization_closure36(MasterTestSpec.groovy)*
>> * at geb.waiting.Wait.waitFor(Wait.groovy:113)*
>> * ... 6 more*
>>
>> Did so many things change with Geb version 4.0?
>>
>> Thank you Marcin for your support!
>> On Monday, April 12, 2021 at 1:46:30 PM UTC+2 marcin@proxerd.pl
>> wrote:
>>
>>> I would suggest sticking to Gradle 6.8.3 - the plugin is built and
>>> tested with the 6.x line so it might or might not work with 7.0. Also,
>>> because the plugin is not resolved from the portal but provided on the
>>> build script classpath you will need to use the "legacy" plugin application
>>> syntax:
>>>
>>> apply plugin: "geb-saucelabs"
>>>
>>> On Mon, Apr 12, 2021 at 7:22 AM medv...@gmail.com 
>>> wrote:
>>>
 I get the same with gradle 6.8.3:

 *Plugin [id: 'geb-saucelabs'] was not found in any of the following
 sources:*

 *- Gradle Core Plugins (not a core plugin, please see
 https://docs.gradle.org/6.8.3/userguide/standard_plugins.html
  for
 available core plugins)*
 *- Plugin Repositories (plugin dependency must include a version number
 for this source)*
 *Open File*

 On Monday, April 12, 2021 at 8:18:58 AM UTC+2 medv...@gmail.com wrote:

> I installed gradle 7.0 and added the code:
>
>
>
>
>
>
>
>
>
>
> *buildscript { repositories { mavenCentral() } dependencies {
> classpath 'org.gebish:geb-gradle:4.0' }}*
>
>
>
>
>
>
>
>
> *plugins { id "idea" id "groovy" id
> "com.github.erdi.webdriver-binaries" version "2.2" id
> "com.github.erdi.idea-base" version "2.2" id "geb-saucelabs"}*
>
> *repositories { jcenter()*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *}ext { drivers = ["remoteChromeK8s", "sauceLabsEdgeWin10",
> "remoteChromeCapeK8s", "remoteChromeDockerStandalone"] ext { groovyVersion
> = ' 2.5.13' gebVersion = '4.0' seleniumVersion = '4.0.0-beta-2'
> chromeDriverVersion = ' 89.0.4389.23' firefoxDriverVersion = '0.29.0'
> ieDriverVersion = ' 3.150.1' javaxMailVersion = '1.4.7' }}*
>
>
> but still get this error:
>
> *Plugin [id: 'geb-saucelabs'] was not found in any of the following
> sources:*
>
> *- Gradle Core Plugins (not a core plugin, please see
> https://docs.gradle.org/7.0/userguide/standard_plugins.html
>  for 
> available
> core plugins)*
> *- Plugin Repositories (plugin dependency must include a version
> number for this source)*
> *Open File*
>
>
> On Wednesday, April 7, 2021 at 9:09:30 PM UTC+2 marcin@proxerd.pl
> wrote:
>
>> If you are still using Gradle 3.x as you have 

Re: [geb-user] Cannot compile after upgrade

2021-04-12 Thread Marcin Erdmann
I would suggest sticking to Gradle 6.8.3 - the plugin is built and tested
with the 6.x line so it might or might not work with 7.0. Also, because the
plugin is not resolved from the portal but provided on the build script
classpath you will need to use the "legacy" plugin application syntax:

apply plugin: "geb-saucelabs"

On Mon, Apr 12, 2021 at 7:22 AM medv...@gmail.com 
wrote:

> I get the same with gradle 6.8.3:
>
> *Plugin [id: 'geb-saucelabs'] was not found in any of the following
> sources:*
>
> *- Gradle Core Plugins (not a core plugin, please see
> https://docs.gradle.org/6.8.3/userguide/standard_plugins.html
>  for
> available core plugins)*
> *- Plugin Repositories (plugin dependency must include a version number
> for this source)*
> *Open File*
>
> On Monday, April 12, 2021 at 8:18:58 AM UTC+2 medv...@gmail.com wrote:
>
>> I installed gradle 7.0 and added the code:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *buildscript { repositories { mavenCentral() } dependencies { classpath
>> 'org.gebish:geb-gradle:4.0' }}*
>>
>>
>>
>>
>>
>>
>>
>>
>> *plugins { id "idea" id "groovy" id "com.github.erdi.webdriver-binaries"
>> version "2.2" id "com.github.erdi.idea-base" version "2.2" id
>> "geb-saucelabs"}*
>>
>> *repositories { jcenter()*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *}ext { drivers = ["remoteChromeK8s", "sauceLabsEdgeWin10",
>> "remoteChromeCapeK8s", "remoteChromeDockerStandalone"] ext { groovyVersion
>> = ' 2.5.13' gebVersion = '4.0' seleniumVersion = '4.0.0-beta-2'
>> chromeDriverVersion = ' 89.0.4389.23' firefoxDriverVersion = '0.29.0'
>> ieDriverVersion = ' 3.150.1' javaxMailVersion = '1.4.7' }}*
>>
>>
>> but still get this error:
>>
>> *Plugin [id: 'geb-saucelabs'] was not found in any of the following
>> sources:*
>>
>> *- Gradle Core Plugins (not a core plugin, please see
>> https://docs.gradle.org/7.0/userguide/standard_plugins.html
>>  for available
>> core plugins)*
>> *- Plugin Repositories (plugin dependency must include a version number
>> for this source)*
>> *Open File*
>>
>>
>> On Wednesday, April 7, 2021 at 9:09:30 PM UTC+2 marcin@proxerd.pl
>> wrote:
>>
>>> If you are still using Gradle 3.x as you have indicated on the issue you
>>> created in the tracker then you will need to upgrade to the Gradle 6.x line
>>> if you want to upgrade to Geb 4.0. I'm not sure what would be the minimum
>>> version supported so best to just up it to the latest which is 6.8.3 and
>>> which will work for sure. Secondly, you will need to bring back the
>>> dependency on org.gebish:geb-gradle to you build script's classpath because
>>> these plugins are not published to Gradle plugin portal but they are
>>> published to Maven Central as they predate the Gradle plugin portal.
>>>
>>> buildscript {
>>> repositories {
>>> mavenCentral()
>>> }
>>> dependencies {
>>> classpath 'org.gebish:geb-gradle:4.0'
>>> }
>>> }
>>>
>>> On Wed, Apr 7, 2021 at 7:58 PM medv...@gmail.com 
>>> wrote:
>>>
 hi,

 I cannot compile after upgrade using following code:

 *plugins { *
 * id "idea" *
 * id "groovy" *
 * id "com.github.erdi.webdriver-binaries" version "2.2" *
 * id "com.github.erdi.idea-base" version "2.2" *
 * id "geb-saucelabs" *
 *}*
 * ext { *
 * drivers = ["remoteChromeK8s", *
 * "sauceLabsEdgeWin10", *
 * "remoteChromeCapeK8s", *
 * "remoteChromeDockerStandalone"] *
 * ext { *
 * groovyVersion = ' 2.5.13' *
 * gebVersion = '4.0' *
 * seleniumVersion = '4.0.0-beta-2' *
 * chromeDriverVersion = ' 89.0.4389.23' *
 * firefoxDriverVersion = '0.29.0' *
 * ieDriverVersion = ' 3.150.1' *
 * javaxMailVersion = '1.4.7' *
 * } *
 *} *
 * repositories { *
 *   jcenter() *
 *}*

 Getting this error:

 *Plugin [id: 'geb-saucelabs'] was not found in any of the following
 sources:*

 *- Gradle Core Plugins (not a core plugin, please see
 https://docs.gradle.org/4.8.1/userguide/standard_plugins.html
  for
 available core plugins)*
 *- Plugin Repositories (plugin dependency must include a version number
 for this source)*

 Any ideas what could be wrong?
 Thank you!

 --
 You received this message because you are subscribed to the Google
 Groups "Geb User Mailing List" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to geb-user+u...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/geb-user/eddb40c1-6c8b-4d1c-ab76-87dc1c72d0ebn%40googlegroups.com
 
 .

>>> --
> You 

Re: [geb-user] Cannot compile after upgrade

2021-04-07 Thread Marcin Erdmann
If you are still using Gradle 3.x as you have indicated on the issue you
created in the tracker then you will need to upgrade to the Gradle 6.x line
if you want to upgrade to Geb 4.0. I'm not sure what would be the minimum
version supported so best to just up it to the latest which is 6.8.3 and
which will work for sure. Secondly, you will need to bring back the
dependency on org.gebish:geb-gradle to you build script's classpath because
these plugins are not published to Gradle plugin portal but they are
published to Maven Central as they predate the Gradle plugin portal.

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gebish:geb-gradle:4.0'
}
}

On Wed, Apr 7, 2021 at 7:58 PM medv...@gmail.com  wrote:

> hi,
>
> I cannot compile after upgrade using following code:
>
> *plugins { *
> * id "idea" *
> * id "groovy" *
> * id "com.github.erdi.webdriver-binaries" version "2.2" *
> * id "com.github.erdi.idea-base" version "2.2" *
> * id "geb-saucelabs" *
> *}*
> * ext { *
> * drivers = ["remoteChromeK8s", *
> * "sauceLabsEdgeWin10", *
> * "remoteChromeCapeK8s", *
> * "remoteChromeDockerStandalone"] *
> * ext { *
> * groovyVersion = ' 2.5.13' *
> * gebVersion = '4.0' *
> * seleniumVersion = '4.0.0-beta-2' *
> * chromeDriverVersion = ' 89.0.4389.23' *
> * firefoxDriverVersion = '0.29.0' *
> * ieDriverVersion = ' 3.150.1' *
> * javaxMailVersion = '1.4.7' *
> * } *
> *} *
> * repositories { *
> *   jcenter() *
> *}*
>
> Getting this error:
>
> *Plugin [id: 'geb-saucelabs'] was not found in any of the following
> sources:*
>
> *- Gradle Core Plugins (not a core plugin, please see
> https://docs.gradle.org/4.8.1/userguide/standard_plugins.html
>  for
> available core plugins)*
> *- Plugin Repositories (plugin dependency must include a version number
> for this source)*
>
> Any ideas what could be wrong?
> Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/eddb40c1-6c8b-4d1c-ab76-87dc1c72d0ebn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQSefxi9P3Bh5o4BaQpOXo%2BdQGo3zPS1h%2BNU26rM%3D9qO1A%40mail.gmail.com.


Re: [geb-user] Exception when using Select element

2021-02-27 Thread Marcin Erdmann
Thomas,

You seem to be living on the bleeding edge using these alpha releases...
What is the reason for using Selenium 4 in your case? Does downgrading to
the latest version in the 3.x line fix the issues?

Marcin

On Fri, Feb 26, 2021 at 4:48 PM Thomas Hirsch  wrote:

> Hi Marcin,
>
> currently I am using these versions:
>
>- Gradle: org.seleniumhq.selenium:selenium-http:4.0.0-alpha-7
>- Gradle: org.seleniumhq.selenium:selenium-devtools:4.0.0-alpha-7
>- Gradle: org.seleniumhq.selenium:selenium-json:4.0.0-alpha-7
>- Gradle:
>org.seleniumhq.selenium:selenium-chromium-driver:4.0.0-alpha-7
>- Gradle: org.seleniumhq.selenium:selenium-chrome-driver:4.0.0-alpha-7
>- Gradle: org.seleniumhq.selenium:selenium-api:4.0.0-alpha-7
>- Gradle: org.seleniumhq.selenium:selenium-remote-driver:4.0.0-alpha-7
>- Gradle: org.seleniumhq.selenium:selenium-support:4.0.0-alpha-7
>
> There is another similar error, that I encountered, I will also put the
> stack trace here.
> Is is another error, this time it is not related to operation of a Select
> element, instead it occurs as a result of a StaleElementReferenceException.
>
> Again, the problem is not what the test does, but what kind of exception
> it produces.
> I have the impression this only occurs on my local machine (Chrome/MacOS),
> and not when running against the Docker-Selenium-Grid, but this is hard to
> confirm.
>
> The NoClassDefFoundError is just really puzzling...
> It's not a blocker for me, but I just wanted to show you this, just in
> case.
>
> I can understand what it's telling me, that the test is unstable, either
> the Select is not fully loaded on the page yet, and in the other case
> below, a StaleElementReferenceException occurs, both of these things are
> very plausible, in fact I am exactly trying to work around those respective
> problems in those places.
> I have seen this in the past, and I thought it might be a result of
> incompatible library versions, so I didn't bother about it right way,
> assuming it might go away after some updates.
> But even after several chromedriver and Selenium upgrades, the error still
> seems to happen.
>
> The other stacktrace:
> ```
> condition did not pass in 30 seconds (failed with exception)
> geb.waiting.WaitTimeoutException: condition did not pass in 30 seconds
> (failed with exception)
> at geb.waiting.Wait.waitFor(Wait.groovy:124)
> at
> geb.waiting.DefaultWaitingSupport.doWaitFor(DefaultWaitingSupport.groovy:50)
> at
> geb.waiting.DefaultWaitingSupport.waitFor(DefaultWaitingSupport.groovy:37)
> at geb.Module.waitFor(Module.groovy:124)
> at 
> at
> geb.content.TemplateDerivedPageContent.methodMissing(TemplateDerivedPageContent.groovy:98)
> at
> spec.now.ui.PacklinkSpec.disconnect_and_delete_Packlink_shipping_method_if_configured_closure7(PacklinkSpec.groovy:330)
> at groovy.lang.Closure.call(Closure.java:412)
> at groovy.lang.Closure.call(Closure.java:428)
> at 
> at 
> Caused by: java.lang.NoClassDefFoundError:
> org.openqa.selenium.StaleElementReferenceException (initialization failure)
> at
> java.base/java.lang.J9VMInternals.initializationAlreadyFailed(J9VMInternals.java:136)
> at
> org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:196)
> at
> org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:129)
> at
> org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:53)
> at
> org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:167)
> at
> org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:123)
> at
> org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:501)
> at
> org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:238)
> at
> org.openqa.selenium.remote.RemoteWebElement.findElements(RemoteWebElement.java:222)
> at org.openqa.selenium.By$ByCssSelector.findElements(By.java:482)
> at
> org.openqa.selenium.remote.RemoteWebElement.findElements(RemoteWebElement.java:188)
> at
> geb.navigator.SearchContextBasedBasicLocator.elementsSupplier_closure8$_closure12(SearchContextBasedBasicLocator.groovy:199)
> at groovy.lang.Closure.call(Closure.java:412)
> at groovy.lang.Closure.call(Closure.java:428)
> at
> geb.navigator.SearchContextBasedBasicLocator.elementsSupplier_closure8(SearchContextBasedBasicLocator.groovy:199)
> at groovy.lang.Closure.call(Closure.java:412)
> at
> geb.navigator.SearchContextBasedBasicLocator.toNavigator(SearchContextBasedBasicLocator.groovy:223)
> at
> geb.navigator.SearchContextBasedBasicLocator.find(SearchContextBasedBasicLocator.groovy:186)
> at
> geb.navigator.SearchContextBasedBasicLocator.find(SearchContextBasedBasicLocator.groovy:55)
> at geb.navigator.DefaultLocator.find(DefaultLocator.groovy:22)
> at geb.navigator.DefaultLocator.find(DefaultLocator.groovy:31)
> at 

Re: [geb-user] Exception when using Select element

2021-02-26 Thread Marcin Erdmann
Thomas,

I agree that it's surprising that you are getting this exception as
org.openqa.selenium.NotFoundException is indeed part of selenium-api
artifact. On thing that surprises me further is that I don't see
org.openqa.selenium.NotFoundException being used in
Select.findOptionsByValue(), at least not in 3.141.59. What is the version
of selenium-support and selenium-api artifacts that you have on the
classpath?

Cheers,
Marcin

On Thu, Feb 25, 2021 at 3:28 PM Thomas Hirsch  wrote:

> Hi,
> sometimes a test of mine fails with this stacktrace:
>
> ```
> java.lang.NoClassDefFoundError: Could not initialize class
> org.openqa.selenium.NotFoundException
> at
> org.openqa.selenium.support.ui.Select.findOptionsByValue(Select.java:287)
> at
> org.openqa.selenium.support.ui.Select.selectByValue(Select.java:190)
> at
> geb.navigator.DefaultNavigator.setSelectValue(DefaultNavigator.groovy:988)
> at
> geb.navigator.DefaultNavigator.setInputValue(DefaultNavigator.groovy:931)
> at
> geb.navigator.DefaultNavigator.setInputValues_closure56(DefaultNavigator.groovy:922)
> at groovy.lang.Closure.call(Closure.java:412)
> at
> geb.navigator.DefaultNavigator.setInputValues(DefaultNavigator.groovy:921)
> at
> geb.navigator.DefaultNavigator.value(DefaultNavigator.groovy:652)
> at
> geb.content.TemplateDerivedPageContent.value(TemplateDerivedPageContent.groovy:34)
> at
> geb.content.PageContentSupport.propertyMissing(PageContentSupport.groovy:54)
> at geb.Page.propertyMissing(Page.groovy:110)
> at geb.Browser.propertyMissing(Browser.groovy:239)
> at geb.spock.GebSpec.propertyMissing(GebSpec.groovy:1)
> at ...
> ```
> The line in the spec is using the assignment operator, i.e. `myElement =
> myValue` where `myElement` is a Geb navigator pointing to a HTML-Select
> element.
>
> Regardless of what the test does, I would like to understand how this
> Exception can even happen. The class is present in my library list, it is
> part of the selenium-api package, which (I assume) Geb depends on.
>
> Thomas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/ecd08d16-afcf-495e-93a3-c2a23b9b25een%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQR2VHddPcUDjNpa7wnBFQrnzzB%2Bo%3DUf5bQQNrvdP296Ag%40mail.gmail.com.


Re: [geb-user] get access to driver in AbstractGlobalExtension

2021-01-05 Thread Marcin Erdmann
>
> Alexander Kriegisch schrieb am 05.01.2021 09:28 (GMT +07:00):
>
> > I forgot to mention: A SpecInfo is just meta information, the best you
> > can get from there is the spec class in order wo rewrite the 'if' as
> >
> > if (GebSpec.isAssignableFrom(iteration.feature.spec.reflection))
> >
> > But then you are at a dead end if you need the actual specification
> > instance because you cannot get it, so there is no way to access its
> > fields or methods like 'getDriver()' from there either. This is why
> > Marcin's approach to use an IMethodInterceptor is exactly right. From
> > the 'IMethodInvocation invocation' parameter you can easily get the
> > instance, while from an 'IterationInfo iteration' you cannot. So you
> > see, my quick & dirty hack without running the code is fundamentally
> > wrong on several levels.
> >
> >
> > Alexander Kriegisch schrieb am 05.01.2021 08:41 (GMT +07:00):
> >
> >>>> I get this error
> >>>>
> >>>> Cannot cast object 'org.spockframework.runtime.model.SpecInfo@73f38e62
> '
> >>>> with class 'org.spockframework.runtime.model.SpecInfo' to class
> >>>> 'geb.spock.GebSpec'
> >>
> >> The simple answer is: I was sloppy and wish too apologise for it. This
> >> is the perfect example why I keep telling the teams I coach: "If you are
> >> sloppy, you either have to do it twice or someone else has to clean up
> >> after you." The latter was the case: Marcin cleaned up after me and I am
> >> feeling embarrassed. So in order to learn a lesson from this, let me
> >> describe what happened:
> >>
> >> -- I added the 'afterIteration' method to my existing extension for
> >> which also a test using it exists.
> >> -- The existing test is a simple Spock test, not a Geb test.
> >> -- Looking at 'if (iteration.feature.spec instanceof GebSpec)', first
> >> of all there is a bug because despite the suggestive property name
> >> 'spec' (which in reality is a method name 'getSpec') the return
> >> value is an instance of SpecInfo, not of Specification. Maybe the
> >> getter should have been named 'getSpecInfo', but anyway it was my
> >> mistake. I did not actually run or debug is, just quickly hacked it
> >> into my IDE using code completion. Secondly, even if this piece of
> >> code would have been correct, I do not really have a GebSpec
> >> running this extension which would make the code enter the 'if'
> >> block. Double mess-up!
> >> -- I actually never planned to run the code because I do not have
> >> access to your 'takeScreenshot' method, simply because you did not
> >> provide it in your original question. So for me it was pseudo code
> >> and I was too lazy to create a dummy 'takeScreenshot' method just
> >> logging something or whatever.
> >>
> >> I wanted to save time and just help getting you started. My main
> >> objective was to convince you to try GebReportingSpec anyway, like I
> >> said. But the sample code was just sloppy. Thanks to Marcin for cleaning
> >> up my mess!
> >>
> >>
> >> Marcin Erdmann schrieb am 05.01.2021 04:10 (GMT +07:00):
> >>>
> >>> Unfortunately the code provided by Alexander is not quite right. You
> >>> cannot obtain an instance of the spec in an AbstractRunListener because
> >>> it's not available on IterationInfo. You will need to combine an
> >>> AbstractRunListener with an IMethodInterceptor, like
> >>> geb.spock.OnFailureReporter which ships with Geb does. The adapted
> example
> >>> from Alexander would look like this:
> >>>
> >>>
> >>> import geb.spock.GebSpec
> >>> import org.spockframework.runtime.AbstractRunListener
> >>> import org.spockframework.runtime.extension.AbstractGlobalExtension
> >>> import org.spockframework.runtime.extension.IMethodInterceptor
> >>> import org.spockframework.runtime.extension.IMethodInvocation
> >>> import org.spockframework.runtime.model.ErrorInfo
> >>> import org.spockframework.runtime.model.SpecInfo
> >>>
> >>> class TestResultExtension extends AbstractGlobalExtension {
> >>> @Override
> >>> void visitSpec(SpecInfo spec) {
> >>> def reporter = new ErrorReporter()
> >>> spec.addListener(reporter)
> >>> spec.allFeatures*.addIterationInterceptor(reporter)
> >>> }
> >>>
> >>> static class ErrorReporter extends AbstractRunLi

Re: [geb-user] get access to driver in AbstractGlobalExtension

2021-01-04 Thread Marcin Erdmann
Unfortunately the code provided by Alexander is not quite right. You cannot
obtain an instance of the spec in an AbstractRunListener because it's not
available on IterationInfo. You will need to combine an AbstractRunListener
with an IMethodInterceptor, like geb.spock.OnFailureReporter which ships
with Geb does. The adapted example from Alexander would look like this:

import geb.spock.GebSpec
import org.spockframework.runtime.AbstractRunListener
import org.spockframework.runtime.extension.AbstractGlobalExtension
import org.spockframework.runtime.extension.IMethodInterceptor
import org.spockframework.runtime.extension.IMethodInvocation
import org.spockframework.runtime.model.ErrorInfo
import org.spockframework.runtime.model.SpecInfo

class TestResultExtension extends AbstractGlobalExtension {
@Override
void visitSpec(SpecInfo spec) {
def reporter = new ErrorReporter()
spec.addListener(reporter)
spec.allFeatures*.addIterationInterceptor(reporter)
}

static class ErrorReporter extends AbstractRunListener implements
IMethodInterceptor {

GebSpec specInstance

@Override
void error(ErrorInfo error) {
if (specInstance) {
def driver = specInstance.driver
driver.manage().window().maximize()
takeScreenshot(driver)
}
}

@Override
void intercept(IMethodInvocation invocation) throws Throwable {
def specInstance = invocation.instance
if (specInstance instanceof GebSpec) {
this.specInstance = specInstance
}

try {
invocation.proceed()
} finally {
this.specInstance = null
}
}
}
}

On Mon, Jan 4, 2021 at 4:20 PM GebUser  wrote:

> where is this "driver" coming from?
> def driver = (iteration.feature.spec as GebSpec).*driver  *
>
> I get this error
> Cannot cast object 'org.spockframework.runtime.model.SpecInfo@73f38e62'
> with class 'org.spockframework.runtime.model.SpecInfo' to class
> 'geb.spock.GebSpec'
>
>
> On Monday, December 21, 2020 at 8:23:55 PM UTC-5 alex...@kriegisch.name
> wrote:
>
>> Hi.
>>
>> I hope it is okay, even though I am not Marcin. ;-)
>>
>> It looks like you you found the sample code in my SO answer here:
>> https://stackoverflow.com/a/50679606/1082681
>>
>> Before we continue, making a possibly simple thing complicated: Are you
>> aware of the fact that if your specification extends GebReportingSpec,
>> it will by default have a screenshot reporter, so by a statement like
>> "report 'my screenshot'" you can just take a screenshot and it will
>> automatically take a screenshot if the test fails?
>>
>> See https://gebish.org/manual/current/#testing-reporting and also search
>> the Book of Geb for "reporting" or "reporter". Just lately someone here
>> in this group posted about how to write a custom reporter in order to
>> use AShot for full page screenshot (if the page is bigger than the
>> viewport or even bigger than the screen size).
>>
>> Now, having the basic information out of the way and assuming for a
>> minute that the default screenshot reporter or even a custom reporter
>> are inadequate for you (which I don't believe, BTW), here is how from
>> your global Spock extension's RunListener you could in principle access
>> browser and driver: First you need to get access to the specification
>> instance, then check if it is really a Geb specification (because not
>> every Spock spec is a Geb spec) and if so, you can use its methods in
>> order to access browser and driver:
>>
>> 
>>
>> package de.scrum_master.testing.extension
>>
>> import geb.spock.GebSpec
>> import org.spockframework.runtime.AbstractRunListener
>> import org.spockframework.runtime.extension.AbstractGlobalExtension
>> import org.spockframework.runtime.model.ErrorInfo
>> import org.spockframework.runtime.model.IterationInfo
>> import org.spockframework.runtime.model.SpecInfo
>> /**
>> * See https://stackoverflow.com/a/50679606/1082681
>> */
>> class TestResultExtension extends AbstractGlobalExtension {
>> @Override
>> void visitSpec(SpecInfo spec) {
>> spec.addListener(new ErrorListener())
>> }
>>
>> static class ErrorListener extends AbstractRunListener {
>> ErrorInfo errorInfo
>>
>> @Override
>> void beforeIteration(IterationInfo iteration) {
>> errorInfo = null
>> }
>>
>> @Override
>> void error(ErrorInfo error) {
>> errorInfo = error
>> }
>>
>> @Override
>> void afterIteration(IterationInfo iteration) {
>> if (iteration.feature.spec instanceof GebSpec) {
>> def driver = (iteration.feature.spec as GebSpec).driver
>> driver.manage().window().maximize()
>> takeScreenshot(driver)
>> }
>> }
>>
>> }
>> }
>>
>> 
>>
>> BTW, you could also check if the spec is an instance of GebReportingSpec
>> and 

[geb-user] [ANN] Geb 4.0 has been released

2020-12-28 Thread Marcin Erdmann
Hi,

Version 4.0 of Geb has been released and is available from Maven Central.

The main change in this new major version is that integrations with test
frameworks were extracted into GebTestManager which helped to remove
duplication and will make integrations with test frameworks easier in the
future. Introduction of GebTestManager required base test classes that Geb
ships with to be changed in a backwards incompatible way -  you should not
be affected by that unless you overrode methods defined on these classes.
All this was prompted by the introduction of support for JUnit 5 which
proved to be enough stimulus to improve code reuse in that area.

The full list of changes in this release is as usual available from the
Book of Geb at https://gebish.org/manual/current/#4-0.

Thanks,
Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTctCbjg5POPZhpkGt0bra5HMbL2smr%3Dbg5pMwVr5zUVw%40mail.gmail.com.


Re: [geb-user] closing a Pop-up opens creates another pop-up

2020-12-10 Thread Marcin Erdmann
I believe you will need to use nested withConfirm() calls in this case:

def firstPopupText
def secondPopupText

secondPopupText = withConfirm(true) {
firstPopupText = withConfirm(true) { clickSubmitBtn() }
}

I've not tested it but I checked the implementation and there's also a test
for nested confirms (geb.AlertAndConfirmHandlingSpec.nested confirms) so
I'm fairly sure it will work.

Marcin

On Thu, Dec 10, 2020 at 8:12 PM GebUser  wrote:

> hi,
> How can I handle this situation with Geb WithAlert?
> 1)click a submit button opens opo-up # 1
> 2) Verify text in pop-up #1 and click OK button to close it
> 3) Closing pop-up # 1 opens pop-up #2
> 4)Verify text in pop-up # 2 and click OK button to close it
>
> I tried the following command but it is closing both the pop-ups
>
> withConfirm(true) {clickSubmitBtn()} == "Are you sure you want tosubmit?"}
>
> Thanks,
> Ramesh
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/547af3b6-3450-4ab3-b153-66ce598e0117n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQS3K07h_R2hZ44h7pcmxnAn4bhR9J7yLbvY%3DtRibqMO9A%40mail.gmail.com.


Re: [geb-user] Pronunciation

2020-12-10 Thread Marcin Erdmann
For what it's worth, the pronunciation is also described in the pom:
https://search.maven.org/artifact/org.gebish/geb-core/3.4.1/jar. Apparently
Luke Daley, who started the project, thought that tweaking the
pronunciation will make the name more "catchy". So funny that ten years
down the line this still comes up. :D

Btw, if you ever wondered what the meaning of Geb is, like I did a couple
of years ago which made me ask Luke, then it stands for "groovy web".

Marcin

On Thu, Dec 10, 2020 at 4:40 PM Ben Frey  wrote:

> Haha, the one place I didn't check, the readme! Thanks folks. I'd been
> leaning towards "jeb" as well.
>
> On Thursday, December 10, 2020 at 11:39:43 AM UTC-5 thok...@gmail.com
> wrote:
>
>> It's called "jeb", it is mentioned in the GitHub-repo's README.
>> https://github.com/geb/geb
>> I think it was also mentioned on the gebsh.org homepage, but apparently
>> it is not (anymore).
>>
>> Am 10.12.2020 17:36 schrieb Ben Frey:
>> > This is a question that's come up on my team: how is Geb pronounced;
>> > with a hard g like "gutter" or a soft g like "gem"?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Geb User Mailing List" group.
>> > To unsubscribe from this group and stop receiving emails from it,
>> > send an email to geb-user+u...@googlegroups.com.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/geb-user/afc0240c-128d-4918-939d-0cd03006a622n%40googlegroups.com
>> > [1].
>> >
>> >
>> > Links:
>> > --
>> > [1]
>> >
>> https://groups.google.com/d/msgid/geb-user/afc0240c-128d-4918-939d-0cd03006a622n%40googlegroups.com?utm_medium=email_source=footer
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/74853b22-a1c7-4abe-8ada-47fefd135514n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQT9vrULgBT7W6M9U%2BnLMZQ-adh5-T4VHapi8nD6X7OPAQ%40mail.gmail.com.


Re: [geb-user] Take screenshot of entire page

2020-12-09 Thread Marcin Erdmann
I believe this is WebDriver implementation specific. I know that Firefox,
at least at some point in the past, would take screenshots of the whole
page and not just the viewport and that's what would end up in Geb reports
when using Firefox as the browser. If you would like a cross browser
solution for that then you need to write a custom reporter which would
employ something like AShot(https://github.com/pazone/ashot). This section
of their docs might be helpful:
https://github.com/pazone/ashot#capturing-the-entire-page.

On Wed, Dec 9, 2020 at 2:22 PM Ben Frey  wrote:

> Currently, when using the default reporter, the report command results in
> a screenshot of the current viewport. Is there a way to capture the entire
> rendered page without manual scrolling?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/a303727c-5c40-448d-b194-579feaf4a436n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTNLxpvmNJeQbTdqz%2BdNR6qPYt5fEZTXE1e4a_%2BEaF1rA%40mail.gmail.com.


Re: [geb-user] Strange behavior for element

2020-12-09 Thread Marcin Erdmann
If you put the breakpoint at the "at MyPage" line then the page reference
has not yet been switched to an instance of MyPage and that's probably why
you're getting a MissingPropertyExpression when trying to evaluate
"otherInsuranceAmount". I would suggest putting the breakpoint after that
line or trying to evaluate "at(MyPage).otherInsuranceAmount".

On Tue, Dec 8, 2020 at 3:16 PM Ben Frey  wrote:

> I have an element on a page that's defined like this:
> otherInsuranceAmount { $('[id$=otheramount]') }
>
> When I debug my test and put a breakpoint at the "at MyPage" line, I get a
> MissingPropertyException when I try to inspect otherInsuranceAmount via the
> debugger. However, the expression $('[id$=otheramount]') resolves just
> fine. What could cause this to happen, and how do I fix it?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/41b1a9f1-b402-485f-9f97-da5e7463cbfcn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRO7DK8w%2BsPpo2vpAV9AB6x%3DvRbsPVrm6DK9tKgWDV-fA%40mail.gmail.com.


Re: [geb-user] How to quit between parameterized tests

2020-12-08 Thread Marcin Erdmann
You can also configure Geb to do clear web storage automatically for you
between tests:
https://gebish.org/manual/3.4.1/#auto-clearing-web-storage-configuration

On Mon, Dec 7, 2020 at 7:40 PM Ben Frey  wrote:

> Great, looks like clearWebStorage() does what I need. Thanks!
>
> On Monday, December 7, 2020 at 2:19:27 PM UTC-5 thok...@gmail.com wrote:
>
>> Hello Ben,
>>
>> this section in the manual explains how to do this:
>> https://gebish.org/manual/3.4.1/#driver-management
>>
>> Cheers,
>> Thomas
>>
>> Am 07.12.2020 20:07 schrieb Ben Frey:
>> > I'm using Spock as my testing framework. Everything works fine if I
>> > comment out all but one row of my where table, but if I try to run
>> > more than one test in sequence, the second one fails. Initially, it
>> > looked like the browser session was staying open, so I added a
>> > cleanup: block with browser.quit(), but now the second run fails
>> > immediately saying "Session ID is null. Using WebDriver after calling
>> > quit()?". I've also tried clearing cookies, but the user is still
>> > logged in. How can I properly close the browser or at least the window
>> > between tests so I know that I'll start from a fresh slate each test?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Geb User Mailing List" group.
>> > To unsubscribe from this group and stop receiving emails from it,
>> > send an email to geb-user+u...@googlegroups.com.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/geb-user/3579243f-c58f-4032-8d4d-4b34dc8a4e78n%40googlegroups.com
>> > [1].
>> >
>> >
>> > Links:
>> > --
>> > [1]
>> >
>> https://groups.google.com/d/msgid/geb-user/3579243f-c58f-4032-8d4d-4b34dc8a4e78n%40googlegroups.com?utm_medium=email_source=footer
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/9354b857-dd67-4c60-97ea-7bc564e4847an%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQR1ia0yGqc1nj6pSy9N6KHZKXxsEP3WAQiPax9-s9n-FQ%40mail.gmail.com.


[geb-user] [ANN] Geb 4.0-rc-1 has been released

2020-11-28 Thread Marcin Erdmann
Hi,

A release candidate version of Geb, 4.0.-rc-1, has been released and is
available from Maven Central.

This is a candidate for a new major version that will bring integration
with JUnit 5.

Please note that the way Geb integrates with test frameworks has been
revamped and extracted into GebTestManager which helped to remove
duplication and will make integration with test frameworks easier in the
future. Introduction of GebTestManager required base test classes that Geb
ships with to be changed in a backwards incompatible way -  you should not
be affected by that unless you overrode methods defined on these classes.

Please try out this release candidate and provide feedback. The plan is to
do a final release in two weeks unless some major issues with the release
candidate are discovered.

The full list of changes in this release is as usual available from the
Book of Geb at https://gebish.org/manual/current/#4-0-rc-1.

Thanks,
Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRRdSVtkZjeD0Uidhvp%3DiXp4qz6Q5k-OGLww_2Yz0vWfA%40mail.gmail.com.


Re: [geb-user] Question: dump the current dom tree of a page into system.out

2020-11-16 Thread Marcin Erdmann
Wouldn't using Element.innerHtml (
https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML) over
Geb's javascript integration (https://gebish.org/manual/current/#js-object)
be a simpler solution?

On Mon, Nov 16, 2020 at 12:20 PM clemens...@gmail.com <
clemens.utsc...@gmail.com> wrote:

> Marcin - we found a way .. - pretty much thru Navigator:children / .text
> &.value ... with a recursive strategy ... maybe we could add that to the
> Navigator (e.g. printContentRecursively())
>
>
> On Thursday, November 12, 2020 at 10:19:21 AM UTC+1 clemens...@gmail.com
> wrote:
>
>> (e.g. because the page is based on a dom modifying framework, e.g. react)
>> ... the key is to get the "thing" (in a human readable fashion) that is the
>> basis of the assertion ..
>>
>> On Thu, Nov 12, 2020 at 10:11 AM clemens utschig 
>> wrote:
>>
>>> Hey Marcin- Thanks much. Will this also contain any modified dom
>>> elements?
>>>
>>> Marcin Erdmann  schrieb am Do., 12. Nov. 2020,
>>> 10:09:
>>>
>>>> I was by no means arguing the why, I just needed some clarification on
>>>> what exactly you are after.
>>>>
>>>> If it's the html of the whole page then you can use
>>>> WebDriver.getPageSource() (
>>>> https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/WebDriver.html#getPageSource--).
>>>> You can obtain an instance of WebDriver from Browser.getDriver() (
>>>> https://gebish.org/manual/current/api/geb/Browser.html#getDriver()).
>>>>
>>>> Marcin
>>>>
>>>> On Tue, Nov 10, 2020 at 7:14 PM clemens utschig 
>>>> wrote:
>>>>
>>>>> The current (fully rendered?) page that is used in my test..
>>>>>
>>>>> So if i have an assertion, e.g. $some.path == 1, i can find that
>>>>> *some.path* in the dump (that will serve as evidence to an auditor that 
>>>>> the
>>>>> assertion part and value truly existed at the point of test)
>>>>>
>>>>> Please lets not argue about the why here. Its a hard requirement
>>>>>
>>>>>
>>>>>
>>>>> Marcin Erdmann  schrieb am Di., 10. Nov. 2020,
>>>>> 12:41:
>>>>>
>>>>>> Can you please define what you mean by "current dom tree"? Do you
>>>>>> mean page source? Or do you mean inner html of some of the elements you
>>>>>> inspect in your test?
>>>>>>
>>>>>> Marcin
>>>>>>
>>>>>> On Tue, Nov 10, 2020 at 11:33 AM clemens...@gmail.com <
>>>>>> clemens...@gmail.com> wrote:
>>>>>>
>>>>>>> Dear all,
>>>>>>> we have a requirement (for official documentation) - to dump the
>>>>>>> current dom tree that is the basis of various test assertions into 
>>>>>>> system
>>>>>>> out.
>>>>>>>
>>>>>>> Anyone an idea on how to do this ... (preferrably in a formatted
>>>>>>> ("with intends") way ..
>>>>>>>
>>>>>>> thanks much
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Geb User Mailing List" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to geb-user+u...@googlegroups.com.
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/geb-user/2d687da9-5386-4052-9581-69136bee3776n%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/geb-user/2d687da9-5386-4052-9581-69136bee3776n%40googlegroups.com?utm_medium=email_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Geb User Mailing List" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to geb-user+u...@googlegroups.com.
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/geb-user/CA%2B52dQRXRbggbStLx1yi_ZbZB2jYcdKts3-fwkyLDBO3pGb08g%40mail.gmail.com
>>>>>&g

Re: [geb-user] Question: dump the current dom tree of a page into system.out

2020-11-12 Thread Marcin Erdmann
I was by no means arguing the why, I just needed some clarification on what
exactly you are after.

If it's the html of the whole page then you can use
WebDriver.getPageSource() (
https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/WebDriver.html#getPageSource--).
You can obtain an instance of WebDriver from Browser.getDriver() (
https://gebish.org/manual/current/api/geb/Browser.html#getDriver()).

Marcin

On Tue, Nov 10, 2020 at 7:14 PM clemens utschig 
wrote:

> The current (fully rendered?) page that is used in my test..
>
> So if i have an assertion, e.g. $some.path == 1, i can find that
> *some.path* in the dump (that will serve as evidence to an auditor that the
> assertion part and value truly existed at the point of test)
>
> Please lets not argue about the why here. Its a hard requirement
>
>
>
> Marcin Erdmann  schrieb am Di., 10. Nov. 2020,
> 12:41:
>
>> Can you please define what you mean by "current dom tree"? Do you mean
>> page source? Or do you mean inner html of some of the elements you inspect
>> in your test?
>>
>> Marcin
>>
>> On Tue, Nov 10, 2020 at 11:33 AM clemens...@gmail.com <
>> clemens.utsc...@gmail.com> wrote:
>>
>>> Dear all,
>>> we have a requirement (for official documentation) - to dump the current
>>> dom tree that is the basis of various test assertions into system out.
>>>
>>> Anyone an idea on how to do this ... (preferrably in a formatted ("with
>>> intends") way ..
>>>
>>> thanks much
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Geb User Mailing List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to geb-user+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/geb-user/2d687da9-5386-4052-9581-69136bee3776n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/geb-user/2d687da9-5386-4052-9581-69136bee3776n%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Geb User Mailing List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to geb-user+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/geb-user/CA%2B52dQRXRbggbStLx1yi_ZbZB2jYcdKts3-fwkyLDBO3pGb08g%40mail.gmail.com
>> <https://groups.google.com/d/msgid/geb-user/CA%2B52dQRXRbggbStLx1yi_ZbZB2jYcdKts3-fwkyLDBO3pGb08g%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/CAHBV8mLDXTjK1smdHO9n-kG3N4p%3Dj7AtowydbZNgJrqnCy%2BP-w%40mail.gmail.com
> <https://groups.google.com/d/msgid/geb-user/CAHBV8mLDXTjK1smdHO9n-kG3N4p%3Dj7AtowydbZNgJrqnCy%2BP-w%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQByx5F7KvEZQ%2Bva9rQTo6vdkttYOzHs2S4Mb_wRnK%3Daw%40mail.gmail.com.


Re: [geb-user] Question: dump the current dom tree of a page into system.out

2020-11-10 Thread Marcin Erdmann
Can you please define what you mean by "current dom tree"? Do you mean page
source? Or do you mean inner html of some of the elements you inspect in
your test?

Marcin

On Tue, Nov 10, 2020 at 11:33 AM clemens...@gmail.com <
clemens.utsc...@gmail.com> wrote:

> Dear all,
> we have a requirement (for official documentation) - to dump the current
> dom tree that is the basis of various test assertions into system out.
>
> Anyone an idea on how to do this ... (preferrably in a formatted ("with
> intends") way ..
>
> thanks much
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/2d687da9-5386-4052-9581-69136bee3776n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRXRbggbStLx1yi_ZbZB2jYcdKts3-fwkyLDBO3pGb08g%40mail.gmail.com.


Re: [geb-user] Create report on exception

2020-11-09 Thread Marcin Erdmann
So I double checked and for the Spock integration, the failure report (the
one taken with label "failure") is taken as soon as the exception happens
and before any cleanup methods are called. The only cases where other code
might be executed in-between the exception and the report being taken are:
- the failing feature method has a cleanup: block which will be executed
before reporting
- an implementation of org.spockframework.runtime.IRunListener which has a
non-empty implementation of error(ErrorInfo) method is registered with the
spec before geb.spock.ReportingOnFailureExtension.visitSpec() which
registers geb.spock.OnFailureReporter as a listener is executed

Basically, in most cases the failure report will be written as soon as the
exception happens. Is this not what you are seeing, Ben?

Marcin

On Sun, Nov 8, 2020 at 11:09 PM Ben Frey  wrote:

> Oh, I didn't realize that the test framework would have such an impact.
> I'm using Spock in this case.
>
> Ben
>
> On Sun, Nov 8, 2020, 3:40 PM Marcin Erdmann 
> wrote:
>
>> Hi Ben,
>>
>> I know by default Geb creates a report if the test reached the end but
>>> failed.
>>
>>
>> I don't think that this is entirely true. The time of when the report is
>> being taken upon a test failure is test framework (as in Spock, JUnit,
>> TestNG) integration dependent but I believe that the report is taken as
>> soon as the hook used by the integration reports a failure. For some of the
>> integrations it might actually happen after cleanup code is executed. Can
>> you please describe in detail which test framework you are using, what
>> behaviour with regards to reporting on failureyou are observing and what
>> behaviour you are expecting?
>>
>>
>>> Is there a way to create a report if an exception was thrown during the
>>> test?
>>
>>
>> That will depend on the test framework we are talking about exposing a
>> hook which is called as soon as an exception is being thrown from within a
>> test. If there is a better mechanism for detecting the exception being
>> thrown or test failure occurring than what we are currently using for the
>> framework in question then I'd be more than happy to switch the integration
>> to that hook.
>>
>> Marcin
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Geb User Mailing List" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/geb-user/sQjkMRaBqdA/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> geb-user+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/geb-user/CA%2B52dQQ6E0J2ezq-ET%3D%3DSYAvurd85VEOMJf50MfGaPokp3MjBQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/geb-user/CA%2B52dQQ6E0J2ezq-ET%3D%3DSYAvurd85VEOMJf50MfGaPokp3MjBQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/CAG7nOpiAa5fO_%2Bz8Q1RSCF11xMmNrQMKi71iWwDV%2BkNotQLG-g%40mail.gmail.com
> <https://groups.google.com/d/msgid/geb-user/CAG7nOpiAa5fO_%2Bz8Q1RSCF11xMmNrQMKi71iWwDV%2BkNotQLG-g%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQT4Uj2w6%3DdefFVh_dNXz4bdXko-avZc9wzxnwcw_2iNuw%40mail.gmail.com.


Re: [geb-user] Create report on exception

2020-11-08 Thread Marcin Erdmann
Hi Ben,

I know by default Geb creates a report if the test reached the end but
> failed.


I don't think that this is entirely true. The time of when the report is
being taken upon a test failure is test framework (as in Spock, JUnit,
TestNG) integration dependent but I believe that the report is taken as
soon as the hook used by the integration reports a failure. For some of the
integrations it might actually happen after cleanup code is executed. Can
you please describe in detail which test framework you are using, what
behaviour with regards to reporting on failureyou are observing and what
behaviour you are expecting?


> Is there a way to create a report if an exception was thrown during the
> test?


That will depend on the test framework we are talking about exposing a hook
which is called as soon as an exception is being thrown from within a test.
If there is a better mechanism for detecting the exception being thrown or
test failure occurring than what we are currently using for the framework
in question then I'd be more than happy to switch the integration to that
hook.

Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQ6E0J2ezq-ET%3D%3DSYAvurd85VEOMJf50MfGaPokp3MjBQ%40mail.gmail.com.


Re: [geb-user] Select element with *this* or *that* value

2020-08-28 Thread Marcin Erdmann
no { $('[id$="91"]') ?: $('[id$="94"]') }

On Fri, Aug 28, 2020 at 7:23 PM Ben Frey  wrote:

>
> Is it possible to have a selector that can choose a given element that may
> have a different ID? For example, the application I'm working on has Yes/No
> radio buttons. Usually, Yes has an id ending in 90 and No's id ends in 91,
> but sometimes it's 93 and 94 instead. Rather than doing something like
> this, is there a way to choose whichever one is there for the No button?
>
> no(required: false) { $('[id$="91"]') }
> weirdNo(required: false) { $('[id$="94"]') }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/9656e778-00a5-4c0f-92e2-1d45aeba0aeen%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQSG9aJNh8nnm00ANKUc_XSDTemwjmcJB3u4iiEddxqybQ%40mail.gmail.com.


Re: [geb-user] Re: Specify wait time for particular page

2020-08-27 Thread Marcin Erdmann
Another option would be removing the waitFor() from within your at checker
and using static atCheckWaiting = 30

On Thu, Aug 27, 2020 at 3:34 PM Ben Frey  wrote:

> Ah, ok, that static line is what I was looking for. Thanks!
>
> On Thursday, August 27, 2020 at 9:25:44 AM UTC-5 Thomas Hirsch wrote:
>
>> In this case you should also set
>>
>> static atCheckWaiting=false
>>
>> on the individual page where you want to have a longer wait.
>> This is because the at-checker is still wrapped in the 15 seconds wait,
>> and if you perform a 30 seconds wait inside a 15 seconds wait, it will
>> still fail after 15 seconds, the outer wait.
>>
>> The stacktrace is merely printing how the waits are configured, and not
>> how long did it actually wait.
>> On Thursday, August 27, 2020 at 4:21:31 PM UTC+2 Ben Frey wrote:
>>
>>> I have my configuration set up with
>>>
>>> atCheckWaiting = true
>>>
>>> waiting {
>>>  timeout = 15
>>>  retryInterval = 0.5
>>> }
>>>
>>> which works fine for most pages, but one at least is a long transition.
>>> I tried setting that page's at checker like this:
>>>
>>> static at = {
>>> waitFor(30) {
>>>  $('.step5active').displayed
>>> }
>>> }
>>>
>>> which cause an interesting stack trace:
>>>
>>> condition did not pass in 15 seconds (failed with exception)
>>> geb.waiting.WaitTimeoutException: condition did not pass in 15 seconds
>>> (failed with exception)
>>> .
>>> .
>>> .
>>> Caused by: geb.waiting.WaitTimeoutException: condition did not pass in
>>> 30 seconds (failed with exception)
>>>
>>> So I don't know which amount of time the page failed for. Should my
>>> setup work as I expect it to?
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/b31d9be5-5889-4754-8aed-4f2a46752dd9n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQT8xNzGRxjokgvKsnme2gBvWLTECX7Bt_%3DQpy92gJGtyQ%40mail.gmail.com.


Re: [geb-user] Chrome Issue

2020-08-26 Thread Marcin Erdmann
Is this the whole stacktrace? There usually would be a "caused by" section
below this showing power assertion output of evaluation of the condition
within the closure passed to waitFor which I'm after

On Wed, Aug 26, 2020 at 12:33 AM raza  wrote:

> geb.waiting.WaitTimeoutException: condition did not pass in 30 seconds
> at geb.waiting.Wait.waitFor(Wait.groovy:124)
> at geb.waiting.Wait$waitFor.call(Unknown Source)
> at
> geb.waiting.DefaultWaitingSupport.doWaitFor(DefaultWaitingSupport.groovy:50)
> at
> geb.waiting.DefaultWaitingSupport.waitFor(DefaultWaitingSupport.groovy:41)
> at
> geb.waiting.DefaultWaitingSupport.waitFor(DefaultWaitingSupport.groovy)
> at geb.waiting.WaitingSupport$waitFor.call(Unknown Source)
> at geb.Page.waitFor(Page.groovy:116)
> at
> geb.binding.BindingUpdater$InvocationForwarding.doCall(BindingUpdater.groovy:136)
> at
> step_definitions.Script4$_run_closure9.doCall(Script4.groovy:283)
> at ✽.I complete Eligibility
> Check(classpath:/home/TestAutomation/target/test-classes/features/Care.feature:9)
>
> On Wed, 26 Aug 2020 at 02:43, Marcin Erdmann 
> wrote:
>
>> What's the stacktrace of the exception?
>>
>> On Mon, Aug 24, 2020 at 10:21 PM raz  wrote:
>>
>>> I have this Salesforce lightning site which is working fine with Firefox
>>> but when I run the same test in Chrome, it's like it can't ready anything
>>> from DOM and just waits at the first instruction.
>>>
>>> For example, when a page loads, I have this code to ensure its loaded
>>> before interacting with the objects which works flawlessly on Firefox and
>>> in Edge.
>>>
>>> *waitFor(WAIT_TIME) { browser.$('h2', text: contains('Eligibility
>>> Check')).isDisplayed() }*
>>>
>>> but the same line of code throws *geb.waiting.WaitTimeoutException:
>>> condition did not pass in 30 seconds *when I run the test in Chrome and
>>> I can see the page is loaded but seems like Geb/Selenium can't interact
>>> with the DOM hence the exception.
>>>
>>> Any ideas what may be going on? I've tried various machines, versions of
>>> Chrome but can;t seem to figure it out. Any help is greatly appreciated.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Geb User Mailing List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to geb-user+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/geb-user/e9c3cc81-156c-45e0-a3bb-ebb6f888d76bn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/geb-user/e9c3cc81-156c-45e0-a3bb-ebb6f888d76bn%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Geb User Mailing List" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/geb-user/IGedAOfoFNk/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> geb-user+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/geb-user/CA%2B52dQS6WXtTRg2cf-0RAYjX5mqPKopK-Ad7wPwQexu5O3BuhA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/geb-user/CA%2B52dQS6WXtTRg2cf-0RAYjX5mqPKopK-Ad7wPwQexu5O3BuhA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/CAFH7xtrYOEkyREeT4cKUoowe1J%2BDQuV5AJ0pK-tgiBoo7eJfWg%40mail.gmail.com
> <https://groups.google.com/d/msgid/geb-user/CAFH7xtrYOEkyREeT4cKUoowe1J%2BDQuV5AJ0pK-tgiBoo7eJfWg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQS6kE7MCLMtNXTwhoWTP7dkBMysiMcwLNZfgvQZ_YsH7Q%40mail.gmail.com.


Re: [geb-user] Re: "element not interactable" after at-checker

2020-08-26 Thread Marcin Erdmann
> Selenium incorrectly reported "element not interactable" when the problem
was in fact that the elemnt was merely outside the viewport. If the element
is close to, or beyond, the edge of the screen, try scrolling before
interacting with it.

This is not what matches my personal experience. I've never experienced
ElementNotInteractableException for an element that was outside of viewport
- Selenium pretty much always scrolls the viewport so that element is
visible before clicking it and when it fails to do that because there are
floating elements on the page you would get something along the lines of
"org.openqa.selenium.WebDriverException: Element is not clickable at point
(x, y). Other element would receive the click". From my
experience ElementNotInteractableException is thrown when the element is
not displayed at all (it is hidden via CSS) or it's disabled/read only.

On Mon, Aug 24, 2020 at 10:16 PM Ben Frey  wrote:

> Ahh, I hadn't thought about the viewport. I'll play with that and see how
> it goes. I also added min properties to the radioButtons navigator object,
> and that seems like it may have helped.
>
> On Monday, August 24, 2020 at 3:54:41 PM UTC-5 thok...@gmail.com wrote:
>
>> Hi Ben,
>>
>> this is difficult to answer correctly without more information.
>> Generally, I would try to narrow down the conditions, or the selector
>> respectively, as much as possible.
>> One explanation could be that you are still looking at the wrong button,
>> after all you seem to be having more than one, and narrowing it down to the
>> correct one seems to be problematic.
>>
>> I just recently had the problem that Selenium incorrectly reported
>> "element not interactable" when the problem was in fact that the elemnt was
>> merely outside the viewport. If the element is close to, or beyond, the
>> edge of the screen, try scrolling before interacting with it.
>>
>> Thomas
>> Ben Frey schrieb am Montag, 24. August 2020 um 20:05:14 UTC+2:
>>
>>> I'm having a devil of a time with one particular page being very flaky.
>>> I've set atCheckWaiting = true globally. In the page's at-checker I
>>> verify that there there's at least one radio button (e.g. 
>>> radioButtons.size()
>>> > 0). In the script, I have some conditional logic that also has a
>>> waitFor that depends on the same condition, but immediately after that, if
>>> I try to interact with radioButtons, I get  the "element not interactable"
>>> message from Selenium. What's going on here? The content should be there
>>> since the at-checker passed.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/08ae974a-ecc5-440a-b246-10e2703f4e70n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQR4LgiqYiw3JY_4Civ4k%3DqfLVM9agCjZwcnwj88bk6N9w%40mail.gmail.com.


Re: [geb-user] Chrome Issue

2020-08-25 Thread Marcin Erdmann
What's the stacktrace of the exception?

On Mon, Aug 24, 2020 at 10:21 PM raz  wrote:

> I have this Salesforce lightning site which is working fine with Firefox
> but when I run the same test in Chrome, it's like it can't ready anything
> from DOM and just waits at the first instruction.
>
> For example, when a page loads, I have this code to ensure its loaded
> before interacting with the objects which works flawlessly on Firefox and
> in Edge.
>
> *waitFor(WAIT_TIME) { browser.$('h2', text: contains('Eligibility
> Check')).isDisplayed() }*
>
> but the same line of code throws *geb.waiting.WaitTimeoutException:
> condition did not pass in 30 seconds *when I run the test in Chrome and I
> can see the page is loaded but seems like Geb/Selenium can't interact with
> the DOM hence the exception.
>
> Any ideas what may be going on? I've tried various machines, versions of
> Chrome but can;t seem to figure it out. Any help is greatly appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/e9c3cc81-156c-45e0-a3bb-ebb6f888d76bn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQS6WXtTRg2cf-0RAYjX5mqPKopK-Ad7wPwQexu5O3BuhA%40mail.gmail.com.


Re: [geb-user] Getting a string instead of a Navigator

2020-08-25 Thread Marcin Erdmann
What's the stacktrace of the exception?

On Mon, Aug 24, 2020 at 7:22 PM Ben Frey  wrote:

> I have a page with this content:
> static content = {
>  startButton { $('button', name: 'startButton') }
> }
>
> While debugging, I've discovered that while the selector does indeed
> return a Navigator object, in my script I have
>
> at MyPage
> startButton.click()
>
> Here, if I evaluate startButton, it just returns the text of the button
> as a string, rather than an actual Navigator. Because of that, the click
> throws an exception. What am I missing here?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/a53ed071-5bf9-4ae3-8fc0-1bc6cad4c06bn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRCT4B4HeDHtej2CZsv8qK-KqkvHioWbcSs%3DvXtXx6yqQ%40mail.gmail.com.


Re: [geb-user] Re: Navigator attribute matching

2020-08-21 Thread Marcin Erdmann
Yeah, but you have to be explicit that you are expecting multiple elements
in the navigator and want to click on all of them by using the spread
operator otherwise you will get a SingleElementNavigatorOnlyMethodException:

def navigatorWithMultiplelements = $()
navigatorWithMultipleElements*.click()

On Thu, Aug 20, 2020 at 7:36 PM Ben Frey  wrote:

> Great. And can I then click all of them at once?
>
> On Thursday, August 20, 2020 at 12:57:08 PM UTC-5 thok...@gmail.com wrote:
>
>>
>> Hello Ben,
>>
>> no, you cannot use placeholders like this in CSS selectors, only direct
>> (partial) comparison.
>>
>> There are two common ways to select WebElements in Selenium (which Geb is
>> built on top of).
>> 1. By CSS selectors, which is the the default in Geb, if you just pass a
>> String to the $-method
>> 2. By XPath, which you can do by passing a Selenium-"By"-object to the
>> $-method, like this: $(By.xpath("//div"))
>>
>> XPath gives you much more options, as it really is a small programming
>> language, that allows you to traverse the tree of HTML in pretty much any
>> way you could imagine, including matching of regular expressions.
>>
>> With XPath, it could work like this:
>>
>> $(By.xpath("//*[matches(@name, ' parentobject.childlist[\\d].thing')]"))
>>
>> i.e. using "\d", which means "digit" in regular expressions as the
>> wildcard (and escaping that with another backslash because its a
>> Java-String).
>>
>> Another option, using only CSS selectors, could be to combine a
>> start-of-string with an end-of-string selector, like this:
>>
>> $("[name^='parentobject.childlist['][name$='].thing']")
>>
>> Best Regards,
>> Thomas
>>
>>
>> Ben Frey schrieb am Donnerstag, 20. August 2020 um 16:28:39 UTC+2:
>>
>>> From the concrete example at
>>> https://gebish.org/manual/current/#the-code-code-function, it sounds
>>> like attribute matching is exact, although it's not super clear that this
>>> is indeed the case. Is this a correct assumption?
>>>
>>> If matching is exact, is there any way to match with a wildcard? I'm
>>> working on automating a page that's built with YUI, and the name attributes
>>> for elements are built from Java objects, so for example
>>> name="parentobject.childlist[0].thing". Is there a way to select all
>>> indices of the childlist, like name="parentobject.childlist[*].thing"?
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/f048c375-22eb-4220-b29d-28e019fc86e2n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRt1S%2Bc_xwAhFcuXLSL8vCRojVgPoJDz3yL3XkzQuKeww%40mail.gmail.com.


Re: [geb-user] Filter of test task

2020-08-13 Thread Marcin Erdmann
You can only use --test filter when requesting execution of a single Test
task. If you are requesting execution of multiple Test tasks via a
lifecycle task (which the task called test in that project boils down to)
then the filter is ignored. This is just how it works because gradle cannot
figure out which task you want to apply the filter to if you requested
execution of a task that depends on other tasks.

On Sat, Aug 8, 2020 at 3:06 PM M T  wrote:

> Hey again good people. Noticed something weird. Hopefully I'm over
> complicating matters.
> So i forked the geb gradle example.
>  I've been developing my tests with the standard chrome/Firefoxtest task
> with --test filter. No issue.
> However, when using the test task, that depends on each driver task, the
> filter is ignored.
> Packages, class names, applying the filter in a doFirst closure--nothing
> seems to work and filter correctly. Curiously, if the test task is called
> via intelij config it works perfectly.
> I fear that something that I haven't fully understand is happening here
> and that's what Id like to figure.
> Thanks in advance
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/319c9504-a448-48fe-9aa7-fe41e67e712fo%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQ%3DnoSL8PnLf-7YFTNH%2BdbSYMHqHhWpNuC7payfniu50g%40mail.gmail.com.


Re: [geb-user] Re: org.testng.TestNGException: Cannot find class in classpath - Testng & GEB

2020-06-29 Thread Marcin Erdmann
Hi Mani,

I'm afraid that you are providing so little information that it's virtually
impossible to help you. What's more, the error you posted has nothing to do
with Geb, it looks like a classpath issue related to TestNG execution.

Can you share your test project by uploading it to Github so that people
can at least have a look at what might be wrong in your setup?

Cheers,
Marcin

On Mon, Jun 29, 2020 at 9:27 AM Mani  wrote:

> Hi Thomas,
>
> I am not using gradle. (Using Maven)
>
> I'm using testng xml where i've given the package & class name of the
> groovy script as mentioned. I'm running testng.xml from eclipse IDE.
>
> Note: I'm new to GEB and trying to integrate GEB with Testng.(Maven)
>
> Regards,
> Mani.
>
> On Monday, June 29, 2020 at 1:48:08 PM UTC+5:30, Thomas Hirsch wrote:
>>
>> Hello Mani,
>>
>> how are you executing this?
>> Are you using Gradle?
>> Are you starting the tests from an IDE?
>> Can you show your build.gradle file?
>>
>> Best regards,
>> Thomas
>> On Monday, June 29, 2020 at 9:48:07 AM UTC+2 Mani wrote:
>>
>>> I created a framework with testng & GEB. (groovy)
>>>
>>> When I executed as testng suite, I'm getting
>>>
>>> Cannot find class in classpath: com.Daca.Smoke.GoogleTest
>>> at org.testng.xml.XmlClass.loadClass(XmlClass.java:81)
>>> at org.testng.xml.XmlClass.init(XmlClass.java:73)
>>> at org.testng.xml.XmlClass.(XmlClass.java:59)
>>> at 
>>> org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:556)
>>> at 
>>> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
>>>
>>>
>>> I tried all the solution given in google such as cleaning the project 
>>> etc.(I've done the same in testng, java & selenium it worked well)
>>>
>>> For groovy, testng & GEB i couldn't resolve it.
>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/6931a7c0-4a44-4455-94f9-527375de8e16o%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRtXMmcNucghJpkhJi3cv5eRO90b4ZPtuf5oKQP3qsrLw%40mail.gmail.com.


Re: [geb-user] GEB with testng framework

2020-06-25 Thread Marcin Erdmann
Not sure what you mean by "sample framework on testng" but Geb comes with
an integration for TestNG, see https://gebish.org/manual/current/#testing.

Marcin

On Thu, Jun 25, 2020 at 3:28 PM Mani  wrote:

> can someone please help me to share sample framework on testng with GEB?
>
> I googled lot but couldn't find anything.
>
> Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/7d649e0f-4036-412a-8da7-e3f9eb3d5322o%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTPnTKP%3DZRuXiW3ANc58AwnTv_xtUxsYQSyXJbx4_4ZHA%40mail.gmail.com.


Re: [geb-user] Re: Chrome Driver Version 81 not found

2020-06-16 Thread Marcin Erdmann
No worries, I'm glad my suggestion helped.

On Mon, Jun 15, 2020 at 9:22 PM Shreya J  wrote:

> Marcin, that was indeed the case. Thank you!
>
> My chrome updated recently to 83 and I was able to use 83.0.4103.39 as
> listed on here for mac -
> https://github.com/webdriverextensions/webdriverextensions-maven-plugin-repository/blob/master/repository-3.0.json
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fwebdriverextensions%2Fwebdriverextensions-maven-plugin-repository%2Fblob%2Fmaster%2Frepository-3.0.json=D=1=AFQjCNEM73RDEaVRFFqvJp7bDgXz2zblgg>Thanks
> again for taking the time to respond and putting the links in the answer.
> They are very helpful.
>
>
> - Shreya
>
> On Monday, June 15, 2020 at 3:09:53 PM UTC-4, Marcin Erdmann wrote:
>>
>> Hi Shreya,
>>
>> On Mon, Jun 15, 2020 at 1:15 PM varun jain  wrote:
>>
>>> One way to overcome this problem is to have chrome driver binary in the
>>> project and set the path to it in the project.
>>>
>>
>> I would advise against doing so. One should not put binaries under source
>> control, especially such that can be easily resolved by the build.
>>
>> You are getting a DriverUrlNotFoundException because the version of
>> chromedriver binary you used does not match one listed in
>> https://github.com/webdriverextensions/webdriverextensions-maven-plugin-repository/blob/master/repository-3.0.json
>>  (see
>> this section of the manual for Gradle webdriver binaries plugin to
>> understand the significance of that file:
>> https://github.com/erdi/webdriver-binaries-gradle-plugin/blob/master/README.md#configuring-download-urls).
>> If your Chrome version is 81.0.4044.138 then you should use 81.0.4044.69 as
>> the version of chromedriver binary.
>>
>> Cheers,
>> Marcin
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/7d28991f-87b1-45a3-b461-c1645ecc94a9o%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/7d28991f-87b1-45a3-b461-c1645ecc94a9o%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRfeg%2BQxrGm18Wx8SYTNLnLkYki5wxV3ptSeDyLmB1c8w%40mail.gmail.com.


Re: [geb-user] Re: Chrome Driver Version 81 not found

2020-06-15 Thread Marcin Erdmann
Hi Shreya,

On Mon, Jun 15, 2020 at 1:15 PM varun jain  wrote:

> One way to overcome this problem is to have chrome driver binary in the
> project and set the path to it in the project.
>

I would advise against doing so. One should not put binaries under source
control, especially such that can be easily resolved by the build.

You are getting a DriverUrlNotFoundException because the version of
chromedriver binary you used does not match one listed in
https://github.com/webdriverextensions/webdriverextensions-maven-plugin-repository/blob/master/repository-3.0.json
(see
this section of the manual for Gradle webdriver binaries plugin to
understand the significance of that file:
https://github.com/erdi/webdriver-binaries-gradle-plugin/blob/master/README.md#configuring-download-urls).
If your Chrome version is 81.0.4044.138 then you should use 81.0.4044.69 as
the version of chromedriver binary.

Cheers,
Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQitJJXo1zbEHQHAYgyoxn3Zb-i9NXVxY%3D7hEegv_EYBQ%40mail.gmail.com.


Re: [geb-user] WaitFor in Geb

2020-06-15 Thread Marcin Erdmann
OperationUtil should not extend Page. After that there are two options:

1. You instantiate geb.waiting.Wait by hand and then call waitFor on it:

import geb.waiting.Wait

new Wait(60).waitFor {
objName.click()
}

2. You pass an instance of configuration to the constructor of
OperationUtil and have an instance of geb.waiting.DefaultWaitingSupport
which you delegate to:

import geb.waiting.DefaultWaitingSupport
import geb.waiting.WaitingSupport
import geb.Configuration

@Delegate
private final WaitingSupport waitingSupport

OperationUtil(Configuration configuration) {
this.waitingSupport = new DefaultWaitingSupport(configuration)
}

void someMethod() {
waitFor {
//some condition
}
}

and then in your page you initiate it like this:

new OperationUtil(browser.config)

As a side note, please be aware that having code which mutates state, i.e.
clicks on things, inside of the waitFor condition is an anti-pattern and I
would advise against doing that.

Marcin

On Fri, Jun 12, 2020 at 7:56 AM Avinash Kumar 
wrote:

> Hi,
>
> i tried with the same way as :
>
>   waitFor(60) {
> ObjName.click()
> true
>   }
>
>   but it didn't worked
>
>
>   My exact issue is that waitFor works find in "Login" class which follows
> exact geb POM where i have created static at , static url , static content
>   and follows with method implementation and same class i have extends
> from Page(geb.Page),
>
>   package pages
>
> import geb.Browser
> import geb.Page
> import modules.OperationUtil
>
>
>
> class Login extends Page {
>
>
> static at = {title == "Login"}
>
> static content = {
> usernameField {$('input#username')}
> passwordField {$('input#password')}
> logInButton {$('button#login-submit')}
>
> }
>
> def "login To App"(username, password) {
> try {
> OperationUtil operationUtil = new OperationUtil();
>
> waitFor(60) {
> operationUtil.enterVal(usernameField, username);
> operationUtil.enterVal(passwordField, password);
> }
>
> operationUtil.clickAnElement(logInButton)
>
> waitFor(Integer.parseInt(ju.getJsonValue("maxWait"))) {
> logoutButton.displayed
> slide.displayed }
> }
> catch(Exception e){
> new ExceptionHandler().customizedException("Cannot login into
> the application");
> e.printStackTrace();
> }
> }
> }
>
>   but in other class "OperationUtil" where i have only extends with Page
> (geb.Page) and does method implementation.
>
>   package modules
>
>   import geb.Page
>
>   class OperationUtil extends Page {
>
>
> def clickAnElement(objName){
> waitFor(60) {
> objName.click()
> return true
> }
>
> }
>
>
>
> }
>
>
>
> so waitFor at OperationUtil doesn't work.
>
>
>
> 2020-06-12 11:53:42 ERROR - Issue with login: Instance of page class
> modules.OperationUtil has not been initialized.
> Please pass it to Browser.to(), Browser.via(), Browser.page() or
> Browser.at() before using it.
> 2020-06-12 11:53:42 ERROR - Issue with login: Instance of page class
> modules.OperationUtil has not been initialized.
> Please pass it to Browser.to(), Browser.via(), Browser.page() or
> Browser.at() before using it.
> geb.error.PageInstanceNotInitializedException: Instance of page class
> modules.OperationUtil has not been initialized.
> Please pass it to Browser.to(), Browser.via(), Browser.page() or
> Browser.at() before using it
>
>
>
> Regards,
> Avinash Kumar
>
> On Fri, Jun 12, 2020 at 10:39 AM Michael Kutz 
> wrote:
>
>> The waitFor expects a closure returning a boolean value. Once the value
>> returned is true, the waiting ends.
>>
>> As Groovy interprets basically any object as an boolean (see
>> http://groovy-lang.org/semantics.html#Groovy-Truth), this works great
>> with Geb's NonEmptyNavigator (true) and EmptyNavigator (false).
>>
>> In your case, you call click. As click returns null, the result will
>> never be true.
>>
>>   waitFor(60) { ObjName }.click()
>>
>> Might work, but you should put the object retrieving inside the closure.
>>
>>   waitFor(60) {
>> ObjName.click()
>> true
>>   }
>>
>> Might also work if the first line on the closure will throw an exception,
>> which would be catched by Wait. If no exception is thrown, the true will be
>> returned and the waiting will end.
>>
>> Kind regards,
>> Micha
>>
>> Avinash Kumar  schrieb am Do., 11. Juni
>> 2020, 16:50:
>>
>>> Hi,
>>>
>>> I am trying to use waitFor method in different class other than page
>>> class.
>>>
>>> For example:
>>>
>>> class test extends page {
>>>
>>>
>>> def clickAnElement(ObjName)
>>> {
>>>
>>> waitFor(60)
>>>  {
>>>  ObjName.click()
>>> }
>>> }
>>> }
>>>
>>>
>>> and clickAnElement, i am calling from one page class .
>>> but code fails at WaitFor() as WaitFor is not working for me in class
>>> other than page class.
>>>
>>>
>>> Can any help me out 

Re: [geb-user] Geb and Cucumber

2020-05-27 Thread Marcin Erdmann
Mike,

Unfortunately I don't have much experience with cucumber other than
maintaining the example project for using Geb with it so I cannot offer any
advice on how to get it working with the newer stack you are using. On
the other hand, if you do get it working then I would appreciate it if you
could feed back what versions and what plugins you ended up using so that I
can update the example project. It might be beneficial to others.

> Additionally, Cucumber Groovy example uses Maven and I wasn't able to
figure out or find the Cucumber dependency being used there

It looks like automated publishing of versions has been stopped after
4.7.1:
https://github.com/cucumber/cucumber-jvm-groovy/commit/30fa9382ba0fa1ac211d1cd263bfce4e2aa791c8
and
no releases have been made since. On the other hand there seem to be a lot
of activity on the repo lately, so maybe another release is coming soon:
https://github.com/cucumber/cucumber-jvm-groovy/commits/master. Indeed:
https://github.com/cucumber/cucumber-jvm-groovy/issues/19#issuecomment-634783593
.

Thanks,
Marcin

On Sun, May 24, 2020 at 5:24 PM Mike Hunter  wrote:

> A few years back at a previous employer, Geb and Cucumber were used very
> successfully.  I personally helped build up the solutions so at the time,
> felt like I knew the in's and out's of the tooling pretty well.  That was
> back when Java 8 was newer etc. and since moving on - I've not kept up to
> date with the tools.
>
> Fast forward, and I'm now currently trying to put together a POC of these
> tools - however; I'm struggling getting these two tools to work well with
> latest versions of Groovy, Gradle, Java 11, etc.  Geb's cucumber example
> still shows Java 8 and Gradle 4.x (from what I can tell it's because of the
> incompatibilities to various plugins, specifically
> 'com.github.samueltbrown.cucumber'.  I really like that plugin as it used
> to always "work".  I attempted to use a different one but didn't have much
> luck getting it to find the Groovy  glue / env on classpath.  Additionally,
> I see a few options now for Cucumber / Groovy but I'm not sure which is the
> better option (given I've been able to get either to work yet).  I've tried
> both info.cukes:cucumber-groovy:1.2.5 which is used in Geb's cucumber
> example, and the seemingly newer one, io.cucumber:cucumber-groovy:4.7.1
> which I found being used in Cucumber's Gradle example,
> https://github.com/cucumber/cucumber-java-skeleton.  Additionally,
> Cucumber Groovy example uses Maven and I wasn't able to figure out or find
> the Cucumber dependency being used there:
> https://github.com/cucumber/cucumber-jvm-groovy/blob/master/examples/pom.xml
> (they're example uses, io.cucumber:cucumber-jvm-groovy:5.1.3-SNAPSHOT).
>
> I've found using Groovy with Cucumber so simple and easy in the past,
> however; for as long as I can remember, the Cucumber-Groovy implementation
> has been unsupported for years (https://cucumber.io/docs/installation/),
> though I've not ran into a problem until now trying to get things working.
> I'd also like to keep using Groovy to help push using Geb w/ Spock (which
> I've got working fine).  I'm just trying to enable re-using the same Geb
> pages by Cucumber's specs now.
>
> So, in an effort to try and keep this as short as possible - any
> recommendations / success stories out there using Java 11, Gradle 6+, and
> Groovy w/ Cucumber?  And if so, what specific versions and plugins are
> working for you?
>
> Thanks in advance!!
>
> Mick
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/59fe2568-933a-4ca5-ab2a-203135254e50%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQbcNWSPdhe8eJv8fgccxXABn-0nVmmUcNpvdw--6DX0g%40mail.gmail.com.


Re: [geb-user] Execute a few tests from terminal and Junit 5 using

2020-05-15 Thread Marcin Erdmann
You're very much welcome, Gordon.

On Thu, May 14, 2020 at 11:50 PM Gordon Freeman 
wrote:

> Marcin, thanks a lot! I very appreciate it. 
>
> On Thursday, May 14, 2020 at 8:30:22 PM UTC+3, Marcin Erdmann wrote:
>>
>> On Wed, May 13, 2020 at 10:50 PM Gordon Freeman 
>> wrote:
>>
>>> *For 2. *I found this article
>>> https://blog.jdriven.com/2018/10/combining-spock-junit-5-tests/ so,
>>> Junit5 and Spock 1.2 should work together.
>>> I`m not familiar with categories in Junit, should I somehow mark tests
>>> to some categories before create Gradle task?
>>>
>>
>> Yes, like shown here for example:
>> https://mkyong.com/unittest/junit-categories-test/
>>
>>
>>> On Wednesday, May 13, 2020 at 11:06:53 PM UTC+3, Marcin Erdmann wrote:
>>>>
>>>> Gordon,
>>>>
>>>> For 1., why don't you simply use built in test filtering provided by
>>>> Gradle Test task?
>>>>
>>>> ./gradlew uiTest --tests=ui.Ui1Spec --tests=ui.Ui5Spec
>>>> --tests=ui.Ui17Spec --tests=ui.UiRegression78Spec
>>>>
>>>> See
>>>> https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html#setTestNameIncludePatterns-java.util.List-
>>>>  and
>>>> https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/TestFilter.html
>>>> .
>>>>
>>>> For 2., I don't think Spock 1.2 supports JUnit5. Why don't you use
>>>> JUnit categories instead as described at the beginning of
>>>> https://docs.gradle.org/current/userguide/java_testing.html#test_grouping
>>>> ?
>>>>
>>>> Marcin
>>>>
>>>> On Mon, May 11, 2020 at 11:52 AM Gordon Freeman 
>>>> wrote:
>>>>
>>>>> Hi, guys! I need your advice.
>>>>>
>>>>> I have 2 test folders:
>>>>> \src\test\groovy\tests\ui
>>>>> \src\test\groovy\tests\api
>>>>>
>>>>> And have 2 tasks in Gradle:
>>>>> task uiTest(type: Test) {
>>>>> doFirst {
>>>>> include "**/ui/${System.getProperty("testPackage", "")}"
>>>>> exclude "**/api/*"
>>>>> }
>>>>> maxParallelForks = 4
>>>>> forkEvery = 4
>>>>> testLogging.showStandardStreams = true
>>>>> }
>>>>>
>>>>> task apiTest(type: Test) {
>>>>> doFirst {
>>>>> include "**/api/${System.getProperty("testPackage", "")}"
>>>>> exclude "**/ui/*"
>>>>> }
>>>>> maxParallelForks = 4
>>>>> forkEvery = 4
>>>>> testLogging.showStandardStreams = true
>>>>> }
>>>>>
>>>>> I can easily execute one particular test OR all tests in one folder
>>>>> without any execution issues, example for ui tests:
>>>>> gradlew.bat "-DtestPackage=/" clean uiTest -b build.gradle
>>>>> gradlew.bat "-DtestPackage=/Ui1Spec*" clean uiTest -b build.gradle
>>>>>
>>>>>
>>>>> So, I have 2 questions:
>>>>> *1. *How can I execute more than 1 test simultaneously for one
>>>>> *testPackage*, but not all tests from *testPackage*?
>>>>> *For example:* in
>>>>>  '\src\test\groovy\tests\ui'
>>>>> I have 100 tests, but I need to execute only* 'Ui1Spec', 'Ui5Spec',
>>>>> 'Ui17Spec'* and *'UiRegression78Spec'*
>>>>>
>>>>> *2.* How can I execute tests by *Junit5 *tag?
>>>>> *Let me explain:* previously I was working on another framework and
>>>>> we used Selenide+JUnit5, it was very easy to mark test by annotation
>>>>> @Tag('regression')
>>>>> and then execute only tests which were marked:
>>>>>  '-Dtag=regression'
>>>>>
>>>>> I was trying to create gradle task with this closure:
>>>>>  useJUnitPlatform {
>>>>> includeTags 'regression' //or System.getProperty('tag') to
>>>>> make it generic
>>>>> }
>>>>>
>>>>> Found it here <https://www.baeldung.com/junit-5-gradle>but it doesn`t
>>>>> work with *Spock/Geb*, maybe because test classes doesn`t contain '
>>>>> *Test*' s

Re: [geb-user] Ability to skip setup() for certain tests

2020-05-14 Thread Marcin Erdmann
All you need to do is add the 3 classes I pasted to your project, annotate
the tests for which you want to skip setup with `@SkipSetup` and add
a META-INF/services/org.spockframework.runtime.extension.IGlobalExtension
resource file as explained by Alexander in his recent email. I don't know
what kind of example you are after, sorry.

On Thu, May 14, 2020 at 2:51 PM jc  wrote:

> I'm confused on how to implement this solution.  Could you provide a short
> example?
>
> On Wednesday, May 13, 2020 at 2:52:47 PM UTC-5, Marcin Erdmann wrote:
>>
>> Yes, you are right, Alexander. I posted my previous solution without
>> trying it out. FWIW, I got it working this way, I think it's a simpler
>> solution than using an annotation driven extension:
>>
>> class SkipSetupExtension extends AbstractGlobalExtension {
>> @Override
>> void visitSpec(SpecInfo spec) {
>> spec.addSetupInterceptor(new SkipSetupMethodInterceptor())
>> }
>> }
>>
>> class SkipSetupMethodInterceptor implements IMethodInterceptor {
>> @Override
>> void intercept(IMethodInvocation invocation) throws Throwable {
>> if (!invocation.feature.featureMethod.getAnnotation(SkipSetup)) {
>> invocation.proceed()
>> }
>> }
>> }
>>
>> @Retention(RUNTIME)
>> @Target(METHOD)
>> @interface SkipSetup {}
>>
>>
>> Cheers,
>> Marcin
>>
>> On Mon, May 11, 2020 at 3:48 AM Alexander Kriegisch <
>> alex...@kriegisch.name> wrote:
>>
>>> Thanks Marcin,
>>>
>>> but this does not work. In Spock 1.3 (Groovy 2.5) each test dies with
>>> exceptions because in class FeatureInfo we have
>>>
>>>   @Override
>>>   public AnnotatedElement getReflection() {
>>> throw new UnsupportedOperationException("getReflection");
>>>   }
>>>
>>> Same in 2.0-M2 (Groovy 3.0), only there the test runner does not print
>>> anything and for each test just says that it does not find any tests to
>>> run.
>>>
>>> Best regards
>>> --
>>> Alexander Kriegisch
>>>
>>>
>>> Marcin Erdmann schrieb am 11.05.2020 00:22 (GMT +07:00):
>>> >
>>> > Thanks for sharing, Alexander. It's cool to see how powerful Spock's
>>> > extension mechanism is and that it actually allows you to come up with
>>> a
>>> > mechanism to skip certain lifecycle methods based on annotations.
>>> >
>>> >
>>> > FWIW, your solution could probably be slightly improved by changing the
>>> > extension to be a global one with the following implementation of
>>> > IGlobalExtension.visitSpec():
>>> >
>>> > void visitSpec(SpecInfo spec) {
>>> > def featuresWithSkippedSetup = spec.allFeatures.findAll {
>>> > it.getAnnotation(SkipSetup) }
>>> > if (featuresWithSkippedSetup) {
>>> > def interceptor = new SkipSetupMethodInterceptor(skippedFeatures:
>>> > featuresWithSkippedSetup*.name)
>>> > spec.addSetupInterceptor(interceptor)
>>> > }
>>> > }
>>> >
>>> > Marcin
>>> >
>>> >
>>> > On Sun, May 3, 2020 at 5:22 PM Alexander Kriegisch
>>> > mailto:alex...@kriegisch.name>
>>> > > wrote:
>>> >
>>> >>
>>> >> Hi Jeremy.
>>> >>
>>> >> I agree with Marcin in everything he says. You really should refactor
>>> the
>>> >> way he suggested. And as he also said the first time he answered your
>>> >> question, this is a Spock rather than a Geb question.
>>> >>
>>> >> But for what it is worth, I was a little bit bored just now and
>>> wanted to
>>> >> find out if an annotation-driven extension
>>> >> <
>>> http://spockframework.org/spock/docs/2.0-M2/all_in_one.html#_annotation_driven_local_extensions
>>> >
>>> >> could solve the problem. Actually to quickly hack
>>> >>
>>> >>  an annotation @SkipSetup which you can add to any feature method
>>> and
>>> >>  a SkipSetupExtension extends
>>> >>  AbstractAnnotationDrivenExtension with a
>>> >>  visitFeatureAnnotation() method which gets triggered each time an
>>> >>  annotated feature method is intercepted
>>> >>
>>> >>
>>> >> is a matter of two minutes.
>>> &

Re: [geb-user] Execute a few tests from terminal and Junit 5 using

2020-05-14 Thread Marcin Erdmann
On Wed, May 13, 2020 at 10:50 PM Gordon Freeman 
wrote:

> *For 2. *I found this article
> https://blog.jdriven.com/2018/10/combining-spock-junit-5-tests/ so,
> Junit5 and Spock 1.2 should work together.
> I`m not familiar with categories in Junit, should I somehow mark tests to
> some categories before create Gradle task?
>

Yes, like shown here for example:
https://mkyong.com/unittest/junit-categories-test/


> On Wednesday, May 13, 2020 at 11:06:53 PM UTC+3, Marcin Erdmann wrote:
>>
>> Gordon,
>>
>> For 1., why don't you simply use built in test filtering provided by
>> Gradle Test task?
>>
>> ./gradlew uiTest --tests=ui.Ui1Spec --tests=ui.Ui5Spec
>> --tests=ui.Ui17Spec --tests=ui.UiRegression78Spec
>>
>> See
>> https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html#setTestNameIncludePatterns-java.util.List-
>>  and
>> https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/TestFilter.html
>> .
>>
>> For 2., I don't think Spock 1.2 supports JUnit5. Why don't you use JUnit
>> categories instead as described at the beginning of
>> https://docs.gradle.org/current/userguide/java_testing.html#test_grouping
>> ?
>>
>> Marcin
>>
>> On Mon, May 11, 2020 at 11:52 AM Gordon Freeman 
>> wrote:
>>
>>> Hi, guys! I need your advice.
>>>
>>> I have 2 test folders:
>>> \src\test\groovy\tests\ui
>>> \src\test\groovy\tests\api
>>>
>>> And have 2 tasks in Gradle:
>>> task uiTest(type: Test) {
>>> doFirst {
>>> include "**/ui/${System.getProperty("testPackage", "")}"
>>> exclude "**/api/*"
>>> }
>>> maxParallelForks = 4
>>> forkEvery = 4
>>> testLogging.showStandardStreams = true
>>> }
>>>
>>> task apiTest(type: Test) {
>>> doFirst {
>>> include "**/api/${System.getProperty("testPackage", "")}"
>>> exclude "**/ui/*"
>>> }
>>> maxParallelForks = 4
>>> forkEvery = 4
>>> testLogging.showStandardStreams = true
>>> }
>>>
>>> I can easily execute one particular test OR all tests in one folder
>>> without any execution issues, example for ui tests:
>>> gradlew.bat "-DtestPackage=/" clean uiTest -b build.gradle
>>> gradlew.bat "-DtestPackage=/Ui1Spec*" clean uiTest -b build.gradle
>>>
>>>
>>> So, I have 2 questions:
>>> *1. *How can I execute more than 1 test simultaneously for one
>>> *testPackage*, but not all tests from *testPackage*?
>>> *For example:* in
>>>  '\src\test\groovy\tests\ui'
>>> I have 100 tests, but I need to execute only* 'Ui1Spec', 'Ui5Spec',
>>> 'Ui17Spec'* and *'UiRegression78Spec'*
>>>
>>> *2.* How can I execute tests by *Junit5 *tag?
>>> *Let me explain:* previously I was working on another framework and we
>>> used Selenide+JUnit5, it was very easy to mark test by annotation
>>> @Tag('regression')
>>> and then execute only tests which were marked:
>>>  '-Dtag=regression'
>>>
>>> I was trying to create gradle task with this closure:
>>>  useJUnitPlatform {
>>> includeTags 'regression' //or System.getProperty('tag') to make
>>> it generic
>>> }
>>>
>>> Found it here <https://www.baeldung.com/junit-5-gradle>but it doesn`t
>>> work with *Spock/Geb*, maybe because test classes doesn`t contain '
>>> *Test*' suffix?
>>>
>>> FYI my dependencies:
>>>
>>> gebVersion = '3.4'
>>> junitVersion = '5.6.1'
>>> spockVersion = '1.2-groovy-2.5'
>>> groovyVersion = '2.5.10'
>>> compile "org.gebish:geb-spock:$gebVersion"
>>> compile "org.codehaus.groovy:groovy-all:$groovyVersion"
>>> compile "org.codehaus.groovy:groovy-dateutil:$groovyVersion"
>>> compile "org.codehaus.groovy:groovy-all:$groovyVersion"
>>> compile "org.codehaus.groovy:groovy-dateutil:$groovyVersion"
>>> testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion")
>>> testCompile("org.spockframework:spock-core:$spockVersion") {
>>> exclude group: "org.codehaus.groovy"
>>> }
>>>
>>> Thanks in advance!
>>>
>>> --
>>> You received this message because you are subscribed to the Google
&g

Re: [geb-user] Ability to skip setup() for certain tests

2020-05-13 Thread Marcin Erdmann
Yes, you are right, Alexander. I posted my previous solution without trying
it out. FWIW, I got it working this way, I think it's a simpler solution
than using an annotation driven extension:

class SkipSetupExtension extends AbstractGlobalExtension {
@Override
void visitSpec(SpecInfo spec) {
spec.addSetupInterceptor(new SkipSetupMethodInterceptor())
}
}

class SkipSetupMethodInterceptor implements IMethodInterceptor {
@Override
void intercept(IMethodInvocation invocation) throws Throwable {
if (!invocation.feature.featureMethod.getAnnotation(SkipSetup)) {
invocation.proceed()
}
}
}

@Retention(RUNTIME)
@Target(METHOD)
@interface SkipSetup {}


Cheers,
Marcin

On Mon, May 11, 2020 at 3:48 AM Alexander Kriegisch <
alexan...@kriegisch.name> wrote:

> Thanks Marcin,
>
> but this does not work. In Spock 1.3 (Groovy 2.5) each test dies with
> exceptions because in class FeatureInfo we have
>
>   @Override
>   public AnnotatedElement getReflection() {
> throw new UnsupportedOperationException("getReflection");
>   }
>
> Same in 2.0-M2 (Groovy 3.0), only there the test runner does not print
> anything and for each test just says that it does not find any tests to
> run.
>
> Best regards
> --
> Alexander Kriegisch
>
>
> Marcin Erdmann schrieb am 11.05.2020 00:22 (GMT +07:00):
> >
> > Thanks for sharing, Alexander. It's cool to see how powerful Spock's
> > extension mechanism is and that it actually allows you to come up with a
> > mechanism to skip certain lifecycle methods based on annotations.
> >
> >
> > FWIW, your solution could probably be slightly improved by changing the
> > extension to be a global one with the following implementation of
> > IGlobalExtension.visitSpec():
> >
> > void visitSpec(SpecInfo spec) {
> > def featuresWithSkippedSetup = spec.allFeatures.findAll {
> > it.getAnnotation(SkipSetup) }
> > if (featuresWithSkippedSetup) {
> > def interceptor = new SkipSetupMethodInterceptor(skippedFeatures:
> > featuresWithSkippedSetup*.name)
> > spec.addSetupInterceptor(interceptor)
> > }
> > }
> >
> > Marcin
> >
> >
> > On Sun, May 3, 2020 at 5:22 PM Alexander Kriegisch
> > mailto:alexan...@kriegisch.name>
> > > wrote:
> >
> >>
> >> Hi Jeremy.
> >>
> >> I agree with Marcin in everything he says. You really should refactor
> the
> >> way he suggested. And as he also said the first time he answered your
> >> question, this is a Spock rather than a Geb question.
> >>
> >> But for what it is worth, I was a little bit bored just now and wanted
> to
> >> find out if an annotation-driven extension
> >> <
> http://spockframework.org/spock/docs/2.0-M2/all_in_one.html#_annotation_driven_local_extensions
> >
> >> could solve the problem. Actually to quickly hack
> >>
> >>  an annotation @SkipSetup which you can add to any feature method
> and
> >>  a SkipSetupExtension extends
> >>  AbstractAnnotationDrivenExtension with a
> >>  visitFeatureAnnotation() method which gets triggered each time an
> >>  annotated feature method is intercepted
> >>
> >>
> >> is a matter of two minutes.
> >>
> >> The complication here is the fact that actually nothing specific should
> >> happen in the annotated method itself but in the feature's setup()
> method
> >> which gets executed at another time (later, more precisely). So we have
> >> to find a way to communicate to the setup() method that we want to skip
> >> it. The way I did it is a bit contrived, but easy enough to implement:
> >>
> >>  The first time our annotation-driven extension gets triggered
> (i.e. the
> >>  first time Spock finds a feature method annotated by @SkipSetup),
> we
> >>  create a special method interceptor which only intercepts setup()
> >>  methods.
> >>  We add that interceptor instance to the SpecInfo and also save a
> >>  reference to it in the SkipSetupExtension in order to avoid
> creating a
> >>  new interceptor each time we meet a @SkipSetup annotation. We only
> want
> >>  to do that once.
> >>  The interceptor itself gets a List skippedFeatures property
> >>  which we update with each newly found feature method name carrying
> the
> >>  marker annotation.
> >>  During runtime the interceptor's interceptSetupMethod() method
> checks if
> >>  it finds the current feature me

Re: [geb-user] How to retrieve system property within GebConfig.groovy when declared in a Gradle task

2020-05-10 Thread Marcin Erdmann
Yeah, getting a confirmation that what you are expecting to work should
work usually helps a great deal because if it doesn't then you can be
certain that it's because of some mistake on your part. I'm glad that it
works for you now, Lee.

Marcin

On Thu, May 7, 2020 at 3:56 PM Lee  wrote:

> Hi Marcin,
>
> I totally redid everything so I could try and reproduce the issue and get
> more error details. And of course, everything worked this time as
> expected.  ;-)
>
> I must have mis-typed one little thing someplace that caused the issue
> initially.
>
> It helped to know that this 'should' work though.
>
> Thanks again for taking a look and responding.
>
> Take care,
>
> Lee
>
>
> On Wednesday, April 29, 2020 at 8:08:11 PM UTC-5, Lee wrote:
>>
>> Thanks for responding Marcin.
>>
>> Unfortunately, I had to move forward with a proof of concept for this and
>> ended up implementing it a very ugly way for now.  I don't have the
>> original results available to provide here.  I will circle back around to
>> this and re-create what I did before and update this with the results in
>> the near future after I finish a higher priority issue.
>>
>> For what it's worth, it seemed like it just couldn't find "
>> http://localhost:/wd/hub; to execute against when I set '
>> standAloneURL' equal to that via the system property 'remoteUrl' that I
>> set in the Gradle task.
>>
>> But, if I hard-coded it in the gebconfig file it did work though.  Like
>> this:
>> standAloneURL = "http://localhost:/wd/hub;
>>
>> environments {
>>  chrome {
>>driver = {
>>  chromeOptions.addArguments("--window-size=1920,1080")
>>  chromeOptions.addArguments("--headless")
>>  chromeOptions.addArguments("--disable-gpu")
>>  new RemoteWebDriver(new URL(standAloneURL), chromeOptions)
>>}
>>   }
>> }
>>
>> Again, I'll try to re-create this soon so I can provide better info.
>>
>> Thanks much,
>>
>> Lee
>>
>> On Wednesday, April 29, 2020 at 4:54:51 PM UTC-5, Marcin Erdmann wrote:
>>>
>>> Hi Lee,
>>>
>>> The configuration you described looks correct to me and it should work
>>> as far as I can tell. The geb.env system property seems to be set because
>>> configuration for chrome environment is used so I don't see a reason why
>>> another property, set in the same way on the same gradle test task would
>>> not be picked up in your geb config script.
>>>
>>> When you say that:
>>>
>>> > This always fails though as it seems to not be able to get the
>>> property when it's declared in the Gradle task.
>>>
>>> how exactly does this failure manifest?
>>>
>>> Cheers,
>>> Marcin
>>>
>>> On Fri, Apr 24, 2020 at 12:55 AM Lee  wrote:
>>>
>>>> I've created a Gradle file where I define a task to execute Geb tests
>>>> pretty much as follows:
>>>>
>>>> task gebTest(type: Test {
>>>>  include 'somePathToTests'
>>>>  systemProperty 'geb.env', 'chrome'
>>>> )
>>>>
>>>> I have the 'chrome' environment configured in my GebConfig.groovy file
>>>> and that works fine.
>>>>
>>>> What I'd like to do is define a new system property in the Gradle task
>>>> and be able to use that from within the GebConfig file.
>>>>
>>>> Example of modified Gradle task with new 'remoteUrl' system property
>>>> declaration:
>>>>
>>>> task gebTest(type: Test {
>>>>   include 'somePathToTests'
>>>>   systemProperty 'geb.env', 'chrome'
>>>>   systemProperty 'remoteUrl', "http://localhost:/wd/hub;
>>>> )
>>>>
>>>>
>>>>
>>>> How I'm trying to use it in the GebConfig file:
>>>>
>>>> standAloneURL = System.getProperty('remoteUrl')​​​
>>>>
>>>> environments {
>>>>  chrome {
>>>>driver = {
>>>>  chromeOptions.addArguments("--window-size=1920,1080")
>>>>  chromeOptions.addArguments("--headless")
>>>>  chromeOptions.addArguments("--disable-gpu")
>>>>  new RemoteWebDriver(new URL(standAloneURL), chromeOptions)
>>>>}
>>>>   }
>>>> }
>>>>
>>>> This always fails though as it seems to not be able to get the property
>>&g

Re: [geb-user] Ability to skip setup() for certain tests

2020-05-10 Thread Marcin Erdmann
pMethod(IMethodInvocation invocation) throws Throwable {
> if (!skippedFeatures.contains(invocation.feature.name))
>   invocation.proceed()
>   }
> }
>
> --
>
> package de.scrum_master.testing
>
> import spock.lang.Specification
>
> class SkipSetupTestA extends Specification {
>   def setup() {
> println "SkipSetupTestA -> setup"
>   }
>
>   def feature1() {
> println "SkipSetupTestA -> feature1"
> expect: true
>   }
>
>   @SkipSetup
>   def feature2() {
> println "SkipSetupTestA -> feature2"
> expect: true
>   }
>
>   def feature3() {
> println "SkipSetupTestA -> feature3"
> expect: true
>   }
>
>   @SkipSetup
>   def feature4() {
> println "SkipSetupTestA -> feature4"
> expect: true
>   }
> }
>
> --
>
> package de.scrum_master.testing
>
> import spock.lang.Specification
>
> class SkipSetupTestB extends Specification {
>   def setup() {
> println "SkipSetupTestB -> setup"
>   }
>
>   def feature1() {
> println "SkipSetupTestB -> feature1"
> expect: true
>   }
>
>   @SkipSetup
>   def feature2() {
> println "SkipSetupTestB -> feature2"
> expect: true
>   }
>
>   def feature3() {
> println "SkipSetupTestB -> feature3"
> expect: true
>   }
>
>   @SkipSetup
>   def feature4() {
> println "SkipSetupTestB -> feature4"
> expect: true
>   }
> }
>
> --
>
> I am also attaching a ZIP file with the source code for your convenience.
> 
>
> Let us complete the picture with the console log output when running both
> specifications together:
> --
>
> SkipSetupTestA -> setup
> SkipSetupTestA -> feature1
> SkipSetupTestA -> feature2
> SkipSetupTestA -> setup
> SkipSetupTestA -> feature3
> SkipSetupTestA -> feature4
> SkipSetupTestB -> setup
> SkipSetupTestB -> feature1
> SkipSetupTestB -> feature2
> SkipSetupTestB -> setup
> SkipSetupTestB -> feature3
> SkipSetupTestB -> feature4
>
> --
> I think this is what you wanted, is it not?
>
> Regards
> --
> Alexander Kriegisch
> https://scrum-master.de
>
>
> Marcin Erdmann schrieb am 03.05.2020 19:22 (GMT +07:00):
>
> Jeremy,
>
> I thought that you asked this question once before and after searching
> through the past messages to the list from you it turned out that I was
> right. I will just link to my reply to your earlier email on the topic:
> https://groups.google.com/d/msg/geb-user/7vIvuB64CFw/CvcUVnxmFQAJ.
> Personally, I'd consider the need to skip the setup method on one or two
> tests a smell as well as an indicator that these tests do not belong in the
> spec in question and should probably be moved out to a separate spec.
>
> Marcin
>
> On Fri, May 1, 2020 at 6:50 PM jc  wrote:
>
>> I think a good enhancement would be the ability to skip the setup() for
>> particular tests.  For example I have 20 tests but 1 or 2 of them are
>> slightly different and don't need the setup().  Perhaps a flag of
>> setup: false
>>
>> on the method or something like that.  Just throwing the idea out there
>> as I have had several time this has come up for me.  We can easily get
>> around it by just creating a method of what we want and putting it in all
>> the tests except the ones that don't need it but I thought maybe others
>> have come across this.  Just want to throw an enhancement idea out there.
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Geb User Mailing List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to geb-user+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/geb-user/306afc9f-0883-4a40-b16c-e786dbfde9a4%40googlegroups.com
>> <https://groups.google.com/d/msgid/geb-user/306afc9f-0883-4a40-b16c-e786dbfde9a4%40googlegroups.com?utm_medium=email_source=footer>
>> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/CA%2B52dQQt_i-1EESWL9fjO3ZMB5FwFXCaeFKb46nn4eg_R2oG%2

Re: [geb-user] Ability to skip setup() for certain tests

2020-05-03 Thread Marcin Erdmann
Jeremy,

I thought that you asked this question once before and after searching
through the past messages to the list from you it turned out that I was
right. I will just link to my reply to your earlier email on the topic:
https://groups.google.com/d/msg/geb-user/7vIvuB64CFw/CvcUVnxmFQAJ.
Personally, I'd consider the need to skip the setup method on one or two
tests a smell as well as an indicator that these tests do not belong in the
spec in question and should probably be moved out to a separate spec.

Marcin

On Fri, May 1, 2020 at 6:50 PM jc  wrote:

> I think a good enhancement would be the ability to skip the setup() for
> particular tests.  For example I have 20 tests but 1 or 2 of them are
> slightly different and don't need the setup().  Perhaps a flag of
> setup: false
>
> on the method or something like that.  Just throwing the idea out there as
> I have had several time this has come up for me.  We can easily get around
> it by just creating a method of what we want and putting it in all the
> tests except the ones that don't need it but I thought maybe others have
> come across this.  Just want to throw an enhancement idea out there.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/306afc9f-0883-4a40-b16c-e786dbfde9a4%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQt_i-1EESWL9fjO3ZMB5FwFXCaeFKb46nn4eg_R2oG%2Bw%40mail.gmail.com.


Re: [geb-user] Overriding click() in a nested parameterized modules

2020-04-29 Thread Marcin Erdmann
Hi Trey,

Unfortunately, I cannot explain the behaviour you are seeing. There is
probably something that you are missing and not mentioning because there is
nothing in your setup that would explain the behaviour you are describing.

In your email you say:
> But, the click() ends up being directed to the navigator on which the
module is based
Can you please explain how you know that? It would be also good to see the
code which actually triggers the click and not just read the description of
it.

In your question you pasted two classes with overridden click methods
(SideNavItem and SideNavGroup) but they seem like two distinct cases, first
one with some debugging in it which doesn't have any child classes and
second one which has a child class (TrafficReports). Why is SideNavItem
relevant to your question?

I tried to reproduce by adding the following test in Geb's codebase but to
no avail:

class OverriddenClickOnAParametrisedChildModuleSpec extends
GebSpecWithCallbackServer {
def "overridden click works as expected"() {
given:
html {
body {
input(type: "text", name: "input")
}
}

when:
def module = module(new ModuleExtendingFromOneWithOverriddenClick())
def clicked = module.click()

then:
clicked.tag() == "input"
module.input.focused
}
}

class ModuleWithOverriddenClick extends Module {
static content = {
input { $("input") }
}

@Override
Navigator click() {
input.click()
}
}

class ModuleExtendingFromOneWithOverriddenClick extends
ModuleWithOverriddenClick {
}

The above is passing as expected and also failing as expected if I remove
the overridden click() method.

On Fri, Apr 24, 2020 at 7:16 AM Trey Turner  wrote:

> Hi again. I am in need of some help, and though my track record suggests
> the possibility I've overlooked something obvious, I've dug as deep as I'm
> able and haven't come up with an answer yet so I thought to ask here.
>
> I commonly implement a click() method override within modules. I do this
> to redirect clicks directed toward the module to a more appropriate content
> element within the module for easier/thoughtless clicking from specs. I
> discovered the pattern when modeling checkbox facades, and to date, it's
> worked without issue, though my use cases have been relatively
> straightforward so far.
>
> I'm modeling a new application now though, and my page objects are
> becoming increasingly complex. At this point, I'm implementing
> parameterized modules from within modules that are extended from
> parameterized module classes, and I'm finding I'm unable to intercept
> clicks bound for my innermost modules.
>
> That is to say, I write a method in the module to intercept and redirect
> the click, as I always have:
>
>
> class SideNavItem extends Module {
>
> String itemName
>
> static content = {
> container (required: false)
> { label.closest('a') }
> label (required: false)
> { $('.mat-list-item-content', text: iEndsWith(itemName)) }
> }
>
> @Override
> Navigator click() {
> log.debug("DOING CUSTOM CLICK")
> container.click()
> }
>
> @Override
> boolean isDisplayed() {
> log.debug("DOING CUSTOM ISDISPLAYED")
> container.isDisplayed()
> }
>
> Navigator click(boolean please) {
> log.debug("DOING CUSTOM CLICK WITH BOOLEAN")
> container.click()
> }
> }
>
>
> But, the click() ends up being directed to the navigator on which the
> module is based, resulting in the wrong element being clicked, and my
> custom log line is never logged. If I am more specific in the spec, and
> click the container directly, my custom method isn't called of course, but
> I get the expected result, so I know my override method would work if it
> were invoked.
>
> To check my logic, I did two things. First I implemented a custom
> isDisplayed() override just as I did the click() override, and it works as
> expected. If I call .isDisplayed() on the module, my custom isDisplayed()
> override method is invoked as the debug line is logged.
>
> To take it one step further, I created a click(boolean) method; and if I
> call .click(true) on the module from my spec, again my override method is
> invoked and I get the expected result.
>
> So I'm at a bit of a loss at this point - I'm not sure why I can't invoke
> my custom click() method, or what I could adjust to maintain my level of
> abstraction and still get the desired effect.
>
> I know it probably doesn't mean much with Groovy, but if I switch my spec
> syntax to use fully-qualified page class names, when I 'go to definition'
> on the module's click() method within IntelliJ IDEA, it goes straight to my
> custom method.
>
> Have I indeed overlooked something simple? Is there anything further I can
> do to troubleshoot?
>
> As I mentioned, the parent module extends from 

Re: [geb-user] How to retrieve system property within GebConfig.groovy when declared in a Gradle task

2020-04-29 Thread Marcin Erdmann
Hi Lee,

The configuration you described looks correct to me and it should work as
far as I can tell. The geb.env system property seems to be set because
configuration for chrome environment is used so I don't see a reason why
another property, set in the same way on the same gradle test task would
not be picked up in your geb config script.

When you say that:

> This always fails though as it seems to not be able to get the property
when it's declared in the Gradle task.

how exactly does this failure manifest?

Cheers,
Marcin

On Fri, Apr 24, 2020 at 12:55 AM Lee  wrote:

> I've created a Gradle file where I define a task to execute Geb tests
> pretty much as follows:
>
> task gebTest(type: Test {
>  include 'somePathToTests'
>  systemProperty 'geb.env', 'chrome'
> )
>
> I have the 'chrome' environment configured in my GebConfig.groovy file and
> that works fine.
>
> What I'd like to do is define a new system property in the Gradle task and
> be able to use that from within the GebConfig file.
>
> Example of modified Gradle task with new 'remoteUrl' system property
> declaration:
>
> task gebTest(type: Test {
>   include 'somePathToTests'
>   systemProperty 'geb.env', 'chrome'
>   systemProperty 'remoteUrl', "http://localhost:/wd/hub;
> )
>
>
>
> How I'm trying to use it in the GebConfig file:
>
> standAloneURL = System.getProperty('remoteUrl')​​​
>
> environments {
>  chrome {
>driver = {
>  chromeOptions.addArguments("--window-size=1920,1080")
>  chromeOptions.addArguments("--headless")
>  chromeOptions.addArguments("--disable-gpu")
>  new RemoteWebDriver(new URL(standAloneURL), chromeOptions)
>}
>   }
> }
>
> This always fails though as it seems to not be able to get the property
> when it's declared in the Gradle task.
>
> But, if I update the GebConfig file by hard coding the 'standAloneURL' to
> be what I want, it works fine.
>
> Example:
> standAloneURL = "http://localhost:/wd/hub;
>
>
> This is confusing me as setting the system property 'geb.env' in my Gradle
> task works just fine.
>
> Are there any suggestions as to what I may be doing wrong?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/49e631e5-d019-4a9b-81b6-1a677e106a82%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQR0vWr1%3DmEKkFbnMaPOb1-N5_O65Kiq%2BY_swA9JH8JEMQ%40mail.gmail.com.


Re: [geb-user] Handling nested iframes with Geb

2020-04-29 Thread Marcin Erdmann
Hi Thomas,

Back in the day, the only way to switch out of a frame was to
call WebDriver.TargetLocator.defaultContent() which indeed switches to the
top level document in the browser and it is what is used at the end of
withFrame() execution. But after you brought this to my attention I had
another look and it seems that WebDriver.TargetLocator.parentFrame() has
been introduced in WebDriver 3.x. I therefore created an issue to switch to
using this new method to better support the frame context when nested
withFrame() calls are used: https://github.com/geb/issues/issues/612.

Cheers,
Marcin

On Wed, Apr 29, 2020 at 4:33 PM Thomas Hirsch  wrote:

> Hello Marcin,
>
> I just came across this issue just now, while having a similar problem
> with nested frames.
> It seemed to me like the browser would always end up in the top level
> document after a withFrame call, at least adding driver.switchTo().frame()
> after every call to  withFrame (inside a nested frame (!!!)) is solving
> the issue for me right now.
> Looking at the code of DefaultFrameSupport, there is indeed a call to
> driver.switchTo().defaultContent(), in the finally block of
> executeWithFrame...
>
> I am assuming that driver.switchTo().defaultContent() would indeed switch
> to the top level document in the browser, as opposed to the next higher up
> frame, do you know if that is actually true?
>
> Here is the code of my method inside a page loaded inside a frame (inputs
> for cardNumber and CVV are inside nested frames), and it worked after
> adding the lines below the comments:
>
> void inputCreditCardDetails(
> String cardNumber,
> String expiryDate,
> String holderName,
> String cvv) {
>
> withFrame(cardNumberIframe) {
> cardNumberInput << cardNumber
> }
> // Not sure why we need this extra frame switching here...
> driver.switchTo().frame($('.checkout-modal-iframe').firstElement())
> expiryDateInput << expiryDate
> holderNameInput << holderName
> withFrame(cvvInputIframe) {
> cvvInput << cvv
> }
> // Not sure why we need this extra frame switching here...
> driver.switchTo().frame($('.checkout-modal-iframe').firstElement())
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/665a6164-5146-47d8-8ce0-59dd3aa22891%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQR9WvzJc_z0H9WY7ZktZRS7RHiuWBm2HgXSdqg-cFpP5w%40mail.gmail.com.


Re: [geb-user] geb.driver.DriverCreationException: failed to create driver from callback 'script1586597042131428524687$_run_closure1$_closure3$_closure7@fafe172'

2020-04-18 Thread Marcin Erdmann
The stacktrace you are getting mentions not being able to call a
constructor of com.google.common.util.concurrent.SimpleTimeLimiter, which
is a guava class. The problem will most likely be that the version of guava
used is incompatible with the version of WebDriver you are using. You seem
to be using WebDrvier 2.47.1 which is a relatively old version and which
most likely requires an older version of Guava. You have a lot of
dependencies specified in your build file and I suspect at least one of
them depends on a newer version of Guava which means that a newer one ends
up on a classpath as selecting a newer version is what Gradle does by
default when there is a dependency version conflict.

To get better insight into what's going on with the dependency on guava you
can execute ./gradlew dependencyInsight --configuration testRuntime
--dependency guava.

On Wed, Apr 15, 2020 at 7:23 AM vijay kumar  wrote:

> when i run my test script, getting below error
>
> om.posh.automation.LoginSpec > Login Test cases FAILED
> geb.driver.DriverCreationException: failed to create driver from
> callback
> 'script1586597042131428524687$_run_closure1$_closure3$_closure7@fafe172'
> at
> geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35)
> at
> geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:85)
> at
> geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy)
> at
> geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:32)
> at
> geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:84)
> at geb.Configuration.createDriver(Configuration.groovy:382)
> at geb.Configuration.getDriver(Configuration.groovy:371)
> at geb.Browser.getDriver(Browser.groovy:111)
> at
> geb.navigator.factory.BrowserBackedNavigatorFactory.(BrowserBackedNavigatorFactory.groovy:35)
> at
> geb.Configuration.createNavigatorFactory(Configuration.groovy:417)
> at geb.Browser.createNavigatorFactory(Browser.groovy:133)
> at geb.Browser.getNavigatorFactory(Browser.groovy:121)
> at geb.Page.init(Page.groovy:144)
> at geb.Browser.createPage(Browser.groovy:859)
> at geb.Browser.to(Browser.groovy:550)
> at geb.Browser.to(Browser.groovy:539)
> at geb.spock.GebSpec.methodMissing(GebSpec.groovy:56)
> at
> com.posh.automation.LoginSpec.$tt__$spock_feature_2_1(LoginSpec.groovy:47)
> at com.posh.automation.LoginSpec.Login Test
> cases_closure2(LoginSpec.groovy)
> at groovy.lang.Closure.call(Closure.java:418)
> at groovy.lang.Closure.call(Closure.java:434)
> at
> grails.gorm.transactions.GrailsTransactionTemplate$1.doInTransaction(GrailsTransactionTemplate.groovy:68)
> at
> org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
> at
> grails.gorm.transactions.GrailsTransactionTemplate.executeAndRollback(GrailsTransactionTemplate.groovy:65)
> at com.posh.automation.LoginSpec.Login Test cases(LoginSpec.groovy)
>
> Caused by:
> java.lang.IllegalAccessError: tried to access method
> com.google.common.util.concurrent.SimpleTimeLimiter.(Ljava/util/concurrent/ExecutorService;)V
> from class org.openqa
> .selenium.net.UrlChecker
> at
> org.openqa.selenium.net.UrlChecker.(UrlChecker.java:66)
> at
> org.openqa.selenium.remote.service.DriverService.start(DriverService.java:167)
> at
> org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:63)
> at
> org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:568)
> at
> org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
> at
> org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:128)
> at
> org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:141)
> at
> org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:170)
> at
> org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:159)
> at
> org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:148)
> at
> script1586597042131428524687$_run_closure1.closure3$_closure7(script1586597042131428524687.groovy:22)
> at
> script1586597042131428524687$_run_closure1.closure3$_closure7(script1586597042131428524687.groovy)
> at
> geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:29)
> ... 24 more
>
> geb.driver.DriverCreationException: failed to create driver from
> callback
> 'script1586597042131428524687$_run_closure1$_closure3$_closure7@fafe172'
>
> Caused by:
> java.lang.IllegalAccessError: tried to access method
> com.google.common.util.concurrent.SimpleTimeLimiter.(Ljava/util/concurrent/ExecutorService;)V

Re: [geb-user] Global toWait?

2020-04-05 Thread Marcin Erdmann
Hi Trey,

Unfortunately, you did not configure it correctly. As per the docs,
atCheckWaiting configuration goes at the top level of GebConfig:
https://gebish.org/manual/current/#at-check-waiting.

FWIW, I've also added a test which confirms that atCheckWaiting global
config applies when clicking on content with "to" option specified:
https://github.com/geb/geb/commit/48d696bfb28c5d90181805218a43f091fd1b3094.
It fails if the `config.atCheckWaiting` line is commented out.

Cheers,
Marcin

On Thu, Apr 2, 2020 at 7:04 PM Trey Turner  wrote:

> Does it not go within the waiting block? :/ I assumed it was working
> because it seems to be properly handled when I go 'to' a page within a
> spec. Apologies if I've got this wrong.
>
> waiting {
>
> // Implicitly wait for at-checks to complete
> atCheckWaiting = true
>
> //default (ie. wait:true)
> timeout = 8
> retryInterval = 0.5
>
> presets {
> shortest {
> timeout = 2
> retryInterval = 0.25
> }
> shorter {
> timeout = 4
> retryInterval = 0.25
> }
> longer {
> timeout = 16
> retryInterval = 0.5
> }
> longest {
> timeout = 32
> retryInterval = 0.5
> }
> coffee {
> timeout = 192
> retryInterval = 1
> }
> }
> }
>
> On Thu, Apr 2, 2020 at 12:49 PM Marcin Erdmann 
> wrote:
>
>> From looking at the code it should be honouring global atCheckWaiting.
>> Are you sure you've configured it correctly? I don't think that we have a
>> specific test for your case but it won't be a big deal to add it. Please
>> double check for me that you have configured global atCheckWaiting
>> correctly before I start adding it, though.
>>
>> On Thu, Apr 2, 2020 at 4:40 PM Trey Turner 
>> wrote:
>>
>>> Ah, to clarify, it seems to pass when I add the page-specific
>>> atCheckWaiting, but it does not seem to apply the global atCheckWaiting
>>> value from GebConfig.groovy. Is this possibly correct?
>>>
>>> On Thu, Apr 2, 2020 at 10:37 AM Trey Turner 
>>> wrote:
>>>
>>>> Hi Marcin,
>>>> Here's the stack thrown without the toWait defined using Geb 3.3. I
>>>> don't see the WaitTimeoutException. This at-check passes if I add the
>>>> toWait.
>>>>
>>>> At checker page verification failed for page
>>>> net.kapsch.roms.qa.ui.page.ServiceIssues
>>>> geb.error.UnexpectedPageException: At checker page verification failed
>>>> for page net.kapsch.roms.qa.ui.page.ServiceIssues
>>>> at geb.navigator.DefaultNavigator.click(DefaultNavigator.groovy:705)
>>>> at geb.navigator.DefaultNavigator.click(DefaultNavigator.groovy:682)
>>>> at geb.Module.click(Module.groovy:186)
>>>> at
>>>> geb.content.TemplateDerivedPageContent.click(TemplateDerivedPageContent.groovy:83)
>>>> at net.kapsch.roms.qa.ui.spec.home.HomeSpec.should be able to open the
>>>> service issues tab(HomeSpec.groovy:24)
>>>> Caused by: geb.error.RequiredPageContentNotPresent: The required page
>>>> content 'net.kapsch.roms.qa.ui.page.ServiceIssues -> toolbar:
>>>> net.kapsch.roms.qa.ui.module.service_issues.Toolbar' is not present
>>>> at
>>>> geb.content.TemplateDerivedPageContent.require(TemplateDerivedPageContent.groovy:64)
>>>> at
>>>> geb.content.PageContentTemplate.create_closure1(PageContentTemplate.groovy:63)
>>>> at
>>>> geb.content.PageContentTemplate.create_closure1(PageContentTemplate.groovy)
>>>> at geb.content.PageContentTemplate.create(PageContentTemplate.groovy:87)
>>>> at geb.content.PageContentTemplate.get(PageContentTemplate.groovy:54)
>>>> at
>>>> geb.content.DefaultPageContentSupport.getContent(DefaultPageContentSupport.groovy:42)
>>>> at
>>>> geb.content.PageContentSupport.propertyMissing(PageContentSupport.groovy:41)
>>>> at geb.Page.propertyMissing(Page.groovy:110)
>>>> at groovy.lang.Closure.getPropertyTryThese(Closure.java:313)
>>>> at groovy.lang.Closure.getPropertyDelegateFirst(Closure.java:303)
>>>> at groovy.lang.Closure.getProperty(Closure.java:288)
>>>> at
>>>> net.kapsch.roms.qa.ui.page.ServiceIssues._clinit__closure1(ServiceIssues.groovy:15)
>>>> at
>>>> net.kapsch.roms.qa.ui.page.ServiceIssues._clinit__closure1(ServiceIssues.groovy)
>>>> at
>>>> geb.waiting.Poten

Re: [geb-user] Global toWait?

2020-04-02 Thread Marcin Erdmann
>From looking at the code it should be honouring global atCheckWaiting. Are
you sure you've configured it correctly? I don't think that we have a
specific test for your case but it won't be a big deal to add it. Please
double check for me that you have configured global atCheckWaiting
correctly before I start adding it, though.

On Thu, Apr 2, 2020 at 4:40 PM Trey Turner  wrote:

> Ah, to clarify, it seems to pass when I add the page-specific
> atCheckWaiting, but it does not seem to apply the global atCheckWaiting
> value from GebConfig.groovy. Is this possibly correct?
>
> On Thu, Apr 2, 2020 at 10:37 AM Trey Turner 
> wrote:
>
>> Hi Marcin,
>> Here's the stack thrown without the toWait defined using Geb 3.3. I don't
>> see the WaitTimeoutException. This at-check passes if I add the toWait.
>>
>> At checker page verification failed for page
>> net.kapsch.roms.qa.ui.page.ServiceIssues
>> geb.error.UnexpectedPageException: At checker page verification failed
>> for page net.kapsch.roms.qa.ui.page.ServiceIssues
>> at geb.navigator.DefaultNavigator.click(DefaultNavigator.groovy:705)
>> at geb.navigator.DefaultNavigator.click(DefaultNavigator.groovy:682)
>> at geb.Module.click(Module.groovy:186)
>> at
>> geb.content.TemplateDerivedPageContent.click(TemplateDerivedPageContent.groovy:83)
>> at net.kapsch.roms.qa.ui.spec.home.HomeSpec.should be able to open the
>> service issues tab(HomeSpec.groovy:24)
>> Caused by: geb.error.RequiredPageContentNotPresent: The required page
>> content 'net.kapsch.roms.qa.ui.page.ServiceIssues -> toolbar:
>> net.kapsch.roms.qa.ui.module.service_issues.Toolbar' is not present
>> at
>> geb.content.TemplateDerivedPageContent.require(TemplateDerivedPageContent.groovy:64)
>> at
>> geb.content.PageContentTemplate.create_closure1(PageContentTemplate.groovy:63)
>> at
>> geb.content.PageContentTemplate.create_closure1(PageContentTemplate.groovy)
>> at geb.content.PageContentTemplate.create(PageContentTemplate.groovy:87)
>> at geb.content.PageContentTemplate.get(PageContentTemplate.groovy:54)
>> at
>> geb.content.DefaultPageContentSupport.getContent(DefaultPageContentSupport.groovy:42)
>> at
>> geb.content.PageContentSupport.propertyMissing(PageContentSupport.groovy:41)
>> at geb.Page.propertyMissing(Page.groovy:110)
>> at groovy.lang.Closure.getPropertyTryThese(Closure.java:313)
>> at groovy.lang.Closure.getPropertyDelegateFirst(Closure.java:303)
>> at groovy.lang.Closure.getProperty(Closure.java:288)
>> at
>> net.kapsch.roms.qa.ui.page.ServiceIssues._clinit__closure1(ServiceIssues.groovy:15)
>> at
>> net.kapsch.roms.qa.ui.page.ServiceIssues._clinit__closure1(ServiceIssues.groovy)
>> at
>> geb.waiting.PotentiallyWaitingExecutor.execute(PotentiallyWaitingExecutor.groovy:30)
>> at geb.Page.verifyThisPageAtOnly(Page.groovy:420)
>> at geb.Page.getAtVerificationResult(Page.groovy:213)
>> at geb.Page.verifyAt(Page.groovy:184)
>> at geb.Browser.methodMissing(Browser.groovy:254)
>> at
>> geb.navigator.DefaultNavigator.click_closure46(DefaultNavigator.groovy:694)
>> at geb.navigator.DefaultNavigator.click_closure46(DefaultNavigator.groovy)
>> at
>> geb.waiting.PotentiallyWaitingExecutor.execute(PotentiallyWaitingExecutor.groovy:30)
>> at geb.navigator.DefaultNavigator.click(DefaultNavigator.groovy:694)
>> ... 4 more
>>
>> Thanks,
>> Trey
>>
>> On Thu, Apr 2, 2020 at 1:40 AM Marcin Erdmann 
>> wrote:
>>
>>> Hi Trey,
>>>
>>> What makes you believe that the value for atCheckWaiting of a page is
>>> ignored when using it as an argument for to: configuration option of a
>>> content template? Are you seeing at check failures that do not
>>> contain WaitTimeoutException in the stacktrace? From what I can see in the
>>> code atCheckWaiting setting for a page will not be ignored in that case
>>> which makes me wonder why you believe it is.
>>>
>>> Marcin
>>>
>>> On Thu, Apr 2, 2020 at 2:09 AM Trey Turner 
>>> wrote:
>>>
>>>> Hi there,
>>>> I had assumed that a content element declared with a (to:PageName)
>>>> parameter would use the target page's (or default) atCheckWaiting value,
>>>> but it seems I must also specify the toWait in each case. Is there any way
>>>> to specify a global toWait? The need for this is pervasive in my complex
>>>> SPA.
>>>>
>>>> Thanks,
>>>> Trey
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>

Re: [geb-user] Global toWait?

2020-04-02 Thread Marcin Erdmann
Hi Trey,

What makes you believe that the value for atCheckWaiting of a page is
ignored when using it as an argument for to: configuration option of a
content template? Are you seeing at check failures that do not
contain WaitTimeoutException in the stacktrace? From what I can see in the
code atCheckWaiting setting for a page will not be ignored in that case
which makes me wonder why you believe it is.

Marcin

On Thu, Apr 2, 2020 at 2:09 AM Trey Turner  wrote:

> Hi there,
> I had assumed that a content element declared with a (to:PageName)
> parameter would use the target page's (or default) atCheckWaiting value,
> but it seems I must also specify the toWait in each case. Is there any way
> to specify a global toWait? The need for this is pervasive in my complex
> SPA.
>
> Thanks,
> Trey
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/c863c7b9-70d3-4f4e-bd57-14cfe2d2a4b8%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTtXDZmjinP2rDokeC-7n0VSyO8KX1tit4j4Ng5drxBdQ%40mail.gmail.com.


Re: [geb-user] best place in code to call geb Configuration's setDefaultWaitTimeout()

2020-03-31 Thread Marcin Erdmann
That would be my suggestion as well, to put it in your Geb config script.

On Tue, Mar 31, 2020 at 2:06 PM Alexander Kriegisch <
alexan...@kriegisch.name> wrote:

> Have you tried GebConfig.groovy?
> https://gebish.org/manual/current/#default-waiting-configuration
>
> --
> Alexander Kriegisch
> https://scrum-master.de
>
>
> Master Automator schrieb am 31.03.2020 09:13 (GMT +07:00):
>
> > In the Gradle command that runs our Geb specs, we pass in the command
> > line a default timeout for that set of specs.
> >
> > Currently, we use this parsed cmd line timeout arg in the setupSpec()
> > method:
> >
> >   browser.getConfig().setDefaultWaitTimeout(<>)
> >
> > Is there a way to not have to do this in every spec but do it in a
> > single place if we are ok with the same default timeout for the set of
> > specs?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/20200331130607.14B4A44C08DF%40dd39516.kasserver.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTZJiqfWVFfxk7b5FUet29FNxqoye-x8wwLBuywSd%2Bp5A%40mail.gmail.com.


[geb-user] [ANN] Geb 3.4 has been released

2020-03-29 Thread Marcin Erdmann
Hi,

Version 3.4 of Geb has been released and is available from Maven Central.

This version contains a number of bug fixes and improvements.

The full list of changes is as usual available in the Book of Geb at
https://gebish.org/manual/current/#3-4.

Cheers,
Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQROARTE64az75e7V8af7Arbjs6wQXHEmo83JHat6U_omQ%40mail.gmail.com.


Re: [geb-user] Know which element intercepted a click

2020-02-24 Thread Marcin Erdmann
With regards to another element receiving a click - I know that some
drivers, i.e. chrome, raise an exception in that case, just google for
"org.openqa.selenium.WebDriverException: Element is not clickable at
point". But I don't know how reliable that is given you are using chrome as
the driver as far as I can tell and you are not seeing that exception...

Other than that, I unfortunately don't have any advice. I don't know how
you would automatically detect that an unintended element received a click.
FWIW, it's probably more of a Selenium rather than Geb question, really.

On Mon, Feb 24, 2020 at 1:09 PM François Guillot 
wrote:

> Hi
>
> I stumbled upon this problem several time.
> I select a Navigator and want to click on it.
> But it's actually another element that receives the click.
> This can happen because Selenium clicks at the middle of the singleElement
> represented by this Navigator.
> And it could be that something else is displayed at that exact coordinates.
>
> It works on my machine, but doesn't on others with a different screen
> resolution (or when I manually play around with my browser test window
> size, because I'm moving it to another screen for instance)
> => On my machine, I also have this 'other element', but it's not reaching
> the middle of the Navigator I want to click on, so I don't see the problem.
> On another browser resolution, the center of the Navigator is obstructed
> by this other -clickable- element. And the resulting behavior is not the
> expected one, and hard to diagnose.
>
> Is there a way to ensure that the element that received the click is the
> one we targeted ?
> I'dl like to print a warning, or even throw when that happens, as it's
> clearly not by-design of the test author.
>
>
> Thanks,
>
> François
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/a641fb85-31e0-413f-98e2-b7b8cf569d74%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQTOUmWAwrUMsfMg2sXgT%3D%2BjyVoitHFRDhr_a%3DCLM7RLEw%40mail.gmail.com.


Re: [geb-user] Generating non-Junit reports ...automating the attaching of test execution results / screenshots from a CI system (e.g. Jenkins) to JIRA

2020-02-21 Thread Marcin Erdmann
I would go even further and say that this is not a Spock question but a
JUnit question because Spock is using JUnit as the execution engine. I
would therefore suggest asking these quesitons in JUnit support channels.
Also, contacting Xray and/or Zephyr support might provide some answers.

Cheers,
Marcin

On Wed, Feb 19, 2020 at 11:52 PM Master Automator 
wrote:

>
> I understand this maybe more of a Spock question than Geb ...
>
> *tldr;*
>
>- I am wondering what other formats of test execution results /
>reports are easily generated when using Geb/Spock?  In addition to JUnit.
>
>
> *Context:*
>
> We are trying to upload test execution results (Junit reports)
> automatically generated by Geb / Spock into a test case management system.
> There are some known issues in Junit reports like tags (specifically tags
> representing the JIRA ticket number the test case is automating etc).  So I
> am wondering what other formats of test execution results / reports are
> easily generated when using Geb/Spock?
>
>
> Also, is anyone here automating the attaching of test execution results /
> screenshots from a CI system (e.g. Jenkins) to JIRA based test case
> management systems (like Xray or Zephyr etc)?
>
> Thanks in advance folks!
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/1070b5cc-6255-4889-bc27-1ae588490047%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRHQM4GHDaGB0hDB0mu%2BFgASF2QHtw_tQ0Q8Ow9g_x3yQ%40mail.gmail.com.


Re: [geb-user] Re: Enhanced screenshots to help understand flakiness

2020-02-17 Thread Marcin Erdmann
On Sun, Feb 16, 2020 at 2:32 PM François Guillot 
wrote:

> I agree with you that it's more convenient to have that info all in one
>> file, but we have to be careful when considering pulling stuff into core
>> not to make the screenshots a dumping ground for information that might be
>> useful to some users. As I said, I'd be more than happy to accept a PR with
>> a custom reporter which reports on the url and dimensions of the browser in
>> a text form but I'm afraid I will have to say no to including that
>> information in the screenshot as I personally believe it is not the right
>> place for that information.
>>
> Totally agree with you here. If it ends up in core, it will be on a
> separate report.
>

Awesome.


> The context I talked about in my previous email was meant to be used to
>> communicate between a caller to report() and various reporters. What you
>> are talking about seems to be a completely different concern which has to
>> do with communicating between respective before/after methods
>> on NavigatorEventListener and possibly also between beforeAtCheck
>> and onAtCheckSuccess/onAtCheckFailure methods on PageEventListener. This
>> sounds like it might be something useful - please feel free to create an
>> issue for implementing this in the tracker at
>> https://github.com/geb/issues/issues.
>>
> Yes that is exactly that.
>
>> On the other hand I'm not sure I understand how this helps you to work
>> around the fact that there is a period of time between something being
>> clicked and the animation marker class being added to the animated element
>> but maybe I don't fully grok what you're trying to explain or do not have
>> the full context to be able to do so. In my opinion one cannot reliably
>> wait for an asynchronously initiated (the fact that it's asynchronous being
>> the key here), temporary state to complete because you either run into the
>> issue that you will consider the state to be completed because you check
>> for it before it even started or you run into the possibility of not
>> detecting the state (animation) to occur at all if it is very short and it
>> manages to start and stop between your polling checks.
>>
> It's just that if you share some state between the before and after click,
> you're sure to not miss the start of the animation, and then poll for its
> end.
> You're right that this cannot work based on polling only, the state holder
> would have to be notified when the animation start, but I'm sure there must
> be some ways to achieve that, no?
>

I'm sorry but I don't see a way to achieve that... How would you register
anything to be triggered when the animation starts? Does velocity.js have a
callback for that? Even if it does, then it will be executed in the browser
and as far as I know there is no way to call back from javascript to
Selenium. It feels to me that what you're after is adding a class that
signifies that an element is being animated in an on click handler in js
which will be synchronous and then removing that class when an animation
completes (looks like velocity.js allows to register a function which is
executed when an animation completes). The below trait shows what I propose
applied to css transitions and based on transitionend event (
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/transitionend_event
):

trait CssTransitionWaitingSupport implements Navigator, WaitingSupport {

abstract JavascriptInterface getJs()

void waitForCssTransitionToFinish(Closure trigger) {
js.exec(singleElement(), '''
var o = jQuery(arguments[0]);
window.setTransitionFinishedClass = function() {
$(this).addClass('transitionFinished');
}
o.bind('transitionend', window.setTransitionFinishedClass);
''')
try {
trigger.call()
waitFor { hasClass('transitionFinished') }
} finally {
js.exec(singleElement(), '''
var o = jQuery(arguments[0]);
o.unbind('transitionend',
window.setTransitionFinishedClass);
o.removeClass('transitionFinished')
window.setTransitionFinishedClass = undefined;
''')
}
}
}

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQR%2BThtBNA8qV5%3D%2B9n_oFtq8GAOCo9MqatjqXioQd-g%2BJQ%40mail.gmail.com.


Re: [geb-user] Re: Enhanced screenshots to help understand flakiness

2020-02-16 Thread Marcin Erdmann
Hi François,

Apologies for the delay in my response, I was on holidays.

On Sat, Feb 8, 2020 at 1:34 PM François Guillot 
wrote:

> With Luke on the team, what would you expect ;) ? We've been using it
> right from the start.
>

You never know, people move on and find new toys to play with. :)


> We do have such setting, but with large width/height.
> It seems that when executed locally, if the window dimension is larger
> than your machine screen, then the dimension is capped to the screen.
> Therefore we sometimes have different behaviors locally on and CI (e.g.
> tooltip hiding an element that is then not clickable, due to the
> positioning of the tooltip being somewhat influenced by the window
> dimension).
>

Right, I see.


> 2. For reporting browser url I would probably introduce a
>> new geb.report.Reporter implementation that writes the url into a text
>> file, I don't think that there is a valid reason for why that information
>> should be written onto the screenshot
>>
> Agreed. This was a quick hack (yet valuable) to pinpoint some missing
> waitFor's.
> That being said, having to look at a text file _and_ a screenshot is less
> ideal to get the global 'context' of a browser test failure.
>

I agree with you that it's more convenient to have that info all in one
file, but we have to be careful when considering pulling stuff into core
not to make the screenshots a dumping ground for information that might be
useful to some users. As I said, I'd be more than happy to accept a PR with
a custom reporter which reports on the url and dimensions of the browser in
a text form but I'm afraid I will have to say no to including that
information in the screenshot as I personally believe it is not the right
place for that information.


> I'll try to prepare something on my time off. It's therefore going to take
> a bit of time, but I'll do it.
>

Looking forward to it. Fingers crossed that you will get round to it at
some point, however long that might take.


> While we're discussing improvements, it would be great than the 'context'
> you're referring to was shared between the beforeClick / afterClick
> callbacks., and if we could somehow inject an arbitrary object into it.
> The use case is that we have some clicks that trigger an animation (using
> velocity.js). The targeted element has a 'velocity-animating' CSS class
> when being animated. We currently use the presence (or the lack thereof) of
> this CSS class to ensure the animation is fully done. But the logic is not
> perfect, because if we're entering the 'afterClick' callback before the
> animation has even started (which could happen when the browser is under
> stress, like in CI), we don't find the 'velocity-animating- CSS class, and
> think the animation is over. To overcome this, I still need to have a
> little waitFor with a timeout, to ensure sufficient time is waited (for the
> likeliness of this scenario to happen to be near zero)
> If we share an object between the beforeClick/afterClick context, I can
> then register something that somehow is notified when the animation will
> start (and we know it will start), and then the afterClick can query this
> same object to know if the animation has started (and potentially is
> already over) reliably.
>

The context I talked about in my previous email was meant to be used to
communicate between a caller to report() and various reporters. What you
are talking about seems to be a completely different concern which has to
do with communicating between respective before/after methods
on NavigatorEventListener and possibly also between beforeAtCheck
and onAtCheckSuccess/onAtCheckFailure methods on PageEventListener. This
sounds like it might be something useful - please feel free to create an
issue for implementing this in the tracker at
https://github.com/geb/issues/issues.
On the other hand I'm not sure I understand how this helps you to work
around the fact that there is a period of time between something being
clicked and the animation marker class being added to the animated element
but maybe I don't fully grok what you're trying to explain or do not have
the full context to be able to do so. In my opinion one cannot reliably
wait for an asynchronously initiated (the fact that it's asynchronous being
the key here), temporary state to complete because you either run into the
issue that you will consider the state to be completed because you check
for it before it even started or you run into the possibility of not
detecting the state (animation) to occur at all if it is very short and it
manages to start and stop between your polling checks.

Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Re: [geb-user] Re: Enhanced screenshots to help understand flakiness

2020-02-08 Thread Marcin Erdmann
Hi François,

Thank you very much for your email. It's great to learn that Geb is being
used to test the frontend of Gradle Enterprise. It's also cool to see that
a fairly new addition to Geb in the form of NavigatorEventListener is being
used out there in the wild.

I think what you're doing makes a lot of sense. I think most folks writing
browser tests for modern, single page apps deal with flakiness caused by
async events in one form or another. For example, on my current project, we
recently had a push to quash flakiness in our tests and introduced a number
of custom reporters which turned out to be very effective:
- one which writes browser console logs
- one which remote controls (https://github.com/ldaley/remote-control) into
the server and writes a thread dump to see if any long running operations
are currently in flight

Both of them could probably be pulled into Geb core in one form or another,
with the biggest stumbling block probably being making the first one cross
browser.

I find big parts of what you've done useful and generic enough to be pulled
into core. Let me comment one by one:

1. I don't see much value in adding the window size onto the screenshot. I
personally tend to make my tests reliable with regards to browser size by
always setting the browser size to a predefined value when constructing a
driver instance, e.g.:

driver.manage().window().size = new Dimension(1024, 768)

2. For reporting browser url I would probably introduce a
new geb.report.Reporter implementation that writes the url into a text
file, I don't think that there is a valid reason for why that information
should be written onto the screenshot

3. Writing out current active element and mouse position looks great. We
could enhance geb.report.ScreenshotReporter with configuration properties
like reportCurrentElement and reportMousePosition and write that info into
the screenshot if these properties are set - that way it would be a
backwards compatible change and we could change the default values of these
props to true in the next major version. Unfortunately I don't have the
capacity at the moment to see if one can get mouse position in a cleaner or
more efficient way than you have done.

4. For dealing with rendering the position of what will be clicked I think
we should extend the reporting mechanism to be able to pass additional
information via some kind of a context and then react in the reporter to
that data being set and perform additional actions.

If you’re up for contributing back what you have then I’d suggest attacking
points 2 and 3 and when we get that merged I will tackle 4 cause that will
be a bit more involved with regards to introducing a reporting context.

Cheers,
Marcin

On Wed, Feb 5, 2020 at 10:15 PM François Guillot 
wrote:

> I actually forgot to add the screenshots mentioned...
>
>
>
> On Wednesday, February 5, 2020 at 11:14:41 PM UTC+1, François Guillot
> wrote:
>>
>> Hi,
>>
>> We are using Geb, associated to a ChromeDriver instance to execute a
>> bunch of browser tests on our application.
>> Some of those tests are flaky, mainly due to the lack of 'waitFor {}'
>> calls around animations that happen when clicking a web element.
>>
>> In order to help us understanding and fixing the flakiness, we capture
>> screenshots when a test fails.
>> But this is sometimes not enough.
>>
>> Say, the test fail with 'waitFor { someElement.displayed }', the
>> screenshot will either show
>> - that the element is indeed not displayed
>> - that the element is displayed, but that doesn't help. It might be that
>> by the time the screenshot is captured, the animation is actually finished
>> and the screenshot doesn't really reflect the _exact_ state when the
>> failure occurred.
>>
>>
>> So, in order to assist even more, I had the idea to enhance the
>> screenshots with some data.
>> Basically, I added a 'ReportingListener', that grabs the created PNG
>> screenshot, and writes a bunch of stuff on top if it, using java's
>> Graphics2D API.
>> Currently, I add info like:
>> - the browser dimension (it can help in case of tooltips being displayed
>> and hiding elements between them. These tooltips positions can differ based
>> on the browser's dimension)
>> - the browser URL
>> - the current 'document.activeElement'
>> - the current cursor position.
>>   - since we can't get the mouse position directly, but only when the
>> mouse moves (correct me if I'm wrong), I hack around this by adding a 
>> 'document.onmousemove
>> = event => { window.mouseX = event.pageX; window.mouseY = event.pageY'
>> script, and then do 'browser.interact { moveByOffset(1, 0) }', and then
>> execute 'return [window.mouseX, window.mouseY]', and substract 1 to the
>> mouseX returned value.
>> - I also capture the cursor position before and after click
>>   - I added a NavigatorEventListener
>>   - implement 'beforeClick' / 'afterClick' and use the same approach as
>> above to store the Navigator.x / Navigator.y values in some 

Re: [geb-user] Is it possible to skip the setup() method for certain features?

2020-02-08 Thread Marcin Erdmann
Hi Jeremy,

This is a bit more of a Spock question than Geb question so probably asking
on StackOverflow and tagging your question with spock would get you more
responses to it.

Anyhow, when I find myself wanting to apply code from setup() method in a
spec to only a subset of feature methods then I either:
- move the code from setup() into a different method and then call that
method at the top of each feature method I want the setup code to apply to
- split the spec into two - one which contains all of the methods that I
want the setup code in question applied to and one with methods that I
don't want the setup code applied to.

As far as I can tell there is no way to apply code from setup() to only a
subset of methods in the spec without splitting things up a bit.

Cheers,
Marcin

On Wed, Feb 5, 2020 at 2:30 PM jc  wrote:

> Just curious, let's say I have 20 tests in a class but 2 of the tests have
> slightly different requirements than what I have in the setup() method.  Is
> there a way to have those 2 tests skip the setup()?  I know I can just
> create separate methods and put them in the appropriate tests, but I was
> just curious if there was an easy way to skip setup(), if at all possible.
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/e5cb2dde-aaa9-41c4-bb75-19c247108dd3%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRwW7_G3EKyJoKdsPa7wfKqrZgqSMsQ6mc%2B%2BV6Yar-Bog%40mail.gmail.com.


Re: [geb-user] geb / selenium proxy config

2020-02-05 Thread Marcin Erdmann
Setting a proxy for selenium has nothing to do with Gradle - it's a concern
specific to the driver implementation used.

I can see that you are using htmlunit driver from the provided stacktrace -
you will most likely want to call this method:
https://www.javadoc.io/doc/org.seleniumhq.selenium/selenium-htmlunit-driver/latest/org/openqa/selenium/htmlunit/HtmlUnitDriver.html#setProxySettings-org.openqa.selenium.Proxy-
from
your driver configuration inside of GebConfig.groovy:
https://gebish.org/manual/current/#factory-closure.

Marcin

On Wed, Feb 5, 2020 at 9:18 AM clemens utschig 
wrote:

> folks we are using  geb / spock / selenium - gradle based inside a
> corporate network - and get lovely css / js loading exceptions
>
> javax.net.ssl.SSLException: Connection reset
>   at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:127)
>   at 
> java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:320)
>   at 
> java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:263)
>   at 
> java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:258)
>   at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:137)
>   at 
> java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1152)
>   at 
> java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063)
>   at 
> java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402)
>   at 
> org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436)
>   at 
> org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384)
>   at 
> com.gargoylesoftware.htmlunit.httpclient.HtmlUnitSSLConnectionSocketFactory.connectSocket(HtmlUnitSSLConnectionSocketFactory.java:184)
>   at 
> org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
>   at 
> org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:374)
>   at 
> org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
>   at 
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
>   at 
> org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
>   at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
>   at 
> org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
>   at 
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
>   at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
>   at 
> com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:189)
>   at 
> com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1407)
>   at 
> com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1326)
>   at 
> com.gargoylesoftware.htmlunit.html.HtmlLink.getWebResponse(HtmlLink.java:202)
>   at 
> com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet.loadStylesheet(CSSStyleSheet.java:314)
>   at 
> com.gargoylesoftware.htmlunit.javascript.host.html.HTMLLinkElement.getSheet(HTMLLinkElement.java:143)
>   at 
> com.gargoylesoftware.htmlunit.javascript.host.css.StyleSheetList.item(StyleSheetList.java:188)
>   at 
> com.gargoylesoftware.htmlunit.javascript.host.Window.getComputedStyle(Window.java:1873)
>   at 
> com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getOffsetParentInternal(HTMLElement.java:1889)
>   at 
> com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getOffsetParent(HTMLElement.java:1796)
>   at 
> com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getOffsetTop(HTMLElement.java:1819)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   at 
> net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:188)
>   at 
> net.sourceforge.htmlunit.corejs.javascript.ScriptableObject$GetterSlot.getValue(ScriptableObject.java:353)
>   at 
> net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.get(ScriptableObject.java:480)
>   at 
> com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.get(SimpleScriptable.java:83)
>   at 
> com.gargoylesoftware.htmlunit.javascript.host.Element.get(Element.java:519)
>   at 
> net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getProperty(ScriptableObject.java:2345)

[geb-user] [ANN] Geb 3.3 has been released

2020-01-12 Thread Marcin Erdmann
Hi,

Version 3.3 of Geb has been released and is available from Maven Central.

This version contains a number of bug fixes and improvements.

The full list of changes is as usual available in the Book of Geb at
https://gebish.org/manual/current/#3-3.

Cheers,
Marcin

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQSVzp1yxU6NSmJHs7BUF-9m2ZRcbQb%3DNViQ%3DNVEnOt-kQ%40mail.gmail.com.


Re: [geb-user] Geb Binding

2020-01-11 Thread Marcin Erdmann
Hi Varun,

It looks like you're getting a null pointer exception which isn't
surprising to me at all because you're not initialising the
`bindingUpdater` variable anywhere and you are attempting to access a
property of it.

To be honest, I've never really used Cucumber for anything meaningful. All
of the experience I have with it is keeping the project at
https://github.com/geb/geb-example-cucumber-jvm, which was contributed by a
community member, working as I release new versions of Geb. I can see that
you are using what looks like a "hooks class" to me as opposed to using a
script at src/cucumber/resources/env/env.groovy like in the example but I
don't know which one is more "correct" for a cucumber project that is being
bootstrapped at this point in time. I think this is a question which can
probably only be answered by somebody with more knowledge about using
Cucumber especially with Groovy.

Cheers,
Marcin

On Thu, Jan 9, 2020 at 9:48 PM Varun Jain  wrote:

> My automation tests use Cucumber and Geb. I am trying to create a browser
> object at the beginning of my test execution in the cucumber before hooks.
> To share the browser object, I am trying to use Geb biding but when I
> create a class variable bindingUpdater and then trying to use it then I
> am getting error.  Can someone help me and explain what is going on. Should
> I only be using the env.groovy file to use binding?
> Following is the code which I am trying in my machine ( copied the code
> from Marcin's repo
> https://github.com/geb/geb-example-gradle/tree/master/src/test)
>
> package hooks
>
> import geb.Browser
> import geb.binding.BindingUpdater
> import io.cucumber.java.After
> import io.cucumber.java.AfterStep
> import io.cucumber.java.Before
> import io.cucumber.java.BeforeStep
>
> class Hooks {
>
> BindingUpdater bindingUpdater
> Browser theBrowser
>
> @Before
> public void createBrowser() {
> if (!bindingUpdater.binding.hasVariable('browser')) {
> theBrowser = new Browser()
> bindingUpdater = new BindingUpdater(bindingUpdater.binding, 
> theBrowser)
> bindingUpdater.initialize()
> } else {
> // save for later screenshot taking
> theBrowser = browser
> }
>
> go "/cart"
> }
>
>
> *Error*
>
>   java.lang.NullPointerException: Cannot get property 'binding' on
> null object
> at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:60)
> at
> org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:190)
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:304)
> at hooks.Hooks.createBrowser(Hooks.groovy:17)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> at cucumber.runtime.Utils$1.call(Utils.java:26)
> at cucumber.runtime.Timeout.timeout(Timeout.java:16)
>
>
> Varun
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/10e57b36-f4f6-4667-97db-2ffbe306da57%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQr3XzTZVrz4c25TrbMTs0L%2BuKpdnb_67vqOvkEKVMrwg%40mail.gmail.com.


Re: [geb-user] "Element is not clickable at point" when element defined in content closure

2019-12-23 Thread Marcin Erdmann
Nico,

Unfortunately I don't have an explanation of why the error occurs. I might
have a better idea if I had access to the full stacktrace and corresponding
code.

Cheers,
Marcin

On Mon, Dec 23, 2019 at 11:53 AM Nico Janssens 
wrote:

> Hi Marcin ,
>
> Thanks for the reply.
>
> After doing some debugging, I found out that the click is actually
> applied. The strange thing is that the error occurs :
>
>
> org.openqa.selenium.ElementClickInterceptedException: element click
> intercepted: Element is not clickable at point (924, 913)
>   (Session info: chrome=79.0.3945.88)
> Build info: version: '3.14.0', revision: 'aae0', time:
> '2018-08-02T20:19:58.91Z'
> System info: host: 'BEC02TQ17BHTD5.local', ip: '10.217.11.203', os.name:
> 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version:
> '1.8.0_202'
> Driver info: org.openqa.selenium.chrome.ChromeDriver
> Capabilities {acceptInsecureCerts: false, browserName: chrome,
> browserVersion: 79.0.3945.88, chrome: {chromedriverVersion: 79.0.3945.36
> (3582db32b3389..., userDataDir: /var/folders/8d/bwl_96yd0bx...},
> goog:chromeOptions: {debuggerAddress: localhost:54252}, javascriptEnabled:
> true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform:
> MAC, platformName: MAC, proxy: Proxy(), setWindowRect: true,
> strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 30,
> script: 3}, unhandledPromptBehavior: dismiss and notify}
> Session ID: a1853ff8f110e25713bf295941e7dd1c
>
>
> What happens is that I click a button in a page A (defined as page object)
> which gets me to a page B (defined as page object). Next I do an at
> verification of page B which is successful. Then I do some actions in page
> B and finally do a click on a save button which should do a save action and
> bring me back to page A.  I can actually see during the test run that the
> save button is clicked and page A is displayed. However after the save
> action , the error is thrown which is quite strange as the click action is
> actually performed?? The location mentioned in the error is the exact
> location of the save button in page B.  Also when looking in the geb
> reports a screenshot is taken of page A when click action has been
> performed.  Any idea why it keeps complaining about element not clickable?
>
> thanks
>
> Kind regards
>
> Nico
>
>
> On Saturday, 21 December 2019 11:53:52 UTC+1, Marcin Erdmann wrote:
>>
>> Hi Nico,
>>
>> Your problem is most likely a timing issue.
>>
>> Is there any difference defining the element in the content closure or
>>> using the navigator directly in the method?
>>>
>>
>> Strictly speaking there is, because the calls will go through different
>> code paths but in general the outcome should be the same. Unless, like in
>> your case, we are dealing with an async page which exposes certain timing
>> properties. Using a selector is just about quicker than using a page
>> definition and I suspect, and it's only a suspicion, that in this case it's
>> quicker enough to lead to a different behaviour because the page is in a
>> different state when clicking on the element.
>>
>> I'd advise you to never put click() within waitFor() blocks - it will be
>> prone to timing issues and can sometimes lead to the element being clicked
>> multiple times. What I would do to make your test reliable is to
>> identify the object which is overlaying the element you're clicking and
>> causing the exception, wait for it to appear, dismiss it and then click on
>> your target element. That way things will be reliable.
>>
>> On Wed, Dec 18, 2019 at 11:45 AM Nico Janssens 
>> wrote:
>>
>>> Hey ,
>>>
>>> Hmmm , I'm already using a waitFor closure in the method , which should
>>> result in the same behaviour as using the wait option in content block.
>>> Anyway when I apply the wait option and remove the waitFor in the method ,
>>> I get the same error.
>>>
>>> ---
>>>
>>> dashboardListSaveButton { $('[data-gtm="content-planner/filters/save"]')}
>>>
>>> def "save dashboard list"() {
>>>waitFor {
>>>   dashboardListSaveButton
>>>}
>>> }
>>>
>>> ---
>>>
>>> VS
>>>
>>> ---
>>>
>>>  dashboardListSaveButton(wait: true) {
>>> $('[data-gtm="content-planner/filters/save"]')}
>>>
>>> def "save dashboard list"() {
>>>   d

Re: [geb-user] "Element is not clickable at point" when element defined in content closure

2019-12-21 Thread Marcin Erdmann
Hi Nico,

Your problem is most likely a timing issue.

Is there any difference defining the element in the content closure or
> using the navigator directly in the method?
>

Strictly speaking there is, because the calls will go through different
code paths but in general the outcome should be the same. Unless, like in
your case, we are dealing with an async page which exposes certain timing
properties. Using a selector is just about quicker than using a page
definition and I suspect, and it's only a suspicion, that in this case it's
quicker enough to lead to a different behaviour because the page is in a
different state when clicking on the element.

I'd advise you to never put click() within waitFor() blocks - it will be
prone to timing issues and can sometimes lead to the element being clicked
multiple times. What I would do to make your test reliable is to
identify the object which is overlaying the element you're clicking and
causing the exception, wait for it to appear, dismiss it and then click on
your target element. That way things will be reliable.

On Wed, Dec 18, 2019 at 11:45 AM Nico Janssens 
wrote:

> Hey ,
>
> Hmmm , I'm already using a waitFor closure in the method , which should
> result in the same behaviour as using the wait option in content block.
> Anyway when I apply the wait option and remove the waitFor in the method ,
> I get the same error.
>
> ---
>
> dashboardListSaveButton { $('[data-gtm="content-planner/filters/save"]')}
>
> def "save dashboard list"() {
>waitFor {
>   dashboardListSaveButton
>}
> }
>
> ---
>
> VS
>
> ---
>
>  dashboardListSaveButton(wait: true) {
> $('[data-gtm="content-planner/filters/save"]')}
>
> def "save dashboard list"() {
>   dashboardListSaveButton
> }
>
> ---
>
>
> thx
>
> On Wednesday, 18 December 2019 11:27:50 UTC+1, micha.kutz wrote:
>>
>> Hey Nico,
>>
>> the difference is the `waitFor` in the method. You can achieve the same
>> behavior in the content block by adding a `wait: true` like this:
>>
>> static content = {
>> ...
>> dashboardListSaveButton(wait: true) {
>> $('[data-gtm="content-planner/filters/save"]')}
>> ...
>> }
>>
>> See https://gebish.org/manual/current/#content-dsl-wait
>>
>> Kind regards
>>
>> Nico Janssens  schrieb am Mi., 18. Dez. 2019,
>> 11:08:
>>
>>> Hi,
>>>
>>> A question about content closure.
>>>
>>> In the content closure of a page object , I have defined some elements :
>>>
>>> static content = {
>>>
>>>   dashboardListSaveButton { $(
>>> '[data-gtm="content-planner/filters/save"]')}
>>>...
>>> }
>>>
>>>
>>> In that same page object , I have a method like
>>>
>>> def "save dashboard list"() {
>>>waitFor {
>>>   dashboardListSaveButton.click()
>>>}
>>> }
>>>
>>>
>>> When running the test ( via spock framework) which makes use of the
>>> method above, I always get following exception
>>> : ElementClickInterceptedException: element click intercepted: Element is
>>> not clickable at point (924, 913)
>>>
>>> When I modify the method like this
>>>
>>> def "save dashboard list"() {
>>>waitFor {
>>>   $('[data-gtm="content-planner/filters/save"]').click()
>>>}
>>> }
>>>
>>> and rerun the test, it works fine.
>>>
>>>
>>> Is there any difference defining the element in the content closure or
>>> using the navigator directly in the method?
>>>
>>> thx
>>>
>>>
>>> Kind regards
>>>
>>> Nico
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Geb User Mailing List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to geb-...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/geb-user/6d2f7006-b5f5-47bb-bd7d-9d4a66dab8dd%40googlegroups.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/581f4240-f58e-41d4-aced-74426616db39%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Re: [geb-user] java.lang.StackOverFlow Exception on waitFor

2019-11-09 Thread Marcin Erdmann
For some reason the class you added (BindingUpdaterSupportingTextMatchers)
inside of the features directory is treated as a script and is being
instantiated using a no arg constructor which doesn't exist, most likely by
cucumber. When I moved the class to the bottom of the env.groovy file and
removed the BindingUpdaterSupportingTextMatchers.groovy file then it worked
for me.

On Thu, Nov 7, 2019 at 6:56 AM raz  wrote:

> Thanks Marcin, issue # 601 created.
>
> I'm trying the workaround to override the BindingUpdater but getting the
> following exception:
>
> [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java
> (default) on project sample-test: An exception occured while executing
> the Java class. Failed to create Script instance for class: class features
> .support.BindingUpdaterSuppo
> rtingTextMatchers. Reason: java.lang.reflect.InvocationTargetException:
> geb.binding.BindingUpdater: method ()V not found -> [Help 1]
>
>
> What I did was
> 1. created a new class *BindingUpdaterSupportingTextMatchers*
> 2. placed your provided code in it
> 3. updated the previous binding statement
> bindingUpdater = new BindingUpdater(binding, browser)
>
> to use the new class
>
> bindingUpdater = new BindingUpdaterSupportingTextMatchers(binding, browser)
>
> Did I miss a step or did something incorrectly? Seems like it's looking for a 
> blank constructor for BindingUpdater but can't find it because it doesn't 
> exist yet??
>
>
> Have also attached the project showing the changes.
>
>
>
> Thanks,
> Raza
>
> On Thursday, 7 November 2019 09:37:53 UTC+11, Marcin Erdmann wrote:
>>
>> This is because the binding updater does not forward methods
>> from geb.textmatching.TextMatchingSupport onto the Browser instance. Would
>> you mind creating an issue for that in the tracker at
>> https://github.com/geb/issues/issues?
>>
>> To workaround that issue you can override the BindingUpdater:
>>
>> @InheritConstructors
>> class BindingUpdaterSupportingTextMatchers extends BindingUpdater {
>> static public final TEXT_MATCHING_FORWARDED_BROWSER_METHODS =
>> ["contains"]
>>
>> @Override
>> BindingUpdater initialize() {
>> super.initialize()
>>
>> TEXT_MATCHING_FORWARDED_BROWSER_METHODS.each {
>> binding.setVariable(it, new
>> BindingUpdater.InvocationForwarding(it, browser))
>> }
>>
>> this
>> }
>>
>> @Override
>> BindingUpdater remove() {
>> super.remove()
>>
>> TEXT_MATCHING_FORWARDED_BROWSER_METHODS.each {
>> binding.variables.remove(it)
>> }
>>
>> this
>> }
>> }
>>
>> and use that instead of the one provided out of the box. You will
>> probably want to add names of additional methods from TextMatchingSupport
>> to TEXT_MATCHING_FORWARDED_BROWSER_METHODS if you want them to work.
>>
>> Another workaround would be not to use the matcher methods directly in
>> your steps but as part of page definitions using content DSL (
>> https://gebish.org/manual/current/#content-dsl). As far as I can tell,
>> using text matcher methods in content definitions should work for you
>> without any changes being needed.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/c79b3597-c94c-4e0c-8351-be419484559e%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/c79b3597-c94c-4e0c-8351-be419484559e%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQ2_zCRGpiWENH3qe3JZDM7xW3NDZ%3DOOrALewNoz6dXdw%40mail.gmail.com.


Re: [geb-user] Having difficulty using SauceLabs with Gradle

2019-11-06 Thread Marcin Erdmann
Does that mean that we've finally arrived at a working solution? If that's
the case then this is most likely the longest thread ending in success on
this list. Like ever. :)

On Wed, Nov 6, 2019 at 10:22 PM Ben Frey  wrote:

>  Oh, I thought that was for if you don't want to use a tunnel *at all*.
> Sure enough, setting that doesn't create an extra tunnel in our SauceLabs
> instance. Thanks for all of your patience, I really appreciate it!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/59cbd606-6bdc-44b2-857a-01cd0d67f52c%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQSQZ03%2B%2Bp2ZnMyvj4Rx5_d9uZSunCu5f%2Bat3aW-%2B5rTxA%40mail.gmail.com.


Re: [geb-user] java.lang.StackOverFlow Exception on waitFor

2019-11-06 Thread Marcin Erdmann
This is because the binding updater does not forward methods
from geb.textmatching.TextMatchingSupport onto the Browser instance. Would
you mind creating an issue for that in the tracker at
https://github.com/geb/issues/issues?

To workaround that issue you can override the BindingUpdater:

@InheritConstructors
class BindingUpdaterSupportingTextMatchers extends BindingUpdater {
static public final TEXT_MATCHING_FORWARDED_BROWSER_METHODS =
["contains"]

@Override
BindingUpdater initialize() {
super.initialize()

TEXT_MATCHING_FORWARDED_BROWSER_METHODS.each {
binding.setVariable(it, new
BindingUpdater.InvocationForwarding(it, browser))
}

this
}

@Override
BindingUpdater remove() {
super.remove()

TEXT_MATCHING_FORWARDED_BROWSER_METHODS.each {
binding.variables.remove(it)
}

this
}
}

and use that instead of the one provided out of the box. You will probably
want to add names of additional methods from TextMatchingSupport
to TEXT_MATCHING_FORWARDED_BROWSER_METHODS if you want them to work.

Another workaround would be not to use the matcher methods directly in your
steps but as part of page definitions using content DSL (
https://gebish.org/manual/current/#content-dsl). As far as I can tell,
using text matcher methods in content definitions should work for you
without any changes being needed.

On Wed, Nov 6, 2019 at 6:24 AM raz  wrote:

> Thanks Marcin,
>
> That seems to have fixed the StackOverFlow exception.
>
> Now I'm getting this exception
> groovy.lang.MissingMethodException: No signature of method: cucumber.
> runtime.groovy.GroovyWorld.contains() is applicable for argument types: (
> String) values: [q]
>
> when using
>
> browser.$('input', name: contains('q')) << term + Keys.ENTER
>
>
> instead of
> browser.$('input', name: 'q') << term + Keys.ENTER
>
> I have attached the updated project again (as per the example you shared),
> can you please let me know if it's setup as it should be? Am I missing an
> import to use shortcut pattern methods?
>
> Really appreciate your help.
>
> Thanks!
>
>
>
> On Saturday, 2 November 2019 00:24:22 UTC+11, Marcin Erdmann wrote:
>>
>> Raz,
>>
>> This is not a problem with Geb but it's down how you setup the
>> environment for your cucumber environment, namely mixing in the browser
>> class into them using this.metaClass.mixin(geb.Browser) which is something
>> you should never do. Instead you should setup your environment using the
>> BindingUpdater, as shown in the example project at
>> https://github.com/geb/geb-example-cucumber-jvm/blob/master/src/cucumber/resources/env/env.groovy.
>> After removing the mixing in and using the bundle updater I was able to get
>> the scenarios you attached to pass:
>>
>> [erdi@mbp ~/Downloads/testsuite-sandbox]$ mvn clean test
>> -Dgeb.env=chrome -DtagArg=@US01
>> [INFO] Scanning for projects...
>> [INFO]
>> [INFO] -< au.com.sandbox:sample-test
>> >-
>> [INFO] Building sandbox-test 0.0.1
>> [INFO] [ jar
>> ]-
>> [INFO]
>> [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ sample-test
>> ---
>> [INFO] Deleting /Users/erdi/Downloads/testsuite-sandbox/target
>> [INFO] Deleting /Users/erdi/Downloads/testsuite-sandbox/reports (includes
>> = [], excludes = [])
>> [INFO]
>> [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @
>> sample-test ---
>> [INFO] Using 'UTF-8' encoding to copy filtered resources.
>> [INFO] skip non existing resourceDirectory
>> /Users/erdi/Downloads/testsuite-sandbox/src/main/resources
>> [INFO]
>> [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @
>> sample-test ---
>> [INFO] No sources to compile
>> [INFO]
>> [INFO] --- maven-resources-plugin:2.6:testResources
>> (default-testResources) @ sample-test ---
>> [INFO] Using 'UTF-8' encoding to copy filtered resources.
>> [INFO] Copying 4 resources
>> [INFO]
>> [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @
>> sample-test ---
>> [INFO] No sources to compile
>> [INFO]
>> [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ sample-test
>> ---
>> [INFO] Tests are skipped.
>> [INFO]
>> [INFO] --- exec-maven-plugin:1.6.0:java (default) @ sample-test ---
>> [io.cucumber.core.cli.Main.main()] INFO
>> io.github.bonigarcia.wdm.WebDriverManager - Using chromedriver 78.0.3904.70
>> (since Google Chrome 78 is installed in your machine)
>> [io.cucum

Re: [geb-user] Having difficulty using SauceLabs with Gradle

2019-11-06 Thread Marcin Erdmann
The gradle plugin will always open a tunnel unless you disable it:
https://gebish.org/manual/current/#disabling-sauceconnect

On Tue, Nov 5, 2019 at 2:31 PM Ben Frey  wrote:

> I think I got it working, at least locally (there's some problem with the
> GitLab runner in my project currently that I assume is unrelated). I
> extended SauceLabsDriverFactory, and I also had to pass the credentials in
> the capabilities method like this:
> create('internet explorer') {
> capabilities(
> browserName: 'Internet Explorer',
> platform: 'Windows 7',
> version: '11',
> parentTunnel: 'company_admin',
> tunnelIdentifier: 'company-ha-tunnel',
> username: System.getenv(SauceAccount.USER_ENV_VAR),
> accessKey: System.getenv(SauceAccount.ACCESS_KEY_ENV_VAR)
> )
> }
>
>
> The only hangup now is that each time I run it it creates a new tunnel
> under my username rather than using one of the existing tunnels. I think
> that's probably a better question for SauceLabs though, correct?
>
>
> On Monday, November 4, 2019 at 2:32:59 PM UTC-6, Marcin Erdmann wrote:
>>
>> I think the easiest way for now will be to extend SauceLabsDriverFactory
>> and override assembleProviderUrl(). That url should probably use https
>> anyway, I've created an issue to address that:
>> https://github.com/geb/issues/issues/599.
>>
>> On Mon, Nov 4, 2019 at 4:42 PM Ben Frey  wrote:
>>
>>> I may have found what's interfering. I tried to log in to our proxy in
>>> my browser (e.g. http://sauceId:suace...@test.company.com:443/wd/hub)
>>> and got funky Unicode characters. The person helping out from within my
>>> company said I need to use HTTPS instead of HTTP. I tried that and got an
>>> error XML from our Layer7 appliance. Is there a way to change
>>> https://github.com/geb/geb/blob/v3.0.1/module/geb-core/src/main/groovy/geb/driver/SauceLabsDriverFactory.groovy#L28
>>> so it can use HTTPS if requested?
>>>
>>> On Friday, November 1, 2019 at 8:10:45 PM UTC-5, Ben Frey wrote:
>>>>
>>>> Alright, I think I've made a little progress. We passed the proxy URL
>>>> to the SauceLabsDriverFactory like this:
>>>> new SauceLabsDriverFactory('testserver.company.com:443/wd/hub')
>>>> and now we're having a different stack trace - it seems the tunnel is
>>>> created successfully (I see "Sauce Connect is up, you may start your
>>>> tests."), but somehow the test can't connect to the proxy. After
>>>> "Unexpected status line:" in the exception message there are five numbers
>>>> in boxes that I can only see in BeyondCompare. The full stack trace is
>>>> below. Do you have any ideas what's going on?
>>>> test.TestClass > classMethod FAILED
>>>> geb.driver.DriverCreationException: failed to create driver from
>>>> callback 'script15726565316811155837962$_run_closure2@65de3495'
>>>> at geb.driver.CallbackDriverFactory.getDriver(
>>>> CallbackDriverFactory.groovy:35)
>>>> at geb.driver.CachingDriverFactory.getDriver_closure4(
>>>> CachingDriverFactory.groovy:57)
>>>> at geb.driver.CachingDriverFactory.getDriver_closure4(
>>>> CachingDriverFactory.groovy)
>>>> at geb.driver.CachingDriverFactory$SimpleCache.get(
>>>> CachingDriverFactory.groovy:81)
>>>> at geb.driver.CachingDriverFactory.getDriver(
>>>> CachingDriverFactory.groovy:56)
>>>> at geb.Configuration.createDriver(Configuration.groovy:675)
>>>> at geb.Configuration.getDriver(Configuration.groovy:353)
>>>> at geb.Browser.getDriver(Browser.groovy:160)
>>>> at geb.navigator.factory.BrowserBackedNavigatorFactory.(
>>>> BrowserBackedNavigatorFactory.groovy:31)
>>>> at geb.Configuration.createNavigatorFactory(Configuration.
>>>> groovy:413)
>>>> at geb.Browser.createNavigatorFactory(Browser.groovy:982)
>>>> at geb.Browser.getNavigatorFactory(Browser.groovy:170)
>>>> at geb.Page.init(Page.groovy:140)
>>>> at geb.Browser.initialisePage(Browser.groovy:1116)
>>>> at geb.Browser.createPage(Browser.groovy:829)
>>>> at geb.Browser.to(Browser.groovy:537)
>>>> at geb.Browser.to(Browser.groovy:526)
>>>> at geb.spock.GebSpec.methodMissing(GebSpec.groovy:60)
>>>

  1   2   3   >