Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.ADDRESSES_TAB;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.ALERT_LOCATOR;
Expand Down Expand Up @@ -57,17 +56,14 @@ public String getUser() {
WebElement userDropdownMenuWebElement = driver.findElement(USER_DROPDOWN_MENU_LOCATOR);

if (!logoutWebElement.isDisplayed()) {
Actions actions = new Actions(driver);
actions.moveToElement(userDropdownMenuWebElement).click().perform();
userDropdownMenuWebElement.click();
}

String logoutText = logoutWebElement.getText();
Pattern pattern = Pattern.compile("Logout \\(([^\\)]+)\\)");
Matcher matcher = pattern.matcher(logoutText);

Actions actions = new Actions(driver);

actions.moveToElement(userDropdownMenuWebElement).click().perform();
userDropdownMenuWebElement.click();

if (matcher.find()) {
return matcher.group(1);
Expand All @@ -79,18 +75,15 @@ public String getUser() {
public AddressesPage getAddressesPage(int timeout) {
WebElement queuesMenuItem = driver.findElement(ADDRESSES_TAB);

Actions actions = new Actions(driver);

actions.moveToElement(queuesMenuItem).click().perform();
queuesMenuItem.click();

return new AddressesPage(driver);
}

public SendMessagePage getAddressSendMessagePage(String address, int timeout) {
refresh(timeout);
WebElement element = driver.findElement(ADDRESSES_TAB);
Actions actions = new Actions(driver);
actions.moveToElement(element).click().perform();
element.click();
List<WebElement> tdElements = driver.findElement(DATA_TABLE).findElement(By.xpath("//tr/td[contains(text(), '" + address + "')]")).findElement(By.xpath("./..")).findElements(TD_TAG_LOCATOR);

tdElements.get(tdElements.size() - 1).findElement(BUTTON_LOCATOR).click();
Expand All @@ -106,8 +99,7 @@ public SendMessagePage getAddressSendMessagePage(String address, int timeout) {
public SendMessagePage getQueueSendMessagePage(String queue, int timeout) {
refresh(timeout);
WebElement element = driver.findElement(QUEUES_TAB);
Actions actions = new Actions(driver);
actions.moveToElement(element).click().perform();
element.click();
List<WebElement> tdElements = driver.findElement(DATA_TABLE).findElement(By.xpath("//tr/td/a[contains(text(), '" + queue + "')]")).findElement(By.xpath("./../..")).findElements(By.tagName("td"));

tdElements.get(tdElements.size() - 1).findElement(BUTTON_LOCATOR).click();
Expand All @@ -122,9 +114,7 @@ public SendMessagePage getQueueSendMessagePage(String queue, int timeout) {
public QueuesPage getQueuesPage(int timeout) {
WebElement queuesMenuItem = driver.findElement(QUEUES_TAB);

Actions actions = new Actions(driver);

actions.moveToElement(queuesMenuItem).click().perform();
queuesMenuItem.click();

waitForElementToBeVisible(QUEUES_TAB_SELECTED, timeout);

Expand All @@ -148,9 +138,7 @@ public int getIndexOfColumn(String name) {
public QueuesPage getQueuesPageFromMessageView(int timeout) {
WebElement queuesMenuItem = driver.findElement(MESSAGE_VIEW_QUEUES_BUTTON);

Actions actions = new Actions(driver);

actions.moveToElement(queuesMenuItem).click().perform();
queuesMenuItem.click();

waitForElementToBeVisible(QUEUES_TAB_SELECTED, timeout);

Expand All @@ -160,9 +148,7 @@ public QueuesPage getQueuesPageFromMessageView(int timeout) {
public QueuesPage getQueuesPageFromMessagesView(int timeout) {
WebElement queuesMenuItem = driver.findElement(MESSAGE_TABLE_QUEUES_BUTTON);

Actions actions = new Actions(driver);

actions.moveToElement(queuesMenuItem).click().perform();
queuesMenuItem.click();

waitForElementToBeVisible(QUEUES_TAB_SELECTED, timeout);

Expand All @@ -171,30 +157,24 @@ public QueuesPage getQueuesPageFromMessagesView(int timeout) {

public LoginPage logout(int timeout) {
WebElement logoutWebElement = driver.findElement(LOGOUT_DROPDOWN_LOCATOR);
Actions actions = new Actions(driver);

actions.moveToElement(logoutWebElement).click().perform();
logoutWebElement.click();
WebElement userDropdownMenuWebElement = logoutWebElement.findElement(LOGOUT_MENU_ITEM_LOCATOR);

actions = new Actions(driver);

actions.moveToElement(userDropdownMenuWebElement).click().perform();
userDropdownMenuWebElement.click();

return new LoginPage(driver);
}

public void enableColumn(String columnId) {
WebElement element = driver.findElement(MANAGE_COLUMNS_BUTTON);
Actions actions = new Actions(driver);
actions.moveToElement(element).click().perform();
element.click();

element = driver.findElement(By.id("check-" + columnId));
actions = new Actions(driver);

actions.moveToElement(element).click().perform();
element.click();
element = driver.findElement(SAVE_BUTTON);
actions = new Actions(driver);
actions.moveToElement(element).click().perform();
element.click();
}

public Object postJolokiaExecRequest(String mbean, String operation, String arguments) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.BRAND_LOCATOR;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.LOGIN_BUTTON_LOCATOR;
Expand All @@ -46,8 +45,7 @@ public StatusPage loginValidUser(String username, String password, int timeout)
driver.findElement(USERNAME_LOCATOR).sendKeys(username);
driver.findElement(PASSWORD_LOCATOR).sendKeys(password);
WebElement element = driver.findElement(LOGIN_BUTTON_LOCATOR);
Actions actions = new Actions(driver);
actions.moveToElement(element).click().perform();
element.click();
waitForElementToBeVisible(LOGOUT_DROPDOWN_LOCATOR, timeout);
waitForElementToBeVisible(By.xpath("//button/span[contains(text(),'Status')]"), timeout);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.A_TAG_LOCATOR;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.COLUMN_MESSAGE_ID;
Expand All @@ -39,8 +38,7 @@ public QueuePage(WebDriver driver) {
public MessagePage getMessagePage(int index, int timeout) {
int col = getIndexOfColumn(COLUMN_MESSAGE_ID);
WebElement element = driver.findElement(TABLE_TAG_LOCATOR).findElements(TD_TAG_LOCATOR).get(col).findElement(A_TAG_LOCATOR);
Actions actions = new Actions(driver);
actions.moveToElement(element).click().perform();
element.click();
waitForElementToBeVisible(VIEW_MESSAGE_TITLE_LOCATOR, timeout);

return new MessagePage(driver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

public class QueuesPage extends ArtemisPage {
private static final String MESSAGE_COUNT_COLUMN_NAME = "Message Count";
Expand All @@ -36,8 +35,7 @@ public QueuePage getQueuePage(String name, int timeout) {
WebElement messagesCountWebElement = queueRowWebElement.findElements(By.tagName("td"))
.get(getIndexOfColumn(MESSAGE_COUNT_COLUMN_NAME)).findElement(By.tagName("a"));

Actions actions = new Actions(driver);
actions.moveToElement(messagesCountWebElement).click().perform();
messagesCountWebElement.click();
waitForElementToBeVisible(QUEUES_PAGE_TITLE, timeout);

return new QueuePage(driver);
Expand All @@ -63,7 +61,7 @@ private By getQueueLocator(String name) {

public boolean searchQueues(String queueNameInResults) {
WebElement element = driver.findElement(SEARCH_BUTTON_LOCATOR);
Actions actions = new Actions(driver);
actions.moveToElement(element).click().perform(); return countQueue(queueNameInResults) == 1;
element.click();
return countQueue(queueNameInResults) == 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,14 @@ public boolean isUseCurrentLogonUserSelected() {
public void selectUseCurrentLogonUser() {
if (!isUseCurrentLogonUserSelected()) {
WebElement element = driver.findElement(USE_LOGIN_LOCATOR);
Actions actions = new Actions(driver);
actions.moveToElement(element).click().perform();
element.click();
}
}

public void unselectUseCurrentLogonUser() {
if (isUseCurrentLogonUserSelected()) {
WebElement element = driver.findElement(USE_LOGIN_LOCATOR);
Actions actions = new Actions(driver);
actions.moveToElement(element).click().perform();
element.click();
}
}

Expand All @@ -76,10 +74,8 @@ public String getMessageText() {

public void sendMessage() {
WebElement element = driver.findElement(By.xpath("//button[contains(text(),'Send')]"));
Actions actions = new Actions(driver);
actions.moveToElement(element).click().perform();
element.click();
element = driver.findElement(By.xpath("//button[contains(text(),'Cancel')]"));
actions = new Actions(driver);
actions.moveToElement(element).click().perform();
element.click();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.apache.activemq.artemis.tests.smoke.console.pages.ConsolePage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.BROKER_NODE_LOCATOR;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.BROKER_BUTTON_LOCATOR;
Expand All @@ -37,17 +36,15 @@ public ArtemisTreePage(WebDriver driver) {
public void expandTree(int timeout) {
waitForElementToBeVisible(EXPAND_BUTTON, timeout);
WebElement element = driver.findElement(EXPAND_BUTTON);
Actions actions = new Actions(driver);
actions.moveToElement(element).click().perform();
element.click();
waitForElementToBeVisible(COLLAPSE_BUTTON, timeout);
}


public void collapseTree(int timeout) {
waitForElementToBeVisible(COLLAPSE_BUTTON, timeout);
WebElement element = driver.findElement(COLLAPSE_BUTTON);
Actions actions = new Actions(driver);
actions.moveToElement(element).click().perform();
element.click();
waitForElementToBeVisible(EXPAND_BUTTON, timeout);
}

Expand All @@ -57,8 +54,7 @@ public String getNodeTitle() {

public AttributesPage selectBrokerNode() {
WebElement element = driver.findElement(BROKER_NODE_LOCATOR).findElement(BROKER_BUTTON_LOCATOR);
Actions actions = new Actions(driver);
actions.moveToElement(element).click().perform();
element.click();
return new AttributesPage(driver);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

import java.util.Iterator;
import java.util.List;
Expand All @@ -42,8 +41,7 @@ public void selectAttribute(String name) {
List<WebElement> cols = row.findElements(TD_TAG_LOCATOR);
if (cols.size() == 2 && name.equals(cols.get(0).getText())) {
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView();", cols.get(0));
Actions actions = new Actions(driver);
actions.moveToElement(cols.get(0)).click().perform();
cols.get(0).click();
break;
}
}
Expand Down