Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ This utility automates the entire first-mile experience — from credential inpu
| 🔍 Pre-requisite Check | Validates if Java, Node, and Python are installed. Provides installation guidance if they are missing. |
| 📊 Plan Variant Detection | Calls the `/plan` API to tailor the sample repo based on the customer’s subscription tier (e.g., Live, Pro). |
| ✅ Console UX with Checkmarks | Mimics the BrowserStack Network Assessment Tool for a familiar experience. |
| 🪵 Logging for Debugging | Saves all raw logs under `~/.browserstack/bstack_onboarding.log` for support and debugging purposes. |
| 🪵 Logging for Debugging | Saves all raw logs under `~/.browserstack/NOW` for support and debugging purposes. |
| 🖥️ (Planned) UI Framework Picker | Allows customers to select their preferred test framework via an interactive UI. |

## How to Use
## How to Use?

You can either run the script directly from the web or clone the repository and run it locally.

### Clone and Run Locally

1. Clone the repository:
```bash
git clone https://github.com/http-heading/browserstack-now.git
git clone https://github.com/BrowserStackCE/browserstack-now.git
```
2. Navigate to the directory:
```bash
Expand All @@ -34,12 +34,17 @@ You can either run the script directly from the web or clone the repository and

**macOS / Linux**
```bash
bash mac_os.sh
bash mac/run.sh or ./mac/run.sh
```
If you encounter any permission issues, ensure the script is executable:

```
chmod +x ./mac/run.sh
```

**Windows**
```powershell
./windows.ps1
./win/run.ps1
```

### Remote Execution
Expand All @@ -49,7 +54,7 @@ You can either run the script directly from the web or clone the repository and
To run the onboarding utility on macOS or Linux without cloning, execute the following command in your terminal:

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/http-heading/browserstack-now/main/mac_os.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/http-heading/browserstack-now/main/mac/run.sh)"
```

#### Windows
Expand All @@ -58,6 +63,23 @@ To run the onboarding utility on Windows without cloning, execute the following
**Note:** You may need to set the execution policy to `RemoteSigned` or `Bypass` to run the script.

```powershell
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/http-heading/browserstack-now/main/windows.ps1'))
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/http-heading/browserstack-now/main/win/run.ps1'))
```

## Identifying and sharing the log files

The NOW framework creates the log files in this folder. To seek assistance from the BrowserStack team after running this Github repository, please share a zip of the logs with the BrowserStack team in toucn with you.

### NOW Framework Logs

#### macOS / Linux
```
$HOME/.browserstack/NOW/logs
```

#### Windows
```
$HOME/.browserstack/NOW/logs
```


56 changes: 56 additions & 0 deletions mac/proxy-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env sh

# URL to test
TEST_URL="https://www.browserstack.com/automate/browsers.json"

# Detect proxy from env (case insensitive)
PROXY="${http_proxy:-${HTTP_PROXY:-${https_proxy:-${HTTPS_PROXY}}}}"

# Reset output variables
export PROXY_HOST=""
export PROXY_PORT=""

# Function: parse proxy url to host + port
parse_proxy() {
p="$1"
# strip protocol e.g. http://, https://
p="${p#http://}"
p="${p#https://}"
# strip credentials if any user:pass@
p="${p#*[@]}"

# extract host and port
export PROXY_HOST="${p%%:*}"
export PROXY_PORT="${p##*:}"
}

base64_encoded_creds=$(printf "%s" $BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY | base64 | tr -d '\n')


# If no proxy configured, exit early
if [ -z "$PROXY" ]; then
echo "No proxy found in environment. Clearing proxy host and port variables."
export PROXY_HOST=""
export PROXY_PORT=""
return 0 2>/dev/null || exit 0
fi

echo "Proxy detected: $PROXY"
parse_proxy "$PROXY"

echo "Testing reachability via proxy..."


STATUS_CODE=$(curl -sS -o /dev/null -H "Authorization: Basic ${base64_encoded_creds}" -w "%{http_code}" --proxy "$PROXY" "$TEST_URL" 2>/dev/null)

if [ "${STATUS_CODE#2}" != "$STATUS_CODE" ]; then
echo "✅ Reachable. HTTP $STATUS_CODE"
echo "Exporting PROXY_HOST=$PROXY_HOST"
echo "Exporting PROXY_PORT=$PROXY_PORT"
export PROXY_HOST
export PROXY_PORT
else
echo "❌ Not reachable (HTTP $STATUS_CODE). Clearing variables."
export PROXY_HOST=""
export PROXY_PORT=""
fi
Loading