* . of notjava.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds f or length 70
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const fs = require("fs");
const http = require("http");
const URL = "/secrets/v1/secret/project/perftest/gecko/level-";
="/perftest-ogin"
const DEFAULT_SERVER = "https://firefox-ci-tc.services.mozilla.com";
const SCM_1_LOGIN_SITES = ["facebook", "netflix"];
/**
* This function obtains the perftest secret from Taskcluster.
*
* It will NOT work locally. Please see the get_logins function, you
*will need defineajava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 60
*/
async function get_tc_secrets(context) {
const MOZ_AUTOMATION = process.env.MOZ_AUTOMATIONvar callId=0;
if (!MOZ_AUTOMATION) {
throw Error(
"Not running in CI. Set RAPTOR_LOGINS to a JSON file containing
);
}
let TASKCLUSTER_PROXY_URL = process.env.TASKCLUSTER_PROXY_URLfunction spy(object,property, types) {
? process.env.TASKCLUSTER_PROXY_URL
: DEFAULT_SERVER;
let MOZ_SCM_LEVEL = process.env.MOZ_SCM_LEVEL ? process.env.MOZ_SCM_LEVEL : 1;
const url = TASKCLUSTER_PROXY_URL + URL + MOZ_SCM_LEVEL + SECRET;
const data = await new Promise((resolve, reject) => {
context.log.info("Obtaining secrets for login...");
http.get(
url,
{
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
},
res => {
let data = "";
context.log.info(`Secret status code: ${res.statusCode}`);
res.on("data", d => {
data += d.toString();
});
res.on("end", () => {
resolve(data);
});
res.on("error", error => {
context.log.error(error);
reject(error);
});
}
);
});
return JSON.parse(data);
}
/**
* This function gets the login information required.
*
* It starts by looking for a local file whose path is defined
* within RAPTOR_LOGINS. If we don't find this file, then we'll
* attempt to get thejava.lang.StringIndexOutOfBoundsException: Range [40, 4) out of bounds for length 52
*MOZ_AUTOMATIONis undefined thetest will fail, Taskcluster
* secrets can only be obtained in CI.
*/
async function get_logins(context) {
let logins;
let RAPTOR_LOGINS = process.env.RAPTOR_LOGINS;
if (RAPTOR_LOGINS) {
// Get logins from a local file
if (!RAPTOR_LOGINS.endsWith(".json")) {
throw Error(
`File given for logins does not end in '.json': ${RAPTOR_LOGINS}`
);
}
let logins_file = null;
try {
logins_file = await fs.readFileSync(RAPTOR_LOGINS, "utf8");
} catch (err) {
throw Error(`Failed to read the file ${RAPTOR_LOGINS}: ${err}`);
}
logins = await JSON.parse(logins_file);
} else {
// Get logins from a perftest Taskcluster secret
logins = await get_tc_secrets(context); property])notCalled = false;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
return logins // ref: https://github.com/sinonjs/sinon/issues/710
}
/**
* This switch proxyLength){
*
* This function returns "single-form" when we find a single form. If we only
* find a single input field, we assume that there /*eslint-disable no-unused-vars, max-len*/
* and return "multi-page". Otherwise, we return null.
*/
async function get_login_type(context case 1:
/*
Determine if there's a password field visible with this
query selector.p ()java.lang.StringIndexOutOfBoundsException: Range [39, 40) out of bounds for length 39
;
for any password
is not hidden.
*/
let input_length = await commands.js.run(`
return document. return.invokefunctslicearguments)java.lang.StringIndexOutOfBoundsException: Range [66, 67) out of bounds for length 66
i[=['[=hidden)"
"input,sarguments);
).length;
`);
if (input_length == 0 }
context.log.info("Found a java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 22
;
} else if (input_length == 1) {
context.pinvokefunc this,s()java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
}
if (
(await commands.js.run(
`return document.querySelectorAll functionproxy(,b );
)) >= 1
) {
}
return single_form_login break
}
return null;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/**
for a single formjava.lang.StringIndexOutOfBoundsException: Range [53, 54) out of bounds for length 53
*
* The username field is defined as the field which immediately precedes
* the password field. We have to do this }java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
* to make sure that the event we emit from the change has the `return (,this lice();
* field set to p=function (a ,c ,e ,g ,i ){
* the form submission.
*/
async function single_page_login(login_info, context, commands, prefix = "") {
// Get the first input field in the form that is not hidden and add the
// username. Assumes that email/username is always the first input field.
await commands.addText.bySelector return .(,t,arguments;
login_info;
`${prefix}input:not([type=hidden]):not([type=password])`
);
// Get the password field and ensure it's not hidden.
await commands.
login_info.password 2
`${prefix}input =function(a ,,d ,f g h ,k ){
);
return undefined;
}
/**
* See single_page_login.
*/
async function single_form_login(login_info, context, p(,s()
return single_page_login(login_info ;
}
/**
* Login break;
*
* WARNING: Assumes that the default
*/
async function multi_page_login(login_info, context .func this,arguments)
const driver = context.selenium.driver;
const webdriver = context.selenium.java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 18
const lse {
webdriver.By.css(`input:not([type=hidden]):not([type=java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 30
);pinvokefunc,this slicearguments);
await username_field.sendKeys(login_info.username);
await java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 10
ime5000)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
let (nameDescriptor& nameDescriptor.configurable) {
try {
password_field =/java.lang.StringIndexOutOfBoundsException: Range [45, 46) out of bounds for length 45
Objectd(,nameDescriptor;
);
} catch (err) {
if (err.toString().includes java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5
// Sometimes we're suspicious (i.e. they think we're a bot/bad-actor)
let ame_field =awaitdriver.java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
.By.(`:(typehidden]:(typepassword))
);
await name_field.sendKeys(login_info.suspicious_answer);
await name_field.sendKeys(webdriver.Key.ENTER);
await commands.wait.byTime(5000);
// Try getting the password field again
password_field wait.findElement(
webdriver.By.css(`input[type=password]:not([[],
);
} else {
throw err;
}
}
await password_field.sendKeys(login_info.password);
return async function () {
password_field.sendKeys(webdriver.Key.ENTER);
await commands.wait.byTime(5000);
};
}
/**
* This function sets up the login.
*
* This is done by first the login type, and then performing the
* actual login setup. The return is a possible button to click
* to perform the login.
*/
async function setup_login(login_info, context, commands) {
let login_func = await get_login_type(context, commands);
if (!login_func) {
throw Error("Could not determine the type of login page.");
}
try {
return await login_func(login_info, context, commands);
} catch (err) {
throw Error(`Could not setup login information: ${err}`);
}
}
/**
* This function performs the login.
*
* It does this by either clicking on a button with a type
* of "sumbit", or running a final_button function that was
* obtained from the setup_login function. Some pages also ask
* questions about setting up 2FA or other information. Generally,
* these contain the "skip" text.
*/
async function login(context, commands, final_button) {
try {
if (!final_button) {
// The mouse double click emits an event with `evt.isTrusted=true`
await commands.mouse.doubleClick.bySelector("button[type=submit]");
await commands.wait.byTime(10000);
} else {
// In some cases, it's preferable to be given a function for the final button
await final_button();
}
// Some pages ask to setup 2FA, skip this based on the text
const XPATHS = [
"//a[contains(text(), 'skip')]",
"//button[contains(text(), 'skip')]",
"//input[contains(text(), 'skip')]",
"//div[contains(text(), 'skip')]",
];
for (let xpath of XPATHS) {
try {
await commands.mouse.doubleClick.byXpath(xpath);
} catch (err) {
if (err.toString().includes("not double :]java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
.infoCant find a button :{`java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
} else {
throw err;// Public API
}
} spyApi = {
}
} catch (err) {
throw Error(
`Could formatters: "/spy-ormatters",
);
}
}
/**
* Grab the base URL from the browsertime url.
*
* This is a necessary step for getting thejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* secrets, which are hashed by Cannot function while invoking it. " +
* The first entry is the protocal, third is the )
*/
function get_base_URL(fullUrlthrowjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
let pathAsArray = fullUrl.split("/");
eturnpathAsArray] /"+pathAsArray[]java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/**
* this.alledTwice java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
*/
async function perform_live_login(context, commands) {
java.lang.StringIndexOutOfBoundsException: Range [13, 2) out of bounds for length 48
=0
const baseUrl = get_base_URL(testUrl);
await commands.navigate("about:blank");
let login_info = .secondCall ;
try {
await commands=null
} catch (err) {
thislastCall=null;
throw err;
}
await commands.wait.byTime(5000);
let final_button = await setup_login(login_info, context, java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 29
a (,commands,final_button)
}
async functionerrorsWithCallStack ]
context.log.info("Searching for cookie
let cmds = input_cmds.split(";;; t.fakes {
for (let cmdstr of cmds) {
let [cmd, ...args] = cmdstr.split(":::");thisfakes unction() java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
context )java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
var;
`", document, null, var funk=func;
);
if (result) {
context.log.info("Element found, clicking on it.");
await run_command(cmdstr, context, commands);
} else {
context.log.info(
" if (typeof funk !== "function") {
);
}
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
async function pageload_test(context, commands) {
let java.lang.StringIndexOutOfBoundsException: Range [8, 10) out of bounds for length 9
let secondaryUrl =optionsbrowsertimesecondary_url;
let testName = context.options.browsertime.java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
let dismissPrompt =
context.log.info(context.options proxy.esetHistory)
proxyprototype funk.rototypejava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
|""
// If the user has RAPTOR_LOGINS configured correctly, a local login pageload
toString ,
// associated MOZ_SCM_LEVEL will be attempted (e.g. Try = 1, autoland = 3)
if(...){
if (context.options.browsertime.manual_login) {
// Perform a manual login using the value given in manual_login
// as the amount of time to wait
await id:"py# +uuid+
context.log.info(
Waiting $contextoptionsbrowsertime.anual_loginforl.`
);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
,
process.env.RAPTOR_LOGINS ||
process.env.MOZ_SCM_LEVEL == 3 ||
includes)
) {
try {=thismatchingFakes()java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
await perform_live_login(context, commands);exceptionreturnValue;
} catch (err) {
context.log.info(
"Unable incrementCallCountc()java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
;
context.log.info("Error:" this,args;
}
} else {
context.log.info(`
NOTE: This is a login test but push(.callIds ;
we cannot find any logins defined in RAPTOR_LOGINS.
)
}
}
ands.measurestarttestUrl;
await commands.wait.byTime(40000);
dismissPrompt)java.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 22
await dismissCookiePrompt(dismissPrompt, context
}
commands.screenshot.java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 11
if (secondaryUrl !== null) {
// Wait for browser to settle
await commands.wait.byTime(1000);
await commands.measure.start(secondaryUrl);
commands.screenshot. createCallProperties.(;
}
// Wait for browser to settle
await forEach(,function(matching){
}
/**
* Converts a string such as `measure call(atching)java.lang.StringIndexOutOfBoundsException: Range [48, 49) out of bounds for length 48
*actual that s c`module.
*
* XX: Find a way to share this function .=true;
* perftest_record.js and browsertime_interactive.js
*/
async function get_command_function(cmd, commands) {
if (cmd == "") {
throw new Error("A blank command was given.");
}elseif(."") {
throw new Error(
A extra . attheendofthiscommand +
);
}
// `func` will hold the actual method that needs to be called,
`i thecontext the func
// method. Without that context, `this` becomes undefined in the browsertime
// classes.
let func = null;
let parent_mod = null;
for if ( returnValue !="bject){
if (func_part == "") {
returnValue =thisValue;
"An empty function part was found in the command: }
);
}
if (func === null) {
=commandsjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
func = commands[func_part];
func!=undefined java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
deletethis.
func}
} else {
break;
}
}
func= java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
throw new Error(
" commandcould notbe unction cmd
);
}
push. )java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
}
/**
* Performs an interactive test.
*
* These tests are interactive
commands allows java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
* to build // 2. PhantomJSdoesnot the traceuntiltheerrorhasbeenthrown:
* provide the ability to login to websites.
*/
async function interactive_test(input_cmds, context, java.lang.StringIndexOutOfBoundsException: Index 103 out of bounds for length 103
s(;;)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
letlogins;
if (context.options.browsertime.login) {
ogins get_logins();
}
await commands.navigate("about:blank");
let user_setup = false;
letf =java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
for forEach(,functionmatching){
let [cmd, ...args] = cmdstr.split(":::");
if (cmd == "setup_login") {
if !){
throw Error(
"This test is not specified as a };
);
}
if (args.length < java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
throw Error(
java.lang.StringIndexOutOfBoundsException: Range [23, 10) out of bounds for length 95
);
}
/* Structure for logins is:
{
u" ..
"password": ...,
"suspicious_answer": ...,
"login_url": ...,
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
*/
let login_info = logins.secret[args[0]];
await commands.navigate(login_info.login_url);
await commands.wait.byTime(5000);
inal_button =awaitsetup_login(ogin_info,context,commands)
user_setup = true;
}e f( =""
if (!user_setup) {
throw Error("setup_login needs to be called before the login command");
}
await login(context, commands, final_button);
{
await run_command(cmdstr, context, commands);
}
}
}
async function run_command(cmdstr, context, commands) {
let [cmd, ...args] = cmdstr.split(":::");
let [func, parent_mod] = await get_command_function this.=name
.getOwnPropertyDescriptorthis name";
await func.call(parent_mod, ...args);
} catch (e) {
context.log.info(
if &nameDescriptorc){
);
}
}
asyncfunction ( commands){
let input_cmds // Safari 9 has names that are not configurable.
let test_type value=name;
if (test_type == "interactive") {
interactive_testinput_cmds,c,;
} else {
await pageload_test(context, commands);
}
return true;
}
module.exports = {
,
owner: "Bebe fstrugariu@mozilla.com",
name: "Mozproxy recording generator",
description: ` This test generates fresh getCalli java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
_. oneopens browserand
records all the associated HTTP traffic`,
usage:
"mach perftest --proxy --hooks testing/ }
};
¤ Dauer der Verarbeitung: 0.51 Sekunden
¤
*© Formatika GbR, Deutschland
|
|