Skip to content

Commit

Permalink
HAL-1912 Fix/migrate tests-hal-deployment tests of testsuite.next
Browse files Browse the repository at this point in the history
  • Loading branch information
OndrejKotek committed Nov 21, 2023
1 parent 6e41717 commit 10b4e38
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 1 addition & 0 deletions common/src/main/java/org/jboss/hal/testsuite/Console.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public void navigate(PlaceRequest request, By selector, URL baseUrl) {
try {
URL url = new URL(baseUrl, hashFragment);
browser.navigate().to(url);
browser.navigate().refresh();
waitModel().until().element(selector).is().present();
browser.manage().window().maximize();
} catch (MalformedURLException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
public class UploadFormFragment {

@Root private WebElement root;
@FindBy(css = "label[for='" + Ids.UPLOAD_FILE_INPUT + "']") private WebElement uploadFileLabel;
@FindBy(css = "ul[class='upload-file-list']") private WebElement uploadedFiles;
@FindBy(id = Ids.UPLOAD_FILE_INPUT) private WebElement fileInput;

public void uploadFile(File fileToUpload) {
fileInput.sendKeys(fileToUpload.getAbsolutePath());
Graphene.waitGui().until().element(uploadFileLabel).text().equalTo(fileToUpload.getName());
Graphene.waitGui().until().element(uploadedFiles).text().equalTo(fileToUpload.getName());
}

public static UploadFormFragment getUploadForm(WebElement serchContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,38 @@ public DeploymentContentPage navigateToDeploymentContent(String deploymentName)
}

public boolean isNodeVisible(String... path) {
return getNodeElementList(path).size() > 0;
return !getNodeElementList(path).isEmpty();
}

public DeploymentContentPage selectNode(String... path) {
WebElement node = getNode(path);
String ariaSelected = "aria-selected";
String selectedAttrValue = node.getAttribute(ariaSelected);
String selectedAttrValue = node.findElement(By.tagName("a")).getAttribute(ariaSelected);
if (selectedAttrValue == null) {
throw new IllegalStateException(ariaSelected + " attribute does not exist.");
}
boolean selected = Boolean.valueOf(selectedAttrValue);
if (!selected) {
node.click();
Graphene.waitGui().until().element(node).attribute(ariaSelected).contains("true");
Graphene.waitGui().until().element(node.findElement(By.tagName("a"))).attribute(ariaSelected).contains("true");
}
return this;
}

public DeploymentContentPage openNode(String... path) {
WebElement node = getNode(path);
String ariaExpanded = "aria-expanded";
String expandedAttrValue = node.getAttribute(ariaExpanded);
if (expandedAttrValue == null) {
throw new IllegalStateException(ariaExpanded + " attribute does not exist.");
}
boolean expanded = Boolean.valueOf(expandedAttrValue);
String expandedAttrValue = node.getAttribute("class");
boolean expanded = expandedAttrValue.contains("jstree-open");
if (!expanded) {
node.findElement(By.cssSelector("i.jstree-icon")).click();
Graphene.waitGui().until().element(node).attribute(ariaExpanded).contains("true");
Graphene.waitGui().until().element(node).attribute("class").contains("jstree-open");
}
return this;
}

public boolean isButtonAvailable(String title) {
List<WebElement> buttonList = getButtonList(title);
if (buttonList.size() > 0) {
if (!buttonList.isEmpty()) {
WebElement button = buttonList.get(0);
if (button.isDisplayed() && !button.getAttribute("class").contains(CSS.disabled)) {
return true;
Expand Down Expand Up @@ -98,7 +94,7 @@ private List<WebElement> getNodeElementList(String... path) {

private WebElement getNode(String... path) {
List<WebElement> nodes = getNodeElementList(path);
if (nodes.size() == 0) {
if (nodes.isEmpty()) {
throw new IllegalStateException("Node specified by path '" + join(";", path) + "' is not visible.");
} else if (nodes.size() > 1) {
throw new IllegalStateException("Node specified by path '" + join(";", path) + "' is ambiguous.");
Expand Down

0 comments on commit 10b4e38

Please sign in to comment.