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 /testing/performance/perftest_facebook.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/performance/perftest_facebook.js')
-rw-r--r-- | testing/performance/perftest_facebook.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/testing/performance/perftest_facebook.js b/testing/performance/perftest_facebook.js new file mode 100644 index 0000000000..bd607d6be4 --- /dev/null +++ b/testing/performance/perftest_facebook.js @@ -0,0 +1,51 @@ +/* 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/. */ + +async function test(context, commands) { + await commands.navigate("https://www.example.com"); + await commands.wait.byTime(15000); + + // Fill in: + let username = "some_user@mail.com"; + let passworld = "topsecretpassword"; + + // We start by navigating to the login page. + await commands.navigate("https://www.facebook.com"); + + // When we fill in a input field/click on a link we wanna + // try/catch that if the HTML on the page changes in the feature + // sitespeed.io will automatically log the error in a user friendly + // way, and the error will be re-thrown so you can act on it. + await commands.wait.byTime(5000); + + // Add text into an input field, finding the field by id + await commands.addText.bySelector(username, "input[name=email]"); + await commands.wait.byTime(2000); + await commands.addText.bySelector(passworld, "input[name=pass]"); + await commands.wait.byTime(2000); + + // Start the measurement before we click on the + // submit button. Sitespeed.io will start the video recording + // and prepare everything. + // Find the sumbit button and click it and then wait + // for the pageCompleteCheck to finish + await commands.measure.start("pageload"); + + // There are two variants of the facebook login page: + try { + await commands.click.bySelectorAndWait("button[name=login]"); + } catch (e) { + await commands.click.bySelectorAndWait("input[type=submit]"); + } + + // Stop and collect the measurement before the next page we want to measure + await commands.measure.stop(); +} + +module.exports = { + test, + owner: "Performance Team", + name: "Facebook", + description: "Measures time to log in to Facebook", +}; |