You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the NightWatchExport when a variable is used, this is constructed as: const varFooBar = bar;
It receives the default value that was set when the variable was declared in snaptest. I don't have to point out that defeats the purpose of being able to work with environments in snaptest, but no longer when exporting them to NightWatchJS.
This could be fixed in the looking for a value in the brower.globals.test_setting with a fallback to the default value like is done for the "baseUrl" variable. That way we could pass in parameters and run the same test against different environments.
Flat.js changes:
function defineTestVariables(test) {
var variableDefs = "";
test.variables.forEach((variable) => {
if (variable.name !== "baseUrl") {
// Allow the setting of the variable value through the "globals.test_settings"
variableDefs += const ${variable.name} = browser.globals.test_settings[${variablename}] || \${variable.defaultValue}`;`;
}
});
return variableDefs;
}
The text was updated successfully, but these errors were encountered:
DavyCool84
pushed a commit
to DavyCool84/snaptest-cli
that referenced
this issue
Feb 28, 2019
You're absolutely right, the variables need to work similar to how the baseUrl works currently, by pulling in the variable names from the global config. We're making some large updates to this generator very soon and variables will become much more standard.
In the NightWatchExport when a variable is used, this is constructed as: const varFooBar =
bar
;It receives the default value that was set when the variable was declared in snaptest. I don't have to point out that defeats the purpose of being able to work with environments in snaptest, but no longer when exporting them to NightWatchJS.
This could be fixed in the looking for a value in the brower.globals.test_setting with a fallback to the default value like is done for the "baseUrl" variable. That way we could pass in parameters and run the same test against different environments.
Flat.js changes:
function defineTestVariables(test) {
var variableDefs = "";
test.variables.forEach((variable) => {
if (variable.name !== "baseUrl") {
// Allow the setting of the variable value through the "globals.test_settings"
variableDefs +=
const ${variable.name} = browser.globals.test_settings[${variablename}] || \
${variable.defaultValue}`;`;}
});
return variableDefs;
}
The text was updated successfully, but these errors were encountered: