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

2019-11-06 Thread Ben Frey
Pretty much! One last question that's more for niceness's sake: how do I 
pass the success or failure of the job to SauceLabs? Right now it's just 
saying "completed".

On Wednesday, November 6, 2019 at 4:39:39 PM UTC-6, Marcin Erdmann wrote:
>
> 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-...@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/6f0d1847-03a9-4282-bbde-f9e156d3d74b%40googlegroups.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.cucumber.core.cli.Main.main()] INFO
>> io.github.bonigarcia.wdm.WebDriverManager - Exporting
>> webdriver.chrome.driver as
>> /Users/erdi/.m2/repository/webdriver/chromedriver/mac64/78.0.3904.70/chromedriver
>> [CONFIG] >>> Chrome Driver Version: 78.0.3904.70
>> Starting ChromeDriver 78.0.3904.70
>> (edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5-refs/branch-heads/3904@{#800})
>> on port 46028
>> Only local connections are allowed.
>> Please protect ports 

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

2019-11-06 Thread Ben Frey
 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.


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)
 at login.LoginTrait$Trait$Helper.logIn(LoginTrait.groovy:7)
 at test.TestClass.setupSpec(TestClass.groovy:8)

 Caused by:
 java.lang.reflect.InvocationTargetException
 at geb.driver.CloudDriverFactory.create(CloudDriverFactory.
 groovy:51)
 at script15726565316811155837962.run_closure2(
 script15726565316811155837962.groovy:20)
 at script15726565316811155837962.run_closure2(
 script15726565316811155837962.groovy)
 at geb.driver.CallbackDriverFactory.getDriver(
 CallbackDriverFactory.groovy:29)
 ... 19 more

 Caused by: