ARTEMIS-3600 Add console index page test
This commit is contained in:
parent
72a4fff167
commit
8f41cf647f
|
@ -48,7 +48,6 @@ public abstract class ConsoleTest extends SmokeTestBase {
|
|||
protected static final int DEFAULT_TIMEOUT = 10000;
|
||||
protected static final String DEFAULT_SERVER_URL = "http://localhost:8161";
|
||||
protected static final String DEFAULT_CONTAINER_SERVER_URL = "http://host.testcontainers.internal:8161";
|
||||
protected static final String DEFAULT_CONSOLE_BRAND_IMAGE = "/activemq-branding/plugin/img/activemq.png";
|
||||
|
||||
protected WebDriver driver;
|
||||
protected MutableCapabilities browserOptions;
|
||||
|
@ -88,12 +87,22 @@ public abstract class ConsoleTest extends SmokeTestBase {
|
|||
// [4] https://github.com/mozilla/geckodriver/
|
||||
|
||||
try {
|
||||
if (ChromeOptions.class.equals(browserOptions.getClass()) &&
|
||||
if (browserOptions instanceof ChromeOptions &&
|
||||
System.getProperty("webdriver.chrome.driver") != null) {
|
||||
driver = new ChromeDriver((ChromeOptions)browserOptions);
|
||||
} else if (FirefoxOptions.class.equals(browserOptions.getClass()) &&
|
||||
ChromeOptions chromeOptions = (ChromeOptions)browserOptions;
|
||||
String arguments = System.getProperty("webdriver.chrome.driver.args");
|
||||
if (arguments != null) {
|
||||
chromeOptions.addArguments(arguments.split(","));
|
||||
}
|
||||
driver = new ChromeDriver(chromeOptions);
|
||||
} else if (browserOptions instanceof FirefoxOptions &&
|
||||
System.getProperty("webdriver.gecko.driver") != null) {
|
||||
driver = new FirefoxDriver((FirefoxOptions)browserOptions);
|
||||
FirefoxOptions firefoxOptions = (FirefoxOptions)browserOptions;
|
||||
String arguments = System.getProperty("webdriver.gecko.driver.args");
|
||||
if (arguments != null) {
|
||||
firefoxOptions.addArguments(arguments.split(","));
|
||||
}
|
||||
driver = new FirefoxDriver(firefoxOptions);
|
||||
} else {
|
||||
serverUrl = DEFAULT_CONTAINER_SERVER_URL;
|
||||
Testcontainers.exposeHostPorts(8161);
|
||||
|
@ -111,7 +120,7 @@ public abstract class ConsoleTest extends SmokeTestBase {
|
|||
|
||||
loadWebDriverWait.until((Function<WebDriver, Object>) webDriver -> {
|
||||
try {
|
||||
webDriver.get(serverUrl + "/console");
|
||||
webDriver.get(serverUrl);
|
||||
return true;
|
||||
} catch (Exception ignore) {
|
||||
return false;
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.activemq.artemis.tests.smoke.console;
|
||||
|
||||
import org.apache.activemq.artemis.tests.smoke.console.pages.IndexPage;
|
||||
import org.junit.Test;
|
||||
import org.openqa.selenium.MutableCapabilities;
|
||||
|
||||
public class IndexTest extends ConsoleTest {
|
||||
|
||||
protected static final String DEFAULT_CONSOLE_INDEX_LOGO_IMAGE = "/images/activemq-logo.png";
|
||||
|
||||
public IndexTest(MutableCapabilities browserOptions) {
|
||||
super(browserOptions);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIndexLogo() {
|
||||
String expectedLogoImage = serverUrl + System.getProperty(
|
||||
"artemis.console.index.logo.image", DEFAULT_CONSOLE_INDEX_LOGO_IMAGE);
|
||||
|
||||
driver.get(serverUrl);
|
||||
IndexPage indexPage = new IndexPage(driver);
|
||||
assertEquals(expectedLogoImage, indexPage.getLogoImage(DEFAULT_TIMEOUT));
|
||||
}
|
||||
}
|
|
@ -18,30 +18,30 @@
|
|||
package org.apache.activemq.artemis.tests.smoke.console;
|
||||
|
||||
import org.apache.activemq.artemis.tests.smoke.console.pages.LoginPage;
|
||||
import org.apache.activemq.artemis.tests.smoke.console.pages.StatusPage;
|
||||
import org.junit.Test;
|
||||
import org.openqa.selenium.MutableCapabilities;
|
||||
|
||||
public class LoginTest extends ConsoleTest {
|
||||
|
||||
private static final String DEFAULT_CONSOLE_LOGIN_BRAND_IMAGE = "/activemq-branding/plugin/img/activemq.png";
|
||||
|
||||
public LoginTest(MutableCapabilities browserOptions) {
|
||||
super(browserOptions);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLogin() {
|
||||
driver.get(serverUrl + "/console");
|
||||
LoginPage loginPage = new LoginPage(driver);
|
||||
StatusPage statusPage = loginPage.loginValidUser(
|
||||
SERVER_ADMIN_USERNAME, SERVER_ADMIN_PASSWORD, DEFAULT_TIMEOUT);
|
||||
|
||||
assertEquals(SERVER_ADMIN_USERNAME, statusPage.getUser());
|
||||
loginPage.loginValidUser(SERVER_ADMIN_USERNAME, SERVER_ADMIN_PASSWORD, DEFAULT_TIMEOUT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoginBrand() {
|
||||
String expectedBrandImage = serverUrl + System.getProperty(
|
||||
"artemis.console.brand.image", DEFAULT_CONSOLE_BRAND_IMAGE);
|
||||
"artemis.console.login.brand.image", DEFAULT_CONSOLE_LOGIN_BRAND_IMAGE);
|
||||
|
||||
driver.get(serverUrl + "/console");
|
||||
LoginPage loginPage = new LoginPage(driver);
|
||||
assertEquals(expectedBrandImage, loginPage.getBrandImage(DEFAULT_TIMEOUT));
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public class QueuesTest extends ConsoleTest {
|
|||
|
||||
@Test
|
||||
public void testDefaultQueues() throws Exception {
|
||||
driver.get(serverUrl + "/console");
|
||||
LoginPage loginPage = new LoginPage(driver);
|
||||
StatusPage statusPage = loginPage.loginValidUser(
|
||||
SERVER_ADMIN_USERNAME, SERVER_ADMIN_PASSWORD, DEFAULT_TIMEOUT);
|
||||
|
@ -58,6 +59,7 @@ public class QueuesTest extends ConsoleTest {
|
|||
final String queueName = "TEST";
|
||||
final String messageText = "TEST";
|
||||
|
||||
driver.get(serverUrl + "/console");
|
||||
LoginPage loginPage = new LoginPage(driver);
|
||||
StatusPage statusPage = loginPage.loginValidUser(
|
||||
SERVER_ADMIN_USERNAME, SERVER_ADMIN_PASSWORD, DEFAULT_TIMEOUT);
|
||||
|
@ -97,6 +99,6 @@ public class QueuesTest extends ConsoleTest {
|
|||
|
||||
QueuesPage afterQueuesPage = messagePage.getQueuesPage(DEFAULT_TIMEOUT);
|
||||
Wait.assertEquals(1, () -> afterQueuesPage.countQueue("DLQ"));
|
||||
Wait.assertEquals(0, () -> afterQueuesPage.countQueue(queueName));
|
||||
Wait.assertEquals(0, () -> afterQueuesPage.getMessagesCount(queueName));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.activemq.artemis.tests.smoke.console.pages;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
public class IndexPage extends ConsolePage {
|
||||
private By logoImageLocator = By.xpath("//div[@class='logo']/img");
|
||||
|
||||
public IndexPage(WebDriver driver) {
|
||||
super(driver);
|
||||
}
|
||||
|
||||
public String getLogoImage(int timeout) {
|
||||
waitForElementToBeVisible(logoImageLocator, timeout);
|
||||
|
||||
return driver.findElement(logoImageLocator).getAttribute("src");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue