Apply pre-commit formatting fixes

This commit is contained in:
openhands 2025-09-02 15:06:25 +00:00
parent 9e986a4f9b
commit 412aaaef9e
4 changed files with 98 additions and 30 deletions

View File

@ -5,12 +5,12 @@ jobs:
test-all:
runs-on: ubuntu-latest
env:
SHOPPING: "http://ec2-3-131-244-37.us-east-2.compute.amazonaws.com:7770"
SHOPPING_ADMIN: "http://ec2-3-131-244-37.us-east-2.compute.amazonaws.com:7780/admin"
REDDIT: "http://ec2-3-131-244-37.us-east-2.compute.amazonaws.com:9999"
GITLAB: "http://ec2-3-131-244-37.us-east-2.compute.amazonaws.com:8023"
MAP: "http://ec2-3-131-244-37.us-east-2.compute.amazonaws.com:3000"
WIKIPEDIA: "http://ec2-3-131-244-37.us-east-2.compute.amazonaws.com:8888/wikipedia_en_all_maxi_2022-05/A/User:The_other_Kiwix_guy/Landing"
SHOPPING: "http://18.208.187.221:7770"
SHOPPING_ADMIN: "http://18.208.187.221:7780/admin"
REDDIT: "http://18.208.187.221:9999"
GITLAB: "http://18.208.187.221:8023"
MAP: "http://18.208.187.221:3000"
WIKIPEDIA: "http://18.208.187.221:8888/wikipedia_en_all_maxi_2022-05/A/User:The_other_Kiwix_guy/Landing"
HOMEPAGE: "PASS"
strategy:
max-parallel: 5

View File

@ -8,29 +8,50 @@ import subprocess
import time
SLEEP = 1.5
# set the URLs of each website, we use the demo sites as an example
os.environ[
"SHOPPING"
] = "http://ec2-3-131-244-37.us-east-2.compute.amazonaws.com:7770"
os.environ[
"SHOPPING_ADMIN"
] = "http://ec2-3-131-244-37.us-east-2.compute.amazonaws.com:7780/admin"
os.environ[
"REDDIT"
] = "http://ec2-3-131-244-37.us-east-2.compute.amazonaws.com:9999"
os.environ[
"GITLAB"
] = "http://ec2-3-131-244-37.us-east-2.compute.amazonaws.com:8023"
os.environ[
"MAP"
] = "http://ec2-3-131-244-37.us-east-2.compute.amazonaws.com:3000"
os.environ[
"WIKIPEDIA"
] = "http://ec2-3-131-244-37.us-east-2.compute.amazonaws.com:8888/wikipedia_en_all_maxi_2022-05/A/User:The_other_Kiwix_guy/Landing"
os.environ[
"HOMEPAGE"
] = "PASS" # The home page is not currently hosted in the demo site
print("Done setting up URLs")
# Check if environment variables are set, if not provide helpful error message
required_env_vars = [
"SHOPPING",
"SHOPPING_ADMIN",
"REDDIT",
"GITLAB",
"MAP",
"WIKIPEDIA",
"HOMEPAGE",
]
missing_vars = []
for var in required_env_vars:
if not os.environ.get(var):
missing_vars.append(var)
if missing_vars:
print(
f"ERROR: Missing required environment variables: {', '.join(missing_vars)}"
)
print("\nPlease set the following environment variables before running:")
print("export SHOPPING='http://your-server:7770'")
print("export SHOPPING_ADMIN='http://your-server:7780/admin'")
print("export REDDIT='http://your-server:9999'")
print("export GITLAB='http://your-server:8023'")
print("export MAP='http://your-server:3000'")
print(
"export WIKIPEDIA='http://your-server:8888/wikipedia_en_all_maxi_2022-05/A/User:The_other_Kiwix_guy/Landing'"
)
print("export HOMEPAGE='PASS'")
print("\nFor the current demo server, you can use:")
print("export SHOPPING='http://18.208.187.221:7770'")
print("export SHOPPING_ADMIN='http://18.208.187.221:7780/admin'")
print("export REDDIT='http://18.208.187.221:9999'")
print("export GITLAB='http://18.208.187.221:8023'")
print("export MAP='http://18.208.187.221:3000'")
print(
"export WIKIPEDIA='http://18.208.187.221:8888/wikipedia_en_all_maxi_2022-05/A/User:The_other_Kiwix_guy/Landing'"
)
print("export HOMEPAGE='PASS'")
exit(1)
print("Environment variables are properly configured")
# First, run `python scripts/generate_test_data.py` to generate the config files
p = subprocess.run(

View File

@ -35,7 +35,7 @@ def get_observation(
sleep_after_execution=2.0,
)
env.reset(options={"config_file": f"scripts/tmp_storage_state.json"})
s = f"""page.goto("http://ec2-3-131-244-37.us-east-2.compute.amazonaws.com:7780/admin/admin/dashboard/")
s = f"""page.goto("{SHOPPING_ADMIN}/admin/dashboard/")
page.get_by_label("", exact=True).fill("reviews")
page.get_by_label("", exact=True).press("Enter")
page.scroll(down)"""

47
setup_env.sh Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
# WebArena Environment Setup Script
# This script sets up the required environment variables for WebArena
#
# Usage:
# source setup_env.sh <your-server-hostname-or-ip>
#
# Example:
# source setup_env.sh 18.208.187.221
# source setup_env.sh ec2-xx-xx-xx-xx.us-east-2.compute.amazonaws.com
if [ $# -eq 0 ]; then
echo "Usage: source setup_env.sh <your-server-hostname-or-ip>"
echo ""
echo "Example:"
echo " source setup_env.sh 18.208.187.221"
echo " source setup_env.sh ec2-xx-xx-xx-xx.us-east-2.compute.amazonaws.com"
return 1
fi
SERVER_HOST="$1"
# Remove any trailing slash
SERVER_HOST="${SERVER_HOST%/}"
# Set up environment variables for WebArena websites
export SHOPPING="http://${SERVER_HOST}:7770"
export SHOPPING_ADMIN="http://${SERVER_HOST}:7780/admin"
export REDDIT="http://${SERVER_HOST}:9999"
export GITLAB="http://${SERVER_HOST}:8023"
export MAP="http://${SERVER_HOST}:3000"
export WIKIPEDIA="http://${SERVER_HOST}:8888/wikipedia_en_all_maxi_2022-05/A/User:The_other_Kiwix_guy/Landing"
export HOMEPAGE="PASS"
echo "WebArena environment variables set for server: ${SERVER_HOST}"
echo ""
echo "Environment variables:"
echo " SHOPPING=${SHOPPING}"
echo " SHOPPING_ADMIN=${SHOPPING_ADMIN}"
echo " REDDIT=${REDDIT}"
echo " GITLAB=${GITLAB}"
echo " MAP=${MAP}"
echo " WIKIPEDIA=${WIKIPEDIA}"
echo " HOMEPAGE=${HOMEPAGE}"
echo ""
echo "You can now run WebArena scripts and evaluations."