Improve test reliability and fix security issues

- Replace waitForTimeout with waitForSelector and waitForLoadState
- Remove eval security risk in bash script
- Use proper wait mechanisms for better test reliability

Co-authored-by: katosdev <7927609+katosdev@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-27 14:12:22 +00:00
parent 31d306ca05
commit 69b31a3be5
2 changed files with 47 additions and 38 deletions

View File

@@ -18,21 +18,31 @@ api_call() {
local data=$3
local token=$4
local curl_cmd="curl -s -X $method"
if [ -n "$token" ]; then
curl_cmd="$curl_cmd -H 'Authorization: Bearer $token'"
if [ -n "$data" ]; then
curl -s -X "$method" \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json" \
-d "$data" \
"$API_URL$endpoint"
else
curl -s -X "$method" \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json" \
"$API_URL$endpoint"
fi
else
if [ -n "$data" ]; then
curl -s -X "$method" \
-H "Content-Type: application/json" \
-d "$data" \
"$API_URL$endpoint"
else
curl -s -X "$method" \
-H "Content-Type: application/json" \
"$API_URL$endpoint"
fi
fi
curl_cmd="$curl_cmd -H 'Content-Type: application/json'"
if [ -n "$data" ]; then
curl_cmd="$curl_cmd -d '$data'"
fi
curl_cmd="$curl_cmd $API_URL$endpoint"
eval $curl_cmd
}
# Function to register a user and get token