diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /devtools/client/netmonitor/src/har/test/browser_harautomation_simple.js | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/netmonitor/src/har/test/browser_harautomation_simple.js')
-rw-r--r-- | devtools/client/netmonitor/src/har/test/browser_harautomation_simple.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/devtools/client/netmonitor/src/har/test/browser_harautomation_simple.js b/devtools/client/netmonitor/src/har/test/browser_harautomation_simple.js new file mode 100644 index 0000000000..9da746d28f --- /dev/null +++ b/devtools/client/netmonitor/src/har/test/browser_harautomation_simple.js @@ -0,0 +1,35 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const HAR_FILENAME = "test_filename.har"; + +// We expect the HAR file to be created on reload in profD/har/logs +const HAR_PATH = ["har", "logs", HAR_FILENAME]; + +/** + * Smoke test for automated HAR export. + * Note that the `enableAutoExportToFile` is set from browser-harautomation.ini + * because the preference needs to be set before starting the browser. + */ +add_task(async function () { + // Set a simple test filename for the exported HAR. + await pushPref("devtools.netmonitor.har.defaultFileName", "test_filename"); + + const tab = await addTab(SIMPLE_URL); + const toolbox = await gDevTools.showToolboxForTab(tab, { + toolId: "inspector", + }); + + await reloadBrowser(); + + info("Wait until the HAR file is created in the profile directory"); + await waitUntil(() => FileUtils.getFile("ProfD", HAR_PATH).exists()); + + const harFile = FileUtils.getFile("ProfD", HAR_PATH); + ok(harFile.exists(), "HAR file was automatically created"); + + await toolbox.destroy(); + await removeTab(tab); +}); |