user1207289 user1207289 - 4 months ago 45
Groovy Question

driver error for geb-gradle-saucelabs integration

I am trying to run below build.gradle with saucelabs integration . Below is GebConfig.groovy

import org.openqa.selenium.chrome.ChromeDriver
import geb.driver.SauceLabsDriverFactory
import geb.buildadapter.BuildAdapterFactory

//driver = { new ChromeDriver() }

def sauceBrowser = System.getProperty("geb.saucelabs.browser")
if (sauceBrowser) {
driver = {
def username = System.getenv("username")
assert username
def accessKey = System.getenv("accesskey")
assert accessKey
new SauceLabsDriverFactory().create(sauceBrowser, username, accessKey)
}
}


I am setting
geb.saucelabs.browser
prop in
build.gradle
according to this. Full build.gradle looks like

apply plugin: "geb-saucelabs"

buildscript {
repositories {
jcenter()
}

dependencies {
classpath 'org.gebish:geb-gradle:0.13.1'
}
}

apply plugin: 'java'
apply plugin: 'groovy'

repositories {

mavenCentral()
maven { url "http://repository-saucelabs.forge.cloudbees.com/release" }
}

dependencies {
def seleniumVersion = '2.45.0'
def phantomJsVersion = '1.1.0'
def groovyVersion = '2.4.3'

//groovy
compile "org.codehaus.groovy:groovy-all:$groovyVersion"

// selenium drivers
testCompile "org.seleniumhq.selenium:selenium-ie-driver:$seleniumVersion"
testCompile "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
//testCompile "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
testCompile "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
testRuntime "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
testCompile("com.github.detro.ghostdriver:phantomjsdriver:$phantomJsVersion") {
transitive = false
}

// geb
testCompile "org.gebish:geb-spock:0.10.0"

// spock
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'

//junit
testCompile "org.gebish:geb-junit4:0.10.0"
testCompile "junit:junit-dep:4.8.2"


sauceConnect "com.saucelabs:sauce-connect:3.0.28"

}

sauceLabs {
browsers {

chrome_mac

}
task {
testClassesDir = test.testClassesDir
testSrcDirs = test.testSrcDirs
classpath = test.classpath
}

account {
username = System.getenv("username")
accessKey = System.getenv("accessKey")
}


}

test {

System.setProperty("geb.saucelabs.browser ","browserName=firefox platform=LINUX version=19")
systemProperties "geb.build.reportsDir": "$reportsDir/geb"
}


but I recieve error and I think driver is not configuring correctly, whats missing in confirguration?

The path to the driver executable must be set by the webdriver.ie.driver system property;

Answer

This has been resolved by setting the env variables on mac in .profile and .bash_profile in this way

export SAUCE_USERNAME=username
export SAUCE_ACCESS_KEY-youraccesskey

Before it was adding quotes to both

Comments