aboutsummaryrefslogtreecommitdiff
path: root/test/html/driver.sh
diff options
context:
space:
mode:
authorCameron Paul <cpaul37@gmail.com>2025-05-24 12:35:29 -0500
committerRodrigo Arias Mallo <rodarima@gmail.com>2025-06-29 14:05:04 +0200
commitc35228c4be4bd7102e350a9b8b1e5947cb4b0f18 (patch)
tree6ec0a6c49c936d0c69d4b9add670dc7968bf4154 /test/html/driver.sh
parent5fcd2063ee3b17ef6d6909f33ee0bf6d3bb02fa6 (diff)
Poll for dillo window during HTML tests
Diffstat (limited to 'test/html/driver.sh')
-rwxr-xr-xtest/html/driver.sh19
1 files changed, 14 insertions, 5 deletions
diff --git a/test/html/driver.sh b/test/html/driver.sh
index 3a950978..bd869ecd 100755
--- a/test/html/driver.sh
+++ b/test/html/driver.sh
@@ -32,11 +32,20 @@ function render_page() {
dillopid=$!
# TODO: We need a better system to determine when the page loaded
- sleep 1
-
- # Capture only Dillo window
- winid=$(xwininfo -all -root | awk '/Dillo:/ {print $1}')
- if [ -z "$winid" ]; then
+ # This will poll for the window every 5th of a second for up to 5 seconds
+ found_window=false
+ for i in {0..25}; do
+ sleep 0.2
+
+ # Capture only Dillo window
+ winid=$(xwininfo -all -root | awk '/Dillo:/ {print $1}')
+ if [ ! -z "$winid" ]; then
+ found_window=true
+ break
+ fi
+ done
+
+ if ! $found_window; then
echo "cannot find Dillo window" >&2
exit 1
fi