Skip to content
Draft
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
11 changes: 6 additions & 5 deletions artemis-console/src/main/webapp/hawtconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"branding": {
"appName": "Artemis Console",
"showAppName": false,
"appLogoUrl": "img/artemis.png",
"companyLogoUrl": "img/artemis.png",
"css": "css/artemis.css",
"favicon": "img/favicon.png"
"appLogoUrl": "img/artemis-logo.svg",
"appLogoDarkModeUrl": "img/artemis-logo.svg",
"favicon": "img/favicon.png",
"css": "css/artemis.css"
},
"login": {
"description": "Login page for Apache Artemis Console.",
Expand All @@ -19,7 +19,8 @@
"productInfo": [{"name": "Apache Artemis", "value": "${project.version}"}],
"additionalInfo": "",
"copyright": " ",
"imgSrc": "img/artemis.png"
"imgSrc": "img/artemis-logo.svg",
"imgDarkModeSrc": "img/artemis-logo.svg"
},
"disabledRoutes": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.junit.jupiter.api.extension.ExtendWith;

import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.DEFAULT_CONSOLE_LOGIN_BRAND_IMAGE;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.DEFAULT_CONSOLE_LOGIN_BRAND_OVERRIDE_IMAGE;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.WEB_URL_PATH;
//Parameters set in super class
@ExtendWith(ParameterizedTestExtension.class)
Expand All @@ -51,10 +52,17 @@ public void testLogin() {
public void testLoginBrand() {
String expectedBrandImage = webServerUrl + WEB_URL_PATH + System.getProperty(
"artemis.console.login.brand.image", DEFAULT_CONSOLE_LOGIN_BRAND_IMAGE);
String expectedBrandingOverrideImage = webServerUrl + WEB_URL_PATH + System.getProperty(
"artemis.console.login.brand.override.image", DEFAULT_CONSOLE_LOGIN_BRAND_OVERRIDE_IMAGE);

driver.get(webServerUrl + WEB_URL_PATH);
LoginPage loginPage = new LoginPage(driver);
assertEquals(expectedBrandImage, loginPage.getBrandImage(DEFAULT_TIMEOUT));

String cssBackground = loginPage.getBrandImageContainer(DEFAULT_TIMEOUT).getCssValue("background-image");
assertTrue(cssBackground.startsWith("url(\""));
assertTrue(cssBackground.endsWith("\")"));
assertEquals(expectedBrandingOverrideImage, cssBackground.substring(5, cssBackground.length() - 2));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ public class PageConstants {
public static final By BUTTON_LOCATOR = By.tagName(BUTTON);

//Branding and Image locations
public static final String DEFAULT_CONSOLE_LOGIN_BRAND_IMAGE = "/img/artemis.png";
//this one comes from artemis-console/src/main/webapp/hawtconfig.json
public static final String DEFAULT_CONSOLE_LOGIN_BRAND_IMAGE = "/img/artemis-logo.svg";
//this one hides the above and uses a version from branding's artemis.css, so it looks better
//in dark mode (where the dark background doesn't change)
public static final String DEFAULT_CONSOLE_LOGIN_BRAND_OVERRIDE_IMAGE = "/img/artemis-logo-white.svg";

public static final String DEFAULT_CONSOLE_NAME = "Artemis";

public static final By BRAND_LOCATOR = By.xpath("//img[@class='pf-v5-c-brand']");
public static final By BRAND_LOCATOR = By.xpath("//img[@class='pf-v6-c-brand']");

//Component Locators
public static final By USERNAME_LOCATOR = By.id("pf-login-username-id");
Expand All @@ -83,10 +87,10 @@ public class PageConstants {

public static final By LOGIN_BUTTON_LOCATOR = By.xpath("//button[@type='submit']");

public static final By LOGIN_ERROR_LOCATOR = By.cssSelector(".pf-v5-c-helper-text__item.pf-m-error");
public static final By LOGIN_ERROR_LOCATOR = By.cssSelector(".pf-v6-c-helper-text__item.pf-m-error");


public static final By MESSAGE_TEXT_EDITOR_LOCATOR = By.cssSelector("div[class='pf-v5-c-code-editor__code']");
public static final By MESSAGE_TEXT_EDITOR_LOCATOR = By.cssSelector("textarea[id='message-body']");

public static final By USE_LOGIN_LOCATOR = By.id("uselogon");

Expand All @@ -96,44 +100,44 @@ public class PageConstants {

public static final By DATA_TABLE = By.id("data-table");

public static final By DATA_ROW_CONTEXT_MENU = By.cssSelector("div[class='pf-v5-c-menu']");
public static final By DATA_ROW_CONTEXT_MENU = By.cssSelector("div[class='pf-v6-c-menu']");

public static final By MESSAGE_TABLE = By.id("message-table");

public static final By TABLE_ROW_LOCATOR = By.cssSelector("tr[data-ouia-component-type='PF5/TableRow']");
public static final By TABLE_ROW_LOCATOR = By.cssSelector("tr[data-ouia-component-type='PF6/TableRow']");

public static final By VIEW_MESSAGE_TITLE_LOCATOR = By.xpath("//h2[contains(text(),'Viewing Message')]");


public static final By QUEUES_TAB = By.xpath("//button/span[contains(text(),'Queues')]");

public static final By QUEUES_TAB_SELECTED = By.cssSelector("button[aria-label='queues'][aria-selected='true']");
public static final By QUEUES_TAB_SELECTED = By.cssSelector("button[class*=pf-m-current]");

public static final By ADDRESSES_TAB = By.xpath("//button[@role='tab']/span[contains(text(),'Addresses')]");
public static final By ADDRESSES_TAB = By.xpath("//button[contains(@class, 'pf-v6-c-nav__link')]/span[contains(text(),'Addresses')]");

public static final By SEND_MESSAGE_BUTTON = By.xpath("//span[contains(text(),'Send Message')]");

public static final By MANAGE_COLUMNS_BUTTON = By.xpath("//button[contains(text(),'Manage Columns')]");
public static final By MANAGE_COLUMNS_BUTTON = By.xpath("//button[contains(span/text(),'Manage Columns')]");

public static final By SAVE_BUTTON = By.xpath("//button[contains(text(),'Save')]");
public static final By SAVE_BUTTON = By.xpath("//button[contains(span/text(),'Save')]");

public static final By SEND_MESSAGE_TITLE = By.xpath("//h2[contains(text(),'Send Message')]");
public static final By SEND_MESSAGE_TITLE = By.xpath("//h1[contains(text(),'Send Message')]");

public static final By NO_NODE_TITLE = By.xpath("//h1[contains(text(),'Send Message')]");

public static final By MESSAGE_VIEW_QUEUES_BUTTON = By.id("message-view-queues-button");
public static final By MESSAGE_VIEW_QUEUES_BUTTON = By.xpath("//button[contains(@class, 'pf-m-link')][contains(span/text(), 'Back to Queue list')]");

public static final By MESSAGE_TABLE_QUEUES_BUTTON = By.id("message-table-queues-button");

public static final By MESSAGE_VIEW_BODY = By.id("body");
public static final By MESSAGE_VIEW_BODY = By.id("code-content");

public static final By EXPAND_BUTTON = By.xpath("//button[contains(text(), 'Expand')]");
public static final By EXPAND_BUTTON = By.xpath("//button[contains(span/text(), 'Expand all')]");

public static final By COLLAPSE_BUTTON = By.xpath("//button[contains(text(), 'Collapse')]");
public static final By COLLAPSE_BUTTON = By.xpath("//button[contains(span/text(), 'Collapse all')]");

public static final By NODE_TITLE_LOCATOR = By.cssSelector("h1.pf-m-lg[data-ouia-component-type='PF5/Title']");
public static final By NODE_TITLE_LOCATOR = By.cssSelector("h1.pf-v6-c-empty-state__title-text");

public static final By BROKER_BUTTON_LOCATOR = By.xpath("//button[contains(text(), 'Broker 0.0.0.0')]");

public static final By ALERT_LOCATOR = By.xpath("//ul/li/div[contains(@class, 'pf-v5-c-alert')]");
public static final By ALERT_LOCATOR = By.xpath("//ul/li/div[contains(@class, 'pf-v6-c-alert')]");
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public ArtemisJMXTest(String browser, String serverName) {


public void loadLandingPage() {
driver.get(webServerUrl + "/console/treeartemisjmx");
driver.get(webServerUrl + "/console/artemis-jmx");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public void testExpandTree() {
loadLandingPage();
ArtemisTreePage treePage = new ArtemisTreePage(driver);
treePage.expandTree(DEFAULT_TIMEOUT);
// to unselect current MBean
treePage.collapseTree(DEFAULT_TIMEOUT);

assertEquals("Select " + expectedConsoleName + " Node", treePage.getNodeTitle());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.LOGOUT_DROPDOWN_LOCATOR;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.LOGOUT_MENU_ITEM_LOCATOR;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.MANAGE_COLUMNS_BUTTON;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.MESSAGE_TABLE_QUEUES_BUTTON;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.MESSAGE_VIEW_QUEUES_BUTTON;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.QUEUES_TAB;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.QUEUES_TAB_SELECTED;
Expand Down Expand Up @@ -100,7 +99,7 @@ public SendMessagePage getQueueSendMessagePage(String queue, int timeout) {
refresh(timeout);
WebElement element = driver.findElement(QUEUES_TAB);
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"));
List<WebElement> tdElements = driver.findElement(DATA_TABLE).findElement(By.xpath("//tr/td/button/span[contains(text(), '" + queue + "')]")).findElement(By.xpath("./../../..")).findElements(By.tagName("td"));

tdElements.get(tdElements.size() - 1).findElement(BUTTON_LOCATOR).click();

Expand Down Expand Up @@ -146,7 +145,7 @@ public QueuesPage getQueuesPageFromMessageView(int timeout) {
}

public QueuesPage getQueuesPageFromMessagesView(int timeout) {
WebElement queuesMenuItem = driver.findElement(MESSAGE_TABLE_QUEUES_BUTTON);
WebElement queuesMenuItem = driver.findElement(MESSAGE_VIEW_QUEUES_BUTTON);

queuesMenuItem.click();

Expand Down Expand Up @@ -182,6 +181,7 @@ public Object postJolokiaExecRequest(String mbean, String operation, String argu
"var callback = arguments[arguments.length - 1];" +
"var xhr = new XMLHttpRequest();" +
"xhr.open('POST', '/console/jolokia', true);" +
"xhr.setRequestHeader('Content-Type', 'application/json');" +
"xhr.onreadystatechange = function() {" +
" if (xhr.readyState == 4) {" +
" callback(xhr.responseText);" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ public void waitForElementToBeVisible(final By elementLocator, int timeout) {
loadWebDriverWait.until(ExpectedConditions.visibilityOfElementLocated(elementLocator));
}

public void waitForElementToBeUnique(final By elementLocator, int timeout) {
WebDriverWait loadWebDriverWait = new WebDriverWait(
driver, Duration.ofMillis(timeout));

loadWebDriverWait.until(ExpectedConditions.numberOfElementsToBe(elementLocator, 1));
}

public void waitForElementToBeClickable(final By elementLocator, int timeout) {
WebDriverWait loadWebDriverWait = new WebDriverWait(
driver, Duration.ofMillis(timeout));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ public LoginPage(WebDriver driver) {
}

public String getBrandImage(int timeout) {
waitForElementToBeVisible(BRAND_LOCATOR, timeout);
waitForElementToBeUnique(BRAND_LOCATOR, timeout);

return driver.findElement(BRAND_LOCATOR).getAttribute("src");
}

public WebElement getBrandImageContainer(int timeout) {
return driver.findElement(BRAND_LOCATOR).findElement(By.xpath("./.."));
}

public StatusPage loginValidUser(String username, String password, int timeout) {
submitCredentials(username, password, timeout);
waitForElementToBeVisible(LOGOUT_DROPDOWN_LOCATOR, timeout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.A_TAG_LOCATOR;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.BUTTON_LOCATOR;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.COLUMN_MESSAGE_ID;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.COLUMN_ORIGINAL_QUEUE;
import static org.apache.activemq.artemis.tests.smoke.console.PageConstants.MESSAGE_TABLE;
Expand All @@ -37,7 +37,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);
WebElement element = driver.findElement(TABLE_TAG_LOCATOR).findElements(TD_TAG_LOCATOR).get(col).findElement(BUTTON_LOCATOR);
element.click();
waitForElementToBeVisible(VIEW_MESSAGE_TITLE_LOCATOR, timeout);

Expand All @@ -48,7 +48,7 @@ public long getMessageId(int index) {
WebElement messageRowWebElement = driver.findElement(MESSAGE_TABLE).findElements(TR_TAG_LOCATOR).get(index + 1);

String messageIdText = messageRowWebElement.findElements(TD_TAG_LOCATOR).get(
getIndexOfColumn(COLUMN_MESSAGE_ID)).findElement(By.tagName("a")).getText();
getIndexOfColumn(COLUMN_MESSAGE_ID)).findElement(By.tagName("button")).getText();

return Long.parseLong(messageIdText);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
public class QueuesPage extends ArtemisPage {
private static final String MESSAGE_COUNT_COLUMN_NAME = "Message Count";
private static final By SEARCH_BUTTON_LOCATOR = By.xpath("//button[contains(text(),'Search')]");
private static final By REFRESH_BUTTON_LOCATOR = By.xpath("//button[@aria-label='Refresh']");
private static final By QUEUES_PAGE_TITLE = By.xpath("//h2[contains(text(),'Browsing')]");

public QueuesPage(WebDriver driver) {
Expand All @@ -33,7 +34,7 @@ public QueuePage getQueuePage(String name, int timeout) {
WebElement queueRowWebElement = driver.findElement(getQueueLocator(name));

WebElement messagesCountWebElement = queueRowWebElement.findElements(By.tagName("td"))
.get(getIndexOfColumn(MESSAGE_COUNT_COLUMN_NAME)).findElement(By.tagName("a"));
.get(getIndexOfColumn(MESSAGE_COUNT_COLUMN_NAME)).findElement(By.tagName("button"));

messagesCountWebElement.click();
waitForElementToBeVisible(QUEUES_PAGE_TITLE, timeout);
Expand All @@ -49,18 +50,18 @@ public int getMessagesCount(String name) {
WebElement queueRowWebElement = driver.findElement(getQueueLocator(name));

String messageCountText = queueRowWebElement.findElements(By.tagName("td"))
.get(getIndexOfColumn(MESSAGE_COUNT_COLUMN_NAME)).findElement(By.tagName("a")).getText();
.get(getIndexOfColumn(MESSAGE_COUNT_COLUMN_NAME)).findElement(By.tagName("button")).getText();

return Integer.parseInt(messageCountText);
}

private By getQueueLocator(String name) {
return By.xpath("//tr[td/a='" + name + "']");
return By.xpath("//tr[td/button/span='" + name + "']");
}


public boolean searchQueues(String queueNameInResults) {
WebElement element = driver.findElement(SEARCH_BUTTON_LOCATOR);
WebElement element = driver.findElement(REFRESH_BUTTON_LOCATOR);
element.click();
return countQueue(queueNameInResults) == 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public SendMessagePage(WebDriver driver) {
}

public void clearMessageText() {
//the "1" here is what HawtIO shows when clear as the 1st line number
while (!"1".equals(getMessageText())) {
// it's no longer monaco-editor, so it should be easier
while (!"".equals(getMessageText())) {
Actions actions = new Actions(driver);
actions.click(driver.findElement(MESSAGE_TEXT_EDITOR_LOCATOR));
actions.sendKeys(Keys.BACK_SPACE);
Expand Down Expand Up @@ -73,9 +73,9 @@ public String getMessageText() {
}

public void sendMessage() {
WebElement element = driver.findElement(By.xpath("//button[contains(text(),'Send')]"));
WebElement element = driver.findElement(By.xpath("//button[contains(span/text(),'Send')]"));
element.click();
element = driver.findElement(By.xpath("//button[contains(text(),'Cancel')]"));
element = driver.findElement(By.xpath("//button[contains(span/text(),'Close')]"));
element.click();
}
}
Loading