Skip to content

Commit

Permalink
hotfix (#106)
Browse files Browse the repository at this point in the history
updated logging with REMOTE_URL about where tests will be running
added ie to driver config
fixed screen resolution specifying with downgraded to selenide 4.11.4
  • Loading branch information
GannaChernyshova authored Oct 4, 2018
1 parent 0123e01 commit 4064aae
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ apply plugin: 'nebula.source-jar'
apply plugin: 'nebula.javadoc-jar'

group = 'ru.alfabank.tests'
version = '3.5.2'

description = """light testing framework Akita"""

Expand All @@ -53,7 +54,7 @@ targetCompatibility = 1.8

project.ext {
cucumberVersion = '2.4.0'
selenideVersion = '4.12.1'
selenideVersion = '4.11.4'
}

dependencies {
Expand Down Expand Up @@ -103,7 +104,7 @@ ext {
bintray {
user = bintrayUserName
key = bintrayPassword
publications = ['maven']
publications = ['nebula']
dryRun = false
publish = true
pkg {
Expand All @@ -128,7 +129,7 @@ bintray {

test {
maxParallelForks = 1
ignoreFailures = false
ignoreFailures = true

jvmArgs += "-Dfile.encoding=UTF-8"
jvmArgs += "-Dbrowser=chrome"
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/ru/alfabank/steps/InitialSetupSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import static com.codeborne.selenide.WebDriverRunner.getWebDriver;
import static com.codeborne.selenide.WebDriverRunner.hasWebDriverStarted;
import static ru.alfabank.tests.core.drivers.CustomDriverProvider.REMOTE_URL;

@Slf4j
public class InitialSetupSteps {
Expand All @@ -54,8 +55,8 @@ public void setScenario(Scenario scenario) throws Exception {
*/
@Before(order = 20)
public static void setEnvironmentToTest() throws Exception {
if (!Strings.isNullOrEmpty(System.getProperty("remote"))) {
log.info("Тесты запущены на удаленной машине: " + System.getProperty("remote"));
if (!Strings.isNullOrEmpty(System.getProperty(REMOTE_URL))) {
log.info("Тесты запущены на удаленной машине: " + System.getProperty(REMOTE_URL));
} else
log.info("Тесты будут запущены локально");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import java.util.Map;

import static com.codeborne.selenide.WebDriverRunner.*;
import static ru.alfabank.tests.core.helpers.PropertyLoader.loadProperty;
import static ru.alfabank.tests.core.helpers.PropertyLoader.loadSystemPropertyOrDefault;

/**
Expand Down Expand Up @@ -108,6 +107,10 @@ public WebDriver createDriver(DesiredCapabilities capabilities) {
return LOCAL.equalsIgnoreCase(remoteUrl) ? createIEDriver(capabilities) : getRemoteDriver(getIEDriverOptions(capabilities), remoteUrl, blackList.getBlacklistEntries());
}

if (IE.equalsIgnoreCase(expectedBrowser)) {
return LOCAL.equalsIgnoreCase(remoteUrl) ? createIEDriver(capabilities) : getRemoteDriver(getIEDriverOptions(capabilities), remoteUrl, blackList.getBlacklistEntries());
}

if (EDGE.equalsIgnoreCase(expectedBrowser)) {
return LOCAL.equalsIgnoreCase(remoteUrl) ? createEdgeDriver(capabilities) : getRemoteDriver(getEdgeDriverOptions(capabilities), remoteUrl, blackList.getBlacklistEntries());
}
Expand All @@ -127,7 +130,7 @@ private WebDriver getRemoteDriver(MutableCapabilities capabilities, String remot
log.info("---------------run Selenoid Remote Driver---------------------");
capabilities.setCapability("enableVNC", true);
capabilities.setCapability("screenResolution", String.format("%sx%s", loadSystemPropertyOrDefault(WINDOW_WIDTH, DEFAULT_WIDTH),
loadSystemPropertyOrDefault(WINDOW_HEIGHT, DEFAULT_HEIGHT)));
loadSystemPropertyOrDefault(WINDOW_HEIGHT, DEFAULT_HEIGHT)));
try {
return new RemoteWebDriver(
URI.create(remoteUrl).toURL(),
Expand Down Expand Up @@ -217,7 +220,7 @@ private OperaOptions getOperaDriverOptions(DesiredCapabilities capabilities) {
* options можно передавать, как системную переменную, например -Doptions=--load-extension=my-custom-extension
* @return internetExplorerOptions
*/
private InternetExplorerOptions getIEDriverOptions(DesiredCapabilities capabilities){
private InternetExplorerOptions getIEDriverOptions(DesiredCapabilities capabilities) {
log.info("---------------IE Driver---------------------");
InternetExplorerOptions internetExplorerOptions = !options[0].equals("") ? new InternetExplorerOptions().addCommandSwitches(options) : new InternetExplorerOptions();
internetExplorerOptions.setCapability(CapabilityType.BROWSER_VERSION, loadSystemPropertyOrDefault(CapabilityType.BROWSER_VERSION, VERSION_LATEST));
Expand All @@ -234,7 +237,7 @@ private InternetExplorerOptions getIEDriverOptions(DesiredCapabilities capabilit
* options можно передавать, как системную переменную, например -Doptions=--load-extension=my-custom-extension
* @return edgeOptions
*/
private EdgeOptions getEdgeDriverOptions(DesiredCapabilities capabilities){
private EdgeOptions getEdgeDriverOptions(DesiredCapabilities capabilities) {
log.info("---------------Edge Driver---------------------");
EdgeOptions edgeOptions = new EdgeOptions();
edgeOptions.setCapability(CapabilityType.BROWSER_VERSION, loadSystemPropertyOrDefault(CapabilityType.BROWSER_VERSION, VERSION_LATEST));
Expand All @@ -247,7 +250,7 @@ private EdgeOptions getEdgeDriverOptions(DesiredCapabilities capabilities){
* options можно передавать, как системную переменную, например -Doptions=--load-extension=my-custom-extension
* @return SafariOptions
*/
private SafariOptions getSafariDriverOptions(DesiredCapabilities capabilities){
private SafariOptions getSafariDriverOptions(DesiredCapabilities capabilities) {
log.info("---------------Safari Driver---------------------");
SafariOptions safariOptions = new SafariOptions();
safariOptions.setCapability(CapabilityType.BROWSER_VERSION, loadSystemPropertyOrDefault(CapabilityType.BROWSER_VERSION, VERSION_LATEST));
Expand All @@ -260,7 +263,7 @@ private SafariOptions getSafariDriverOptions(DesiredCapabilities capabilities){
*
* @return WebDriver
*/
private WebDriver createChromeDriver(DesiredCapabilities capabilities){
private WebDriver createChromeDriver(DesiredCapabilities capabilities) {
ChromeDriver chromeDriver = new ChromeDriver(getChromeDriverOptions(capabilities));
chromeDriver.manage().window().setSize(setDimension());
return chromeDriver;
Expand All @@ -271,7 +274,7 @@ private WebDriver createChromeDriver(DesiredCapabilities capabilities){
*
* @return WebDriver
*/
private WebDriver createFirefoxDriver(DesiredCapabilities capabilities){
private WebDriver createFirefoxDriver(DesiredCapabilities capabilities) {
FirefoxDriver firefoxDriver = new FirefoxDriver(getFirefoxDriverOptions(capabilities));
firefoxDriver.manage().window().setSize(setDimension());
return firefoxDriver;
Expand All @@ -282,7 +285,7 @@ private WebDriver createFirefoxDriver(DesiredCapabilities capabilities){
*
* @return WebDriver
*/
private WebDriver createOperaDriver(DesiredCapabilities capabilities){
private WebDriver createOperaDriver(DesiredCapabilities capabilities) {
OperaDriver operaDriver = new OperaDriver(getOperaDriverOptions(capabilities));
operaDriver.manage().window().setSize(setDimension());
return operaDriver;
Expand All @@ -293,7 +296,7 @@ private WebDriver createOperaDriver(DesiredCapabilities capabilities){
*
* @return WebDriver
*/
private WebDriver createIEDriver(DesiredCapabilities capabilities){
private WebDriver createIEDriver(DesiredCapabilities capabilities) {
InternetExplorerDriver internetExplorerDriver = new InternetExplorerDriver(getIEDriverOptions(capabilities));
internetExplorerDriver.manage().window().setSize(setDimension());
return internetExplorerDriver;
Expand All @@ -304,7 +307,7 @@ private WebDriver createIEDriver(DesiredCapabilities capabilities){
*
* @return WebDriver
*/
private WebDriver createEdgeDriver(DesiredCapabilities capabilities){
private WebDriver createEdgeDriver(DesiredCapabilities capabilities) {
EdgeDriver edgeDriver = new EdgeDriver(getEdgeDriverOptions(capabilities));
edgeDriver.manage().window().setSize(setDimension());
return edgeDriver;
Expand All @@ -315,7 +318,7 @@ private WebDriver createEdgeDriver(DesiredCapabilities capabilities){
*
* @return WebDriver
*/
private WebDriver createSafariDriver(DesiredCapabilities capabilities){
private WebDriver createSafariDriver(DesiredCapabilities capabilities) {
SafariDriver safariDriver = new SafariDriver(getSafariDriverOptions(capabilities));
safariDriver.manage().window().setSize(setDimension());
return safariDriver;
Expand All @@ -328,9 +331,9 @@ private WebDriver createSafariDriver(DesiredCapabilities capabilities){
* Например: ./gradlew test -Dbrowser=chrome -Dwidth=1200 -Dheight=800
* Если пользовательские значения ширины и высоты окна браузера не указаны, используются дефолтные 1920x1080
*/
private Dimension setDimension(){
private Dimension setDimension() {
return new Dimension(loadSystemPropertyOrDefault(WINDOW_WIDTH, DEFAULT_WIDTH),
loadSystemPropertyOrDefault(WINDOW_HEIGHT, DEFAULT_HEIGHT));
loadSystemPropertyOrDefault(WINDOW_HEIGHT, DEFAULT_HEIGHT));
}

/**
Expand Down

0 comments on commit 4064aae

Please sign in to comment.