Compare commits
10 Commits
circleci-p
...
master
Author | SHA1 | Date | |
---|---|---|---|
427980f503 | |||
bdf9c79b49 | |||
56009863c1 | |||
8fa358eed0 | |||
6c1efa5202 | |||
2eaa3eb182 | |||
13e730c156 | |||
377c3eb6a4 | |||
546d5cd94a | |||
0fbae9e186 |
@ -1,42 +0,0 @@
|
|||||||
# Java Gradle CircleCI 2.0 configuration file
|
|
||||||
#
|
|
||||||
# Check https://circleci.com/docs/2.0/language-java/ for more details
|
|
||||||
#
|
|
||||||
version: 2
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
docker:
|
|
||||||
# specify the version you desire here
|
|
||||||
- image: circleci/openjdk:8-jdk
|
|
||||||
|
|
||||||
# Specify service dependencies here if necessary
|
|
||||||
# CircleCI maintains a library of pre-built images
|
|
||||||
# documented at https://circleci.com/docs/2.0/circleci-images/
|
|
||||||
# - image: circleci/postgres:9.4
|
|
||||||
|
|
||||||
working_directory: ~/repo
|
|
||||||
|
|
||||||
environment:
|
|
||||||
# Customize the JVM maximum heap limit
|
|
||||||
JVM_OPTS: -Xmx3200m
|
|
||||||
TERM: dumb
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
|
|
||||||
# Download and cache dependencies
|
|
||||||
- restore_cache:
|
|
||||||
keys:
|
|
||||||
- v1-dependencies-{{ checksum "build.gradle" }}
|
|
||||||
# fallback to using the latest cache if no exact match is found
|
|
||||||
- v1-dependencies-
|
|
||||||
|
|
||||||
- run: gradle dependencies
|
|
||||||
|
|
||||||
- save_cache:
|
|
||||||
paths:
|
|
||||||
- ~/.gradle
|
|
||||||
key: v1-dependencies-{{ checksum "build.gradle" }}
|
|
||||||
|
|
||||||
# run tests!
|
|
||||||
- run: gradle test
|
|
61
.gitea/workflows/build.yml
Normal file
61
.gitea/workflows/build.yml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
name: msbuild
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
env:
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-gitea
|
||||||
|
env:
|
||||||
|
CHROMEDRIVER_VERSION: 113.0.5672.63
|
||||||
|
CHROME_VERSION: 113.0.5672.0
|
||||||
|
EDGEDRIVER_VERSION: 126.0.2592.102
|
||||||
|
steps:
|
||||||
|
- name: Clone the repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install java 17
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'adopt'
|
||||||
|
java-version: '17'
|
||||||
|
|
||||||
|
- name: Install Gradle
|
||||||
|
run: |
|
||||||
|
wget https://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||||
|
unzip gradle-8.9-bin.zip
|
||||||
|
export PATH=$PATH:${{gitea.workspace}}/gradle-8.9/bin
|
||||||
|
|
||||||
|
- name: Validate Java installation
|
||||||
|
run: |
|
||||||
|
export PATH=$PATH:${{gitea.workspace}}/gradle-8.9/bin
|
||||||
|
java -version
|
||||||
|
gradle --version
|
||||||
|
echo $JAVA_HOME
|
||||||
|
|
||||||
|
- name: Prep the host environment for MS Edge
|
||||||
|
run: |
|
||||||
|
apt update -y
|
||||||
|
apt upgrade -y
|
||||||
|
|
||||||
|
- name: Install Edge and EdgeDriver for Linux
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
run: |
|
||||||
|
wget https://msedgedriver.azureedge.net/${EDGEDRIVER_VERSION}/edgedriver_linux64.zip
|
||||||
|
unzip edgedriver_linux64.zip
|
||||||
|
mv msedgedriver drivers
|
||||||
|
|
||||||
|
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
|
||||||
|
install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
|
||||||
|
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
|
||||||
|
sudo rm microsoft.gpg
|
||||||
|
apt update
|
||||||
|
apt install -y microsoft-edge-stable
|
||||||
|
|
||||||
|
- name: Gradle Build
|
||||||
|
run: |
|
||||||
|
export PATH=$PATH:${{gitea.workspace}}/drivers
|
||||||
|
export PATH=$PATH:${{gitea.workspace}}/gradle-8.9/bin
|
||||||
|
gradle build --scan
|
13
build.gradle
13
build.gradle
@ -19,17 +19,16 @@ dependencies {
|
|||||||
implementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.7.0'
|
implementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.7.0'
|
||||||
implementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.7.0'
|
implementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.7.0'
|
||||||
implementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.7.0'
|
implementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.7.0'
|
||||||
implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.0.0-alpha-6'
|
implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.23.0'
|
||||||
//implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.59'
|
implementation group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '5.9.1'
|
||||||
implementation group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '4.2.2'
|
|
||||||
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2'
|
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2'
|
||||||
testImplementation 'io.cucumber:cucumber-java:6.7.0'
|
testImplementation 'io.cucumber:cucumber-java:7.18.1'
|
||||||
testImplementation 'io.cucumber:cucumber-junit:6.7.0'
|
testImplementation 'io.cucumber:cucumber-junit:7.18.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
|
11
gradle/wrapper/gradle-wrapper.properties
vendored
11
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
#Wed Jul 24 17:16:25 BST 2024
|
||||||
distributionPath=wrapper/dists
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
zipStorePath=wrapper/dists
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
@ -30,7 +30,7 @@ public class BrowserDriver {
|
|||||||
case "edge":
|
case "edge":
|
||||||
return getEdge(headless); // headless unsupported until selenium 4
|
return getEdge(headless); // headless unsupported until selenium 4
|
||||||
case "safari":
|
case "safari":
|
||||||
return getSafari(false); // headless unsupported indefinitely
|
return getSafari(); // headless unsupported indefinitely
|
||||||
default: throw new IllegalArgumentException("Invalid browser specified");
|
default: throw new IllegalArgumentException("Invalid browser specified");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +38,10 @@ public class BrowserDriver {
|
|||||||
private static RemoteWebDriver getChrome(final Boolean headless){
|
private static RemoteWebDriver getChrome(final Boolean headless){
|
||||||
WebDriverManager.chromedriver().setup();
|
WebDriverManager.chromedriver().setup();
|
||||||
ChromeOptions options = new ChromeOptions();
|
ChromeOptions options = new ChromeOptions();
|
||||||
options.setHeadless(headless);
|
if (headless.equals(true)) {
|
||||||
|
options.addArguments("--headless");
|
||||||
|
}
|
||||||
|
options.addArguments("--headless");
|
||||||
options.setAcceptInsecureCerts(true);
|
options.setAcceptInsecureCerts(true);
|
||||||
RemoteWebDriver driver = new ChromeDriver(options);
|
RemoteWebDriver driver = new ChromeDriver(options);
|
||||||
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
|
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
|
||||||
@ -48,7 +51,9 @@ public class BrowserDriver {
|
|||||||
private static RemoteWebDriver getFirefox(final Boolean headless){
|
private static RemoteWebDriver getFirefox(final Boolean headless){
|
||||||
WebDriverManager.firefoxdriver().setup();
|
WebDriverManager.firefoxdriver().setup();
|
||||||
FirefoxOptions options = new FirefoxOptions();
|
FirefoxOptions options = new FirefoxOptions();
|
||||||
options.setHeadless(headless);
|
if (headless.equals(true)) {
|
||||||
|
options.addArguments("--headless");
|
||||||
|
}
|
||||||
options.setAcceptInsecureCerts(true);
|
options.setAcceptInsecureCerts(true);
|
||||||
RemoteWebDriver driver = new FirefoxDriver(options);
|
RemoteWebDriver driver = new FirefoxDriver(options);
|
||||||
driver.manage().timeouts().implicitlyWait(7, TimeUnit.SECONDS);
|
driver.manage().timeouts().implicitlyWait(7, TimeUnit.SECONDS);
|
||||||
@ -56,18 +61,9 @@ public class BrowserDriver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static RemoteWebDriver getEdge(final Boolean headless){
|
private static RemoteWebDriver getEdge(final Boolean headless){
|
||||||
List<String> osNames = Arrays.asList("Windows 10", "Mac OS X");
|
|
||||||
if (!osNames.contains(osName)){
|
|
||||||
throw new UnreachableBrowserException("Edge browser not available on this platform");
|
|
||||||
}
|
|
||||||
WebDriverManager.edgedriver().setup();
|
WebDriverManager.edgedriver().setup();
|
||||||
EdgeOptions options = new EdgeOptions();
|
EdgeOptions options = new EdgeOptions();
|
||||||
options.setAcceptInsecureCerts(true);
|
options.setAcceptInsecureCerts(true);
|
||||||
//if (headless.equals(true)){ // necessary for Selenium 3
|
|
||||||
// throw new UnsupportedOperationException("Edge does not support headless execution yet");
|
|
||||||
//}
|
|
||||||
//options.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
|
|
||||||
//** the following will only work once Selenium 4 is ready.
|
|
||||||
if (headless){
|
if (headless){
|
||||||
options.addArguments("headless");
|
options.addArguments("headless");
|
||||||
}
|
}
|
||||||
@ -76,18 +72,15 @@ public class BrowserDriver {
|
|||||||
return driver;
|
return driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RemoteWebDriver getSafari(final Boolean headless){
|
private static RemoteWebDriver getSafari(){
|
||||||
String osName = System.getProperty("os.name");
|
String osName = System.getProperty("os.name");
|
||||||
if (!osName.contentEquals("Mac OS X")){
|
if (!osName.contentEquals("Mac OS X")){
|
||||||
throw new UnreachableBrowserException("Safari browser not available on this platform");
|
throw new UnreachableBrowserException("Safari browser not available on this platform");
|
||||||
}
|
}
|
||||||
if (headless.equals(true)){
|
|
||||||
throw new UnsupportedOperationException("Safari does not support headless execution yet");
|
|
||||||
}
|
|
||||||
SafariOptions options = new SafariOptions();
|
SafariOptions options = new SafariOptions();
|
||||||
//options.setAcceptInsecureCerts(true);
|
//options.setAcceptInsecureCerts(true);
|
||||||
DesiredCapabilities capabilities = new DesiredCapabilities();
|
DesiredCapabilities capabilities = new DesiredCapabilities();
|
||||||
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
|
capabilities.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
|
||||||
RemoteWebDriver driver = new SafariDriver(options);
|
RemoteWebDriver driver = new SafariDriver(options);
|
||||||
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
||||||
return driver;
|
return driver;
|
||||||
|
@ -29,25 +29,25 @@ public class BrowserTests {
|
|||||||
|
|
||||||
@DisplayName("Browser Validation")
|
@DisplayName("Browser Validation")
|
||||||
@ParameterizedTest(name = "Browser: {0}")
|
@ParameterizedTest(name = "Browser: {0}")
|
||||||
@ValueSource(strings = {"chrome", "firefox", "edge", "safari" })
|
@ValueSource(strings = {"edge" })
|
||||||
void testBrowsers(String browser) {
|
void testBrowsers(String browser) {
|
||||||
driver = BrowserDriver.getDriver(browser, true);
|
driver = BrowserDriver.getDriver(browser, true);
|
||||||
System.out.println(dtf.format(LocalDateTime.now()) + " Navigating to url...");
|
System.out.println(dtf.format(LocalDateTime.now()) + " Navigating to url...");
|
||||||
String url = "https://duckduckgo.com/";
|
String url = "https://search.brave.com/";
|
||||||
driver.get(url);
|
driver.get(url);
|
||||||
if (!driver.getCurrentUrl().equals(url)){
|
if (!driver.getCurrentUrl().equals(url)){
|
||||||
fail("Browser navigation failed");
|
fail("Browser navigation failed");
|
||||||
}
|
}
|
||||||
System.out.println(dtf.format(LocalDateTime.now()) + " Entering search now...");
|
System.out.println(dtf.format(LocalDateTime.now()) + " Entering search now...");
|
||||||
RemoteWebElement searchBox =
|
RemoteWebElement searchBox =
|
||||||
(RemoteWebElement)driver.findElementByXPath("//input[@id='search_form_input_homepage']");
|
(RemoteWebElement)driver.findElement(By.xpath("//*[@id='searchbox']"));
|
||||||
searchBox.sendKeys("frankenberries");
|
searchBox.sendKeys("frankenberries");
|
||||||
searchBox.sendKeys(Keys.ENTER);
|
searchBox.sendKeys(Keys.ENTER);
|
||||||
System.out.println(dtf.format(LocalDateTime.now())+ " Checking search results...");
|
System.out.println(dtf.format(LocalDateTime.now())+ " Checking search results...");
|
||||||
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10),Duration.ofMillis(100));
|
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10),Duration.ofMillis(1000));
|
||||||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='links']")));
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='results']")));
|
||||||
RemoteWebElement results =
|
RemoteWebElement results =
|
||||||
(RemoteWebElement)driver.findElementByPartialLinkText("Monster cereal");
|
(RemoteWebElement)driver.findElement(By.partialLinkText("Monster cereals"));
|
||||||
System.out.println(results.getText());
|
System.out.println(results.getText());
|
||||||
Assertions.assertNotNull(results);
|
Assertions.assertNotNull(results);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user