Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Develop an automated ECL Watch Test Suite #18861

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
511baa0
HPCC-31857 : Added new step to run ecl watch UI tests, updated step t…
Nisha-Bagdwal Jul 8, 2024
c551066
HPCC-31857 : Added the directory framework and file TestRunner to tes…
Nisha-Bagdwal Jul 10, 2024
520e075
HPCC-31857 : Updated folder name ecl_watch_ui_tests with the older one.
Nisha-Bagdwal Jul 10, 2024
4dae588
HPCC-31857 : Updated yml to fix selenium server run
Nisha-Bagdwal Jul 10, 2024
ff2b674
HPCC-31857 : updated yml
Nisha-Bagdwal Jul 10, 2024
e73d05b
HPCC-31857 : updated yml
Nisha-Bagdwal Jul 10, 2024
d94ff4d
HPCC-31857 : Updated yml
Nisha-Bagdwal Jul 10, 2024
24afc30
HPCC-31857 : Updated yml
Nisha-Bagdwal Jul 10, 2024
fbe4f83
HPCC-31857 : Updated yml
Nisha-Bagdwal Jul 10, 2024
5b7931c
HPCC-31857 : Updated yml
Nisha-Bagdwal Jul 10, 2024
95567f0
HPCC-31857 : Updated yml
Nisha-Bagdwal Jul 10, 2024
45f0941
HPCC-31857 : Updated yml
Nisha-Bagdwal Jul 10, 2024
08356cf
HPCC-31857 : Updated yml
Nisha-Bagdwal Jul 10, 2024
1aee8b2
HPCC-31857 : Updated yml
Nisha-Bagdwal Jul 10, 2024
be12186
HPCC-31857 : Updated yml
Nisha-Bagdwal Jul 10, 2024
4987f94
HPCC-31857 : Updated yml
Nisha-Bagdwal Jul 10, 2024
e792f8c
HPCC-31857 : Updated yml
Nisha-Bagdwal Jul 11, 2024
7fd5f0e
HPCC-31857 : Updated yml
Nisha-Bagdwal Jul 11, 2024
06582c2
HPCC-31857
Nisha-Bagdwal Jul 11, 2024
941b314
HPCC-31857
Nisha-Bagdwal Jul 11, 2024
657ff6a
HPCC-31857 - Modified code to as per updated selenium jar
Nisha-Bagdwal Jul 11, 2024
fb017c2
HPCC-31857 - Changes
Nisha-Bagdwal Jul 12, 2024
9203913
HPCC-31857 - Changes
Nisha-Bagdwal Jul 12, 2024
cc62060
HPCC-31857 - Changes
Nisha-Bagdwal Jul 12, 2024
efbf3df
HPCC-31857 - Changes
Nisha-Bagdwal Jul 12, 2024
10c6572
HPCC-31857 - Changes
Nisha-Bagdwal Jul 12, 2024
7a719f1
HPCC-31857 - Changes
Nisha-Bagdwal Jul 12, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ jobs:
${{ github.workspace }}/HPCC-Platform/.github/workflows/timeoutcmd
if-no-files-found: error

- name: Upload UI Test Files
- name: Upload ECL Watch UI Test Files
if: ${{ inputs.upload-package == true }}
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.asset-name }}-ui_test-files
name: ${{ inputs.asset-name }}-ecl_watch_ui_tests
path: |
${{ github.workspace }}/HPCC-Platform/esp/src/test-ui/**/*
${{ github.workspace }}/HPCC-Platform/esp/src/test-ui/tests/**/*
if-no-files-found: error

- name: Upload Error Logs
Expand Down
55 changes: 31 additions & 24 deletions .github/workflows/test-ui-gh_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ jobs:
- name: Download UI Test Files
uses: actions/download-artifact@v3
with:
name: ${{ inputs.asset-name }}-ui_test-files
path: ${{ inputs.asset-name }}-ui_test-files
name: ${{ inputs.asset-name }}-ecl_watch_ui_tests
path: ${{ inputs.asset-name }}-ecl_watch_ui_tests

- name: Check ECLWatch UI Test Directory
id: check
run: |
if [[ ! -d ${{ inputs.asset-name }}-ui_test-files ]]
if [[ ! -d ${{ inputs.asset-name }}-ecl_watch_ui_tests ]]
then
echo "ECLWatch UI ${{ inputs.asset-name }}-ui_test-files directory missing."
echo "ECLWatch UI ${{ inputs.asset-name }}-ecl_watch_ui_tests directory missing."
else
javaFilesCount=$(find ${{ inputs.asset-name }}-ui_test-files/ -iname '*.java' -type f -print | wc -l )
javaFilesCount=$(find ${{ inputs.asset-name }}-ecl_watch_ui_tests/ -iname '*.java' -type f -print | wc -l )
echo "Number of test java files is $javaFilesCount"
if [[ ${javaFilesCount} -eq 0 ]]
then
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
chmod +x ./${{ inputs.asset-name }}-support-files/*
sudo cp ./${{ inputs.asset-name }}-support-files/* /opt/HPCCSystems/bin

chmod +x ./${{ inputs.asset-name }}-ui_test-files/*
chmod +x ./${{ inputs.asset-name }}-ecl_watch_ui_tests/*

- name: Start HPCC-Platform
shell: "bash"
Expand Down Expand Up @@ -136,34 +136,41 @@ jobs:
run: |
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt-get install -y ./google-chrome-stable_current_amd64.deb
wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo mv chromedriver /usr/bin/chromedriver
wget https://storage.googleapis.com/chrome-for-testing-public/126.0.6478.126/linux64/chromedriver-linux64.zip
unzip chromedriver-linux64.zip -d chromedriver
sudo mv chromedriver/chromedriver-linux64/chromedriver /usr/bin/chromedriver
sudo chown root:root /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver
wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
wget http://www.java2s.com/Code/JarDownload/testng/testng-6.8.7.jar.zip
unzip testng-6.8.7.jar.zip

- name: Run Tests
timeout-minutes: 10 # generous, current runtime is ~1min, this should be increased if new tests are added
wget https://repo1.maven.org/maven2/org/testng/testng/7.7.1/testng-7.7.1.jar
wget https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.17.0/jackson-annotations-2.17.0.jar
wget https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.17.0/jackson-core-2.17.0.jar
wget https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.17.0/jackson-databind-2.17.0.jar
wget https://repo1.maven.org/maven2/com/beust/jcommander/1.82/jcommander-1.82.jar
wget https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.22.0/selenium-java-4.22.0.zip
wget https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar
wget https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/1.7.30/slf4j-simple-1.7.30.jar
unzip selenium-java-4.22.0.zip -d selenium-libs

- name: Run ECL Watch UI Tests
timeout-minutes: 80 # generous, current runtime is ~38 minutes, this should be increased if new tests are added
if: steps.check.outputs.runtests
shell: "bash"
run: |
export CLASSPATH=".:${{ github.workspace }}/selenium-server-standalone-3.141.59.jar:${{ github.workspace }}/testng-6.8.7.jar"
pushd ${{ inputs.asset-name }}-ui_test-files
./run.sh tests http://localhost:8010 > eclWatchUiTest.log 2>&1
retCode=$?
echo "UI test done"
[[ $retCode -ne 0 ]] && exit 1
export CLASSPATH=".:${{ inputs.asset-name }}-ecl_watch_ui_tests:${{ github.workspace }}/selenium-libs/*:${{ github.workspace }}/testng-7.7.1.jar:${{ github.workspace }}/jackson-annotations-2.17.0.jar:${{ github.workspace }}/jackson-core-2.17.0.jar:${{ github.workspace }}/jackson-databind-2.17.0.jar:${{ github.workspace }}/jcommander-1.82.jar:${{ github.workspace }}/slf4j-api-1.7.30.jar:${{ github.workspace }}/slf4j-simple-1.7.30.jar"
pushd ${{ inputs.asset-name }}-ecl_watch_ui_tests
find . -iname '*.java' -type f -print -exec javac {} \;
java framework.TestRunner detail
echo "ECL Watch UI test done"
lines=$(wc -l < error_ecl_test.log)
[[ $lines -ne 0 ]] && exit 1
popd

- name: eclwatch-ui-test-logs-artifact
- name: Upload ECL Watch UI Test Logs To Artifact
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.asset-name }}-ui_test-logs
name: ${{ inputs.asset-name }}-ecl_watch_ui_tests
path: |
${{ inputs.asset-name }}-ui_test-files/eclWatchUiTest.log
${{ inputs.asset-name }}-ecl_watch_ui_tests/*.log
/home/runner/HPCCSystems-regression/log/*.json
if-no-files-found: error
2 changes: 1 addition & 1 deletion esp/src/test-ui/tests/Activities.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void main(String[] args) throws IOException, InterruptedException
Capabilities caps = ((RemoteWebDriver) driver).getCapabilities();

String browserName = caps.getBrowserName();
String browserVersion = caps.getVersion();
//String browserVersion = caps.getVersion();
// System.out.println(browserName+" "+browserVersion);

driver.get(args[0]);
Expand Down
72 changes: 72 additions & 0 deletions esp/src/test-ui/tests/framework/TestRunner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package framework;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;

public class TestRunner {

public static void main(String[] args) {
System.setProperty("webdriver.chrome.silentOutput", "true");
System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");
//System.setProperty("webdriver.chrome.driver", "C:/Users/nisha/Documents/Internship/Work/jars/chromeDriver/chromedriver.exe");
// java.util.logging.Logger.getLogger("org.openqa.selenium").setLevel(Level.OFF);

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--no-sandbox");
chromeOptions.addArguments("--log-level=3");

WebDriver driver = null;

try {

driver = new ChromeDriver(chromeOptions);

Capabilities caps = ((RemoteWebDriver) driver).getCapabilities();

String browserName = caps.getBrowserName();
System.out.println("browserName: " + browserName);
//String browserVersion = caps.getVersion();
// System.out.println(browserName+" "+browserVersion);
} catch (Exception ex) {
System.out.println("Exception in driver initialization: " + ex.getMessage());
}

try {

if (driver != null) {
driver.get("http://127.0.0.1:8010/");
//driver.get("https://play.hpccsystems.com:18010/esp/files/index.html#/activities");

Thread.sleep(1000);

if (driver.getPageSource().contains("Job Name")) {
System.out.println("Pass");
} else {
System.err.println("Fail");
}
if (driver.getPageSource().contains("Owner")) {
System.out.println("Pass");
} else {
System.err.println("Fail");
}
if (driver.getPageSource().contains("Target/Wuid")) {
System.out.println("Pass");
} else {
System.err.println("Fail");
}

driver.quit();

}else{
System.out.println("Error: Driver did not initialize");
}

} catch (Exception ex) {
System.out.println("Exception in loading web page: " + ex.getMessage());
}
}
}
Loading