The Simplest Way to Make Firestore and Selenium Work Like They Should
Teams pair Firestore and Selenium to test web apps against real document data. Selenium drives the browser while Firestore stores the state that each test checks. This setup lets engineers seed test data before a browser run starts. After the browser finishes an action, the test script checks the database state. When both tools work in sync, teams catch UI bugs and data bugs fast. How Firestore and Selenium share login keys and data A test runner needs two paths to test a full web app. First
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams pair Firestore and Selenium to test web apps against real document data. Selenium drives the browser while Firestore stores the state that each test checks.
This setup lets engineers seed test data before a browser run starts. After the browser finishes an action, the test script checks the database state. When both tools work in sync, teams catch UI bugs and data bugs fast.
How Firestore and Selenium share login keys and data
A test runner needs two paths to test a full web app. First, Selenium opens a browser and acts like a real user on the page. Second, the test runner talks to Firestore to set up or clean up records.
The browser app uses client rules to read and write allowed user documents. The test runner often uses a cloud service role with broader rights. That role lets the script insert fresh records before Selenium clicks a button.
Once the browser step finishes, the test script reads the document back. It checks that the web app wrote the right fields to the collection. Then the runner deletes the test records so the next run starts clean.
Teams also use Firestore to store test results and run logs. Each Selenium node can write pass or fail notes to a shared collection. This helps engineers see which browser step broke during a long test suite.
Common risks when linking browser tests to cloud data
Many teams take shortcuts when they set up database keys for test runners. They put one broad service key into every test job and developer laptop. If that key leaks, anyone can read or wipe collections across the project.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Shared service roles also ruin audit logs during a test run. When ten test workers use one identity, logs show the same account name. You cannot tell which test job or engineer changed a sensitive document.
Another common bug happens when tests run against live data by mistake. A stray Selenium script can overwrite real user emails or phone numbers. Without strict role limits, a cleanup script might delete a whole collection.
How to scope roles and network paths for test runs
Start by keeping test collections separate from live production collections at all times. Give your Selenium runner a narrow cloud role that only touches test data. Never grant full project admin rights to a browser test script.
Use local emulators for early checks on developer laptops whenever you can. Save real cloud database runs for staging jobs that need full cloud checks. When staging jobs run, map each test worker to a distinct role.
Lock down network paths so only approved test runners reach your staging database. Rotate keys often and drop long-lived key files from your code repos. If test data holds emails, phone numbers, or card numbers, mask those fields. Data masking rewrites matched fields in results before they reach test logs.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Should Selenium scripts read Firestore directly during a test?
Yes, scripts often read documents to check that a browser action worked. Keep those reads limited to a dedicated test project with narrow role rights.
How do we stop parallel Selenium tests from breaking each other?
Give each parallel test worker its own unique document prefix or collection. This stops one browser test from deleting records that another test still needs.
How can we protect sensitive fields in staging test data?
Use synthetic data for most browser tests instead of real user records. When staging data contains emails or phone numbers, apply masking to rewrite matched fields.
Related guides
In this post