Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAL-1912 Fix/migrate tests-hal-deployment tests of testsuite.next #196

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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