To test a web application that integrates with Salesforce, run the app in a controlled test environment, set Cypress’s e2e.baseUrl to that app, and use a dedicated Salesforce Developer Edition org or development sandbox for authenticated API work. Use Cypress browser tests for user-visible journeys, cy.request() for API setup and checks, and cy.origin() when a test must interact with a second origin during OAuth or SSO. This recipe is for applications your team controls; it is not a universal way to test every Salesforce-hosted interface.
Choose the Salesforce surface you are testing
“Salesforce testing” can mean several different things, and the right Cypress setup depends on which one applies:
As an Amazon Associate I earn from qualifying purchases.
- A custom web app that calls Salesforce APIs: run Cypress against your app and use authenticated API requests or controlled test endpoints to prepare and verify data.
- An app that logs users in through Salesforce OAuth or SSO: test the redirect and login journey where that behavior matters, and handle commands on a second origin with
cy.origin(). - A Salesforce-hosted or platform-specific UI: check the tooling documented for that exact surface. Salesforce’s current Multi-Framework guide describes React/Angular unit-test tooling and Playwright E2E templates for its UI bundles, not Cypress. Salesforce Multi-Framework testing should not be generalized to all Salesforce applications.
Cypress’s own guidance is aimed at testing applications you build and control, not using Cypress as general-purpose automation for arbitrary external sites. See its E2E testing guidance.
Configure the application and Salesforce test org
- Start the application outside Cypress. Run the app server separately, then configure the Cypress E2E
baseUrlto the local or controlled test deployment. Visit relative paths such as/loginin tests. Cypress recommends starting the server separately rather than starting it inside a test script. See Cypress E2E testing. - Use a development org. Use a Salesforce Developer Edition org or development sandbox for test API access. Salesforce’s REST API quick start documents a CLI-based flow that logs in to an org and provides an access token and instance URL. For a sandbox, use the sandbox login and resulting instance context.
- Keep the two URL roles separate. Cypress
baseUrlis the web application Cypress visits. Salesforce REST requests go to the Salesforce org’s instance URL and require Salesforce authentication. Do not use the app’s base URL as though it were the Salesforce API host. - Choose an OAuth flow for your app and org. The correct flow and client setup depend on application type and Salesforce org configuration. Salesforce’s OAuth documentation explains the available approaches; do not copy a client-app or flow setup without checking that it is permitted for your environment. Treat access and refresh tokens as secrets and keep credentials out of source control.
Use UI tests and API requests for different jobs
Use browser E2E tests for user-visible behavior
Use a small set of browser tests for behavior that only a browser journey can establish: whether login redirects correctly, whether a user can complete an important workflow, and whether the resulting interface communicates the expected outcome. If OAuth or SSO moves the browser to a different origin, wrap commands for that origin in cy.origin(). Cypress requires this for commands on a second origin in a test; it does not support cross-origin iframe automation. Details are in Cypress cross-origin testing.
#1 Best Overall
Use cy.request() for setup, contracts, and persistence checks
cy.request() sends real HTTP requests and can inspect status, body, and headers. It is useful for preparing test data, checking API behavior, validating authorization cases, and confirming that a UI action persisted state on the server. It can use a relative URL when a suitable baseUrl is configured; for Salesforce requests, use the authenticated instance URL instead. See Cypress cy.request().
Salesforce REST requests must be authenticated. Salesforce states in its REST API Developer Guide that an access token obtained through authentication is required to send requests. For authenticated calls, supply the token as a secret and build the request URL from the instance URL returned for the test org. The precise Salesforce endpoint and payload depend on the API operation and org configuration; avoid hard-coding a production org or credentials into a Cypress test.
Make test state repeatable
- Seed or reset data with supported test endpoints or Node-side
cy.task()functions, rather than depending on leftover records or a sequence of fragile UI setup steps. - Keep a small number of tests that exercise the login UI when the login flow itself is under test. For the rest, a reusable login command and
cy.session()can cache browser context; verify the cached session so stale authentication does not silently invalidate later tests. Cypress describes these patterns in its E2E testing guide. - Separate UI-created state from API- or task-seeded state according to the test’s purpose: create state through the interface when that workflow is what you are testing; seed it directly when the test concerns a later step.
- Keep org data and configuration controlled. Tests against services or orgs your team does not control can be brittle, blocked, or affected by changes outside the test suite.
Decide where each check belongs
| Decision | Option | Best fit |
|---|---|---|
| Authentication | UI-driven OAuth or login redirect | Validating the user-facing login and redirect journey. |
| Authentication | Programmatic token-based setup | Efficiently preparing authenticated state, provided the OAuth flow and client are supported by the org. |
| Test layer | Browser E2E | High-value user journeys and visible outcomes. |
| Test layer | Direct API request with cy.request() |
API contracts, setup, permissions, and server-side persistence checks. |
| Environment | Developer Edition org | A dedicated development org for controlled test access and configuration. |
| Environment | Development sandbox | A test environment aligned with the team’s Salesforce setup and data policy. |
| State setup | UI creates state | When creating that state is part of the user workflow being tested. |
| State setup | API or task seeds state | When repeatable setup and focused checks matter more than testing state creation through the UI. |
The Salesforce quick-start workflow supports a Developer Edition org or development sandbox; choose based on access, isolation, data policy, and org configuration rather than assuming one environment fits every team.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #2
Troubleshoot common setup failures
Cypress visits the wrong site or cannot resolve a relative path
Check that the application server is running and that e2e.baseUrl points to the application under test. Use relative paths for app pages only after that is set. A Salesforce instance URL belongs in Salesforce API requests, not in the app’s baseUrl.
Salesforce API requests return an authentication error
Confirm that the request uses a valid access token for the selected org and the matching instance URL. Re-authenticate through the flow supported by the application and org, and ensure secrets are injected securely rather than committed in test files.
A redirect test fails after leaving the app’s origin
Commands interacting with the second origin need to be inside cy.origin(). If the desired behavior is inside a cross-origin iframe, Cypress does not support that automation; redesign the test around a supported integration boundary or another test strategy.
Tests pass alone but fail in a suite
Look for shared or stale org data, order-dependent setup, and expired cached browser sessions. Seed/reset state deterministically and validate the session cached by cy.session().
Tests are flaky against an external Salesforce surface
Make sure the test target is an app or org your team controls and is intended for automation. External pages, org policies, login requirements, and data changes can make a test unstable or prevent it from running.
Or skip the browser setup
If your immediate need is a screenshot of a page rather than an interactive Salesforce test, ScreenshotNeo is a website screenshot API and MCP server. A single request can return an image or PDF; its cleanup steps accept cookie banners and remove supported consent platforms, newsletter popups, and chat widgets before capture. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, with response headers identifying the page verdict and billing status. Its MCP server exposes screenshot, page-info, and PDF tools for AI agents.
For a quick capture, use the API key from your account and replace the target URL as needed. See the ScreenshotNeo documentation.
Rank #4
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for free.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsVersion and documentation notes
Cypress’s E2E documentation reported “Last updated on Sep 20, 2026” when checked on Oct 3, 2026 UTC. The cited Salesforce pages present current official guidance but do not state a publication or version date in the reviewed page content. OAuth flows, org policy, and tooling can change, so verify documentation against the Cypress version and Salesforce org configuration used by your project.
Frequently Asked Questions
Does Cypress have a Salesforce-specific plugin or one universal Salesforce test setup?
The documented approach depends on whether you are testing a custom app, an OAuth journey, or a particular Salesforce UI surface; Salesforce’s Multi-Framework UI bundle guidance documents different test tooling.
Best Value
Can Cypress test Salesforce login redirects across domains?
Yes, for supported browser interactions, use `cy.origin()` for commands on the second origin. Cypress does not support cross-origin iframe automation.
Does setting Cypress `baseUrl` authenticate Salesforce API calls?
No. It identifies the web app Cypress visits. Salesforce REST requests need their own org instance URL and authenticated access token.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




