Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use local paths for screenshot images #95

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 7 additions & 4 deletions lib/src/timeline/html/print_html.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,27 @@ extension HtmlTimelinePrinter on Timeline {
spotTempDir.deleteSync(recursive: true);
}
spotTempDir.createSync(recursive: true);
final screenshotsDir = spotTempDir.directory('screenshots');

const screenshotsDirName = 'screenshots';
final screenshotsDir = spotTempDir.directory(screenshotsDirName);
screenshotsDir.createSync(recursive: true);

final events = spotTempDir.file('events.json');
final jsonTimelineEvents = this.events.map((e) {
// save screenshots relative to the events.json file in screenshots/
File? screenshotFile;
if (e.screenshot != null) {
final name = e.screenshot!.file.name;
screenshotFile = screenshotsDir.file(name);
final screenshotFile = screenshotsDir.file(name);
screenshotFile.writeAsBytesSync(e.screenshot!.file.readAsBytesSync());
}

return x.TimelineEvent(
eventType: e.eventType.label,
details: e.details,
timestamp: e.timestamp.toIso8601String(),
screenshotUrl: screenshotFile?.path,
screenshotUrl: e.screenshot != null
? './$screenshotsDirName/${e.screenshot!.file.name}'
: null,
color: e.color == flt.Colors.grey
? null
// ignore: deprecated_member_use
Expand Down
3 changes: 2 additions & 1 deletion lib/src/timeline/html/render_timeline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ Future<String> renderTimelineWithJaspr(
timelineEvents: events,
),
),
standalone: true,
);

return html;
return '<!DOCTYPE html>\n$html';
}

/// Returns the test name including the group hierarchy.
Expand Down
1 change: 0 additions & 1 deletion lib/src/timeline/html/sources/script.js.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
sdk: flutter
integration_test:
sdk: flutter
jaspr: ^0.15.1
jaspr: ^0.15.2
meta: ^1.8.0
nanoid2: ^2.0.0
stack_trace: ^1.11.0
Expand Down