# Selenium test suite — NRI Property Guard website

`test_functionality.py` is a complete, runnable Selenium (Python) test suite covering the same
functional surface as `tests/test_playwright_suite.py`: page load health, SEO meta tags,
structured data validity, the WhatsApp widget, mobile navigation, the FAQ accordion, the
contact/lead form, the owner portal login screen, and `robots.txt`/`sitemap.xml`.

## Why this suite's results aren't in the QA report

This site was built and tested inside a sandboxed cloud environment. That sandbox's
pre-installed Chromium is version 141, but the only `chromedriver` available locally is
version 147 — a hard version mismatch that Selenium refuses to bridge
(`SessionNotCreatedException`). Selenium 4's Selenium Manager normally resolves this
automatically by downloading a matching driver, and installing a pinned `chromedriver`
package via npm is another way to do the same thing — but both routes require reaching
`googlechromelabs.github.io`, which that sandbox's network allowlist blocks outright
(HTTP 403 "request blocked: no rule or allowlist entry allows host").

In other words: this is an environment limitation, not a defect in this test code or in the
site it tests. Every scenario below was still verified for real — using Playwright instead,
whose bundled browser and driver are pre-matched and installed offline in that sandbox — and
the full 139/139 pass results are in the QA report. This Selenium suite is delivered so you
can run the identical scenarios yourself in a normal environment (your machine, or CI), where
no such restriction exists.

## Running it

```bash
pip install -r requirements.txt

# In one terminal, from the site/ root:
python3 -m http.server 8899

# In another terminal:
cd selenium
python3 test_functionality.py -v
# or:
pytest test_functionality.py -v
```

Requires Chrome or Chromium installed locally. Selenium 4's Selenium Manager will
auto-download a matching chromedriver the first time you run it (needs outbound internet
access to googlechromelabs.github.io) — or point Selenium at an existing driver on your
`PATH` if you already have one.

## Safety note on the contact form test

`test_submit_shows_success_message_live` is **skipped by default** because a real submit
would write a genuine row into the live `website_leads` Supabase table. Set
`RUN_LIVE_LEAD_SUBMIT=1` in the environment if you want to actually exercise the full
submit-and-confirm path against production; otherwise the suite only fills and validates the
form fields, which is enough to catch most real regressions (missing fields, wrong input
types) without touching production data. The Playwright suite in `tests/` takes a different,
equally valid approach to this same problem: it intercepts the network request and asserts on
its shape, so it can safely test the full success/error-handling code path on every run.

## Testing against a different environment

```bash
BASE_URL=https://staging.nripropertyguard.in python3 test_functionality.py -v
```
