Updated script to only take screenshots on failed steps
This commit is contained in:
@@ -3419,31 +3419,31 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||
};
|
||||
|
||||
const clearOldResults = () => {
|
||||
// Remove old screenshots
|
||||
//Remove old screenshots
|
||||
const screenshotDir = path.join('screenshots', 'alignConceptsPage');
|
||||
if (fs.existsSync(screenshotDir)) {
|
||||
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||
}
|
||||
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
|
||||
// Remove old Excel file
|
||||
//Remove old Excel file
|
||||
if (fs.existsSync('alignConceptsPageResults.xlsx')) {
|
||||
fs.unlinkSync('alignConceptsPageResults.xlsx');
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
clearOldResults();
|
||||
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
workbook = XLSX.utils.book_new();
|
||||
worksheet = XLSX.utils.aoa_to_sheet([
|
||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||
]);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Log test start time
|
||||
//Log test start time
|
||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||
|
||||
let allStepsPassed = true;
|
||||
@@ -3453,12 +3453,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -3476,11 +3500,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'alignConceptsPageResults.xlsx');
|
||||
} finally {
|
||||
|
||||
@@ -2295,31 +2295,31 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||
};
|
||||
|
||||
const clearOldResults = () => {
|
||||
// Remove old screenshots
|
||||
//Remove old screenshots
|
||||
const screenshotDir = path.join('screenshots', 'alignContentPage');
|
||||
if (fs.existsSync(screenshotDir)) {
|
||||
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||
}
|
||||
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
|
||||
// Remove old Excel file
|
||||
//Remove old Excel file
|
||||
if (fs.existsSync('alignContentPageResults.xlsx')) {
|
||||
fs.unlinkSync('alignContentPageResults.xlsx');
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
clearOldResults();
|
||||
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
workbook = XLSX.utils.book_new();
|
||||
worksheet = XLSX.utils.aoa_to_sheet([
|
||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||
]);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Log test start time
|
||||
//Log test start time
|
||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||
|
||||
let allStepsPassed = true;
|
||||
@@ -2329,12 +2329,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -2352,11 +2376,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'alignContentPageResults.xlsx');
|
||||
} finally {
|
||||
|
||||
@@ -5440,31 +5440,31 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||
};
|
||||
|
||||
const clearOldResults = () => {
|
||||
// Remove old screenshots
|
||||
//Remove old screenshots
|
||||
const screenshotDir = path.join('screenshots', 'alignStandardsPage');
|
||||
if (fs.existsSync(screenshotDir)) {
|
||||
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||
}
|
||||
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
|
||||
// Remove old Excel file
|
||||
//Remove old Excel file
|
||||
if (fs.existsSync('alignStandardsPageResults.xlsx')) {
|
||||
fs.unlinkSync('alignStandardsPageResults.xlsx');
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
clearOldResults();
|
||||
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
workbook = XLSX.utils.book_new();
|
||||
worksheet = XLSX.utils.aoa_to_sheet([
|
||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||
]);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Log test start time
|
||||
//Log test start time
|
||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||
|
||||
let allStepsPassed = true;
|
||||
@@ -5474,12 +5474,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -5497,11 +5521,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'alignStandardsPageResults.xlsx');
|
||||
} finally {
|
||||
|
||||
@@ -2634,31 +2634,31 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||
};
|
||||
|
||||
const clearOldResults = () => {
|
||||
// Remove old screenshots
|
||||
//Remove old screenshots
|
||||
const screenshotDir = path.join('screenshots', 'contentPage');
|
||||
if (fs.existsSync(screenshotDir)) {
|
||||
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||
}
|
||||
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
|
||||
// Remove old Excel file
|
||||
//Remove old Excel file
|
||||
if (fs.existsSync('contentPageResults.xlsx')) {
|
||||
fs.unlinkSync('contentPageResults.xlsx');
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
clearOldResults();
|
||||
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
workbook = XLSX.utils.book_new();
|
||||
worksheet = XLSX.utils.aoa_to_sheet([
|
||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||
]);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Log test start time
|
||||
//Log test start time
|
||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||
|
||||
let allStepsPassed = true;
|
||||
@@ -2668,12 +2668,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -2691,11 +2715,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'contentPageResults.xlsx');
|
||||
} finally {
|
||||
|
||||
@@ -2971,31 +2971,31 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||
};
|
||||
|
||||
const clearOldResults = () => {
|
||||
// Remove old screenshots
|
||||
//Remove old screenshots
|
||||
const screenshotDir = path.join('screenshots', 'dashboardMyContent');
|
||||
if (fs.existsSync(screenshotDir)) {
|
||||
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||
}
|
||||
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
|
||||
// Remove old Excel file
|
||||
//Remove old Excel file
|
||||
if (fs.existsSync('dashboardMyContentResults.xlsx')) {
|
||||
fs.unlinkSync('dashboardMyContentResults.xlsx');
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
clearOldResults();
|
||||
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
workbook = XLSX.utils.book_new();
|
||||
worksheet = XLSX.utils.aoa_to_sheet([
|
||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||
]);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Log test start time
|
||||
//Log test start time
|
||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||
|
||||
let allStepsPassed = true;
|
||||
@@ -3005,12 +3005,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -3028,11 +3052,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'dashboardMyContentResults.xlsx');
|
||||
} finally {
|
||||
|
||||
@@ -2669,31 +2669,31 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||
};
|
||||
|
||||
const clearOldResults = () => {
|
||||
// Remove old screenshots
|
||||
//Remove old screenshots
|
||||
const screenshotDir = path.join('screenshots', 'editItem');
|
||||
if (fs.existsSync(screenshotDir)) {
|
||||
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||
}
|
||||
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
|
||||
// Remove old Excel file
|
||||
//Remove old Excel file
|
||||
if (fs.existsSync('editItemResults.xlsx')) {
|
||||
fs.unlinkSync('editItemResults.xlsx');
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
clearOldResults();
|
||||
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
workbook = XLSX.utils.book_new();
|
||||
worksheet = XLSX.utils.aoa_to_sheet([
|
||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||
]);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Log test start time
|
||||
//Log test start time
|
||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||
|
||||
let allStepsPassed = true;
|
||||
@@ -2703,12 +2703,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -2726,11 +2750,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'editItemResults.xlsx');
|
||||
} finally {
|
||||
|
||||
@@ -9694,31 +9694,31 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||
};
|
||||
|
||||
const clearOldResults = () => {
|
||||
// Remove old screenshots
|
||||
//Remove old screenshots
|
||||
const screenshotDir = path.join('screenshots', 'editItemAddConcept');
|
||||
if (fs.existsSync(screenshotDir)) {
|
||||
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||
}
|
||||
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
|
||||
// Remove old Excel file
|
||||
//Remove old Excel file
|
||||
if (fs.existsSync('editItemAddConceptResults.xlsx')) {
|
||||
fs.unlinkSync('editItemAddConceptResults.xlsx');
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
clearOldResults();
|
||||
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
workbook = XLSX.utils.book_new();
|
||||
worksheet = XLSX.utils.aoa_to_sheet([
|
||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||
]);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Log test start time
|
||||
//Log test start time
|
||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||
|
||||
let allStepsPassed = true;
|
||||
@@ -9728,12 +9728,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -9751,11 +9775,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'editItemAddConceptResults.xlsx');
|
||||
} finally {
|
||||
|
||||
@@ -2791,31 +2791,31 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||
};
|
||||
|
||||
const clearOldResults = () => {
|
||||
// Remove old screenshots
|
||||
//Remove old screenshots
|
||||
const screenshotDir = path.join('screenshots', 'frameworkFrameworkGroupsDIV');
|
||||
if (fs.existsSync(screenshotDir)) {
|
||||
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||
}
|
||||
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
|
||||
// Remove old Excel file
|
||||
//Remove old Excel file
|
||||
if (fs.existsSync('frameworkFrameworkGroupsDIVResults.xlsx')) {
|
||||
fs.unlinkSync('frameworkFrameworkGroupsDIVResults.xlsx');
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
clearOldResults();
|
||||
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
workbook = XLSX.utils.book_new();
|
||||
worksheet = XLSX.utils.aoa_to_sheet([
|
||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||
]);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Log test start time
|
||||
//Log test start time
|
||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||
|
||||
let allStepsPassed = true;
|
||||
@@ -2825,12 +2825,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -2848,11 +2872,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'frameworkFrameworkGroupsDIVResults.xlsx');
|
||||
} finally {
|
||||
|
||||
@@ -1753,31 +1753,31 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||
};
|
||||
|
||||
const clearOldResults = () => {
|
||||
// Remove old screenshots
|
||||
//Remove old screenshots
|
||||
const screenshotDir = path.join('screenshots', 'frameworkFrameworkSettingsDIV');
|
||||
if (fs.existsSync(screenshotDir)) {
|
||||
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||
}
|
||||
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
|
||||
// Remove old Excel file
|
||||
//Remove old Excel file
|
||||
if (fs.existsSync('frameworkFrameworkSettingsDIVResults.xlsx')) {
|
||||
fs.unlinkSync('frameworkFrameworkSettingsDIVResults.xlsx');
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
clearOldResults();
|
||||
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
workbook = XLSX.utils.book_new();
|
||||
worksheet = XLSX.utils.aoa_to_sheet([
|
||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||
]);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Log test start time
|
||||
//Log test start time
|
||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||
|
||||
let allStepsPassed = true;
|
||||
@@ -1787,12 +1787,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -1810,11 +1834,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'frameworkFrameworkSettingsDIVResults.xlsx');
|
||||
} finally {
|
||||
|
||||
@@ -4157,31 +4157,31 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||
};
|
||||
|
||||
const clearOldResults = () => {
|
||||
// Remove old screenshots
|
||||
//Remove old screenshots
|
||||
const screenshotDir = path.join('screenshots', 'frameworkManagementPage');
|
||||
if (fs.existsSync(screenshotDir)) {
|
||||
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||
}
|
||||
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
|
||||
// Remove old Excel file
|
||||
//Remove old Excel file
|
||||
if (fs.existsSync('frameworkManagementPageResults.xlsx')) {
|
||||
fs.unlinkSync('frameworkManagementPageResults.xlsx');
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
clearOldResults();
|
||||
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
workbook = XLSX.utils.book_new();
|
||||
worksheet = XLSX.utils.aoa_to_sheet([
|
||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||
]);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Log test start time
|
||||
//Log test start time
|
||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||
|
||||
let allStepsPassed = true;
|
||||
@@ -4191,12 +4191,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -4214,11 +4238,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'frameworkManagementPageResults.xlsx');
|
||||
} finally {
|
||||
|
||||
@@ -3045,12 +3045,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -3068,11 +3092,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'frameworkPublishFrameworkDIVResults.xlsx');
|
||||
} finally {
|
||||
|
||||
@@ -3175,31 +3175,31 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||
};
|
||||
|
||||
const clearOldResults = () => {
|
||||
// Remove old screenshots
|
||||
//Remove old screenshots
|
||||
const screenshotDir = path.join('screenshots', 'frameworkPublishingPage');
|
||||
if (fs.existsSync(screenshotDir)) {
|
||||
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||
}
|
||||
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
|
||||
// Remove old Excel file
|
||||
//Remove old Excel file
|
||||
if (fs.existsSync('frameworkPublishingPageResults.xlsx')) {
|
||||
fs.unlinkSync('frameworkPublishingPageResults.xlsx');
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
clearOldResults();
|
||||
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
workbook = XLSX.utils.book_new();
|
||||
worksheet = XLSX.utils.aoa_to_sheet([
|
||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||
]);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Log test start time
|
||||
//Log test start time
|
||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||
|
||||
let allStepsPassed = true;
|
||||
@@ -3209,12 +3209,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -3232,11 +3256,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'frameworkPublishingPageResults.xlsx');
|
||||
} finally {
|
||||
|
||||
@@ -490,31 +490,31 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||
};
|
||||
|
||||
const clearOldResults = () => {
|
||||
// Remove old screenshots
|
||||
//Remove old screenshots
|
||||
const screenshotDir = path.join('screenshots', 'landingPage');
|
||||
if (fs.existsSync(screenshotDir)) {
|
||||
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||
}
|
||||
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
|
||||
// Remove old Excel file
|
||||
//Remove old Excel file
|
||||
if (fs.existsSync('landingPageResults.xlsx')) {
|
||||
fs.unlinkSync('landingPageResults.xlsx');
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
clearOldResults();
|
||||
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
workbook = XLSX.utils.book_new();
|
||||
worksheet = XLSX.utils.aoa_to_sheet([
|
||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||
]);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Log test start time
|
||||
//Log test start time
|
||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||
|
||||
let allStepsPassed = true;
|
||||
@@ -524,12 +524,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -547,11 +571,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'landingPageResults.xlsx');
|
||||
} finally {
|
||||
|
||||
@@ -383,31 +383,31 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||
};
|
||||
|
||||
const clearOldResults = () => {
|
||||
// Remove old screenshots
|
||||
//Remove old screenshots
|
||||
const screenshotDir = path.join('screenshots', 'login');
|
||||
if (fs.existsSync(screenshotDir)) {
|
||||
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||
}
|
||||
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||
|
||||
// Remove old Excel file
|
||||
//Remove old Excel file
|
||||
if (fs.existsSync('loginResults.xlsx')) {
|
||||
fs.unlinkSync('loginResults.xlsx');
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
clearOldResults();
|
||||
|
||||
// Initialize workbook and worksheet
|
||||
//Initialize workbook and worksheet
|
||||
workbook = XLSX.utils.book_new();
|
||||
worksheet = XLSX.utils.aoa_to_sheet([
|
||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||
]);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Log test start time
|
||||
//Log test start time
|
||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||
|
||||
let allStepsPassed = true;
|
||||
@@ -417,12 +417,36 @@ try {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
try {
|
||||
//Screenshot of failed step
|
||||
await step.action();
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
|
||||
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
|
||||
|
||||
//Log a successful step with no screenshot
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Passed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
null //No screenshot for passed steps
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
//Only take screenshot if the step fails
|
||||
const screenshotPath = await takeScreenshot(
|
||||
driver,
|
||||
stepIndex,
|
||||
`${step.description}_Failed`
|
||||
);
|
||||
|
||||
worksheet = logStep(
|
||||
worksheet,
|
||||
step.description,
|
||||
'Failed',
|
||||
stepIndex,
|
||||
timestamp,
|
||||
screenshotPath
|
||||
);
|
||||
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
allStepsPassed = false;
|
||||
@@ -440,11 +464,11 @@ try {
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
|
||||
// Log test end time
|
||||
//Log test end time
|
||||
const endTime = new Date().toISOString();
|
||||
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||
|
||||
// Write the updated worksheet back to the workbook and save it
|
||||
//Write the updated worksheet back to the workbook and save it
|
||||
workbook.Sheets['Sheet1'] = worksheet;
|
||||
XLSX.writeFile(workbook, 'loginResults.xlsx');
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user