To copy screenshots to a different location call this function at the end of your test.
/**
* Call this function at the end of your test to copy all captured
* screenshots to the specified folder.
* Make sure that `folder` has the trailing \.
*/
function CopyReportImagesTo(/**string*/ folder)
{
if (typeof(g_saveScreenshotsReportHtmlPath) == "undefined")
{
Tester.Message("There are no images in the report");
return;
}
if (!File.FolderExists(folder))
{
Tester.Message("Folder does not exist: " + folder);
}
var fso = new ActiveXObject("Scripting.FileSystemObject");
// To copy all images at once
// fso.CopyFile(g_saveScreenshotsReportHtmlPath + "\\*.png", folder);
// return;
// To print file names into report
var arrFiles = File.Find(g_saveScreenshotsReportHtmlPath, "*.png", false).split('\n');
for(var i = 0; i < arrFiles.length; i++)
{
var f = arrFiles[i];
Tester.Message(f);
fso.CopyFile(f, folder);
}
}
To change default folder for captured images call this function at the beginning of your test,
/**
* Changes default folder for captured screenshots.
*/
function SetScreenshotsFolder(/**string*/ folder)
{
g_saveScreenshotsReportHtmlPath = folder;
g_screenFlowHistory.filename = g_saveScreenshotsReportHtmlPath + "/index.html";
}