The Simplest Way to Make Pulumi and Selenium Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use pulumi and selenium to build cloud servers and test web apps right away. Pulumi sets up the cloud resources, and Selenium runs browser tests against the new app. This pair turns slow manual testing into a fast automated workflow. Your code spins up a fresh test site, checks every page, and tears it down. Engineers find bugs before any bad code reaches real users. How pulumi and selenium share roles and data A good test run needs a clear handoff between your cloud setup and your bro

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 use pulumi and selenium to build cloud servers and test web apps right away. Pulumi sets up the cloud resources, and Selenium runs browser tests against the new app.

This pair turns slow manual testing into a fast automated workflow. Your code spins up a fresh test site, checks every page, and tears it down. Engineers find bugs before any bad code reaches real users.

How pulumi and selenium share roles and data

A good test run needs a clear handoff between your cloud setup and your browser. Pulumi runs first and creates the web servers, databases, and network rules. When the setup finishes, Pulumi writes out the new site address and test state. Your pipeline reads those outputs and passes them straight to the Selenium test runner.

Identity and permissions matter at every step of this handoff. Pulumi needs cloud roles that can create and delete servers for the test run. Selenium needs a way to log in to the web app as a test user. Teams should keep these two sets of permissions separate at all times. Your browser tests should never hold the keys to your cloud account.

Data flows from the cloud tool to the test runner in a clean loop. Pulumi outputs the app URL, and Selenium opens that URL in a headless browser. The browser clicks buttons, fills out forms, and checks that the app works right. When the tests finish, the pipeline tells Pulumi to delete the temporary resources.

Common failure modes and how to fix them

Many teams hit trouble when they rush the link between these two tools. A common mistake is using one big shared service account for the whole pipeline. If a test script leaks that wide token, an attacker can control your cloud. Teams also hardcode test passwords inside browser scripts, which puts secrets in code repos.

Unlogged database queries and hidden test actions create another big problem for teams. When a browser test fails, engineers need to know what the app did behind the scenes. If all tests use one shared login, the logs will not show which test failed. You also risk leaking real user data if tests run against a copy of production. Data masking can help here by rewriting emails, phone numbers, and card numbers in results.

Pulumi Policy as Code + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix these risks by scoping roles and network paths between the two systems. Give Pulumi a narrow role that only touches resources inside your test account. Give Selenium a separate test user login that only works for a single test run. Lock down the network so only the test runner can reach the temporary web app. Put clear logs on the app and database so you can trace every test step.

Keeping test runs fast and clean at scale

As your team grows, you will run many cloud stacks and browser tests at once. If two pipelines share the same cloud state or test database, tests will break. One test might delete a user record while another test tries to read it.

Give each pull request its own isolated stack and its own test database. Let Pulumi name each stack after the branch so resources never clash. When Selenium runs against a dedicated stack, every browser check stays clean and predictable. Clean up old stacks on a schedule so failed runs do not waste cloud money.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Should Pulumi run Selenium tests directly inside the deployment code?

No, keep cloud setup and browser testing as two separate steps in your pipeline. Let Pulumi finish creating the app first, then pass the output URL to Selenium.

How do we pass web app secrets to Selenium without putting them in code?

Store test user credentials in a secret manager during the cloud setup step. Have your pipeline fetch those secrets at runtime and pass them into the test runner.

What happens if a Selenium test fails before the cloud stack is deleted?

Set up your pipeline to run a cleanup step even when the test step fails. That rule saves cloud costs by deleting temporary servers after every single test run.

The query runs. The emails stay hidden.