| #!/bin/bash |
| |
| |
|
|
| source "$(dirname "$0")/common.sh" |
|
|
| |
| start_test "auto-https: goto without protocol adds https://" |
|
|
| |
| |
| pt goto "fixtures:80/index.html" |
|
|
| |
| if echo "$PT_OUT" | grep -qiE "chrome-error|err_|error|refused|failed|ssl"; then |
| echo -e " ${GREEN}β${NC} CLI added https:// prefix (Chrome shows error page)" |
| ((ASSERTIONS_PASSED++)) || true |
| elif [ "$PT_CODE" -ne 0 ]; then |
| echo -e " ${GREEN}β${NC} CLI added https:// prefix (navigation failed as expected)" |
| ((ASSERTIONS_PASSED++)) || true |
| else |
| |
| if echo "$PT_OUT" | grep -q '"url".*https://'; then |
| echo -e " ${GREEN}β${NC} CLI added https:// prefix (URL in response shows https)" |
| ((ASSERTIONS_PASSED++)) || true |
| else |
| echo -e " ${RED}β${NC} Expected https:// URL or error, got: $PT_OUT" |
| ((ASSERTIONS_FAILED++)) || true |
| fi |
| fi |
|
|
| end_test |
|
|
| |
| start_test "auto-https: explicit http:// is preserved" |
|
|
| |
| pt_ok goto "http://fixtures:80/index.html" |
|
|
| if echo "$PT_OUT" | grep -q '"url".*http://'; then |
| echo -e " ${GREEN}β${NC} Response URL is http://" |
| ((ASSERTIONS_PASSED++)) || true |
| else |
| echo -e " ${RED}β${NC} Expected http:// in URL" |
| ((ASSERTIONS_FAILED++)) || true |
| fi |
|
|
| end_test |
|
|
| |
| start_test "auto-https: explicit https:// is preserved" |
|
|
| |
| pt goto "https://fixtures:80/index.html" |
|
|
| |
| if echo "$PT_OUT" | grep -qiE "chrome-error|err_|error|refused|failed"; then |
| echo -e " ${GREEN}β${NC} Explicit https:// preserved (Chrome shows error)" |
| ((ASSERTIONS_PASSED++)) || true |
| elif echo "$PT_OUT" | grep -q '"url".*https://'; then |
| echo -e " ${GREEN}β${NC} Explicit https:// preserved (URL shows https)" |
| ((ASSERTIONS_PASSED++)) || true |
| else |
| echo -e " ${RED}β${NC} Expected https:// URL or error, got: $PT_OUT" |
| ((ASSERTIONS_FAILED++)) || true |
| fi |
|
|
| end_test |
|
|