No, unfortunately that's not supported at the moment. We would need to add
support for adding multiple test tasks per capability/browser type - would
you mind submitting an issue for that in the tracker? There's already a
number of issues around improvements to cloud browser plugins, I could just
make the next release all about that.
With regards to a workaround for this, there's nothing that comes to my
mind apart from a nasty hack where you would set a project property on the
command line, like -PstuffToTest=a and then have an if statement like:
sauceLabs {
task {
if (stuffToTest == "a") {
filter {
includeTestsMatching 'stufftotest.*'
}
}
}
}
}
Nasty, but can work in the meantime.
On Wed, Oct 23, 2019 at 1:59 PM Ben Frey <[email protected]> wrote:
> Oh, I guess I didn't quite get the implications of bullet point 4 there,
> thanks for clarifying. So is there a way to filter or group tests based on
> test class/method rather than capability? I'm trying to run groups of
> scenarios in parallel CI jobs, rather than all of the tests in one.
>
> On Wednesday, October 23, 2019 at 7:55:08 AM UTC-5, Marcin Erdmann wrote:
>>
>> Yeah, this is where the problem is. The Gradle SauceLabs plugin adds a
>> separate task to run tests at SauceLabs - any tasks that you add manually
>> as well as the default test task will not include the configuration for
>> SauceLabs. Based on the configuration that you provided in the original
>> email the test task name will be internetExplorerTest - it's derived on the
>> name of the item that you add in the `browsers {}` configuration block.
>> It's all described at
>> https://gebish.org/manual/current/#geb-saucelabs-plugin.
>>
>> On Wed, Oct 23, 2019 at 1:28 PM Ben Frey <[email protected]> wrote:
>>
>>> ./gradlew clean testTaskName
>>>
>>> where "testTaskName" is a Gradle task defined like this
>>> task testTaskName(type: Test) {
>>> filter {
>>> includeTestsMatching 'stufftotest.*'
>>> }
>>> }
>>>
>>>
>>> On Wednesday, October 23, 2019 at 6:27:12 AM UTC-5, Marcin Erdmann wrote:
>>>>
>>>> What's the Gradle task that you are running in CI?
>>>>
>>>> On Tue, Oct 22, 2019 at 6:33 PM Ben Frey <[email protected]> wrote:
>>>>
>>>>> My tests are working locally, although I have to use the bonigarcia
>>>>> WebDriverManager to retrieve a Chromedriver locally:
>>>>> WebDriverManager.chromedriver().version('2.35').setup()
>>>>>
>>>>> In my build.gradle file I want to set up an Internet Explorer browser
>>>>> in the remote SauceLabs instance:
>>>>> sauceLabs {
>>>>> browsers {
>>>>> create('internet explorer') {
>>>>> capabilities platform: 'Windows 7', browserVersion: '11'
>>>>> }
>>>>> task {
>>>>> }
>>>>> account {
>>>>> def username = System.getenv('SAUCE_USERNAME')
>>>>> def accessKey = System.getenv('SAUCE_ACCESS_KEY')
>>>>> }
>>>>> }
>>>>> }
>>>>>
>>>>> and my GebConfig.groovy looks like this
>>>>> baseUrl = 'https://www.domain.com'
>>>>> reportsDir = 'build/reports/tests/geb'
>>>>>
>>>>> def sauceLabsBrowser = System.getProperty('geb.saucelabs.browser')
>>>>> if (sauceLabsBrowser) {
>>>>> println 'Got a SauceLabs browser'
>>>>> driver = {
>>>>> def username = System.getenv('SAUCE_USERNAME')
>>>>> assert username
>>>>> def saucelabsKey = System.getenv('SAUCE_ACCESS_KEY')
>>>>> assert saucelabsKey
>>>>>
>>>>> new SauceLabsDriverFactory().create(sauceLabsBrowser, username
>>>>> , saucelabsKey)
>>>>> }
>>>>> } else {
>>>>> println 'Attempting to get a local webdriver'
>>>>> // WebDriverManager.chromedriver().version('2.35').setup()
>>>>> }
>>>>>
>>>>> When I push my code to my company's GitLab instance, I get the
>>>>> following stack trace:
>>>>> tests.TestClass > classMethod FAILED
>>>>> java.lang.IllegalStateException: The path to the driver
>>>>> executable must be set by the webdriver.chrome.driver system property;
>>>>> for more information, see https://
>>>>> github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version
>>>>> can be downloaded from
>>>>> http://chromedriver.storage.googleapis.com/index.html
>>>>> at com.google.common.base.Preconditions.checkState(
>>>>> Preconditions.java:847)
>>>>> at org.openqa.selenium.remote.service.DriverService.
>>>>> findExecutable(DriverService.java:134)
>>>>> at org.openqa.selenium.chrome.ChromeDriverService.access$000(
>>>>> ChromeDriverService.java:35)
>>>>> at org.openqa.selenium.chrome.ChromeDriverService$Builder.
>>>>> findDefaultExecutable(ChromeDriverService.java:159)
>>>>> at org.openqa.selenium.remote.service.DriverService$Builder.
>>>>> build(DriverService.java:355)
>>>>> at org.openqa.selenium.chrome.ChromeDriverService.
>>>>> createDefaultService(ChromeDriverService.java:94)
>>>>> at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver
>>>>> .java:123)
>>>>> at geb.driver.NameBasedDriverFactory.getDriver(
>>>>> NameBasedDriverFactory.groovy:44)
>>>>> 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.<init>(
>>>>> 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 tests.TestClass.setupSpec(TestClass.groovy:8)
>>>>>
>>>>> So I have two questions:
>>>>>
>>>>> 1. Why is it trying to retrieve a Chrome webdriver in the CI
>>>>> pipeline when my buildscript specifies Internet Explorer?
>>>>> 2. Am I setting everything up as expected? I left out the
>>>>> sauceLabs.task closure because I was getting Gradle errors on e.g.
>>>>> test.testClassesDir
>>>>>
>>>>> --
>>>>> 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 [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/geb-user/7545c8f8-e510-4065-8d3c-7c29b67304b0%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/geb-user/7545c8f8-e510-4065-8d3c-7c29b67304b0%40googlegroups.com?utm_medium=email&utm_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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/geb-user/b70f3fe1-acd7-4317-8df6-c74f91d77270%40googlegroups.com
>>> <https://groups.google.com/d/msgid/geb-user/b70f3fe1-acd7-4317-8df6-c74f91d77270%40googlegroups.com?utm_medium=email&utm_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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/21fa1c21-3185-4a12-ab6e-cebc799bf5c1%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/21fa1c21-3185-4a12-ab6e-cebc799bf5c1%40googlegroups.com?utm_medium=email&utm_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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/geb-user/CA%2B52dQSTro6DTshzb7uf_qZEOkJpjihJjKqyPP7ZW9qHn5-F_A%40mail.gmail.com.