The version 2.0.1 of the versionfilter-icm-test component used to resolve dependencies to external libraries contains the following changes:
The main goal of these changes is to allow the execution of Geb tests with a real Firefox or Chrome browser, run in a headless mode.
Another goal is to remove PhantomJSDriver dependency as it is out of support. The reason why Selenium decided to drop the support for PhantomJS driver can be explained as follows:
In case custom assemblies in customer projects require the execution of Geb tests, some migration of assembly Gradle files will be needed when upgrading from a version before 7.10.13.0 to ICM 7.10.13.0 or to a later version. Migration is done for the standard Intershop assemblies (intershop7, inspired-b2c, inspired-b2x).
Update the following Gradle files in the project of your assembly:
Sample code blocks:
gebConfiguration { webDrivers { chromeDriver { environments { chromePC chromeTablet } download { linux { url = 'http://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip' archiveType = 'zip' webDriverExec = 'chromedriver' } windows { url = 'http://chromedriver.storage.googleapis.com/2.35/chromedriver_win32.zip' archiveType = 'zip' webDriverExec = 'chromedriver.exe' } } } geckoDriver { environments { geckoPC {check=true} geckoTablet } download { linux { url = 'https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz' archiveType = 'tar' webDriverExec = 'geckodriver' } windows { url = 'https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-win32.zip' archiveType = 'zip' webDriverExec = 'geckodriver.exe' } } } } }
import org.openqa.selenium.Dimension import org.openqa.selenium.chrome.ChromeDriver import org.openqa.selenium.firefox.* import org.openqa.selenium.remote.* def gebEnv = System.getProperty("geb.env"); def webDriverDir = System.getProperty("webDriverDir") def webDriverExec = new File(webDriverDir, System.getProperty("webDriverExec")).absolutePath waiting { // max request time in seconds timeout = 180 // http://gebish.org/manual/current/#failure-causes includeCauseInMessage = true } environments { chromeTablet { driver = { def driver = createChromeDriverInstance(webDriverExec) driver.manage().window().setSize(new Dimension(1024, 768)) driver } } chromePC { driver = { def driver = createChromeDriverInstance(webDriverExec) driver.manage().window().setSize(new Dimension(1920, 1200)) driver } } geckoPC { driver = { def driver = createGeckoDriverInstance(webDriverExec) driver.manage().window().setSize(new Dimension(1920, 1200)) driver } } geckoTablet { driver = { def driver = createGeckoDriverInstance(webDriverExec) driver.manage().window().setSize(new Dimension(1024, 768)) driver } } } private def createGeckoDriverInstance(String webDriverExec) { System.setProperty("webdriver.gecko.driver", webDriverExec) FirefoxOptions options = new FirefoxOptions() options.setHeadless(true) driverInstance = new FirefoxDriver(options) driverInstance } private def createChromeDriverInstance(String webDriverExec) { System.setProperty("webdriver.chrome.driver", webDriverExec) driverInstance = new ChromeDriver() driverInstance }
Now you can use the gebGeckoPCEnvironmentTest
Gradle task (instead of gebPhantomJsPCEnvironmentTest
) to execute Geb Tests in the assembly. Example:
> gradlew
:<*assembly>:gebGeckoPCEnvironmentTest --tests *OrderSpec* -x
deployServer -x buildSearchIndex -x startWebserver -x startNodemanager
-x stopNodemanager -x stopWebserver -s