new test on audits; selenium upgrade to make usable by team hopefully

This commit is contained in:
2023-02-17 12:03:55 -06:00
parent 3eb831b30e
commit 32711098c1
18 changed files with 610 additions and 56 deletions

View File

@ -0,0 +1,97 @@
package com.kingsrook.qqq.materialdashboard.lib;
import com.kingsrook.qqq.materialdashboard.lib.javalin.QSeleniumJavalin;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
/*******************************************************************************
** Base class for Selenium tests
*******************************************************************************/
public class QBaseSeleniumTest
{
private static ChromeOptions chromeOptions;
private WebDriver driver;
protected QSeleniumJavalin qSeleniumJavalin;
protected QSeleniumLib qSeleniumLib;
/*******************************************************************************
**
*******************************************************************************/
@BeforeAll
static void beforeAll()
{
chromeOptions = new ChromeOptions();
chromeOptions.setAcceptInsecureCerts(true);
chromeOptions.addArguments("--ignore-certificate-errors");
String headless = System.getenv("QQQ_SELENIUM_HEADLESS");
if("true".equals(headless))
{
chromeOptions.setHeadless(true);
}
WebDriverManager.chromiumdriver().setup();
}
/*******************************************************************************
**
*******************************************************************************/
@BeforeEach
void beforeEach()
{
driver = new ChromeDriver(chromeOptions);
driver.manage().window().setSize(new Dimension(1600, 1200));
qSeleniumLib = new QSeleniumLib(driver);
qSeleniumJavalin = new QSeleniumJavalin();
addJavalinRoutes(qSeleniumJavalin);
qSeleniumJavalin.start();
}
/*******************************************************************************
** meant for sub-classes to define their own javalin routes, if they need to
*******************************************************************************/
protected void addJavalinRoutes(QSeleniumJavalin qSeleniumJavalin)
{
qSeleniumJavalin
.withRouteToFile("/metaData", "metaData/index.json")
.withRouteToFile("/metaData/authentication", "metaData/authentication.json")
.withRouteToFile("/metaData/table/person", "metaData/table/person.json")
.withRouteToFile("/metaData/table/city", "metaData/table/person.json");
}
/*******************************************************************************
**
*******************************************************************************/
@AfterEach
void afterEach()
{
if(driver != null)
{
driver.quit();
}
if(qSeleniumJavalin != null)
{
qSeleniumJavalin.stop();
}
}
}