Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion pkg/pub_integration/lib/src/screenshot_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ extension ScreenshotElementHandleExt on ElementHandle {
final body = await page.$('body');
final bodyClassAttr =
(await body.evaluate('el => el.getAttribute("class")')) as String;
final bodyClasses = bodyClassAttr.split(' ');
final bodyClasses = [
...bodyClassAttr.split(' '),
'-pub-ongoing-screenshot',
];

for (final vp in _viewports.entries) {
await page.setViewport(vp.value);
Expand All @@ -84,10 +87,17 @@ extension ScreenshotElementHandleExt on ElementHandle {
// The presence of the element is verified, continue only if screenshots are enabled.
if (!_isScreenshotDirSet) continue;

// Arbitrary delay in the hope that potential ongoing updates complete.
await Future.delayed(Duration(milliseconds: 500));

final path = p.join(_screenshotDir!, '$prefix-${vp.key}-$theme.png');
await _writeScreenshotToFile(path);
}
}

// restore the original body class attributes
await body.evaluate('(el, v) => el.setAttribute("class", v)',
args: [bodyClassAttr]);
}

Future<void> _writeScreenshotToFile(String path) async {
Expand Down
10 changes: 10 additions & 0 deletions pkg/web_css/lib/src/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -493,3 +493,13 @@ a.-x-ago {
margin-left: 36px;
}
}

.-pub-ongoing-screenshot {
// Disables flashing caret (cursor) in input fields by making it invisible.
caret-color: transparent;

// Instantaneous transitions - no ambiguous delay in the end state.
* {
transition-duration: 0s !important;
}
}
Loading