Jacobvu84 / serenity-pageobject-junit-webdriver

4 stars 1 forks source link

Các thiết lập hữu ích trong serenity.conf #45

Closed Jacobvu84 closed 5 years ago

Jacobvu84 commented 5 years ago

Tập hợp các cấu hình hữu ích

Jacobvu84 commented 5 years ago
webdriver {
  driver = chrome
  timeouts {
    implicitlywait = 5000
    fluentwait = 10000
  }
}

headless.mode = true

serenity {
  browser {
    width=1200
    height=800
  }
  restart.browser.for.each = NEVER
}
Jacobvu84 commented 5 years ago
#
# Define drivers for different platforms. 
# Serenity will automatically pick the correct driver for the current platform
#
drivers {
  windows {
    webdriver.chrome.driver = "src/test/resources/webdriver/windows/chromedriver.exe"
    webdriver.gecko.driver = "src/test/resources/webdriver/windows/geckodriver.exe"
  }
  mac {
    webdriver.chrome.driver = "src/test/resources/webdriver/mac/chromedriver"
    webdriver.gecko.driver = "src/test/resources/webdriver/mac/geckodriver"
  }
  linux {
    webdriver.chrome.driver = "src/test/resources/webdriver/linux/chromedriver"
    webdriver.gecko.driver = "src/test/resources/webdriver/linux/geckodriver"
  }
}
Jacobvu84 commented 5 years ago
#
# This section defines environment-specific configuration for different environments.
# You can define normal Serenity properties, such as webdriver.base.url, or custom ones
# You can find more details about this feature at 
# https://johnfergusonsmart.com/environment-specific-configuration-in-serenity-bdd/
#

environments {
  default {
    webdriver.base.url = "https://tfl.gov.uk"
  }
  dev {
    webdriver.base.url = "https://dev.tfl.gov.uk"
  }
  staging {
    webdriver.base.url = "https://staging.tfl.gov.uk"
  }
  prod {
    webdriver.base.url = "https://tfl.gov.uk"
  }
}
Jacobvu84 commented 5 years ago
#
# Chrome options can be defined using the chrome.switches property
#
chrome.switches="""--start-maximized;
                   --test-type;--no-sandbox;
                   --ignore-certificate-errors;
                   --disable-popup-blocking;
                   --disable-default-apps;
                   --disable-extensions-file-access-check;
                   --incognito;
                   --disable-infobars,
                   --disable-gpu"""
Jacobvu84 commented 5 years ago

How to access the values of the variables defined in this ?

private EnvironmentVariables environmentVariables;

String url= environmentVariables.getProperty("environments.dev.webdriver.base.url")