Basic function

Basic function of this class is to provide setup for instance of Seb. Most important property is List<PropertiesValue> propertiesHolder which holds the hierarchy of values. You usually do not interact with it directly. PropertiesValue class is identified by a key and holds set of properties. Mostly you will use method .getProperty(String) which will search through it. If some values are defined more than once, higher placed PropertiesValue instances take precedence before the lower once. By default propertiesHolder is populated on instantiation from system properties with key system and from file seb.properties with key default.

Override | extend default config

Usually you will want to provide custom settings. You can do that by extending class BasicSebConfiguration and overriding its methods. To load other than default property file use any mutation of addResourceProperties*() method which can add PropertiesValue instance before/after PropertiesValue or at the end of propertiesHolder. Fo example, if you want to have different setup for different environments consider following example:

seb.properties: // 2
    environment=prod

BasicSebConfig:
    public Environment getEnvironment() {  // 3
        return getProperty("environment");
    }

    @Override
    public void init() {
        super.init();
        addResourcePropertiesAfter("system", "env", "seb." + getEnvironment() + ".properties");  // 4
    }

1) First you create seb.dev.properties and seb.prod.properties. Each with different seb.baseUrl property value.

2) Choose the environment you want to load by specifying property environment in seb.properties (as shown above) or by providing it to JVM directly by calling -Denvironment=prod. If you specify property in both, JVM properties will take precedence as explained in previous section.

3) Retrieve the specified environment during the runtime.

4) Using retrieved value load the specific property file into propertiesHolder and place it after PropertiesValue with key "system". Method init() gets called on Seb startup.

This creates propertiesHolder with following structure:

  • "system" - JVM properties loaded by default
  • "env" - values from seb.prod.properties specified by us
  • "default" - values from seb.properties loaded by default

We advice to use more specific property names than environment used above to avoid collision.

Minimal setup

Minimal setup for start requires seb.baseUrl property specified at any propertiesHolder level.

Example: seb.baseUrl=http://www.etnetera.cz/

It is important to provide whole address including http/https! This value will be used in combination with value provided on PageObject to navigate to specific URL.

Logging

If isDefaultReported() set to true, by default logs will be saved into seb-reports folder. If you want to include any additional files you can do so by calling any mutation of method .saveFile() where you can provide input in form of File, byte[] or String.

Other important methods

  • getDefaultDriver() - override to create other than default (=Firefox) driver
  • getDefaultHubUrl() - override this to provide HubUrl (or provide seb.hubUrl property)
  • getDefaultCapabilities() - override this to provide capabilities to start WebDriver with (or provide seb.caps.* property => seb.caps.acceptSslCerts=true will be translated to capabilities.setCapability("acceptSslCerts", true))