ScreenshotManager class

Manages screenshot capture for browser tests, including automatic capture on failures.

This class handles the creation of screenshot directories, generation of unique filenames, and the actual capture and saving of screenshots from WebDriver instances.

Constructors

ScreenshotManager({required String screenshotDirectory, bool autoScreenshots = false})
Creates a new ScreenshotManager instance.
const

Properties

autoScreenshots bool
Whether automatic screenshots are enabled.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
screenshotDirectory String
The directory where screenshots should be saved.
final

Methods

captureFailureScreenshot(dynamic driver, {String? action, String? selector, String? testName}) Future<String?>
Captures a failure screenshot with a descriptive name based on the error context.
captureFailureScreenshotSync(dynamic driver, {String? action, String? selector, String? testName}) String?
Synchronous version of captureFailureScreenshot.
captureScreenshot(dynamic driver, {String? name, String? context}) Future<String?>
Captures a screenshot from the given WebDriver instance and saves it to a file.
captureScreenshotSync(dynamic driver, {String? name, String? context}) String?
Captures a screenshot synchronously from the given WebDriver instance.
cleanupOldScreenshots({Duration maxAge = const Duration(days: 7)}) → void
Cleans up old screenshot files to prevent disk space issues.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited