[e2e] refactor POM classes structure (#2736)
* Resolved conflicts * revert QaseExtension * Added waiter * Deleted unused imports * Renamed method clickOnButton * Added waitUntil * Refactored SelenideElements * Refactored xPath in ConnectorCreateForm * Resolve conversations * Revert xPath * Resolved conversations * Resolved conversations * Resolved conversations * Deleted clickByJavaScript * Refactored methods setConnectorConfig and setConfig, added alertMessage condition Co-authored-by: Vlad Senyuta <66071557+VladSenyuta@users.noreply.github.com>
This commit is contained in:
parent
45aa4542ba
commit
7f92c0f2e5
16 changed files with 259 additions and 191 deletions
|
@ -11,22 +11,27 @@ import static com.provectus.kafka.ui.settings.Source.CLUSTER_NAME;
|
||||||
|
|
||||||
public class NaviSideBar {
|
public class NaviSideBar {
|
||||||
|
|
||||||
|
protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
|
||||||
|
protected SelenideElement dashboardMenuItem = $x("//a[@title='Dashboard']");
|
||||||
|
protected String sideMenuOptionElementLocator = ".//ul/li[contains(.,'%s')]";
|
||||||
|
protected String clusterElementLocator = "//aside/ul/li[contains(.,'%s')]";
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public NaviSideBar waitUntilScreenReady() {
|
public NaviSideBar waitUntilScreenReady() {
|
||||||
$x("//*[contains(text(),'Loading')]").shouldBe(Condition.disappear, Duration.ofSeconds(30));
|
loadingSpinner.shouldBe(Condition.disappear, Duration.ofSeconds(30));
|
||||||
$x("//a[@title='Dashboard']").shouldBe(Condition.visible, Duration.ofSeconds(30));
|
dashboardMenuItem.shouldBe(Condition.visible, Duration.ofSeconds(30));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public NaviSideBar openSideMenu(String clusterName, SideMenuOption option) {
|
public NaviSideBar openSideMenu(String clusterName, SideMenuOption option) {
|
||||||
SelenideElement clusterElement = $x(String.format("//aside/ul/li[contains(.,'%s')]", clusterName)).shouldBe(Condition.visible);
|
SelenideElement clusterElement = $x(String.format(clusterElementLocator, clusterName)).shouldBe(Condition.visible);
|
||||||
if (clusterElement.parent().$$x(".//ul").size() == 0) {
|
if (clusterElement.parent().$$x(".//ul").size() == 0) {
|
||||||
clusterElement.click();
|
clusterElement.click();
|
||||||
}
|
}
|
||||||
clusterElement
|
clusterElement
|
||||||
.parent()
|
.parent()
|
||||||
.$x(String.format(".//ul/li[contains(.,'%s')]", option.value))
|
.$x(String.format(sideMenuOptionElementLocator, option.value))
|
||||||
.click();
|
.click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +42,6 @@ public class NaviSideBar {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public enum SideMenuOption {
|
public enum SideMenuOption {
|
||||||
BROKERS("Brokers"),
|
BROKERS("Brokers"),
|
||||||
TOPICS("Topics"),
|
TOPICS("Topics"),
|
||||||
|
|
|
@ -3,37 +3,33 @@ package com.provectus.kafka.ui.pages.connector;
|
||||||
import com.codeborne.selenide.Condition;
|
import com.codeborne.selenide.Condition;
|
||||||
import com.codeborne.selenide.SelenideElement;
|
import com.codeborne.selenide.SelenideElement;
|
||||||
import io.qameta.allure.Step;
|
import io.qameta.allure.Step;
|
||||||
import org.openqa.selenium.By;
|
|
||||||
|
|
||||||
import static com.codeborne.selenide.Selenide.$;
|
import static com.codeborne.selenide.Selenide.$x;
|
||||||
import static com.codeborne.selenide.Selenide.sleep;
|
|
||||||
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
||||||
import static com.provectus.kafka.ui.utilities.screenshots.Screenshooter.log;
|
|
||||||
|
|
||||||
public class ConnectorCreateForm {
|
public class ConnectorCreateForm {
|
||||||
|
|
||||||
protected SelenideElement nameField = $(By.xpath("//input[@name='name']"));
|
protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
|
||||||
protected SelenideElement contentTextArea = $(".ace_text-input");
|
protected SelenideElement nameField = $x("//input[@name='name']");
|
||||||
protected SelenideElement submitButton = $(By.xpath("//button[@type='submit']"));
|
protected SelenideElement contentTextArea = $x("//textarea[@class='ace_text-input']");
|
||||||
|
protected SelenideElement submitBtn = $x("//button[@type='submit']");
|
||||||
private static final String path = "/ui/clusters/secondLocal/connectors/create_new";
|
protected SelenideElement configField = $x("//div[@id='config']");
|
||||||
|
|
||||||
@Step("Set connector config JSON")
|
|
||||||
public ConnectorDetails setConnectorConfig(String connectName, String configJson) {
|
|
||||||
nameField.setValue(connectName);
|
|
||||||
$("#config").click();
|
|
||||||
contentTextArea.setValue("");
|
|
||||||
contentTextArea.setValue(String.valueOf(configJson.toCharArray()));
|
|
||||||
nameField.click();
|
|
||||||
clickByJavaScript(submitButton);
|
|
||||||
sleep(4000);
|
|
||||||
log.info("Connector config is submitted");
|
|
||||||
return new ConnectorDetails();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public ConnectorCreateForm waitUntilScreenReady() {
|
public ConnectorCreateForm waitUntilScreenReady() {
|
||||||
|
loadingSpinner.shouldBe(Condition.disappear);
|
||||||
nameField.shouldBe(Condition.visible);
|
nameField.shouldBe(Condition.visible);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Step
|
||||||
|
public ConnectorCreateForm setConnectorConfig(String connectName, String configJson) {
|
||||||
|
nameField.shouldBe(Condition.enabled).setValue(connectName);
|
||||||
|
configField.shouldBe(Condition.enabled).click();
|
||||||
|
contentTextArea.setValue(configJson);
|
||||||
|
nameField.shouldBe(Condition.enabled).click();
|
||||||
|
clickByJavaScript(submitBtn);
|
||||||
|
loadingSpinner.shouldBe(Condition.disappear);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,71 +3,75 @@ package com.provectus.kafka.ui.pages.connector;
|
||||||
import com.codeborne.selenide.Condition;
|
import com.codeborne.selenide.Condition;
|
||||||
import com.codeborne.selenide.SelenideElement;
|
import com.codeborne.selenide.SelenideElement;
|
||||||
import io.qameta.allure.Step;
|
import io.qameta.allure.Step;
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.Keys;
|
|
||||||
|
|
||||||
import static com.codeborne.selenide.Selenide.$;
|
import java.util.Arrays;
|
||||||
import static com.codeborne.selenide.Selenide.sleep;
|
|
||||||
|
import static com.codeborne.selenide.Selenide.$x;
|
||||||
|
import static com.provectus.kafka.ui.utilities.WebUtils.clearByKeyboard;
|
||||||
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
||||||
import static com.provectus.kafka.ui.utilities.screenshots.Screenshooter.log;
|
|
||||||
|
|
||||||
public class ConnectorDetails {
|
public class ConnectorDetails {
|
||||||
protected SelenideElement dotMenuBtn = $(By.xpath("//button[@aria-label='Dropdown Toggle']"));
|
|
||||||
protected SelenideElement deleteBtn = $(By.xpath("//li/div[text()='Delete']"));
|
protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
|
||||||
protected SelenideElement confirmBtnMdl = $(By.xpath("//div[@role='dialog']//button[text()='Confirm']"));
|
protected SelenideElement dotMenuBtn = $x("//button[@aria-label='Dropdown Toggle']");
|
||||||
protected SelenideElement submitBtn = $(By.xpath("//button[@type='submit']"));
|
protected SelenideElement deleteBtn = $x("//li/div[contains(text(),'Delete')]");
|
||||||
protected SelenideElement contentTextArea = $("[wrap]");
|
protected SelenideElement confirmBtnMdl = $x("//div[@role='dialog']//button[contains(text(),'Confirm')]");
|
||||||
|
protected SelenideElement submitBtn = $x("//button[@type='submit']");
|
||||||
|
protected SelenideElement contentTextArea = $x("//textarea[@class='ace_text-input']");
|
||||||
|
protected SelenideElement taskTab = $x("//a[contains(text(),'Tasks')]");
|
||||||
|
protected SelenideElement configTab = $x("//a[contains(text(),'Config')]");
|
||||||
|
protected SelenideElement configField = $x("//div[@id='config']");
|
||||||
|
protected SelenideElement successAlertMessage = $x("//div[contains(text(),'Config successfully updated')]");
|
||||||
|
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public ConnectorDetails waitUntilScreenReady() {
|
public ConnectorDetails waitUntilScreenReady() {
|
||||||
$(By.xpath("//a[text() ='Tasks']")).shouldBe(Condition.visible);
|
loadingSpinner.shouldBe(Condition.disappear);
|
||||||
$(By.xpath("//a[text() ='Config']")).shouldBe(Condition.visible);
|
Arrays.asList(taskTab,configTab).forEach(elementsMenu -> elementsMenu.shouldBe(Condition.visible));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step()
|
@Step
|
||||||
public ConnectorDetails openConfigTab() {
|
public ConnectorDetails openConfigTab() {
|
||||||
clickByJavaScript($(By.xpath("//a[text() ='Config']")));
|
clickByJavaScript(configTab);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step()
|
@Step
|
||||||
public ConnectorDetails setConfig(String configJson) {
|
public ConnectorDetails setConfig(String configJson) {
|
||||||
$("#config").click();
|
configField.shouldBe(Condition.enabled).click();
|
||||||
contentTextArea.sendKeys(Keys.LEFT_CONTROL + "a");
|
clearByKeyboard(contentTextArea);
|
||||||
contentTextArea.setValue("");
|
contentTextArea.setValue(configJson);
|
||||||
contentTextArea.setValue(String.valueOf(configJson.toCharArray()));
|
configField.shouldBe(Condition.enabled).click();
|
||||||
$("#config").click();
|
|
||||||
clickByJavaScript(submitBtn);
|
clickByJavaScript(submitBtn);
|
||||||
sleep(4000);
|
successAlertMessage.shouldBe(Condition.visible);
|
||||||
log.info("Connector config is submitted");
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step()
|
@Step
|
||||||
public ConnectorDetails openDotMenu() {
|
public ConnectorDetails openDotMenu() {
|
||||||
clickByJavaScript(dotMenuBtn);
|
clickByJavaScript(dotMenuBtn);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step()
|
@Step
|
||||||
public ConnectorDetails clickDeleteButton() {
|
public ConnectorDetails clickDeleteBtn() {
|
||||||
clickByJavaScript(deleteBtn);
|
clickByJavaScript(deleteBtn);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step()
|
@Step
|
||||||
public ConnectorDetails clickConfirmButton() {
|
public ConnectorDetails clickConfirmBtn() {
|
||||||
confirmBtnMdl.shouldBe(Condition.enabled).click();
|
confirmBtnMdl.shouldBe(Condition.enabled).click();
|
||||||
confirmBtnMdl.shouldBe(Condition.disappear);
|
confirmBtnMdl.shouldBe(Condition.disappear);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step()
|
@Step
|
||||||
public ConnectorDetails deleteConnector() {
|
public ConnectorDetails deleteConnector() {
|
||||||
openDotMenu();
|
openDotMenu();
|
||||||
clickDeleteButton();
|
clickDeleteBtn();
|
||||||
clickConfirmButton();
|
clickConfirmBtn();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
package com.provectus.kafka.ui.pages.connector;
|
package com.provectus.kafka.ui.pages.connector;
|
||||||
|
|
||||||
import com.codeborne.selenide.Condition;
|
import com.codeborne.selenide.Condition;
|
||||||
|
import com.codeborne.selenide.SelenideElement;
|
||||||
import com.provectus.kafka.ui.utilities.WaitUtils;
|
import com.provectus.kafka.ui.utilities.WaitUtils;
|
||||||
import io.qameta.allure.Step;
|
import io.qameta.allure.Step;
|
||||||
import lombok.experimental.ExtensionMethod;
|
import lombok.experimental.ExtensionMethod;
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
|
|
||||||
import static com.codeborne.selenide.Selenide.$;
|
|
||||||
import static com.codeborne.selenide.Selenide.$x;
|
import static com.codeborne.selenide.Selenide.$x;
|
||||||
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
||||||
import static com.provectus.kafka.ui.utilities.WebUtils.isVisible;
|
import static com.provectus.kafka.ui.utilities.WebUtils.isVisible;
|
||||||
|
@ -14,34 +14,41 @@ import static com.provectus.kafka.ui.utilities.WebUtils.isVisible;
|
||||||
@ExtensionMethod(WaitUtils.class)
|
@ExtensionMethod(WaitUtils.class)
|
||||||
public class KafkaConnectList {
|
public class KafkaConnectList {
|
||||||
|
|
||||||
|
protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
|
||||||
|
protected SelenideElement pageTitle = $x("//h1[text()='Connectors']");
|
||||||
|
protected SelenideElement createConnectorBtn = $x("//button[contains(text(),'Create Connector')]");
|
||||||
|
protected SelenideElement connectorsGrid = $x("//table");
|
||||||
|
protected String tabElementLocator = "//td[contains(text(),'%s')]";
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public KafkaConnectList waitUntilScreenReady() {
|
public KafkaConnectList waitUntilScreenReady() {
|
||||||
$(By.xpath("//h1[text()='Connectors']")).shouldBe(Condition.visible);
|
loadingSpinner.shouldBe(Condition.disappear);
|
||||||
|
pageTitle.shouldBe(Condition.visible);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step("Click on button 'Create Connector'")
|
@Step
|
||||||
public ConnectorCreateForm clickCreateConnectorButton() {
|
public KafkaConnectList clickCreateConnectorBtn() {
|
||||||
clickByJavaScript($x("//button[text()='Create Connector']"));
|
clickByJavaScript(createConnectorBtn);
|
||||||
return new ConnectorCreateForm();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public KafkaConnectList openConnector(String connectorName) {
|
public KafkaConnectList openConnector(String connectorName) {
|
||||||
$x("//tbody//td[1][text()='" + connectorName + "']").shouldBe(Condition.enabled).click();
|
$x(String.format(tabElementLocator,connectorName)).shouldBe(Condition.visible).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public boolean isConnectorVisible(String connectorName) {
|
public boolean isConnectorVisible(String connectorName) {
|
||||||
$(By.xpath("//table")).shouldBe(Condition.visible);
|
connectorsGrid.shouldBe(Condition.visible);
|
||||||
return isVisible($x("//tbody//td[1][text()='" + connectorName + "']"));
|
return isVisible($x(String.format(tabElementLocator,connectorName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public KafkaConnectList connectorIsUpdatedInList(String connectorName, String topicName) {
|
public KafkaConnectList connectorIsUpdatedInList(String connectorName, String topicName) {
|
||||||
$(By.xpath(String.format("//a[text() = '%s']", connectorName))).shouldBe(Condition.visible);
|
$x(String.format(tabElementLocator,connectorName)).shouldBe(Condition.visible);
|
||||||
By.xpath(String.format("//a[text() = '%s']", topicName)).refreshUntil(Condition.visible);
|
By.xpath(String.format(tabElementLocator,topicName)).refreshUntil(Condition.visible);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,70 +1,73 @@
|
||||||
package com.provectus.kafka.ui.pages.schema;
|
package com.provectus.kafka.ui.pages.schema;
|
||||||
|
|
||||||
import com.codeborne.selenide.Condition;
|
import com.codeborne.selenide.Condition;
|
||||||
import com.codeborne.selenide.Selenide;
|
|
||||||
import com.codeborne.selenide.SelenideElement;
|
import com.codeborne.selenide.SelenideElement;
|
||||||
import com.provectus.kafka.ui.api.model.CompatibilityLevel;
|
import com.provectus.kafka.ui.api.model.CompatibilityLevel;
|
||||||
import com.provectus.kafka.ui.api.model.SchemaType;
|
import com.provectus.kafka.ui.api.model.SchemaType;
|
||||||
import io.qameta.allure.Step;
|
import io.qameta.allure.Step;
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.Keys;
|
|
||||||
|
|
||||||
import static com.codeborne.selenide.Selenide.$;
|
import static com.codeborne.selenide.Selenide.$;
|
||||||
import static com.codeborne.selenide.Selenide.$x;
|
import static com.codeborne.selenide.Selenide.$x;
|
||||||
|
import static com.provectus.kafka.ui.utilities.WebUtils.clearByKeyboard;
|
||||||
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
||||||
|
|
||||||
public class SchemaCreateForm {
|
public class SchemaCreateForm {
|
||||||
|
|
||||||
protected SelenideElement subjectName = $(By.xpath("//input[@name='subject']"));
|
protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
|
||||||
protected SelenideElement schemaField = $(By.xpath("//textarea[@name='schema']"));
|
protected SelenideElement schemaNameField = $x("//input[@name='subject']");
|
||||||
protected SelenideElement submitSchemaButton = $(By.xpath("//button[@type='submit']"));
|
protected SelenideElement pageTitle = $x("//h1['Edit']");
|
||||||
protected SelenideElement newSchemaTextArea = $("#newSchema [wrap]");
|
protected SelenideElement schemaTextArea = $x("//textarea[@name='schema']");
|
||||||
protected SelenideElement schemaTypeDropDown = $x("//ul[@name='schemaType']");
|
protected SelenideElement submitBtn = $x("//button[@type='submit']");
|
||||||
|
protected SelenideElement newSchemaInput = $("#newSchema [wrap]");
|
||||||
|
protected SelenideElement schemaTypeDdl = $x("//ul[@name='schemaType']");
|
||||||
|
protected SelenideElement compatibilityLevelList = $x("//ul[@name='compatibilityLevel']");
|
||||||
|
protected SelenideElement newSchemaTextArea = $x("//div[@id='newSchema']");
|
||||||
|
protected String elementLocatorDdl = "//li[@value='%s']";
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public SchemaCreateForm waitUntilScreenReady(){
|
public SchemaCreateForm waitUntilScreenReady(){
|
||||||
$x("//h1['Edit']").shouldBe(Condition.visible);
|
loadingSpinner.shouldBe(Condition.disappear);
|
||||||
|
pageTitle.shouldBe(Condition.visible);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public SchemaCreateForm setSubjectName(String name) {
|
public SchemaCreateForm setSubjectName(String name) {
|
||||||
subjectName.setValue(name);
|
schemaNameField.setValue(name);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public SchemaCreateForm setSchemaField(String text) {
|
public SchemaCreateForm setSchemaField(String text) {
|
||||||
schemaField.setValue(text);
|
schemaTextArea.setValue(text);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public SchemaCreateForm selectSchemaTypeFromDropdown(SchemaType schemaType) {
|
public SchemaCreateForm selectSchemaTypeFromDropdown(SchemaType schemaType) {
|
||||||
$("ul[role='listbox']").click();
|
schemaTypeDdl.shouldBe(Condition.enabled).click();
|
||||||
$x("//li[text()='" + schemaType.getValue() + "']").click();
|
$x(String.format(elementLocatorDdl, schemaType.getValue())).shouldBe(Condition.visible).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public SchemaDetails clickSubmit() {
|
public SchemaCreateForm clickSubmitBtn() {
|
||||||
clickByJavaScript(submitSchemaButton);
|
clickByJavaScript(submitBtn);
|
||||||
return new SchemaDetails();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public SchemaCreateForm selectCompatibilityLevelFromDropdown(CompatibilityLevel.CompatibilityEnum level) {
|
public SchemaCreateForm selectCompatibilityLevelFromDropdown(CompatibilityLevel.CompatibilityEnum level) {
|
||||||
$x("//ul[@name='compatibilityLevel']").click();
|
compatibilityLevelList.shouldBe(Condition.enabled).click();
|
||||||
$x("//li[text()='" + level.getValue() + "']").click();
|
$x(String.format(elementLocatorDdl, level.getValue())).shouldBe(Condition.visible).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step("Set new schema value")
|
@Step
|
||||||
public SchemaCreateForm setNewSchemaValue(String configJson) {
|
public SchemaCreateForm setNewSchemaValue(String configJson) {
|
||||||
$("#newSchema").click();
|
newSchemaTextArea.shouldBe(Condition.visible).click();
|
||||||
newSchemaTextArea.sendKeys(Keys.CONTROL + "a", Keys.BACK_SPACE);
|
clearByKeyboard(newSchemaInput);
|
||||||
Selenide.executeJavaScript("arguments[0].value = '';", $("#newSchema"));
|
newSchemaInput.setValue(configJson);
|
||||||
newSchemaTextArea.setValue(configJson);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +75,7 @@ public class SchemaCreateForm {
|
||||||
public boolean isSchemaDropDownDisabled(){
|
public boolean isSchemaDropDownDisabled(){
|
||||||
boolean disabled = false;
|
boolean disabled = false;
|
||||||
try{
|
try{
|
||||||
String attribute = schemaTypeDropDown.getAttribute("disabled");
|
String attribute = schemaTypeDdl.getAttribute("disabled");
|
||||||
disabled = true;
|
disabled = true;
|
||||||
}
|
}
|
||||||
catch (Throwable ignored){
|
catch (Throwable ignored){
|
||||||
|
|
|
@ -3,39 +3,45 @@ package com.provectus.kafka.ui.pages.schema;
|
||||||
import com.codeborne.selenide.Condition;
|
import com.codeborne.selenide.Condition;
|
||||||
import com.codeborne.selenide.SelenideElement;
|
import com.codeborne.selenide.SelenideElement;
|
||||||
import io.qameta.allure.Step;
|
import io.qameta.allure.Step;
|
||||||
import org.openqa.selenium.By;
|
|
||||||
|
|
||||||
import static com.codeborne.selenide.Selenide.*;
|
import static com.codeborne.selenide.Selenide.$$x;
|
||||||
|
import static com.codeborne.selenide.Selenide.$x;
|
||||||
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
||||||
|
|
||||||
public class SchemaDetails {
|
public class SchemaDetails {
|
||||||
|
|
||||||
protected SelenideElement dotMenuBtn = $$x("//button[@aria-label='Dropdown Toggle']").first();
|
protected SelenideElement dotMenuBtn = $$x("//button[@aria-label='Dropdown Toggle']").first();
|
||||||
|
protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
|
||||||
|
protected SelenideElement actualVersionTextArea = $x("//div[@id='schema']");
|
||||||
|
protected SelenideElement compatibilityField = $x("//h4[contains(text(),'Compatibility')]/../p");
|
||||||
|
protected SelenideElement editSchemaBtn = $x("//button[contains(text(),'Edit Schema')]");
|
||||||
|
protected SelenideElement removeBtn = $x("//*[contains(text(),'Remove')]");
|
||||||
|
protected SelenideElement confirmBtn = $x("//div[@role='dialog']//button[contains(text(),'Confirm')]");
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public SchemaDetails waitUntilScreenReady() {
|
public SchemaDetails waitUntilScreenReady() {
|
||||||
$("div#schema").shouldBe(Condition.visible);
|
loadingSpinner.shouldBe(Condition.disappear);
|
||||||
|
actualVersionTextArea.shouldBe(Condition.visible);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public String getCompatibility() {
|
public String getCompatibility() {
|
||||||
return $x("//h4[contains(text(),'Compatibility')]/../p").getText();
|
return compatibilityField.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public SchemaDetails openEditSchema(){
|
public SchemaDetails openEditSchema(){
|
||||||
$x("//button[text()= 'Edit Schema']").click();
|
editSchemaBtn.shouldBe(Condition.visible).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public SchemaRegistryList removeSchema() {
|
public SchemaDetails removeSchema() {
|
||||||
clickByJavaScript(dotMenuBtn);
|
clickByJavaScript(dotMenuBtn);
|
||||||
$(By.xpath("//*[contains(text(),'Remove')]")).click();
|
removeBtn.shouldBe(Condition.enabled).click();
|
||||||
SelenideElement confirmButton = $x("//div[@role=\"dialog\"]//button[text()='Confirm']");
|
confirmBtn.shouldBe(Condition.visible).click();
|
||||||
confirmButton.shouldBe(Condition.enabled).click();
|
confirmBtn.shouldBe(Condition.disappear);
|
||||||
confirmButton.shouldBe(Condition.disappear);
|
return this;
|
||||||
return new SchemaRegistryList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,40 +3,41 @@ package com.provectus.kafka.ui.pages.schema;
|
||||||
import com.codeborne.selenide.Condition;
|
import com.codeborne.selenide.Condition;
|
||||||
import com.codeborne.selenide.SelenideElement;
|
import com.codeborne.selenide.SelenideElement;
|
||||||
import io.qameta.allure.Step;
|
import io.qameta.allure.Step;
|
||||||
import org.openqa.selenium.By;
|
|
||||||
|
|
||||||
import static com.codeborne.selenide.Selenide.$;
|
|
||||||
import static com.codeborne.selenide.Selenide.$x;
|
import static com.codeborne.selenide.Selenide.$x;
|
||||||
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
||||||
import static com.provectus.kafka.ui.utilities.WebUtils.isVisible;
|
import static com.provectus.kafka.ui.utilities.WebUtils.isVisible;
|
||||||
|
|
||||||
public class SchemaRegistryList {
|
public class SchemaRegistryList {
|
||||||
|
|
||||||
private final SelenideElement schemaButton = $(By.xpath("//*[contains(text(),'Create Schema')]"));
|
protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
|
||||||
|
protected SelenideElement createSchemaBtn = $x("//button[contains(text(),'Create Schema')]");
|
||||||
|
protected SelenideElement schemaGrid = $x("//table");
|
||||||
|
protected String schemaTabElementLocator = "//a[contains(text(),'%s')]";
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public SchemaRegistryList waitUntilScreenReady(){
|
public SchemaRegistryList waitUntilScreenReady(){
|
||||||
$x("//*[contains(text(),'Loading')]").shouldBe(Condition.disappear);
|
loadingSpinner.shouldBe(Condition.disappear);
|
||||||
$x("//button[contains(text(),'Create Schema')]").shouldBe(Condition.visible);
|
createSchemaBtn.shouldBe(Condition.visible);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public SchemaCreateForm clickCreateSchema() {
|
public SchemaRegistryList clickCreateSchema() {
|
||||||
clickByJavaScript(schemaButton);
|
clickByJavaScript(createSchemaBtn);
|
||||||
return new SchemaCreateForm();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public SchemaDetails openSchema(String schemaName) {
|
public SchemaRegistryList openSchema(String schemaName) {
|
||||||
$(By.xpath("//*[contains(text(),'" + schemaName + "')]")).click();
|
$x(String.format(schemaTabElementLocator,schemaName)).shouldBe(Condition.visible).click();
|
||||||
return new SchemaDetails();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public boolean isSchemaVisible(String schemaName) {
|
public boolean isSchemaVisible(String schemaName) {
|
||||||
$(By.xpath("//table")).shouldBe(Condition.visible);
|
schemaGrid.shouldBe(Condition.visible);
|
||||||
return isVisible($x("//tbody//td//a[text()='" + schemaName + "']"));
|
return isVisible($x(String.format(schemaTabElementLocator,schemaName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,46 +3,56 @@ package com.provectus.kafka.ui.pages.topic;
|
||||||
import com.codeborne.selenide.Condition;
|
import com.codeborne.selenide.Condition;
|
||||||
import com.codeborne.selenide.SelenideElement;
|
import com.codeborne.selenide.SelenideElement;
|
||||||
import io.qameta.allure.Step;
|
import io.qameta.allure.Step;
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.Keys;
|
|
||||||
|
|
||||||
import static com.codeborne.selenide.Selenide.$;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static com.codeborne.selenide.Selenide.$x;
|
||||||
import static com.codeborne.selenide.Selenide.refresh;
|
import static com.codeborne.selenide.Selenide.refresh;
|
||||||
|
import static com.provectus.kafka.ui.utilities.WebUtils.clearByKeyboard;
|
||||||
|
|
||||||
public class ProduceMessagePanel {
|
public class ProduceMessagePanel {
|
||||||
|
|
||||||
private final SelenideElement keyField = $(By.xpath("//div[@id='key']/textarea"));
|
protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
|
||||||
private final SelenideElement contentField = $(By.xpath("//div[@id='content']/textarea"));
|
protected SelenideElement keyTextArea = $x("//div[@id='key']/textarea");
|
||||||
private final SelenideElement headersField = $(By.xpath("//div[@id='headers']/textarea"));
|
protected SelenideElement contentTextArea = $x("//div[@id='content']/textarea");
|
||||||
private final SelenideElement submitBtn = headersField.$(By.xpath("../../../..//button[@type='submit']"));
|
protected SelenideElement headersTextArea = $x("//div[@id='headers']/textarea");
|
||||||
|
protected SelenideElement submitBtn = headersTextArea.$x("../../../..//button[@type='submit']");
|
||||||
|
protected SelenideElement partitionDdl = $x("//ul[@name='partition']");
|
||||||
|
protected SelenideElement keySerdeDdl = $x("//ul[@name='keySerde']");
|
||||||
|
protected SelenideElement contentSerdeDdl = $x("//ul[@name='valueSerde']");
|
||||||
|
|
||||||
|
@Step
|
||||||
|
public ProduceMessagePanel waitUntilScreenReady(){
|
||||||
|
loadingSpinner.shouldBe(Condition.disappear);
|
||||||
|
Arrays.asList(partitionDdl, keySerdeDdl, contentSerdeDdl).forEach(element -> element.shouldBe(Condition.visible));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public ProduceMessagePanel setKeyField(String value) {
|
public ProduceMessagePanel setKeyField(String value) {
|
||||||
keyField.shouldBe(Condition.enabled)
|
clearByKeyboard(keyTextArea);
|
||||||
.sendKeys(Keys.chord(Keys.DELETE));
|
keyTextArea.setValue(value);
|
||||||
keyField.setValue(value);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public ProduceMessagePanel setContentFiled(String value) {
|
public ProduceMessagePanel setContentFiled(String value) {
|
||||||
contentField.shouldBe(Condition.enabled)
|
clearByKeyboard(contentTextArea);
|
||||||
.sendKeys(Keys.DELETE);
|
contentTextArea.setValue(value);
|
||||||
contentField.setValue(value);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public ProduceMessagePanel setHeaderFiled(String value) {
|
public ProduceMessagePanel setHeaderFiled(String value) {
|
||||||
headersField.setValue(value);
|
headersTextArea.setValue(value);
|
||||||
return new ProduceMessagePanel();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicDetails submitProduceMessage() {
|
public ProduceMessagePanel submitProduceMessage() {
|
||||||
submitBtn.shouldBe(Condition.enabled).click();
|
submitBtn.shouldBe(Condition.enabled).click();
|
||||||
submitBtn.shouldBe(Condition.disappear);
|
submitBtn.shouldBe(Condition.disappear);
|
||||||
refresh();
|
refresh();
|
||||||
return new TopicDetails();
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.codeborne.selenide.Condition;
|
||||||
import com.codeborne.selenide.ElementsCollection;
|
import com.codeborne.selenide.ElementsCollection;
|
||||||
import com.codeborne.selenide.SelenideElement;
|
import com.codeborne.selenide.SelenideElement;
|
||||||
import io.qameta.allure.Step;
|
import io.qameta.allure.Step;
|
||||||
import org.openqa.selenium.By;
|
|
||||||
|
|
||||||
import static com.codeborne.selenide.Selenide.*;
|
import static com.codeborne.selenide.Selenide.*;
|
||||||
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
||||||
|
@ -13,43 +12,55 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
public class TopicCreateEditForm {
|
public class TopicCreateEditForm {
|
||||||
|
|
||||||
private final SelenideElement timeToRetain = $(By.cssSelector("input#timeToRetain"));
|
protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
|
||||||
private final SelenideElement maxMessageBytes = $(By.name("maxMessageBytes"));
|
protected SelenideElement timeToRetainField = $x("//input[@id='timeToRetain']");
|
||||||
|
protected SelenideElement nameField = $x("//input[@name='name']");
|
||||||
|
protected SelenideElement maxMessageBytesField = $x("//input[@name='maxMessageBytes']");
|
||||||
|
protected SelenideElement minInSyncReplicasField = $x("//input[@name='minInSyncReplicas']");
|
||||||
|
protected SelenideElement cleanUpPolicyDdl = $x("//ul[@id='topicFormCleanupPolicy']");
|
||||||
|
protected SelenideElement createTopicBtn = $x("//button[@type='submit']");
|
||||||
|
protected String cleanUpPolicyTypeLocator = "//li[text()='%s']";
|
||||||
|
|
||||||
|
@Step
|
||||||
|
public TopicCreateEditForm waitUntilScreenReady(){
|
||||||
|
loadingSpinner.shouldBe(Condition.disappear);
|
||||||
|
nameField.shouldBe(Condition.visible);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicCreateEditForm setTopicName(String topicName) {
|
public TopicCreateEditForm setTopicName(String topicName) {
|
||||||
$("input#topicFormName").setValue(topicName);
|
nameField.setValue(topicName);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicCreateEditForm setMinInsyncReplicas(Integer minInsyncReplicas) {
|
public TopicCreateEditForm setMinInsyncReplicas(Integer minInsyncReplicas) {
|
||||||
$("input[name=minInSyncReplicas]").setValue(minInsyncReplicas.toString());
|
minInSyncReplicasField.setValue(minInsyncReplicas.toString());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicCreateEditForm setTimeToRetainDataInMs(Long ms) {
|
public TopicCreateEditForm setTimeToRetainDataInMs(Long ms) {
|
||||||
timeToRetain.setValue(ms.toString());
|
timeToRetainField.setValue(ms.toString());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicCreateEditForm setTimeToRetainDataInMs(String ms) {
|
public TopicCreateEditForm setTimeToRetainDataInMs(String ms) {
|
||||||
timeToRetain.setValue(ms);
|
timeToRetainField.setValue(ms);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicCreateEditForm setMaxSizeOnDiskInGB(String value) {
|
public TopicCreateEditForm setMaxSizeOnDiskInGB(String value) {
|
||||||
KafkaUISelectElement kafkaUISelectElement = new KafkaUISelectElement("retentionBytes");
|
new KafkaUISelectElement("retentionBytes").selectByVisibleText(value);
|
||||||
kafkaUISelectElement.selectByVisibleText(value);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicCreateEditForm setMaxMessageBytes(Long bytes) {
|
public TopicCreateEditForm setMaxMessageBytes(Long bytes) {
|
||||||
maxMessageBytes.setValue(bytes.toString());
|
maxMessageBytesField.setValue(bytes.toString());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +71,7 @@ public class TopicCreateEditForm {
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicCreateEditForm setTimeToRetainDataInMsUsingButtons(String value) {
|
public TopicCreateEditForm setTimeToRetainDataInMsUsingButtons(String value) {
|
||||||
timeToRetain
|
timeToRetainField
|
||||||
.parent()
|
.parent()
|
||||||
.parent()
|
.parent()
|
||||||
.$$("button")
|
.$$("button")
|
||||||
|
@ -77,8 +88,8 @@ public class TopicCreateEditForm {
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicCreateEditForm selectCleanupPolicy(String cleanupPolicyOptionValue) {
|
public TopicCreateEditForm selectCleanupPolicy(String cleanupPolicyOptionValue) {
|
||||||
$("ul#topicFormCleanupPolicy").click();
|
cleanUpPolicyDdl.shouldBe(Condition.visible).click();
|
||||||
$x("//li[text()='" + cleanupPolicyOptionValue + "']").click();
|
$x(String.format(cleanUpPolicyTypeLocator,cleanupPolicyOptionValue)).shouldBe(Condition.visible).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,9 +104,9 @@ public class TopicCreateEditForm {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicDetails sendData() {
|
public TopicCreateEditForm clickCreateTopicBtn() {
|
||||||
clickByJavaScript($x("//button[@type='submit']"));
|
clickByJavaScript(createTopicBtn);
|
||||||
return new TopicDetails();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
|
@ -148,7 +159,7 @@ public class TopicCreateEditForm {
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicCreateEditForm timeToRetainIs(String time) {
|
public TopicCreateEditForm timeToRetainIs(String time) {
|
||||||
String value = timeToRetain.getValue();
|
String value = timeToRetainField.getValue();
|
||||||
assertThat(value)
|
assertThat(value)
|
||||||
.as("Time to retain data (in ms) should be " + time)
|
.as("Time to retain data (in ms) should be " + time)
|
||||||
.isEqualTo(time);
|
.isEqualTo(time);
|
||||||
|
@ -162,7 +173,7 @@ public class TopicCreateEditForm {
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public String getTimeToRetain() {
|
public String getTimeToRetain() {
|
||||||
return timeToRetain.getValue();
|
return timeToRetainField.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
|
@ -172,7 +183,7 @@ public class TopicCreateEditForm {
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public String getMaxMessageBytes() {
|
public String getMaxMessageBytes() {
|
||||||
return maxMessageBytes.getValue();
|
return maxMessageBytesField.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,25 +7,36 @@ import io.qameta.allure.Step;
|
||||||
import lombok.experimental.ExtensionMethod;
|
import lombok.experimental.ExtensionMethod;
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static com.codeborne.selenide.Selenide.*;
|
import static com.codeborne.selenide.Selenide.*;
|
||||||
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
||||||
|
|
||||||
@ExtensionMethod({WaitUtils.class})
|
@ExtensionMethod({WaitUtils.class})
|
||||||
public class TopicDetails {
|
public class TopicDetails {
|
||||||
|
|
||||||
|
protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
|
||||||
protected SelenideElement dotMenuBtn = $$x("//button[@aria-label='Dropdown Toggle']").first();
|
protected SelenideElement dotMenuBtn = $$x("//button[@aria-label='Dropdown Toggle']").first();
|
||||||
|
protected SelenideElement overviewTab = $x("//a[contains(text(),'Overview')]");
|
||||||
|
protected SelenideElement messagesTab = $x("//a[contains(text(),'Messages')]");
|
||||||
|
protected SelenideElement editSettingsTab = $x("//li[@role][contains(text(),'Edit settings')]");
|
||||||
|
protected SelenideElement removeTopicBtn = $x("//ul[@role='menu']//div[contains(text(),'Remove Topic')]");
|
||||||
|
protected SelenideElement confirmBtn = $x("//div[@role='dialog']//button[contains(text(),'Confirm')]");
|
||||||
|
protected SelenideElement produceMessageBtn = $x("//div//button[text()='Produce Message']");
|
||||||
|
protected SelenideElement contentMessageTab = $x("//html//div[@id='root']/div/main//table//p");
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicDetails waitUntilScreenReady() {
|
public TopicDetails waitUntilScreenReady() {
|
||||||
$(By.linkText("Overview")).shouldBe(Condition.visible);
|
loadingSpinner.shouldBe(Condition.disappear);
|
||||||
|
Arrays.asList(overviewTab,messagesTab).forEach(element -> element.shouldBe(Condition.visible));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicCreateEditForm openEditSettings() {
|
public TopicDetails openEditSettings() {
|
||||||
clickByJavaScript(dotMenuBtn);
|
clickByJavaScript(dotMenuBtn);
|
||||||
$x("//li[@role][text()='Edit settings']").click();
|
editSettingsTab.shouldBe(Condition.visible).click();
|
||||||
return new TopicCreateEditForm();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
|
@ -35,19 +46,18 @@ public class TopicDetails {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicsList deleteTopic() {
|
public TopicDetails deleteTopic() {
|
||||||
clickByJavaScript(dotMenuBtn);
|
clickByJavaScript(dotMenuBtn);
|
||||||
$x("//ul[@role='menu']//div[text()='Remove Topic']").click();
|
removeTopicBtn.shouldBe(Condition.visible).click();
|
||||||
SelenideElement confirmButton = $x("//div[@role=\"dialog\"]//button[text()='Confirm']");
|
confirmBtn.shouldBe(Condition.enabled).click();
|
||||||
confirmButton.shouldBe(Condition.enabled).click();
|
confirmBtn.shouldBe(Condition.disappear);
|
||||||
confirmButton.shouldBe(Condition.disappear);
|
return this;
|
||||||
return new TopicsList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public ProduceMessagePanel clickOnButton(String buttonName) {
|
public TopicDetails clickProduceMessageBtn() {
|
||||||
clickByJavaScript($(By.xpath(String.format("//div//button[text()='%s']", buttonName))));
|
clickByJavaScript(produceMessageBtn);
|
||||||
return new ProduceMessagePanel();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
|
@ -57,7 +67,7 @@ public class TopicDetails {
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public boolean isContentMessageVisible(String contentMessage) {
|
public boolean isContentMessageVisible(String contentMessage) {
|
||||||
return contentMessage.matches($x("//html//div[@id='root']/div/main//table//p").getText().trim());
|
return contentMessage.matches(contentMessageTab.getText().trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum DotMenuHeaderItems {
|
private enum DotMenuHeaderItems {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.provectus.kafka.ui.pages.topic;
|
package com.provectus.kafka.ui.pages.topic;
|
||||||
|
|
||||||
import com.codeborne.selenide.Condition;
|
import com.codeborne.selenide.Condition;
|
||||||
|
import com.codeborne.selenide.SelenideElement;
|
||||||
import com.provectus.kafka.ui.utilities.WaitUtils;
|
import com.provectus.kafka.ui.utilities.WaitUtils;
|
||||||
import io.qameta.allure.Step;
|
import io.qameta.allure.Step;
|
||||||
import lombok.experimental.ExtensionMethod;
|
import lombok.experimental.ExtensionMethod;
|
||||||
|
@ -14,28 +15,34 @@ import static com.provectus.kafka.ui.utilities.WebUtils.isVisible;
|
||||||
@ExtensionMethod(WaitUtils.class)
|
@ExtensionMethod(WaitUtils.class)
|
||||||
public class TopicsList {
|
public class TopicsList {
|
||||||
|
|
||||||
|
protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
|
||||||
|
protected SelenideElement topicListHeader = $x("//h1[text()='Topics']");
|
||||||
|
protected SelenideElement addTopicBtn = $x("//button[normalize-space(text()) ='Add a Topic']");
|
||||||
|
protected SelenideElement topicGrid = $x("//table");
|
||||||
|
protected String topicElementLocator = "//tbody//td//a[text()='%s']";
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicsList waitUntilScreenReady() {
|
public TopicsList waitUntilScreenReady() {
|
||||||
$(By.xpath("//*[contains(text(),'Loading')]")).shouldBe(Condition.disappear);
|
loadingSpinner.shouldBe(Condition.disappear);
|
||||||
$(By.xpath("//h1[text()='Topics']")).shouldBe(Condition.visible);
|
topicListHeader.shouldBe(Condition.visible);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicCreateEditForm pressCreateNewTopic() {
|
public TopicsList clickAddTopicBtn() {
|
||||||
clickByJavaScript($x("//button[normalize-space(text()) ='Add a Topic']"));
|
clickByJavaScript(addTopicBtn);
|
||||||
return new TopicCreateEditForm();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public boolean isTopicVisible(String topicName) {
|
public boolean isTopicVisible(String topicName) {
|
||||||
$(By.xpath("//table")).shouldBe(Condition.visible);
|
topicGrid.shouldBe(Condition.visible);
|
||||||
return isVisible($x("//tbody//td//a[text()='" + topicName + "']"));
|
return isVisible($x(String.format(topicElementLocator,topicName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public TopicDetails openTopic(String topicName) {
|
public TopicsList openTopic(String topicName) {
|
||||||
$(By.linkText(topicName)).click();
|
$(By.linkText(topicName)).click();
|
||||||
return new TopicDetails();
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.provectus.kafka.ui.utilities;
|
||||||
import com.codeborne.selenide.Condition;
|
import com.codeborne.selenide.Condition;
|
||||||
import com.codeborne.selenide.SelenideElement;
|
import com.codeborne.selenide.SelenideElement;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.openqa.selenium.Keys;
|
||||||
|
|
||||||
import static com.codeborne.selenide.Selenide.executeJavaScript;
|
import static com.codeborne.selenide.Selenide.executeJavaScript;
|
||||||
|
|
||||||
|
@ -10,18 +11,26 @@ import static com.codeborne.selenide.Selenide.executeJavaScript;
|
||||||
public class WebUtils {
|
public class WebUtils {
|
||||||
|
|
||||||
public static void clickByJavaScript(SelenideElement element) {
|
public static void clickByJavaScript(SelenideElement element) {
|
||||||
|
log.debug("\nclickByJavaScript: {}", element.getSearchCriteria());
|
||||||
element.shouldBe(Condition.enabled);
|
element.shouldBe(Condition.enabled);
|
||||||
String script = "arguments[0].click();";
|
String script = "arguments[0].click();";
|
||||||
executeJavaScript(script, element);
|
executeJavaScript(script, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void clearByKeyboard(SelenideElement field) {
|
||||||
|
log.debug("\nclearByKeyboard: {}", field.getSearchCriteria());
|
||||||
|
field.shouldBe(Condition.enabled).sendKeys(Keys.END);
|
||||||
|
field.sendKeys(Keys.chord(Keys.CONTROL + "a"), Keys.DELETE);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isVisible(SelenideElement element) {
|
public static boolean isVisible(SelenideElement element) {
|
||||||
|
log.debug("\nisVisible: {}", element.getSearchCriteria());
|
||||||
boolean isVisible = false;
|
boolean isVisible = false;
|
||||||
try {
|
try {
|
||||||
element.shouldBe(Condition.visible);
|
element.shouldBe(Condition.visible);
|
||||||
isVisible = true;
|
isVisible = true;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
log.debug("Element {} is not visible", element.getSearchCriteria());
|
log.debug("{} is not visible", element.getSearchCriteria());
|
||||||
}
|
}
|
||||||
return isVisible;
|
return isVisible;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,11 @@ import io.qameta.allure.Step;
|
||||||
import io.qameta.allure.selenide.AllureSelenide;
|
import io.qameta.allure.selenide.AllureSelenide;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static com.codeborne.selenide.Selenide.*;
|
import static com.codeborne.selenide.Selenide.*;
|
||||||
import static com.provectus.kafka.ui.settings.Source.BASE_WEB_URL;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class Setup {
|
public abstract class Setup {
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class ConnectorsTests extends BaseTest {
|
||||||
.openSideMenu(KAFKA_CONNECT);
|
.openSideMenu(KAFKA_CONNECT);
|
||||||
kafkaConnectList
|
kafkaConnectList
|
||||||
.waitUntilScreenReady()
|
.waitUntilScreenReady()
|
||||||
.clickCreateConnectorButton();
|
.clickCreateConnectorBtn();
|
||||||
connectorCreateForm
|
connectorCreateForm
|
||||||
.waitUntilScreenReady()
|
.waitUntilScreenReady()
|
||||||
.setConnectorConfig(connectorForCreate.getName(), connectorForCreate.getConfig());
|
.setConnectorConfig(connectorForCreate.getName(), connectorForCreate.getConfig());
|
||||||
|
@ -114,8 +114,8 @@ public class ConnectorsTests extends BaseTest {
|
||||||
connectorDetails
|
connectorDetails
|
||||||
.waitUntilScreenReady()
|
.waitUntilScreenReady()
|
||||||
.openDotMenu()
|
.openDotMenu()
|
||||||
.clickDeleteButton()
|
.clickDeleteBtn()
|
||||||
.clickConfirmButton();
|
.clickConfirmBtn();
|
||||||
naviSideBar
|
naviSideBar
|
||||||
.openSideMenu(KAFKA_CONNECT);
|
.openSideMenu(KAFKA_CONNECT);
|
||||||
kafkaConnectList
|
kafkaConnectList
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class SchemasTests extends BaseTest {
|
||||||
.setSubjectName(schemaAvro.getName())
|
.setSubjectName(schemaAvro.getName())
|
||||||
.setSchemaField(fileToString(schemaAvro.getValuePath()))
|
.setSchemaField(fileToString(schemaAvro.getValuePath()))
|
||||||
.selectSchemaTypeFromDropdown(schemaAvro.getType())
|
.selectSchemaTypeFromDropdown(schemaAvro.getType())
|
||||||
.clickSubmit();
|
.clickSubmitBtn();
|
||||||
schemaDetails
|
schemaDetails
|
||||||
.waitUntilScreenReady();
|
.waitUntilScreenReady();
|
||||||
naviSideBar
|
naviSideBar
|
||||||
|
@ -84,7 +84,7 @@ public class SchemasTests extends BaseTest {
|
||||||
schemaCreateForm
|
schemaCreateForm
|
||||||
.selectCompatibilityLevelFromDropdown(CompatibilityLevel.CompatibilityEnum.NONE)
|
.selectCompatibilityLevelFromDropdown(CompatibilityLevel.CompatibilityEnum.NONE)
|
||||||
.setNewSchemaValue(fileToString(AVRO_API.getValuePath()))
|
.setNewSchemaValue(fileToString(AVRO_API.getValuePath()))
|
||||||
.clickSubmit();
|
.clickSubmitBtn();
|
||||||
schemaDetails
|
schemaDetails
|
||||||
.waitUntilScreenReady();
|
.waitUntilScreenReady();
|
||||||
Assertions.assertEquals(CompatibilityLevel.CompatibilityEnum.NONE.toString(), schemaDetails.getCompatibility(), "getCompatibility()");
|
Assertions.assertEquals(CompatibilityLevel.CompatibilityEnum.NONE.toString(), schemaDetails.getCompatibility(), "getCompatibility()");
|
||||||
|
@ -128,7 +128,7 @@ public class SchemasTests extends BaseTest {
|
||||||
.setSubjectName(schemaJson.getName())
|
.setSubjectName(schemaJson.getName())
|
||||||
.setSchemaField(fileToString(schemaJson.getValuePath()))
|
.setSchemaField(fileToString(schemaJson.getValuePath()))
|
||||||
.selectSchemaTypeFromDropdown(schemaJson.getType())
|
.selectSchemaTypeFromDropdown(schemaJson.getType())
|
||||||
.clickSubmit();
|
.clickSubmitBtn();
|
||||||
schemaDetails
|
schemaDetails
|
||||||
.waitUntilScreenReady();
|
.waitUntilScreenReady();
|
||||||
naviSideBar
|
naviSideBar
|
||||||
|
@ -177,7 +177,7 @@ public class SchemasTests extends BaseTest {
|
||||||
.setSubjectName(schemaProtobuf.getName())
|
.setSubjectName(schemaProtobuf.getName())
|
||||||
.setSchemaField(fileToString(schemaProtobuf.getValuePath()))
|
.setSchemaField(fileToString(schemaProtobuf.getValuePath()))
|
||||||
.selectSchemaTypeFromDropdown(schemaProtobuf.getType())
|
.selectSchemaTypeFromDropdown(schemaProtobuf.getType())
|
||||||
.clickSubmit();
|
.clickSubmitBtn();
|
||||||
schemaDetails
|
schemaDetails
|
||||||
.waitUntilScreenReady();
|
.waitUntilScreenReady();
|
||||||
naviSideBar
|
naviSideBar
|
||||||
|
|
|
@ -49,10 +49,11 @@ public class TopicTests extends BaseTest {
|
||||||
.openSideMenu(TOPICS);
|
.openSideMenu(TOPICS);
|
||||||
topicsList
|
topicsList
|
||||||
.waitUntilScreenReady()
|
.waitUntilScreenReady()
|
||||||
.pressCreateNewTopic();
|
.clickAddTopicBtn();
|
||||||
topicCreateEditForm
|
topicCreateEditForm
|
||||||
|
.waitUntilScreenReady()
|
||||||
.setTopicName(topicToCreate.getName())
|
.setTopicName(topicToCreate.getName())
|
||||||
.sendData();
|
.clickCreateTopicBtn();
|
||||||
topicDetails
|
topicDetails
|
||||||
.waitUntilScreenReady();
|
.waitUntilScreenReady();
|
||||||
naviSideBar
|
naviSideBar
|
||||||
|
@ -79,12 +80,13 @@ public class TopicTests extends BaseTest {
|
||||||
.waitUntilScreenReady()
|
.waitUntilScreenReady()
|
||||||
.openEditSettings();
|
.openEditSettings();
|
||||||
topicCreateEditForm
|
topicCreateEditForm
|
||||||
|
.waitUntilScreenReady()
|
||||||
.selectCleanupPolicy(TOPIC_FOR_UPDATE.getCompactPolicyValue())
|
.selectCleanupPolicy(TOPIC_FOR_UPDATE.getCompactPolicyValue())
|
||||||
.setMinInsyncReplicas(10)
|
.setMinInsyncReplicas(10)
|
||||||
.setTimeToRetainDataInMs(TOPIC_FOR_UPDATE.getTimeToRetainData())
|
.setTimeToRetainDataInMs(TOPIC_FOR_UPDATE.getTimeToRetainData())
|
||||||
.setMaxSizeOnDiskInGB(TOPIC_FOR_UPDATE.getMaxSizeOnDisk())
|
.setMaxSizeOnDiskInGB(TOPIC_FOR_UPDATE.getMaxSizeOnDisk())
|
||||||
.setMaxMessageBytes(TOPIC_FOR_UPDATE.getMaxMessageBytes())
|
.setMaxMessageBytes(TOPIC_FOR_UPDATE.getMaxMessageBytes())
|
||||||
.sendData();
|
.clickCreateTopicBtn();
|
||||||
topicDetails
|
topicDetails
|
||||||
.waitUntilScreenReady();
|
.waitUntilScreenReady();
|
||||||
naviSideBar
|
naviSideBar
|
||||||
|
@ -139,8 +141,9 @@ public class TopicTests extends BaseTest {
|
||||||
topicDetails
|
topicDetails
|
||||||
.waitUntilScreenReady()
|
.waitUntilScreenReady()
|
||||||
.openTopicMenu(TopicDetails.TopicMenu.MESSAGES)
|
.openTopicMenu(TopicDetails.TopicMenu.MESSAGES)
|
||||||
.clickOnButton("Produce Message");
|
.clickProduceMessageBtn();
|
||||||
produceMessagePanel
|
produceMessagePanel
|
||||||
|
.waitUntilScreenReady()
|
||||||
.setContentFiled(TOPIC_FOR_UPDATE.getMessageContent())
|
.setContentFiled(TOPIC_FOR_UPDATE.getMessageContent())
|
||||||
.setKeyField(TOPIC_FOR_UPDATE.getMessageKey())
|
.setKeyField(TOPIC_FOR_UPDATE.getMessageKey())
|
||||||
.submitProduceMessage();
|
.submitProduceMessage();
|
||||||
|
|
Loading…
Add table
Reference in a new issue