Skip to content

Commit 1117b29

Browse files
David-DB88davitbejanyanMgrdichHaaroleanVladSenyuta
authored
UI: Implement a dark theme (#2996)
--------- Co-authored-by: davitbejanyan <[email protected]> Co-authored-by: Mgrdich <[email protected]> Co-authored-by: Roman Zabaluev <[email protected]> Co-authored-by: VladSenyuta <[email protected]> Co-authored-by: Vlad Senyuta <[email protected]> Co-authored-by: Oleg Shur <[email protected]>
1 parent 4c2d37d commit 1117b29

File tree

106 files changed

+1785
-717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1785
-717
lines changed

kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/models/Schema.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ public class Schema {
1616
public static Schema createSchemaAvro() {
1717
return new Schema().setName("schema_avro-" + randomAlphabetic(5))
1818
.setType(SchemaType.AVRO)
19-
.setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_avro_value.json");
19+
.setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schemas/schema_avro_value.json");
2020
}
2121

2222
public static Schema createSchemaJson() {
2323
return new Schema().setName("schema_json-" + randomAlphabetic(5))
2424
.setType(SchemaType.JSON)
25-
.setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_Json_Value.json");
25+
.setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schemas/schema_json_Value.json");
2626
}
2727

2828
public static Schema createSchemaProtobuf() {
2929
return new Schema().setName("schema_protobuf-" + randomAlphabetic(5))
3030
.setType(SchemaType.PROTOBUF)
31-
.setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_protobuf_value.txt");
31+
.setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schemas/schema_protobuf_value.txt");
3232
}
3333
}

kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/BasePage.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
import com.codeborne.selenide.Condition;
44
import com.codeborne.selenide.ElementsCollection;
55
import com.codeborne.selenide.SelenideElement;
6+
import com.codeborne.selenide.WebDriverRunner;
67
import com.provectus.kafka.ui.utilities.WebUtils;
78
import lombok.extern.slf4j.Slf4j;
9+
import org.openqa.selenium.Keys;
10+
import org.openqa.selenium.interactions.Actions;
811

912
import java.time.Duration;
1013

@@ -34,14 +37,24 @@ public abstract class BasePage extends WebUtils {
3437
protected void waitUntilSpinnerDisappear() {
3538
log.debug("\nwaitUntilSpinnerDisappear");
3639
if (isVisible(loadingSpinner)) {
37-
loadingSpinner.shouldBe(Condition.disappear, Duration.ofSeconds(30));
40+
loadingSpinner.shouldBe(Condition.disappear, Duration.ofSeconds(60));
3841
}
3942
}
4043

4144
protected void clickSubmitBtn() {
4245
clickByJavaScript(submitBtn);
4346
}
4447

48+
protected void setJsonInputValue(SelenideElement jsonInput, String jsonConfig) {
49+
sendKeysByActions(jsonInput, jsonConfig.replace(" ", ""));
50+
new Actions(WebDriverRunner.getWebDriver())
51+
.keyDown(Keys.SHIFT)
52+
.sendKeys(Keys.PAGE_DOWN)
53+
.keyUp(Keys.SHIFT)
54+
.sendKeys(Keys.DELETE)
55+
.perform();
56+
}
57+
4558
protected SelenideElement getTableElement(String elementName) {
4659
log.debug("\ngetTableElement: {}", elementName);
4760
return $x(String.format(tableElementNameLocator, elementName));

kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/connectors/ConnectorCreateForm.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,22 @@ public ConnectorCreateForm waitUntilScreenReady() {
2121
}
2222

2323
@Step
24-
public ConnectorCreateForm setConnectorDetails(String connectName, String configJson) {
24+
public ConnectorCreateForm setName(String connectName) {
2525
nameField.shouldBe(Condition.enabled).setValue(connectName);
26+
return this;
27+
}
28+
29+
@Step
30+
public ConnectorCreateForm setConfig(String configJson) {
2631
configField.shouldBe(Condition.enabled).click();
27-
contentTextArea.setValue(configJson);
28-
nameField.shouldBe(Condition.enabled).click();
32+
setJsonInputValue(contentTextArea, configJson);
33+
return this;
34+
}
35+
36+
@Step
37+
public ConnectorCreateForm setConnectorDetails(String connectName, String configJson) {
38+
setName(connectName);
39+
setConfig(configJson);
2940
return this;
3041
}
3142

kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/schemas/SchemaCreateForm.java

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@
22

33
import com.codeborne.selenide.Condition;
44
import com.codeborne.selenide.SelenideElement;
5+
import com.codeborne.selenide.WebDriverRunner;
56
import com.provectus.kafka.ui.api.model.CompatibilityLevel;
67
import com.provectus.kafka.ui.api.model.SchemaType;
78
import com.provectus.kafka.ui.pages.BasePage;
89
import io.qameta.allure.Step;
10+
import org.openqa.selenium.Keys;
11+
import org.openqa.selenium.interactions.Actions;
912

1013
import java.util.List;
1114
import java.util.stream.Collectors;
1215
import java.util.stream.Stream;
1316

1417
import static com.codeborne.selenide.Selenide.*;
18+
import static org.openqa.selenium.By.id;
1519

1620
public class SchemaCreateForm extends BasePage {
1721

@@ -23,7 +27,8 @@ public class SchemaCreateForm extends BasePage {
2327
protected SelenideElement compatibilityLevelList = $x("//ul[@name='compatibilityLevel']");
2428
protected SelenideElement newSchemaTextArea = $x("//div[@id='newSchema']");
2529
protected SelenideElement latestSchemaTextArea = $x("//div[@id='latestSchema']");
26-
protected SelenideElement schemaVersionDdl = $$x("//ul[@role='listbox']/li[text()='Version 2']").first();
30+
protected SelenideElement leftVersionDdl = $(id("left-select"));
31+
protected SelenideElement rightVersionDdl = $(id("right-select"));
2732
protected List<SelenideElement> visibleMarkers = $$x("//div[@class='ace_scroller']//div[contains(@class,'codeMarker')]");
2833
protected List<SelenideElement> elementsCompareVersionDdl = $$x("//ul[@role='listbox']/ul/li");
2934
protected String ddlElementLocator = "//li[@value='%s']";
@@ -68,8 +73,14 @@ public SchemaCreateForm selectCompatibilityLevelFromDropdown(CompatibilityLevel.
6873
}
6974

7075
@Step
71-
public SchemaCreateForm openSchemaVersionDdl() {
72-
schemaVersionDdl.shouldBe(Condition.enabled).click();
76+
public SchemaCreateForm openLeftVersionDdl() {
77+
leftVersionDdl.shouldBe(Condition.enabled).click();
78+
return this;
79+
}
80+
81+
@Step
82+
public SchemaCreateForm openRightVersionDdl() {
83+
rightVersionDdl.shouldBe(Condition.enabled).click();
7384
return this;
7485
}
7586

@@ -92,8 +103,15 @@ public int getMarkedLinesNumber() {
92103
@Step
93104
public SchemaCreateForm setNewSchemaValue(String configJson) {
94105
newSchemaTextArea.shouldBe(Condition.visible).click();
95-
clearByKeyboard(newSchemaInput);
96-
newSchemaInput.setValue(configJson);
106+
newSchemaInput.shouldBe(Condition.enabled);
107+
new Actions(WebDriverRunner.getWebDriver())
108+
.sendKeys(Keys.PAGE_UP)
109+
.keyDown(Keys.SHIFT)
110+
.sendKeys(Keys.PAGE_DOWN)
111+
.keyUp(Keys.SHIFT)
112+
.sendKeys(Keys.DELETE)
113+
.perform();
114+
setJsonInputValue(newSchemaInput, configJson);
97115
return this;
98116
}
99117

kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topics/ProduceMessagePanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public ProduceMessagePanel setHeaderFiled(String value) {
4949

5050
@Step
5151
public ProduceMessagePanel submitProduceMessage() {
52-
submitBtn.shouldBe(Condition.enabled).click();
52+
clickByActions(submitBtn);
5353
submitBtn.shouldBe(Condition.disappear);
5454
refresh();
5555
return this;

kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/settings/drivers/LocalWebDriver.java

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,54 +14,55 @@
1414

1515
public abstract class LocalWebDriver {
1616

17-
private static org.openqa.selenium.WebDriver getWebDriver() {
18-
try {
19-
return WebDriverRunner.getWebDriver();
20-
} catch (IllegalStateException ex) {
21-
Configuration.headless = false;
22-
Configuration.browser = "chrome";
23-
Configuration.browserSize = "1920x1080";
24-
/**screenshots and savePageSource config is needed for local debug
25-
* optionally can be set as 'false' to not duplicate Allure report
26-
*/
27-
Configuration.screenshots = true;
28-
Configuration.savePageSource = true;
29-
Configuration.pageLoadTimeout = 120000;
30-
Configuration.browserCapabilities = new ChromeOptions()
31-
.addArguments("--lang=en_US");
32-
open();
33-
return WebDriverRunner.getWebDriver();
17+
private static org.openqa.selenium.WebDriver getWebDriver() {
18+
try {
19+
return WebDriverRunner.getWebDriver();
20+
} catch (IllegalStateException ex) {
21+
Configuration.headless = false;
22+
Configuration.browser = "chrome";
23+
Configuration.browserSize = "1920x1080";
24+
/**screenshots and savePageSource config is needed for local debug
25+
* optionally can be set as 'false' to not duplicate Allure report
26+
*/
27+
Configuration.screenshots = true;
28+
Configuration.savePageSource = true;
29+
Configuration.pageLoadTimeout = 120000;
30+
Configuration.browserCapabilities = new ChromeOptions()
31+
.addArguments("--remote-allow-origins=*")
32+
.addArguments("--lang=en_US");
33+
open();
34+
return WebDriverRunner.getWebDriver();
35+
}
3436
}
35-
}
3637

37-
@Step
38-
public static void openUrl(String url) {
39-
if (!getWebDriver().getCurrentUrl().equals(url)) {
40-
getWebDriver().get(url);
38+
@Step
39+
public static void openUrl(String url) {
40+
if (!getWebDriver().getCurrentUrl().equals(url)) {
41+
getWebDriver().get(url);
42+
}
4143
}
42-
}
4344

44-
@Step
45-
public static void browserInit() {
46-
getWebDriver();
47-
}
45+
@Step
46+
public static void browserInit() {
47+
getWebDriver();
48+
}
4849

49-
@Step
50-
public static void browserClear() {
51-
clearBrowserLocalStorage();
52-
clearBrowserCookies();
53-
refresh();
54-
}
50+
@Step
51+
public static void browserClear() {
52+
clearBrowserLocalStorage();
53+
clearBrowserCookies();
54+
refresh();
55+
}
5556

56-
@Step
57-
public static void browserQuit() {
58-
getWebDriver().quit();
59-
}
57+
@Step
58+
public static void browserQuit() {
59+
getWebDriver().quit();
60+
}
6061

61-
@Step
62-
public static void loggerSetup() {
63-
SelenideLogger.addListener("AllureSelenide", new AllureSelenide()
64-
.screenshots(true)
65-
.savePageSource(false));
66-
}
62+
@Step
63+
public static void loggerSetup() {
64+
SelenideLogger.addListener("AllureSelenide", new AllureSelenide()
65+
.screenshots(true)
66+
.savePageSource(false));
67+
}
6768
}

kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/settings/listeners/QaseResultListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ private static QaseTestCaseListener createQaseListener() {
3939
}
4040

4141
@Override
42-
public void onTestStart(ITestResult result) {
42+
public void onTestStart(ITestResult tr) {
4343
getQaseTestCaseListener().onTestCaseStarted();
44-
super.onTestStart(result);
44+
super.onTestStart(tr);
4545
}
4646

4747
@Override

kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/utilities/WebUtils.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ public static void clickByActions(SelenideElement element) {
2121
.perform();
2222
}
2323

24+
public static void sendKeysByActions(SelenideElement element, String keys) {
25+
log.debug("\nsendKeysByActions: {} \nsend keys '{}'", element.getSearchCriteria(), keys);
26+
element.shouldBe(Condition.enabled);
27+
new Actions(WebDriverRunner.getWebDriver())
28+
.moveToElement(element)
29+
.sendKeys(element, keys)
30+
.perform();
31+
}
32+
2433
public static void clickByJavaScript(SelenideElement element) {
2534
log.debug("\nclickByJavaScript: {}", element.getSearchCriteria());
2635
element.shouldBe(Condition.enabled);

kafka-ui-e2e-checks/src/main/resources/config_for_create_connector.json renamed to kafka-ui-e2e-checks/src/main/resources/testData/connectors/config_for_create_connector.json

File renamed without changes.

kafka-ui-e2e-checks/src/main/resources/config_for_create_connector_via_api.json renamed to kafka-ui-e2e-checks/src/main/resources/testData/connectors/config_for_create_connector_via_api.json

File renamed without changes.

0 commit comments

Comments
 (0)