зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1432865 - Clean up show and hideColumn test API. r=Honza
MozReview-Commit-ID: EGL5wC3UPa2 --HG-- extra : rebase_source : 15f871aa04e3afab719ab9687d51b68b16b9f66a
This commit is contained in:
Родитель
0732ef3648
Коммит
5bb7f4be73
|
@ -7,8 +7,8 @@
|
|||
* Tests that last visible column can't be hidden
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
add_task(async function () {
|
||||
let { monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, parent } = monitor.panelWin;
|
||||
|
@ -29,32 +29,18 @@ add_task(function* () {
|
|||
if (!shown) {
|
||||
continue;
|
||||
}
|
||||
yield testLastMenuItem(column);
|
||||
await testLastMenuItem(column);
|
||||
break;
|
||||
}
|
||||
|
||||
if (shown) {
|
||||
yield hideColumn(column);
|
||||
await hideColumn(monitor, column);
|
||||
}
|
||||
}
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function* hideColumn(column) {
|
||||
info(`Clicking context-menu item for ${column}`);
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||
document.querySelector("#requests-list-status-button") ||
|
||||
document.querySelector("#requests-list-waterfall-button"));
|
||||
|
||||
let onHeaderRemoved = waitForDOM(document, `#requests-list-${column}-button`, 0);
|
||||
parent.document.querySelector(`#request-list-header-${column}-toggle`).click();
|
||||
|
||||
yield onHeaderRemoved;
|
||||
ok(!document.querySelector(`#requests-list-${column}-button`),
|
||||
`Column ${column} should be hidden`);
|
||||
}
|
||||
|
||||
function* testLastMenuItem(column) {
|
||||
async function testLastMenuItem(column) {
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||
document.querySelector(`#requests-list-${column}-button`));
|
||||
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
* Tests if visible columns are properly saved
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
Services.prefs.setCharPref("devtools.netmonitor.visibleColumns",
|
||||
'["status", "contentSize", "waterfall"]');
|
||||
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document } = monitor.panelWin;
|
||||
|
@ -21,8 +21,8 @@ add_task(function* () {
|
|||
ok(document.querySelector("#requests-list-contentSize-button"),
|
||||
"Content size column should be shown");
|
||||
|
||||
yield hideColumn(monitor, "status");
|
||||
yield hideColumn(monitor, "contentSize");
|
||||
await hideColumn(monitor, "status");
|
||||
await hideColumn(monitor, "contentSize");
|
||||
|
||||
let visibleColumns = JSON.parse(
|
||||
Services.prefs.getCharPref("devtools.netmonitor.visibleColumns")
|
||||
|
@ -33,7 +33,7 @@ add_task(function* () {
|
|||
ok(!visibleColumns.includes("contentSize"),
|
||||
"Pref should be synced for contentSize");
|
||||
|
||||
yield showColumn(monitor, "status");
|
||||
await showColumn(monitor, "status");
|
||||
|
||||
visibleColumns = JSON.parse(
|
||||
Services.prefs.getCharPref("devtools.netmonitor.visibleColumns")
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
/**
|
||||
* Tests reset column menu item
|
||||
*/
|
||||
add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
add_task(async function () {
|
||||
let { monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, parent, windowRequire } = monitor.panelWin;
|
||||
|
@ -15,8 +15,8 @@ add_task(function* () {
|
|||
|
||||
let prefBefore = Prefs.visibleColumns;
|
||||
|
||||
hideColumn(monitor, "status");
|
||||
hideColumn(monitor, "waterfall");
|
||||
await hideColumn(monitor, "status");
|
||||
await hideColumn(monitor, "waterfall");
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||
document.querySelector("#requests-list-contentSize-button"));
|
||||
|
|
|
@ -14,11 +14,22 @@ add_task(async function () {
|
|||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
hideColumn(monitor, "waterfall");
|
||||
showColumn(monitor, "endTime");
|
||||
showColumn(monitor, "responseTime");
|
||||
showColumn(monitor, "duration");
|
||||
showColumn(monitor, "latency");
|
||||
let visibleColumns = store.getState().ui.columns;
|
||||
|
||||
// Hide the waterfall column to make sure timing data are fetched
|
||||
// by the other timing columns ("endTime", "responseTime", "duration",
|
||||
// "latency").
|
||||
// Note that all these timing columns are based on the same
|
||||
// `RequestListColumnTime` component.
|
||||
if (visibleColumns.waterfall) {
|
||||
await hideColumn(monitor, "waterfall");
|
||||
}
|
||||
|
||||
["endTime", "responseTime", "duration", "latency"].forEach(async (column) => {
|
||||
if (!visibleColumns[column]) {
|
||||
await showColumn(monitor, column);
|
||||
}
|
||||
});
|
||||
|
||||
let onNetworkEvents = waitForNetworkEvents(monitor, 1);
|
||||
let onEventTimings = waitFor(monitor.panelWin, EVENTS.RECEIVED_EVENT_TIMINGS);
|
||||
|
|
|
@ -706,7 +706,7 @@ function testColumnsAlignment(headers, requestList) {
|
|||
}
|
||||
}
|
||||
|
||||
function* hideColumn(monitor, column) {
|
||||
async function hideColumn(monitor, column) {
|
||||
let { document, parent } = monitor.panelWin;
|
||||
|
||||
info(`Clicking context-menu item for ${column}`);
|
||||
|
@ -715,13 +715,13 @@ function* hideColumn(monitor, column) {
|
|||
|
||||
let onHeaderRemoved = waitForDOM(document, `#requests-list-${column}-button`, 0);
|
||||
parent.document.querySelector(`#request-list-header-${column}-toggle`).click();
|
||||
yield onHeaderRemoved;
|
||||
await onHeaderRemoved;
|
||||
|
||||
ok(!document.querySelector(`#requests-list-${column}-button`),
|
||||
`Column ${column} should be hidden`);
|
||||
}
|
||||
|
||||
function* showColumn(monitor, column) {
|
||||
async function showColumn(monitor, column) {
|
||||
let { document, parent } = monitor.panelWin;
|
||||
|
||||
info(`Clicking context-menu item for ${column}`);
|
||||
|
@ -730,7 +730,7 @@ function* showColumn(monitor, column) {
|
|||
|
||||
let onHeaderAdded = waitForDOM(document, `#requests-list-${column}-button`, 1);
|
||||
parent.document.querySelector(`#request-list-header-${column}-toggle`).click();
|
||||
yield onHeaderAdded;
|
||||
await onHeaderAdded;
|
||||
|
||||
ok(document.querySelector(`#requests-list-${column}-button`),
|
||||
`Column ${column} should be visible`);
|
||||
|
|
Загрузка…
Ссылка в новой задаче