Bug 1666386 - [devtools] Find blocked request using url name fixes intermittent r=nchevobbe

The test previously depended on the position of the blocked request
in the request list view, This causes the test to fail intermittently
when the list is out of order.

This fix instead finds the request using the name in the url which is
more consistent.

Differential Revision: https://phabricator.services.mozilla.com/D109497
This commit is contained in:
Hubert Boma Manilla 2021-03-23 19:21:21 +00:00
Родитель b21e72004b
Коммит af3289f596
1 изменённых файлов: 14 добавлений и 10 удалений

Просмотреть файл

@ -61,34 +61,38 @@ add_task(async function() {
waitForReload,
]);
const requests = document.querySelectorAll(".request-list-item");
// Find the request list item that matches the blocked url
const request = document.querySelector(
"td.requests-list-url[title*=request_0]"
).parentNode;
info("Assert the blocked request");
ok(
!!requests[1].querySelector(
".requests-list-status .status-code-blocked-icon"
),
!!request.querySelector(".requests-list-status .status-code-blocked-icon"),
"The request blocked status icon is visible"
);
is(
requests[1].querySelector(
".requests-list-status .requests-list-status-code"
).title,
request.querySelector(".requests-list-status .requests-list-status-code")
.title,
"Blocked",
"The request status title is 'Blocked'"
);
is(
requests[1].querySelector(".requests-list-type").innerText,
request.querySelector(".requests-list-type").innerText,
"",
"The request shows no type"
);
is(
requests[1].querySelector(".requests-list-transferred").innerText,
request.querySelector(".requests-list-transferred").innerText,
`Blocked By ${extensionName}`,
"The request shows the blocking extension name"
);
is(
requests[1].querySelector(".requests-list-size").innerText,
request.querySelector(".requests-list-size").innerText,
"",
"The request shows no size"
);