From 5dcac60ab7b1b095bcb188668fb1e76a5ae8b259 Mon Sep 17 00:00:00 2001 From: svetlana Date: Tue, 27 Oct 2020 18:21:27 +0300 Subject: [PATCH 1/2] set scenario name of test to selenoid name capability, if we don't set capability via properties, add description --- page-factory-doc/src/main/asciidoc/web_properties.asciidoc | 4 ++-- .../web/capabilities/SelenoidCapabilitiesParser.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/page-factory-doc/src/main/asciidoc/web_properties.asciidoc b/page-factory-doc/src/main/asciidoc/web_properties.asciidoc index 45c8ab5d..100c0e6c 100644 --- a/page-factory-doc/src/main/asciidoc/web_properties.asciidoc +++ b/page-factory-doc/src/main/asciidoc/web_properties.asciidoc @@ -135,7 +135,7 @@ http://proxy.com:8080 |selenoid.enableVNC = true |selenoid.screenResolution | Разрешение экрана -selenoid.screenResolution = 1280x1024x24 +|selenoid.screenResolution = 1280x1024x24 |selenoid.enableVideo | Включение/выключение записи видео |selenoid.enableVideo = true @@ -149,7 +149,7 @@ selenoid.video.name = my-cool-video.mp4 | Количество кадров в секунду |selenoid.video.frameRate = 24 |selenoid.nameOfTests -| Имя теста +| Имя теста, по умолчанию наименование берется из названия сценария |selenoid.nameOfTests = myCoolTestName |selenoid.timeZone | Таймзона diff --git a/plugins/web-plugin/src/main/java/ru/sbtqa/tag/pagefactory/web/capabilities/SelenoidCapabilitiesParser.java b/plugins/web-plugin/src/main/java/ru/sbtqa/tag/pagefactory/web/capabilities/SelenoidCapabilitiesParser.java index 80701cb4..494b946d 100644 --- a/plugins/web-plugin/src/main/java/ru/sbtqa/tag/pagefactory/web/capabilities/SelenoidCapabilitiesParser.java +++ b/plugins/web-plugin/src/main/java/ru/sbtqa/tag/pagefactory/web/capabilities/SelenoidCapabilitiesParser.java @@ -8,6 +8,7 @@ import org.openqa.selenium.remote.DesiredCapabilities; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import ru.sbtqa.tag.pagefactory.environment.Environment; import ru.sbtqa.tag.pagefactory.web.environment.WebEnvironment; import ru.sbtqa.tag.pagefactory.web.properties.WebConfiguration; @@ -30,7 +31,7 @@ public DesiredCapabilities parse() { setCapability("videoName", PROPERTIES.getSelenoidVideoName(), VIDEONAME_FORMAT); setCapability("videoScreenSize", PROPERTIES.getSelenoidVideoScreenSize()); setCapability("videoFrameRate", PROPERTIES.getSelenoidVideoFrameRate()); - setCapability("name", PROPERTIES.getSelenoidNameOfTests()); + setCapability("name", PROPERTIES.getSelenoidNameOfTests().trim().isEmpty() ? Environment.getScenario().getName() : PROPERTIES.getSelenoidNameOfTests()); setCapability("timeZone", PROPERTIES.getSelenoidTimeZone()); setCapability("hostsEntries", PROPERTIES.getSelenoidHostEntries()); setCapability("applicationContainers", PROPERTIES.getSelenoidApplicationContainers()); From 8305ed9e2d2d55a1088054aed735af7928d2c8d9 Mon Sep 17 00:00:00 2001 From: svetlana Date: Wed, 28 Oct 2020 12:44:36 +0300 Subject: [PATCH 2/2] set scenario name of test (cucumber) --- .../src/main/asciidoc/web_properties.asciidoc | 2 +- .../web/capabilities/SelenoidCapabilitiesParser.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/page-factory-doc/src/main/asciidoc/web_properties.asciidoc b/page-factory-doc/src/main/asciidoc/web_properties.asciidoc index 100c0e6c..20d2cbe2 100644 --- a/page-factory-doc/src/main/asciidoc/web_properties.asciidoc +++ b/page-factory-doc/src/main/asciidoc/web_properties.asciidoc @@ -149,7 +149,7 @@ selenoid.video.name = my-cool-video.mp4 | Количество кадров в секунду |selenoid.video.frameRate = 24 |selenoid.nameOfTests -| Имя теста, по умолчанию наименование берется из названия сценария +| Имя теста, по умолчанию наименование берется из названия сценария (для cucumber сценария) |selenoid.nameOfTests = myCoolTestName |selenoid.timeZone | Таймзона diff --git a/plugins/web-plugin/src/main/java/ru/sbtqa/tag/pagefactory/web/capabilities/SelenoidCapabilitiesParser.java b/plugins/web-plugin/src/main/java/ru/sbtqa/tag/pagefactory/web/capabilities/SelenoidCapabilitiesParser.java index 494b946d..b0c014ef 100644 --- a/plugins/web-plugin/src/main/java/ru/sbtqa/tag/pagefactory/web/capabilities/SelenoidCapabilitiesParser.java +++ b/plugins/web-plugin/src/main/java/ru/sbtqa/tag/pagefactory/web/capabilities/SelenoidCapabilitiesParser.java @@ -31,7 +31,13 @@ public DesiredCapabilities parse() { setCapability("videoName", PROPERTIES.getSelenoidVideoName(), VIDEONAME_FORMAT); setCapability("videoScreenSize", PROPERTIES.getSelenoidVideoScreenSize()); setCapability("videoFrameRate", PROPERTIES.getSelenoidVideoFrameRate()); - setCapability("name", PROPERTIES.getSelenoidNameOfTests().trim().isEmpty() ? Environment.getScenario().getName() : PROPERTIES.getSelenoidNameOfTests()); + String selenoidName; + if (PROPERTIES.getSelenoidNameOfTests().trim().isEmpty() && Environment.getScenario() != null) { + selenoidName = Environment.getScenario().getName(); + } else { + selenoidName = PROPERTIES.getSelenoidNameOfTests(); + } + setCapability("name", selenoidName); setCapability("timeZone", PROPERTIES.getSelenoidTimeZone()); setCapability("hostsEntries", PROPERTIES.getSelenoidHostEntries()); setCapability("applicationContainers", PROPERTIES.getSelenoidApplicationContainers());