Docker
Stoobly Scaffold Docker Runtime E2E Testing - Questions & Answers
This document covers Docker-specific E2E testing customization options for Stoobly scaffold. For general E2E testing topics, see README.md. For local runtime E2E testing, see local.md.
Docker Plugin Support
Q: What files are created when I use the --plugin option with Docker runtime?
A: When you specify a plugin with Docker runtime, Stoobly creates a custom Dockerfile and entrypoint script in the entrypoint/test/ directory specifically configured for that E2E framework.
Files created for Playwright:
.stoobly/services/entrypoint/test/.Dockerfile.playwright- Stoobly-maintained base image that pulls in the stock Playwright image (override viaPLAYWRIGHT_IMAGE).stoobly/services/entrypoint/test/.entrypoint.sh- Entrypoint script with CA certificate setup.stoobly/services/entrypoint/test/docker-compose.yml- Docker compose configuration.stoobly/services/entrypoint/test/configure- Stoobly configuration script.stoobly/services/entrypoint/test/init- Initialization script
Files created for Cypress:
.stoobly/services/entrypoint/test/.Dockerfile.cypress- Stoobly-maintained base image that pulls in the stock Cypress image (override viaCYPRESS_IMAGE).stoobly/services/entrypoint/test/docker-compose.yml- Docker compose configuration.stoobly/services/entrypoint/test/configure- Stoobly configuration script.stoobly/services/entrypoint/test/init- Initialization script
Docker Initial Setup
Q: How do I create a scaffold script for Docker E2E testing?
A: Create a shell script with only the scaffold creation commands. Include workflow commands as commented examples for reference.
Example:
Q: How do I scaffold an app for Playwright E2E testing with Docker?
A: Create an app with the --plugin playwright option and --runtime docker to set up Playwright-specific configurations.
Example:
Q: How do I scaffold an app for Cypress E2E testing with Docker?
A: Create an app with the --plugin cypress option and --runtime docker to set up Cypress-specific configurations.
Example:
Docker Configuration Files
Q: What files should I modify to add my Playwright tests with Docker?
A: After scaffolding, you need to modify the entrypoint service docker-compose.yml to run your tests, the configure script to set up Stoobly rules, and your Playwright configuration to use the proxy. The example below shows how you would override the Stoobly-managed entrypoint.playwright service definition—only do this when you need additional customizations.
Example - Modify docker-compose.yml:
Example - Modify configure script:
Example - Create Playwright config:
Q: What files should I modify to add my Cypress tests with Docker?
A: For Cypress, modify the entrypoint service docker-compose.yml and Cypress configuration to work with Stoobly's proxy. As with Playwright, the example below overrides the managed entrypoint.cypress service definition—only override it when you need custom behavior.
Example - Modify docker-compose.yml:
Example - Create Cypress config:
Q: How do I add custom npm packages for my Docker tests?
A: Don't edit the Stoobly-maintained Dockerfiles (files beginning with a dot). Instead, point PLAYWRIGHT_IMAGE or CYPRESS_IMAGE at a custom image that already includes your dependencies.
Build those images however you like (e.g., start from mcr.microsoft.com/playwright or cypress/included and add packages), then reference them with the environment variable. Stoobly will use your custom image without touching the managed .Dockerfile.* files.
Q: How do I pass environment variables to my Docker tests?
A: Add environment variables in the docker-compose.yml file under the environment section.
Example:
Running Docker E2E Tests
Q: How do I record E2E test traffic with Docker?
A: Use the record workflow to capture all HTTP requests made during your E2E tests.
Example:
Q: How do I run E2E tests with mocked responses using Docker?
A: Use the mock workflow to run tests against recorded responses without hitting real APIs.
Example:
Q: How do I run E2E tests with response validation using Docker?
A: Use the test workflow to validate that responses match expected results.
Example:
Q: How do I run specific test files or suites with Docker?
A: Modify the command in docker-compose.yml to target specific tests.
Example for Playwright:
Example for Cypress:
Docker Debugging
Q: How do I view test output and logs with Docker?
A: Use the logs command to see test execution output.
Example:
Q: How do I debug failing Docker tests?
A: Enable headed mode and increase logging verbosity in the docker-compose.yml.
Example:
Q: How do I save test artifacts (screenshots, videos) with Docker?
A: Mount an artifacts directory to persist test outputs and configure your test framework to save artifacts.
Example:
Docker Best Practices
Q: Should I record once and mock for all subsequent runs with Docker?
A: Yes, this is the recommended approach for fast, reliable E2E tests that don't depend on external APIs.
Example:
Q: How do I organize E2E tests by feature with Docker?
A: Create separate services or custom workflows for different test suites.
Example:
Docker CI/CD Integration
Q: Which runtime should I use in CI/CD for E2E testing?
A: Docker is recommended for CI/CD as it provides consistent, isolated environments for E2E tests.
Example:
Q: How do I test with Docker runtime in CI/CD?
A: Use Makefile commands in your CI/CD pipeline.
Example:
Q: How do I use the Makefile in CI/CD pipelines?
A: Set all confirmation environment variables to avoid prompts and run the desired workflow commands.
Example:
Q: How do I run workflows in Docker containers for CI/CD?
A: The Makefile automatically handles Docker-based workflows. Ensure Docker is running and accessible.
Example:
Docker Advanced Configuration
Q: How do I mount test fixtures and data with Docker?
A: Add volume mounts to share fixtures between host and container.
Example:
Docker Complete Example
Q: What's a complete example of setting up Playwright E2E tests with Docker?
A: Here's a full example from scaffold to running tests.
Step 1: Scaffold the app
Step 2: Configure entrypoint docker-compose.yml
Step 3: Configure Stoobly rules
Step 4: Create Playwright config
Step 5: Create test
Step 6: Run tests
Last updated
Was this helpful?