Skip to content

Commit ffbac56

Browse files
danilsomsikovDevtools-frontend LUCI CQ
authored andcommitted
Postpone resolve interactions VEIDs in e2e tests VE assertions
Bug: 41492400 Change-Id: Id5c13428bb42631b225a199bdb38a2406da4e94a Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6850418 Commit-Queue: Alex Rudenko <[email protected]> Reviewed-by: Alex Rudenko <[email protected]> Auto-Submit: Danil Somsikov <[email protected]>
1 parent 1a213b6 commit ffbac56

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

front_end/ui/visual_logging/Debugging.ts

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,7 @@ export function processEventForTestDebugging(
244244
if (event !== 'SettingAccess' && event !== 'FunctionCall') {
245245
lastImpressionLogEntry = null;
246246
}
247-
maybeLogDebugEvent(
248-
{interaction: `${event}: ${veTestKeys.get(state?.veid || 0) || (state?.veid ? '<UNKNOWN>' : '')}`});
247+
maybeLogDebugEvent({interaction: event, veid: state?.veid || 0});
249248
checkPendingEventExpectation();
250249
}
251250

@@ -312,6 +311,7 @@ type TestLogEntry = {
312311
impressions: string[],
313312
}|{
314313
interaction: string,
314+
veid?: number,
315315
};
316316

317317
export function processImpressionsForDebugging(states: LoggingState[]): void {
@@ -715,7 +715,8 @@ export function processStartLoggingForDebugging(): void {
715715
// Interaction events need to match exactly.
716716
function compareVeEvents(actual: TestLogEntry, expected: TestLogEntry): boolean {
717717
if ('interaction' in expected && 'interaction' in actual) {
718-
return expected.interaction === actual.interaction;
718+
const actualString = formatInteraction(actual);
719+
return expected.interaction === actualString;
719720
}
720721
if ('impressions' in expected && 'impressions' in actual) {
721722
const actualSet = new Set(actual.impressions);
@@ -755,8 +756,26 @@ function formatImpressions(impressions: string[]): string {
755756

756757
const EVENT_EXPECTATION_TIMEOUT = 5000;
757758

759+
function formatInteraction(e: TestLogEntry): string {
760+
if ('interaction' in e) {
761+
if (e.veid !== undefined) {
762+
const key = veTestKeys.get(e.veid) || (e.veid ? '<UNKNOWN>' : '');
763+
return `${e.interaction}: ${key}`;
764+
}
765+
return e.interaction;
766+
}
767+
return '';
768+
}
769+
758770
function formatVeEvents(events: TestLogEntry[]): string {
759-
return events.map(e => 'interaction' in e ? e.interaction : formatImpressions(e.impressions)).join('\n');
771+
return events
772+
.map(e => {
773+
if ('interaction' in e) {
774+
return formatInteraction(e);
775+
}
776+
return formatImpressions(e.impressions);
777+
})
778+
.join('\n');
760779
}
761780

762781
// Verifies that VE events contains all the expected events in given order.
@@ -832,9 +851,7 @@ function checkPendingEventExpectation(): void {
832851

833852
function getUnmatchedVeEvents(): string {
834853
console.error(numMatchedEvents);
835-
return (veDebugEventsLog.slice(numMatchedEvents) as TestLogEntry[])
836-
.map(e => 'interaction' in e ? e.interaction : formatImpressions(e.impressions))
837-
.join('\n');
854+
return formatVeEvents(veDebugEventsLog.slice(numMatchedEvents) as TestLogEntry[]);
838855
}
839856

840857
// @ts-expect-error

0 commit comments

Comments
 (0)