diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /devtools/client/jsonview/test/browser_jsonview_copy_headers.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/jsonview/test/browser_jsonview_copy_headers.js')
-rw-r--r-- | devtools/client/jsonview/test/browser_jsonview_copy_headers.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/devtools/client/jsonview/test/browser_jsonview_copy_headers.js b/devtools/client/jsonview/test/browser_jsonview_copy_headers.js new file mode 100644 index 0000000000..faa6e43354 --- /dev/null +++ b/devtools/client/jsonview/test/browser_jsonview_copy_headers.js @@ -0,0 +1,38 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const TEST_JSON_URL = URL_ROOT + "valid_json.json"; + +add_task(async function () { + info("Test valid JSON started"); + + await addJsonViewTab(TEST_JSON_URL); + + // Select the RawData tab + await selectJsonViewContentTab("headers"); + + // Check displayed headers + const count = await getElementCount(".headersPanelBox .netHeadersGroup"); + is(count, 2, "There must be two header groups"); + + const text = await getElementText(".headersPanelBox .netInfoHeadersTable"); + isnot(text, "", "Headers text must not be empty"); + + const browser = gBrowser.selectedBrowser; + + // Verify JSON copy into the clipboard. + await waitForClipboardPromise( + function setup() { + BrowserTestUtils.synthesizeMouseAtCenter( + ".headersPanelBox .toolbar button.copy", + {}, + browser + ); + }, + function validator(value) { + return value.indexOf("application/json") > 0; + } + ); +}); |