Skip to content

Commit 1165662

Browse files
committed
fix: add more logs
1 parent d16a196 commit 1165662

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

test/e2e/helpers/identity/user-storage/userStorageMockttpController.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ export class UserStorageMockttpController {
9191
request: Pick<CompletedRequest, 'path' | 'headers'>,
9292
statusCode: number = 200,
9393
) => {
94+
// #region agent log
95+
console.log(`[SYNC_DEBUG:onGet] path=${path}, url=${request.path}`);
96+
// #endregion
9497
const srpIdentifier = getSrpIdentifierFromHeaders(request.headers);
9598
const internalPathData = this.paths.get(path);
9699

@@ -154,6 +157,9 @@ export class UserStorageMockttpController {
154157
request: Pick<CompletedRequest, 'path' | 'body' | 'headers'>,
155158
statusCode: number = 204,
156159
) => {
160+
// #region agent log
161+
console.log(`[SYNC_DEBUG:onPut] path=${path}, url=${request.path}`);
162+
// #endregion
157163
const srpIdentifier = getSrpIdentifierFromHeaders(request.headers);
158164
const isFeatureEntry = determineIfFeatureEntryFromURL(request.path);
159165

@@ -330,6 +336,15 @@ export class UserStorageMockttpController {
330336
},
331337
) => {
332338
const previouslySetupPath = this.paths.get(path);
339+
// #region agent log
340+
const hadPreviousData = !!previouslySetupPath;
341+
const previousResponseCount = previouslySetupPath?.response?.length ?? 0;
342+
const newResponseCount =
343+
overrides?.getResponse?.length ?? previousResponseCount;
344+
console.log(
345+
`[SYNC_DEBUG:setupPath] path=${path}, hadPreviousData=${hadPreviousData}, previousResponseCount=${previousResponseCount}, newResponseCount=${newResponseCount}`,
346+
);
347+
// #endregion
333348

334349
this.paths.set(path, {
335350
response: overrides?.getResponse || previouslySetupPath?.response || [],
@@ -357,5 +372,8 @@ export class UserStorageMockttpController {
357372
.thenCallback((request) =>
358373
this.onDelete(path, request, overrides?.deleteStatusCode),
359374
);
375+
// #region agent log
376+
console.log(`[SYNC_DEBUG:setupPath] Handlers registered for path=${path}`);
377+
// #endregion
360378
};
361379
}

test/e2e/page-objects/pages/home/homepage.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,26 @@ class HomePage {
453453
);
454454
await this.driver.delay(POST_UNLOCK_DELAY);
455455
console.log('Check if account syncing has synced at least once');
456+
// #region agent log
457+
let pollCount = 0;
458+
// #endregion
456459
await this.driver.waitUntil(
457460
async () => {
458461
const uiState = await getCleanAppState(this.driver);
462+
// #region agent log
463+
pollCount += 1;
464+
const syncState =
465+
uiState?.metamask?.hasAccountTreeSyncingSyncedAtLeastOnce;
466+
const isSignedIn = uiState?.metamask?.isSignedIn;
467+
const isUnlocked = uiState?.metamask?.isUnlocked;
468+
const isBackupAndSyncEnabled =
469+
uiState?.metamask?.isBackupAndSyncEnabled;
470+
const isAccountSyncingEnabled =
471+
uiState?.metamask?.isAccountSyncingEnabled;
472+
console.log(
473+
`[SYNC_DEBUG:poll#${pollCount}] syncState=${syncState}, isSignedIn=${isSignedIn}, isUnlocked=${isUnlocked}, isBackupAndSyncEnabled=${isBackupAndSyncEnabled}, isAccountSyncingEnabled=${isAccountSyncingEnabled}`,
474+
);
475+
// #endregion
459476
// Check for nullish, as the state we might seems to be `null` sometimes.
460477
return (
461478
uiState?.metamask?.hasAccountTreeSyncingSyncedAtLeastOnce === true

0 commit comments

Comments
 (0)