Files
react-native-devtools-frontend/test/e2e/application/reporting-api_test.ts
T
Wolfgang Beyer a831b26b7e Display Reporting API endpoints
This CL adds content to the endpoints table in the Application panel's
Reporting API view. For each endpoint it shows the origin which
configured the endpoint, the endpoint name and the endpoint URL.

Bug: 1200732
Change-Id: Ie3b94bd81d85d7c6001fd38484434d989a32f9cf
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3291155
Commit-Queue: Wolfgang Beyer <wolfi@chromium.org>
Reviewed-by: Danil Somsikov <dsv@chromium.org>
2021-11-23 10:26:50 +00:00

64 lines
3.1 KiB
TypeScript

// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {assert} from 'chai';
import {$, click, enableExperiment, getBrowserAndPages, getTestServerPort, goToResource, waitFor} from '../../shared/helper.js';
import {describe, it} from '../../shared/mocha-extensions.js';
import {navigateToApplicationTab} from '../helpers/application-helpers.js';
import {getDataGrid, getDataGridRows, getInnerTextOfDataGridCells} from '../helpers/datagrid-helpers.js';
const REPORTING_API_SELECTOR = '[aria-label="Reporting API"]';
describe('The Reporting API Page', async () => {
beforeEach(async () => {
await enableExperiment('reportingApiDebugging');
});
it('shows reports', async () => {
const {target} = getBrowserAndPages();
await navigateToApplicationTab(target, 'reporting-api');
await click(REPORTING_API_SELECTOR);
const dataGrid = await getDataGrid();
const innerText = await getInnerTextOfDataGridCells(dataGrid, 1, false);
const reportBody = '{"columnNumber":10,"id":"PrefixedStorageInfo","lineNumber":9,"message":"' +
'\'window.webkitStorageInfo\' is deprecated. Please use \'navigator.webkitTemporaryStorage\' or ' +
'\'navigator.webkitPersistentStorage\' instead.","sourceFile":' +
`"https://localhost:${getTestServerPort()}/test/e2e/resources/application/reporting-api.html"}`;
assert.strictEqual(
innerText[0][0], `https://localhost:${getTestServerPort()}/test/e2e/resources/application/reporting-api.html`);
assert.strictEqual(innerText[0][1], 'deprecation');
assert.strictEqual(innerText[0][2], 'Queued');
assert.strictEqual(innerText[0][3], 'default');
assert.strictEqual(innerText[0][5], reportBody);
const rows = await getDataGridRows(1, dataGrid, false);
await click(rows[rows.length - 1][0]);
const jsonView = await waitFor('.json-view');
const jsonViewText = await jsonView.evaluate(el => (el as HTMLElement).innerText);
assert.strictEqual(jsonViewText, '{columnNumber: 10, id: "PrefixedStorageInfo", lineNumber: 9,…}');
});
it('shows endpoints', async () => {
await goToResource('application/reporting-api.rawresponse');
await click('#tab-resources');
await waitFor('.storage-group-list-item'); // Make sure the application navigation list is shown
await click(REPORTING_API_SELECTOR);
const endpointsGrid = await $('devtools-resources-endpoints-grid');
if (!endpointsGrid) {
assert.fail('Could not find data-grid');
}
const dataGrid = await getDataGrid(endpointsGrid);
const innerText = await getInnerTextOfDataGridCells(dataGrid, 2, true);
assert.strictEqual(innerText[0][0], `https://localhost:${getTestServerPort()}`);
assert.strictEqual(innerText[0][1], 'default');
assert.strictEqual(innerText[0][2], 'https://reports.example/default');
assert.strictEqual(innerText[1][0], `https://localhost:${getTestServerPort()}`);
assert.strictEqual(innerText[1][1], 'main-endpoint');
assert.strictEqual(innerText[1][2], 'https://reports.example/main');
});
});