summaryrefslogtreecommitdiffstats
path: root/testing/performance/perftest_facebook.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/performance/perftest_facebook.js')
-rw-r--r--testing/performance/perftest_facebook.js51
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",
+};