Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify #287

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion seleniumbuilder/chrome/content/html/js/builder/i18n/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,11 @@ m.step_storeAlertPresent = "Affecter la présence d'une alerte ";
m.step_assertEval = "Vérifier le script (bloquant)";
m.step_verifyEval = "Vérifier le script";
m.step_waitForEval = "Attendre la fin du script";
m.step_storeForEval = "Affecter le résultat du script";
m.step_storeEval = "Affecter le résultat du script";
m.step_answerAlert = "Compléter la boite de dialogue";
m.step_acceptAlert = "Acquitter la boite de dialogue";
m.step_dismissAlert = "Répudier la boite de dialogue";
m.step_setWindowSize = "Redimensionner la fenêtre";
m.p_attributeName = "Attribut";
m.p_file = "Fichier";
m.p_locator = "Localisation";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,36 +310,17 @@ builder.selenium2.playback.deselectElement = function(target, callback) {

/** Performs ${variable} substitution for parameters. */
builder.selenium2.playback.param = function(pName) {
var output = "";
var hasDollar = false;
var insideVar = false;
var varName = "";
var text = builder.selenium2.playback.currentStep.type.getParamType(pName) == "locator" ? builder.selenium2.playback.currentStep[pName].getValue() : builder.selenium2.playback.currentStep[pName];
for (var i = 0; i < text.length; i++) {
var ch = text.substring(i, i + 1);
if (insideVar) {
if (ch == "}") {
if (builder.selenium2.playback.vars[varName] == undefined) {
throw _t('sel2_variable_not_set', varName);
}
output += builder.selenium2.playback.vars[varName];
insideVar = false;
hasDollar = false;
varName = "";
} else {
varName += ch;
}
} else {
// !insideVar
if (hasDollar) {
if (ch == "{") { insideVar = true; } else { hasDollar = false; output += "$" + ch; }
} else {
if (ch == "$") { hasDollar = true; } else { output += ch; }
}
}
}

return builder.selenium2.playback.currentStep.type.getParamType(pName) == "locator" ? {"type": builder.selenium2.playback.currentStep[pName].getName(builder.selenium2), "value": output} : output;
var text = builder.selenium2.playback.currentStep.type.getParamType(pName) == "locator"
? builder.selenium2.playback.currentStep[pName].getValue()
: builder.selenium2.playback.currentStep[pName];
var output = text.replace(/\${(\w+)}/g, function(match, varName) {
return builder.selenium2.playback.vars[varName] !== undefined
? builder.selenium2.playback.vars[varName]
: match;
});
return builder.selenium2.playback.currentStep.type.getParamType(pName) == "locator"
? {"type": builder.selenium2.playback.currentStep[pName].getName(builder.selenium2), "value": output}
: output;
};

builder.selenium2.playback.canPlayback = function(stepType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,36 +349,17 @@ builder.selenium2.rcPlayback.send = function(r, http_method, path, msg, callback

/** Performs ${variable} substitution for parameters. */
builder.selenium2.rcPlayback.param = function(r, pName) {
var output = "";
var hasDollar = false;
var insideVar = false;
var varName = "";
var text = r.currentStep.type.getParamType(pName) == "locator" ? r.currentStep[pName].getValue() : r.currentStep[pName];
for (var i = 0; i < text.length; i++) {
var ch = text.substring(i, i + 1);
if (insideVar) {
if (ch == "}") {
if (r.vars[varName] == undefined) {
throw "Variable not set: " + varName + ".";
}
output += r.vars[varName];
insideVar = false;
hasDollar = false;
varName = "";
} else {
varName += ch;
}
} else {
// !insideVar
if (hasDollar) {
if (ch == "{") { insideVar = true; } else { hasDollar = false; output += "$" + ch; }
} else {
if (ch == "$") { hasDollar = true; } else { output += ch; }
}
}
}

return r.currentStep.type.getParamType(pName) == "locator" ? {"using": r.currentStep[pName].getName(builder.selenium2), "value": output} : output;
var text = r.currentStep.type.getParamType(pName) == "locator"
? r.currentStep[pName].getValue()
: r.currentStep[pName];
var output = text.replace(/\${(\w+)}/g, function(match, varName) {
return r.vars[varName] !== undefined
? r.vars[varName]
: match;
});
return r.currentStep.type.getParamType(pName) == "locator"
? {"using": r.currentStep[pName].getName(builder.selenium2), "value": output}
: output;
};

builder.selenium2.rcPlayback.print = function(r, text) {
Expand Down