-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add firefox headless step in job
- Loading branch information
Showing
4 changed files
with
59 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FILENAME=$1 | ||
if grep -q 'title="FAILED"' "$FILENAME"; then | ||
failed_info=$(grep -oE '<div id="[^"]+" title="FAILED">([^<]+)' "$FILENAME" | awk 'NR==1 {print substr($0, index($0,$4))}') | ||
echo $failed_info | ||
exit 1 | ||
elif grep -q 'title="OK"' "$FILENAME"; then | ||
grep -oE '<div id="[^"]+" title="OK">([^<]+)' "$FILENAME" | awk '{print substr($0, index($0,$4))}' | ||
echo "Success: all tests passed." | ||
else | ||
cat "$FILENAME" | ||
echo "No test results found. Check $FILENAME output." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from selenium import webdriver | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.support.ui import WebDriverWait | ||
from selenium.webdriver.support import expected_conditions as EC | ||
|
||
options = webdriver.FirefoxOptions() | ||
options.add_argument("--headless") | ||
driver = webdriver.Firefox(options=options) | ||
driver.get("http://localhost:8080/") | ||
|
||
# Adjust the timeout to 1 minute | ||
wait = WebDriverWait(driver, 180) | ||
|
||
# Wait until the div with id "tests_finished" is displayed | ||
tests_finished_element = wait.until(EC.presence_of_element_located((By.ID, "tests_finished"))) | ||
|
||
html = driver.page_source | ||
with open("firefox-results.html", "w", encoding="utf-8") as file: | ||
file.write(html) | ||
|
||
driver.quit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters