1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 async function test(context, commands) {
6 await commands.navigate("https://www.example.com");
7 await commands.wait.byTime(15000);
10 let username = "some_user@mail.com";
11 let passworld = "topsecretpassword";
13 // We start by navigating to the login page.
14 await commands.navigate("https://www.facebook.com");
16 // When we fill in a input field/click on a link we wanna
17 // try/catch that if the HTML on the page changes in the feature
18 // sitespeed.io will automatically log the error in a user friendly
19 // way, and the error will be re-thrown so you can act on it.
20 await commands.wait.byTime(5000);
22 // Add text into an input field, finding the field by id
23 await commands.addText.bySelector(username, "input[name=email]");
24 await commands.wait.byTime(2000);
25 await commands.addText.bySelector(passworld, "input[name=pass]");
26 await commands.wait.byTime(2000);
28 // Start the measurement before we click on the
29 // submit button. Sitespeed.io will start the video recording
30 // and prepare everything.
31 // Find the sumbit button and click it and then wait
32 // for the pageCompleteCheck to finish
33 await commands.measure.start("pageload");
35 // There are two variants of the facebook login page:
37 await commands.click.bySelectorAndWait("button[name=login]");
39 await commands.click.bySelectorAndWait("input[type=submit]");
42 // Stop and collect the measurement before the next page we want to measure
43 await commands.measure.stop();
48 owner: "Performance Team",
50 description: "Measures time to log in to Facebook",