Comments (1)
I ran into this issue as well. I would like to migrate to Storycap from Loki as it seems to be significantly faster, but the large screenshots make comparing changes difficult.
I'm aware of the clip
option, which looks helpful, but it requires hard coded x/y/width/height.
In Loki, they have a chromeSelector
option which they use to automatically determine the clip
dimensions:
In Loki you can provide chromeSelector: "body > *"
which will only capture the component root elements (e.g. React root element plus any React Portals). This means the screenshot is still wide, but only as tall as the rendered component, not the entire body
element.
Perhaps a similar feature could be added to Storycap? Perhaps an option, like clipSelector
?
Storycap already queries the page using the Puppeteer Page API where it specifies the clip
option for the screenshot
call. This could be a convenient place to automatically calculate the value for clip
based on a clipSelector
.
storycap/packages/storycap/src/node/capturing-browser.ts
Lines 460 to 465 in af615c5
In addition to #506, mentioned above, I found a suggestion in #186 to use Jimp to post-process the images, however, using Jimp significantly increases the total build time. If the original screenshot only captured the rendered div/s, that would be really helpful.
from storycap.
Related Issues (20)
- Failed to capture a screenshot for stories with click/focus options: Error: failed to find element matching selector HOT 1
- waitFor leads to timeout with storybook 7 HOT 4
- component triggered by storybook "play" is missing in the captured image
- no npm bin files published at [email protected] HOT 1
- no parsers registered for: "+(Act" when running storycap @storycap4 HOT 2
- sometimes `disable-animation.css` might not applied as expected
- [Question] Why `waitBrowserMetricsStable` before considering `scOpt.skip`? HOT 2
- Navigation timeout of 30000 ms exceeded while waiting for stories definition HOT 1
- cli: -p doesn't work
- Error: failed to find element matching selector inside CapturingBrowser.resetIfTouched() HOT 1
- Error: @storybook/react 7.3.2 withScreenshot in preview.tsx HOT 2
- [Question] Can I use regex in the exclude option? HOT 1
- storybook 7 support? HOT 8
- Unreliable results with more than 1 for `--parallel`
- File separators in viewport keys are treated as file separators in the filesystem
- Chrome Canary processes continue after CLI ends.
- Storybook 8 compatibility HOT 3
- Flaky screenshots with Storybook v7 in GitHub Actions
- The linux() function in find-chrome.ts doesn't check $CHROME_PATH, but an error message incorrectly suggests setting $CHROME_PATH in certain situations.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storycap.