Step 1
Place the following function to your User.js
function GetSecret(/**string*/ secretName)
{
if(typeof(g_amazonWrapper)=="undefined")
{
g_amazonWrapper = new ActiveXObject("SeSWrappers.AmazonWrapper");
}
var region = "us-east-1";
var versionId = "";
var versionStage = "";
var awsAccessKey = "";
var awsSecretAccessKey = "";
var secret = g_amazonWrapper.AwsGetSecret(secretName, versionId, versionStage, region, awsAccessKey, awsSecretAccessKey);
if (secret)
{
return JSON.parse(secret);
}
return null;
}
Adjust the variables.
region
String representation of a region where you want to run your tests.
versionId
Specific secret version id.
versionStage
Specific version stage.
awsAccessKey , awsSecretAccessKey
You may assign the access keys right in the function or set system environment variables:
Environment variable names are AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
Read more about the variables here.
Step 2
Call GetSecret function in your test. It will return an object representing your secret.
var secret = GetSecret("TestSecret");
if (secret)
{
Tester.Message(secret.SecretKey);
}