Skip to content

Commit 41d8bbb

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[e2e] Fix flaky memory panel test
Use our helper and an extra drainTask to stabilize the test. No-Tree-Checks: True Bug: none Change-Id: I7f9c9f2846350fc14f9dcb5c8ed9b6e976e005c0 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6765967 Commit-Queue: Nikolay Vitkov <[email protected]> Reviewed-by: Jack Franklin <[email protected]>
1 parent f4368fb commit 41d8bbb

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

test/e2e/helpers/memory-helpers.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,14 @@ export async function navigateToMemoryTab(devToolsPage = getBrowserAndPagesWrapp
2424
}
2525

2626
export async function takeDetachedElementsProfile(devToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
27-
const radioButton = await devToolsPage.$('//label[text()="Detached elements"]', undefined, 'xpath');
28-
await devToolsPage.clickElement(radioButton);
27+
await devToolsPage.click('xpath///label[text()="Detached elements"]');
2928
await devToolsPage.click('devtools-button[aria-label="Obtain detached elements"]');
3029
await devToolsPage.waitForNone('.heap-snapshot-sidebar-tree-item.wait');
3130
await devToolsPage.waitFor('.heap-snapshot-sidebar-tree-item.selected');
3231
}
3332

3433
export async function takeAllocationProfile(devToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
35-
const radioButton = await devToolsPage.$('//label[text()="Allocation sampling"]', undefined, 'xpath');
36-
await devToolsPage.clickElement(radioButton);
34+
await devToolsPage.click('xpath///label[text()="Allocation sampling"]');
3735
await devToolsPage.click('devtools-button[aria-label="Start heap profiling"]');
3836
await new Promise(r => setTimeout(r, 200));
3937
await devToolsPage.click('devtools-button[aria-label="Stop heap profiling"]');
@@ -46,8 +44,7 @@ export async function takeAllocationTimelineProfile(
4644
recordStacks: false,
4745
},
4846
devToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
49-
const radioButton = await devToolsPage.$('//label[text()="Allocations on timeline"]', undefined, 'xpath');
50-
await devToolsPage.clickElement(radioButton);
47+
await devToolsPage.click('xpath///label[text()="Allocations on timeline"]');
5148
if (recordStacks) {
5249
await devToolsPage.click('[title="Allocation stack traces (more overhead)"]');
5350
}
@@ -303,8 +300,9 @@ export async function focusTableRowWithName(text: string, devToolsPage = getBrow
303300
export async function focusTableRow(
304301
row: puppeteer.ElementHandle<Element>, devToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
305302
// Click in a numeric cell, to avoid accidentally clicking a link.
306-
const cell = await devToolsPage.waitFor('.numeric-column', row);
307-
await devToolsPage.clickElement(cell);
303+
await devToolsPage.click('.numeric-column', {
304+
root: row,
305+
});
308306
}
309307

310308
export async function expandFocusedRow(devToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
@@ -398,16 +396,19 @@ export async function getRemovedCountFromComparisonRow(
398396
export async function clickOnContextMenuForRetainer(
399397
retainerName: string, menuItem: string, devToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
400398
const retainersPane = await devToolsPage.waitFor('.retaining-paths-view');
401-
const element = await devToolsPage.waitFor(`//span[text()="${retainerName}"]`, retainersPane, undefined, 'xpath');
402-
// Push the click right a bit further to avoid the disclosure triangle.
403-
await devToolsPage.clickElement(element, {clickOptions: {button: 'right', offset: {x: 35, y: 0}}});
404-
const button = await devToolsPage.waitForAria(menuItem);
405-
await devToolsPage.clickElement(button);
399+
await devToolsPage.click(`xpath///span[text()="${retainerName}"]`, {
400+
root: retainersPane,
401+
clickOptions: {
402+
button: 'right',
403+
// Push the click right a bit further to avoid the disclosure triangle.
404+
offset: {x: 35, y: 0},
405+
},
406+
});
407+
await devToolsPage.click(`aria/${menuItem}`);
406408
}
407409

408410
export async function restoreIgnoredRetainers(devToolsPage = getBrowserAndPagesWrappers().devToolsPage) {
409-
const element = await devToolsPage.waitFor('devtools-button[aria-label="Restore ignored retainers"]');
410-
await devToolsPage.clickElement(element);
411+
await devToolsPage.click('devtools-button[aria-label="Restore ignored retainers"]');
411412
}
412413

413414
export async function setFilterDropdown(filter: string, devToolsPage = getBrowserAndPagesWrappers().devToolsPage) {

test/e2e_non_hosted/memory/memory_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ describe('The Memory Panel', function() {
574574
await expandFocusedRow(devToolsPage);
575575
// TODO: pressing arrowDown does not work while UI is rendering.
576576
await devToolsPage.drainTaskQueue();
577+
await devToolsPage.drainTaskQueue();
577578
await devToolsPage.page.keyboard.press('ArrowDown');
578579
await clickOnContextMenuForRetainer('x', 'Reveal in Summary view', devToolsPage);
579580
await waitUntilRetainerChainSatisfies(

0 commit comments

Comments
 (0)