How to Fix Missing Cypress Screenshots and Videos in Azure Pipelines
Find missing Cypress screenshots and videos in Azure Pipelines by checking generation, paths, cleanup, and artifact publication in order.

Cypress screenshots are created locally but missing from Azure Pipelines when one of four layers breaks: Cypress does not generate the file, the file is written somewhere else, the workspace is cleaned or the failed step prevents publication, or Azure publishes the wrong path. Check those layers in that order.
During cypress run, Cypress captures a screenshot when a test fails unless screenshotOnRunFailure is disabled. Videos are disabled by default; enable video: true. Cypress writes screenshots to cypress/screenshots and videos to cypress/videos unless you configure different folders. Azure must then publish the real directory with a task such as PublishPipelineArtifact@1. Cypress screenshot behavior, Cypress configuration and Microsoft’s artifact task documentation describe these defaults and requirements.
1. Confirm Cypress generated the files
Put a directory listing immediately after the Cypress command. This separates a Cypress problem from an Azure publication problem.

- script: |
npx cypress run
echo "Generated Cypress assets:"
find cypress/screenshots cypress/videos -type f -print 2>/dev/null || true
displayName: Run Cypress and list assets
If both directories are empty, stay in Cypress configuration and execution until a file appears. If files exist, skip to the publication checks.
What should generate each asset?
| Asset | When it is generated | Default location |
|---|---|---|
| Failure screenshot | A failed test during cypress run, when screenshotOnRunFailure is true |
cypress/screenshots |
| Manual screenshot | A test calls cy.screenshot() in either open or run mode |
cypress/screenshots |
| Video | Each spec during cypress run when video: true |
cypress/videos |
cypress open does not record videos. A passing test also does not create an automatic failure screenshot, so an empty screenshots folder can be expected when no manual screenshot is requested and all tests pass.
2. Make the effective Cypress configuration explicit
Use this minimal configuration in cypress.config.ts (the same properties work in cypress.config.js):
import { defineConfig } from 'cypress'
export default defineConfig({
video: true,
screenshotOnRunFailure: true,
screenshotsFolder: 'cypress/screenshots',
videosFolder: 'cypress/videos',
trashAssetsBeforeRuns: true,
})
These are the normal defaults, written explicitly so a CI change is visible in code review. Check the following settings and any environment-specific overrides:
video: must betruefor videos.screenshotOnRunFailure: must betruefor automatic failure screenshots.screenshotsFolderandvideosFolder: Azure must publish these actual paths, including any absolute or workspace-relative customization.trashAssetsBeforeRuns: defaults totrue, so files from an earlier run are deleted before the current run.
Do not use an old file as proof that the current run generated an asset. List the workspace after the current cypress run.
3. Account for spec-relative paths
Cypress mirrors the spec structure below the asset folders. A screenshot may therefore be deeper than cypress/screenshots, and a video is normally one file per spec. Print all descendants instead of checking one guessed filename.
find "${SYSTEM_DEFAULT_WORKINGDIRECTORY:-$PWD}/cypress" -type f \( -name '*.png' -o -name '*.jpg' -o -name '*.jpeg' -o -name '*.mp4' \) -print
For programmatic logging, Cypress exposes resolved paths through the after:screenshot and after:spec Node events. Log those paths when custom folders, parallel jobs or generated spec names make the directory layout hard to predict.
4. Ensure Azure reaches the publication step
A failing Cypress command normally returns a nonzero exit code. Azure may stop the job before the artifact task runs. Configure the publication step to run under your pipeline’s failure policy, commonly with condition: always():
- script: npx cypress run
displayName: Run Cypress
- script: |
echo "Screenshots:"
find "$(System.DefaultWorkingDirectory)/cypress/screenshots" -type f -print 2>/dev/null || true
echo "Videos:"
find "$(System.DefaultWorkingDirectory)/cypress/videos" -type f -print 2>/dev/null || true
displayName: Inspect Cypress assets
condition: always()
- task: PublishPipelineArtifact@1
displayName: Publish Cypress screenshots and videos
condition: always()
inputs:
targetPath: '$(System.DefaultWorkingDirectory)/cypress'
artifact: cypress-assets
publishLocation: pipeline
The task needs a real file or directory in targetPath. Wildcards are not supported there. You can publish each folder separately:
- task: PublishPipelineArtifact@1
displayName: Publish screenshots
condition: always()
inputs:
targetPath: '$(System.DefaultWorkingDirectory)/cypress/screenshots'
artifact: cypress-screenshots
publishLocation: pipeline
- task: PublishPipelineArtifact@1
displayName: Publish videos
condition: always()
inputs:
targetPath: '$(System.DefaultWorkingDirectory)/cypress/videos'
artifact: cypress-videos
publishLocation: pipeline
If a directory might not exist, create it before publication or use a script to report the missing directory clearly. Publishing the parent cypress directory is usually simpler because it preserves both subdirectories.
5. Verify the artifact in Azure
- Open the completed pipeline run.
- Open the Summary tab.
- Select
cypress-assets(or the separate artifact name). - Confirm the expected PNG, JPEG or MP4 files are present.
- If the artifact is absent, read the publication task log for its resolved
targetPathand access errors.
PublishPipelineArtifact@1 is supported on Azure DevOps Services. Microsoft documents Publish Build Artifacts for Azure DevOps Server/TFS 2018 scenarios; use the task supported by the platform hosting your agent.
6. A complete Azure Pipelines example
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: '20.x'
displayName: Use Node.js
- script: npm ci
displayName: Install dependencies
- script: npx cypress install
displayName: Install Cypress binary
- script: npx cypress run
displayName: Run Cypress
- script: |
echo "Workspace: $(System.DefaultWorkingDirectory)"
echo "Screenshots:"
find "$(System.DefaultWorkingDirectory)/cypress/screenshots" -type f -print 2>/dev/null || true
echo "Videos:"
find "$(System.DefaultWorkingDirectory)/cypress/videos" -type f -print 2>/dev/null || true
displayName: Inspect generated assets
condition: always()
- task: PublishPipelineArtifact@1
displayName: Publish Cypress assets
condition: always()
inputs:
targetPath: '$(System.DefaultWorkingDirectory)/cypress'
artifact: cypress-assets
publishLocation: pipeline
7. Troubleshooting missing screenshots and videos
| Symptom | Likely cause | Fix |
|---|---|---|
| Both folders are empty | Command used cypress open, tests passed without cy.screenshot(), or folders were customized |
Run npx cypress run, enable failure screenshots, set video: true, and inspect configured paths. |
| Screenshots exist but no videos | Video recording is disabled | Set video: true; videos are recorded per spec only during cypress run. |
| Old files disappear | trashAssetsBeforeRuns: true |
Inspect immediately after the current run or set cleanup deliberately for your workflow. |
| Files appear locally but not in CI | Different config, working directory or environment variable in CI | Print the effective folders and pwd; use absolute paths based on $(System.DefaultWorkingDirectory). |
| Azure task says path does not exist | targetPath is wrong or contains a wildcard |
List the directory, then pass the existing directory without a glob. |
| No artifact after a failed test | Publication step was skipped after cypress run failed |
Add condition: always() to inspection and publication steps. |
| Video is present but unusable | CI resource constraints can pause recording or drop frames | Review agent CPU, memory and parallelism; distinguish a degraded video from a missing file. |
| Cypress binary errors before tests | Binary was not installed or cache is unavailable | Run npx cypress cache path and npx cypress cache list; install the binary in the job. |
| Azure DevOps Server rejects the task | Pipeline Artifact task support differs from Azure DevOps Services | Use the server-supported Build Artifacts task. |
8. Cypress Cloud versus Azure Pipeline Artifacts
These are separate storage paths. With --record, Cypress can process and upload videos to Cypress Cloud after each spec. Azure Pipeline Artifacts require your job to publish a local directory. Compare them on storage location, retention and access controls, links to a specific test or spec, and whether your pipeline must maintain publication paths. Deleting a video before Cypress Cloud finishes also prevents that Cloud upload.
9. Performance, reliability and cost considerations
- Video recording increases disk use and upload time; publish only the folders and runs your team needs.
- Publishing one parent directory preserves structure and uses one task; separate artifacts can make permissions or retention easier to manage.
- Keep the inspection step because it makes path failures visible without rerunning the whole pipeline.
- Use deterministic Node and Cypress installation in CI so a missing binary is not confused with missing output.
- Artifact retention, access and storage charges are controlled by your Azure organization and project policies.
10. Or skip the browser setup
If you need a screenshot service for pages outside the Cypress test run, ScreenshotNeo provides a single GET request that returns PNG, JPEG, WebP or PDF. Before capture it accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report the page verdict and billing status.

See the ScreenshotNeo API documentation for all options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo also supports full-page and element captures, device presets, retina scale, custom CSS and JavaScript, waits, request blocking, headers, cookies, geolocation, caching, signed links, asynchronous jobs, bulk capture and an MCP server with take_screenshot, get_page_info and capture_pdf.
1,000 screenshots a month are free with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.
FAQ
Why is my screenshot folder empty when the pipeline passed?
A passing run does not create an automatic failure screenshot. Add cy.screenshot() for a manual capture or test the failure path with cypress run.
Can I publish screenshots and videos with the YAML publish shortcut?
Yes. The shortcut maps to ordinary pipeline artifact publication, but it still needs the actual directory path and does not support a wildcard in place of that path.
Does Cypress record videos in interactive mode?
No. Video recording is for cypress run.
Should I disable asset cleanup?
Usually no. Cleanup prevents stale files from being mistaken for current evidence. Keep it enabled and inspect the current workspace after the run.
Where do I find the published files?
Open the Azure run’s Summary tab and select the artifact name configured in the publication task.


