Prompt

How do I run end-to-end tests locally and in the cloud with the same suite

Technology / Testing & QA1 observationLast seen Oct 27, 2026

Latest observation

Oct 27, 2026OpenAI APIWeb search: off

To run the same end-to-end test suite locally and in the cloud, the key is to make the tests environment-agnostic and drive everything through config.

Recommended approach

1) Keep one test suite

Write one set of E2E tests that targets your app through a base URL or environment config.

Example:

  • BASE_URL=http://localhost:3000 for local
  • BASE_URL=https://staging.yourapp.com for cloud

Your tests should not care where the app is running, only that they can reach it.


2) Parameterize environment-specific values

Use environment variables for:

  • BASE_URL
  • test credentials
  • feature flags
  • API endpoints
  • browser settings

Example:

BASE_URL=http://localhost:3000 npm test
BASE_URL=https://staging.example.com npm test

In test code, read from config:

const baseUrl = process.env.BASE_URL;

3) Separate test data from test logic

Avoid hardcoding:

  • usernames/passwords
  • account IDs
  • mock data
  • emails

Instead, inject them via:

  • env vars
  • fixtures
  • seeded test accounts
  • test data factories

This keeps the suite reusable in any environment.


4) Use the same runner everywhere

Pick one test framework and use it both locally and in CI/cloud:

  • Playwright
  • Cypress
  • WebdriverIO
  • Selenium
  • TestCafe

For example, Playwright works well with both local and cloud execution.


5) Make browser execution configurable

Run locally:

  • headed or headless browser on your machine

Run in cloud:

  • headless browsers in CI
  • or on a cloud provider’s test grid

Example config options:

  • browser: chromium/firefox/webkit
  • headless: true/false
  • retries: on in CI, off locally
  • video/screenshot capture: on in CI

Typical setup pattern

Package scripts

{
  "scripts": {
    "test:e2e:local": "BASE_URL=http://localhost:3000 playwright test",
    "test:e2e:staging": "BASE_URL=https://staging.example.com playwright test",
    "test:e2e:ci": "playwright test"
  }
}

Test config

// playwright.config.js
module.exports = {
  use: {
    baseURL: process.env.BASE_URL || 'http://localhost:3000'
  }
};

Test example

import { test, expect } from '@playwright/test';

test('login works', async ({ page }) => {
  await page.goto('/');
  await page.getByLabel('Email').fill(process.env.TEST_EMAIL);
  await page.getByLabel('Password').fill(process.env.TEST_PASSWORD);
  await page.getByRole('button', { name: 'Sign in' }).click();
  await expect(page).toHaveURL(/dashboard/);
});

If you mean “cloud” as a browser testing service

You can still use the same suite with only config changes, for example:

  • BrowserStack
  • Sauce Labs
  • LambdaTest
  • Azure DevOps hosted agents
  • GitHub Actions / GitLab CI / CircleCI

The idea is:

  1. same tests
  2. different BASE_URL
  3. different browser capability config
  4. same assertions

Best practices

  • Use stable selectors like data-testid
  • Avoid relying on timing; use explicit waits/assertions
  • Seed/reset test data before each run
  • Keep tests independent
  • Run the same suite in CI on every merge request
  • Add a small local subset for fast feedback if needed, but keep the full suite identical

Simple mental model

Think of it as:

Test code = same
Environment config = different

That’s the cleanest way to run E2E tests locally and in the cloud with one suite.

If you want, I can show you:

  1. a Playwright example,
  2. a Cypress example, or
  3. a GitHub Actions + cloud grid setup.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.