fix: guard timestamp recording against cross-session contamination
If recording is stopped and restarted inside the same execute() call, the finally block could append an interval from the old recording into the new recording's executionTimestamps. Fix by comparing against the snapshotted recordingStartedAt instead of just checking non-null.
This commit is contained in:
@@ -1050,7 +1050,9 @@ export class PlaywrightExecutor {
|
||||
} finally {
|
||||
// Record timestamp even on error — the execution still occupied real time
|
||||
// that should not be sped up in the demo video.
|
||||
if (recordingStartSnapshot !== null && execStartSec >= 0 && this.recordingStartedAt !== null) {
|
||||
// Compare against snapshot to avoid cross-session contamination if
|
||||
// recording was stopped and restarted inside the same execute() call.
|
||||
if (recordingStartSnapshot !== null && execStartSec >= 0 && this.recordingStartedAt === recordingStartSnapshot) {
|
||||
const execEndSec = (Date.now() - recordingStartSnapshot) / 1000
|
||||
this.executionTimestamps.push({ start: execStartSec, end: execEndSec })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user