Start the app outside Cypress, wait until its URL returns a response, and only then run Cypress. A command such as npm start & npx cypress run can launch the tests before the server is ready; a fixed sleep is less reliable than checking readiness directly.
Use one command to start, check, test, and stop the app
For a typical npm project, Cypress documents using start-server-and-test to manage the sequence. Add scripts like these to package.json, adjusting the server command and port to match your app:
As an Amazon Associate I earn from qualifying purchases.
{
"scripts": {
"start": "my-server -p 3030",
"cy:run": "cypress run",
"test": "start-server-and-test start http://localhost:3030 cy:run"
}
}
Run npm test. The utility starts the server, waits for the supplied URL to return HTTP 200, runs the Cypress command, and shuts down the server afterward. This is a useful default when a single command should own the whole lifecycle. See Cypress’s Continuous Integration guide.
Recommended Free Tools
Choose a startup workflow that fits your setup
Use a wrapper when one command should manage everything
start-server-and-test start http://localhost:3030 cy:run combines startup, URL readiness, test execution, and shutdown. It avoids treating “the process was launched” as proof that the app can serve requests.
#1 Best Overall
Use wait-on when you manage the server process yourself
If your script or CI job already owns the background process, wait for the URL before invoking Cypress:
npm start &
npx wait-on http://localhost:3030
npx cypress run
On a local machine, arrange to stop the background process yourself, for example by retaining its process ID and cleaning it up after the run. CI providers commonly clean up background processes, but local shells may leave the server running. Cypress describes this approach in its CI guide.
Use Cypress GitHub Action startup options in GitHub Actions
The Cypress GitHub Action provides start and wait-on options, so a workflow can start the app and wait for its URL without adding a separate readiness package. Follow the action’s documented configuration for your workflow: Cypress GitHub Action.
Rank #2
Use an explicit GET probe if HEAD does not work
Some servers do not respond to a readiness check made with the HTTP HEAD method. Cypress’s wrapper example supports http-get://localhost:3030 to request the page with GET instead. Choose the probe that matches what the server actually serves.
For local HTTPS, treat certificate bypass as a development workaround
Cypress’s example uses https-get://localhost:3030 with START_SERVER_AND_TEST_INSECURE=1 to allow a local certificate. Keep this scoped to local development; it is not a reason to weaken TLS validation generally.
Separate server readiness from Cypress’s other waits
“The app is ready” can mean several different things. Use the wait that corresponds to the condition you need rather than increasing an unrelated timeout.
Rank #3
Server URL readiness: before Cypress starts
A launched process may still be initializing, binding a port, or failing to serve requests. start-server-and-test, wait-on, or the GitHub Action’s readiness options check the URL before the test command begins. Cypress warns that immediately running tests after backgrounding the server does not guarantee it has booted: CI guide.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →baseUrl reachability: Cypress’s target configuration
Set baseUrl in Cypress configuration to establish the app’s origin. Cypress uses it to prefix relative cy.visit() and cy.request() URLs, opens the test window at that URL, and checks reachability before the run. It does not start the server, so use it alongside external startup orchestration. See Cypress’s best practices, baseUrl guidance, and migration guide.
Browser page load: after cy.visit()
cy.visit() waits for the page’s load event. Cypress’s FAQ documents a default cy.visit() timeout of 60,000 ms. That wait covers navigation and page resources; it does not boot the server before Cypress runs. See Cypress FAQ.
Rank #4
Application initialization: assert a meaningful signal
A page can fire its load event before the application has finished its own initialization. If you control the app, expose a specific signal such as window.appReady and assert it after visiting:
cy.visit('/')
cy.window().should('have.property', 'appReady', true)
This checks application state rather than guessing how many seconds initialization needs. Cypress shows this pattern in its window command documentation.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Selected network requests: intercept and wait for what matters
When a test depends on particular API calls, register intercepts before visiting and wait for those aliases:
cy.intercept('GET', '/api/data').as('data')
cy.visit('/')
cy.wait('@data')
Cypress does not have a general automatic way to know that every arbitrary XHR or Ajax request on a page has finished. Wait for the requests that matter to the test. The distinction is covered in the FAQ.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Avoid common startup patterns that create fragile tests
Do not background the server and immediately run Cypress
npm start & npx cypress run has a race: Cypress may begin before the server can answer requests. Put a URL readiness check between startup and test execution instead.
Do not replace readiness with a fixed sleep
A fixed delay is either unnecessarily long when startup is quick or too short when startup is slow. A URL probe waits for the condition the tests need: the app responding.
Do not use cy.task() or a test hook to own a long-running server
Cypress says tasks must eventually exit. Backgrounding a server from cy.task() makes process access, logs, repeated runs, and port conflicts harder to manage; an after hook is not guaranteed to run. Start the server before Cypress and arrange shutdown after the run. See Cypress best practices.
Troubleshoot readiness failures
- The URL never becomes ready: check the server’s startup output, expected port, and configured URL. Confirm that the app is bound to the host and port being probed.
- The server works in a browser but the check fails: the readiness probe may be using HEAD against a server that only handles GET. For
start-server-and-test, try the documentedhttp-get://form. - Tests start but the app is not initialized: server reachability only proves that the URL responds. Add an app-specific readiness assertion, such as a checked
window.appReadyproperty, or wait for a required API alias. - A local HTTPS check fails on the certificate: use the documented insecure option only for a local development certificate, not as a general TLS setting.
- The port is already in use on a later run: make sure the previous local server was stopped. When managing the process yourself, retain its PID and clean it up after Cypress exits; a lifecycle wrapper can handle shutdown for its managed server.
Keep timeout values tied to the event they measure
Cypress’s FAQ lists a default timeout of 4 seconds for commands generally and 60,000 ms for cy.visit(); the latter is a page-navigation wait, not a server-startup probe. Neither timeout replaces an explicit readiness check. If startup orchestration is slow, investigate server startup and probe behavior rather than extending a browser command timeout to mask the race. See the Cypress FAQ.
Or skip the browser setup
If the task is to capture a site screenshot rather than run browser tests, ScreenshotNeo offers a website screenshot API and MCP server. A single GET request returns a PNG, JPEG, WebP, or PDF; for API details and options, see the ScreenshotNeo documentation.
Quick Recap
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Sign up for ScreenshotNeo’s free plan.
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.




