diff options
Diffstat (limited to 'devtools/client/performance-new/test/browser/browser_aboutprofiling-interval.js')
-rw-r--r-- | devtools/client/performance-new/test/browser/browser_aboutprofiling-interval.js | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/devtools/client/performance-new/test/browser/browser_aboutprofiling-interval.js b/devtools/client/performance-new/test/browser/browser_aboutprofiling-interval.js new file mode 100644 index 0000000000..6dcc4e1156 --- /dev/null +++ b/devtools/client/performance-new/test/browser/browser_aboutprofiling-interval.js @@ -0,0 +1,72 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +"use strict"; + +add_task(async function test() { + info("Test that about:profiling can modify the sampling interval."); + + await withAboutProfiling(async document => { + const intervalInput = await getNearestInputFromText( + document, + "Sampling interval:" + ); + is( + getActiveConfiguration().interval, + 1, + "The active configuration's interval is set to a specific number initially." + ); + is( + intervalInput.getAttribute("aria-valuemin"), + "0.01", + "aria-valuemin has the expected value" + ); + is( + intervalInput.getAttribute("aria-valuemax"), + "100", + "aria-valuemax has the expected value" + ); + is( + intervalInput.getAttribute("aria-valuenow"), + "1", + "aria-valuenow has the expected value" + ); + + info( + "Increase the interval by an arbitrary amount. The input range will " + + "scale that to the final value presented to the profiler." + ); + setReactFriendlyInputValue(intervalInput, Number(intervalInput.value) + 1); + + is( + getActiveConfiguration().interval, + 2, + "The configuration's interval was able to be increased." + ); + is( + intervalInput.getAttribute("aria-valuenow"), + "2", + "aria-valuenow has the expected value" + ); + + intervalInput.focus(); + + info("Increase the interval with the keyboard"); + EventUtils.synthesizeKey("VK_RIGHT"); + await waitUntil(() => getActiveConfiguration().interval === 3); + is( + intervalInput.getAttribute("aria-valuenow"), + "3", + "aria-valuenow has the expected value" + ); + + info("Decrease the interval with the keyboard"); + EventUtils.synthesizeKey("VK_LEFT"); + await waitUntil(() => getActiveConfiguration().interval === 2); + is( + intervalInput.getAttribute("aria-valuenow"), + "2", + "aria-valuenow has the expected value" + ); + }); +}); |