[go: nahoru, domu]

Make e2e test more flake resilient on Mac

This CL fixes a problem where Window names retainer chains
were not consistenly reported across platforms. In particular,
some windows will be called 'Window /' on one platform, but
only 'Window' on other platforms (occassionally).

This CL normalizes window names further to just "Window".

Bug: chromium:1110817
Change-Id: Ie37a4a627bde55b58ff7964701754ac987c081fb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2412329
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
diff --git a/test/e2e/helpers/memory-helpers.ts b/test/e2e/helpers/memory-helpers.ts
index 584b73a..c86ae8c 100644
--- a/test/e2e/helpers/memory-helpers.ts
+++ b/test/e2e/helpers/memory-helpers.ts
@@ -143,9 +143,10 @@
 
 const normalizRetainerName = (retainerName: string) => {
   // Retainers starting with `Window /` might have host information in their
-  // name, including the port, so we need to strip that.
+  // name, including the port, so we need to strip that. We can't distinguish
+  // Window from Window / either, because on Mac it is often just Window.
   if (retainerName.startsWith('Window /')) {
-    return 'Window /';
+    return 'Window';
   }
   // Retainers including double-colons :: are names from the C++ implementation
   // exposed through Chromium's gn arg `enable_additional_blink_object_names`;
diff --git a/test/e2e/memory/memory_test.ts b/test/e2e/memory/memory_test.ts
index b3de89b..8b11806 100644
--- a/test/e2e/memory/memory_test.ts
+++ b/test/e2e/memory/memory_test.ts
@@ -47,7 +47,7 @@
       'Detached InternalNode',
       'Detached HTMLDivElement',
       'Retainer',
-      'Window /',
+      'Window',
     ]);
   });
 
@@ -70,7 +70,7 @@
       'HTMLBodyElement',
       'HTMLHtmlElement',
       'HTMLDocument',
-      'Window /',
+      'Window',
     ]);
   });
 
@@ -118,6 +118,6 @@
     // iframe window is not detached.
     await waitUntilRetainerChainSatisfies(
         retainerChain => retainerChain.some(
-            ({propertyName, retainerClassName}) => propertyName === 'aUniqueName' && retainerClassName === 'Window /'));
+            ({propertyName, retainerClassName}) => propertyName === 'aUniqueName' && retainerClassName === 'Window'));
   });
 });