Skip to content

Getting started.

james-goddard-magentys edited this page Jun 29, 2017 · 1 revision

Setup

In order to use cinnamon the dependencies can be mixed and matched based on your requirements :

For the Cinnamon WebDriver APIs :

<dependency>
    <groupId>io.magentys</groupId>
    <artifactId>cinnamon-webdriver</artifactId>
    <version>0.0.2</version>
</dependency>

For setting up a cucumber project:

<dependency>
    <groupId>io.magentys</groupId>
    <artifactId>cinnamon-cucumber</artifactId>
    <version>0.0.2</version>
</dependency>

Quick setup

In order to get up and running quickly, you can use the Cinnamon archetype to create a new project. This creates a project comprising our cucumber and webdriver modules, so there is no need to manually add the dependencies yourself.

Parameters summary

  • -DbrowserProfile : Specifies the browser profile for the webdriver
  • -DhubUrl : Specifies the remote grid url and will instantiate a remote webdriver based on the browserProfile capabilties
  • -DwebDriverConfig : When external webdriver configuration is injected to the project this should give the path to this file
  • -Denv : Which environment profile settings to pick up to test against
  • -Dcucumber.options : when cinnamon-cucumber is used, you may specify cucumber tags for the execution

Using Env in your project

The configuration library used is [typesafe config] (https://github.com/typesafehub/config). Env is a wrapper for typesafe config, so you can still use standard typesafe config if necessary.

Cinnamon provides a way to manage the different environments you may need to configure and test against. This is an optional feature. It helps manage the different settings by using a config file named env.conf:

default : {
  baseUrl : "http://localhost:8080"

  # Examples of additional config
  db : {
    url : "some/url"
    # Examples of external properties that may be needed
    username : ${?dbUsername}
    password : ${?dbPassword}
  }
}

st : {
  baseUrl : "http://st:8080"
}

sit : {
  baseUrl : "http://sit:8080"
}

If Guice is used for dependency injection, you simply need to inject the Env in your constructor:

@Inject
public MyPage(final WebDriver webDriver, final Env env) {
    super(webDriver);
    baseUrl = env.config.getString("baseUrl");
}

When Env is used, cinnamon expects the system property to be set: -Denv=sit