Reducing CI Costs by 60% in Playwright: Artifact Optimization at Scale
CI costs rarely explode all at once.
They creep.
A few extra videos here.
Screenshots on every test there.
Longer retention “just in case.”
One more parallel runner because the suite got slower.
Then one day, someone opens the cloud bill and asks an uncomfortable question:
“Why is our test pipeline costing more than some production services?”
At QAstra, we’ve seen this across startups and large enterprises alike. Playwright is fast, capable, and generous with artifacts — but left unchecked, it can quietly become expensive.
The good news?
Most CI cost bloat isn’t caused by testing more.
It’s caused by keeping too much, for too long, without intention.
This article breaks down how QAstra helps teams cut Playwright CI storage and execution costs by up to 60% — without losing debuggability or confidence.
The Hidden Cost of “Helpful” Artifacts
Playwright makes it easy to collect everything:
- Videos
- Screenshots
- Traces
- Network logs
That’s great — until every test, in every run, across every branch, starts producing artifacts.
Here’s what usually happens:
- Videos are enabled globally “for safety”
- Screenshots are taken on pass andfailure
- Traces are recorded for every test
- CI retention is set to 30–90 days “just in case”
Multiply that by:
- Parallel jobs
- Feature branches
- Nightly runs
- Reruns
And suddenly, storage costs dwarf the value of the artifacts themselves.
The first mindset shift we make at QAstra is simple:
Artifacts are for failures, not for success.
- Rule #1: Stop Recording Videos for Passing Tests
- Rule #2: Screenshots Are Evidence, Not Documentation
- Rule #3: Traces Are Powerful — Treat Them Like Gold
- Rule #4: Retention Policies Matter More Than People Think
- Rule #5: Don’t Store What You Can Reproduce
- Rule #6: Parallelism Without Planning Gets Expensive Fast
- Rule #7: Compress What You Must Keep
Videos feel reassuring.
They’re also one of the biggest cost drivers.
The Anti-Pattern We See Everywhere
use: {
video: ‘on’,
}
This records every test, even the boring, stable ones that pass 99.9% of the time.
In large suites, this alone can account for 40–50% of CI storage usage.
QAstra’s Default
use: {
video: ‘retain-on-failure’,
}
Here’s the reality:
- No one watches videos of passing tests
- Engineers open videos only when something breaks
- Failures are the minority (or they should be)
This single change often cuts artifact size almost in half.
Screenshots are useful — but only at the right moment.
Common Mistake
use: {
screenshot: ‘on’,
}
This captures screenshots for every test step, whether needed or not.
QAstra’s Approach
use: {
screenshot: ‘only-on-failure’,
}
If a test fails, you get:
- The final UI state
- Enough visual context to debug
- Zero noise for passing runs
If a test passes, there’s nothing to investigate — and nothing to store.
Playwright traces are incredibly useful.
They’re also large.
A full trace includes:
- DOM snapshots
- Network activity
- Screenshots per step
- Console logs
Recording traces for everything is like recording flight data for a plane that landed safely.
Anti-Pattern
use: {
trace: ‘on’,
}
QAstra’s Standard
use: {
trace: ‘retain-on-failure’,
}
And sometimes even more selectively:
use: {
trace: process.env.CI ? ‘retain-on-failure’ : ‘on’,
}
Local debugging? Record everything.
CI at scale? Be selective.
Even well-configured artifacts become expensive if they’re kept forever.
One of the most overlooked cost drivers is artifact retention at the CI platform level.
What We Commonly See
- GitHub Actions artifacts kept for 90 days
- Azure DevOps pipelines with default retention
- No differentiation between branches
QAstra’s Recommendation
- PR / feature branches:3–7 days
- Main branch:7–14 days
- Release runs:longer if required (compliance-driven)
Artifacts are debugging tools, not archives.
If a failure hasn’t been looked at in two weeks, it probably never will be.
Another subtle cost issue: storing artifacts for failures that are easy to reproduce locally.
At QAstra, we ask:
- Is this failure environment-specific?
- Or is it deterministic and reproducible?
If it’s deterministic, the trace is useful once, not forever.
We often advise teams to:
- Download the artifact
- Fix the issue
- Let CI retention clean it up naturally
Long-term storage should be the exception, not the rule.
Parallel execution saves time — but it increases artifact volume linearly.
10 parallel jobs = 10× artifacts.
That doesn’t mean you shouldn’t parallelize.
It means you should optimize artifacts first, then scale runners.
QAstra typically:
- Tunes artifact settings first
- Measures average artifact size per run
- Then increases parallelism with confidence
Otherwise, teams accidentally trade time savings for massive storage bills.
In some environments (regulated, audit-heavy), artifacts must be retained.
In those cases, compression matters.
For example:
- Videos can often be compressed by 50–70%
- Traces can be zipped aggressively
- Screenshots can be downscaled slightly without losing value
This is rarely handled by default tooling — but it’s worth the effort at scale.
What “60% Cost Reduction” Actually Looked Like
In one QAstra engagement (anonymized):
- ~1,200 Playwright tests
- 8 parallel CI jobs
- Videos + screenshots + traces always on
- 30-day retention
After optimization:
- Videos only on failure
- Screenshots only on failure
- Traces only on failure
- Retention reduced to 10 days for PRs
Result:
- ~60% reduction in artifact storage
- Faster CI uploads
- No loss in debuggability
- Higher trust in failures (less noise)
Nothing magical.
Just intentional design.
Final Thought
CI costs don’t explode because teams test too much.
They explode because nobody owns the cost of “helpful defaults.”
Playwright gives you incredible observability — but it assumes you’ll be thoughtful about how you use it.
At QAstra, we treat artifact strategy as part of test architecture, not an afterthought.
Because the cheapest pipeline isn’t the one with no artifacts — it’s the one with only the artifacts that matter.
Want to Optimize Your Playwright CI Without Losing Visibility?
At QAstra Technologies, we help teams scale Playwright responsibly — faster pipelines, lower CI costs, and test suites engineers actually trust.
If your CI bill is creeping up or your artifacts feel out of control, we’d be happy to help you tighten things up.