From 32d4994eb02be80c6997ae03bc5045f8c6288ddd Mon Sep 17 00:00:00 2001 From: jhuerta Date: Fri, 3 Oct 2025 12:44:12 -0700 Subject: [PATCH] Updated script to only take screenshots on failed steps --- tests/ExACT_alignConceptsPage.js | 48 ++++++++++---- tests/ExACT_alignContentPage.js | 48 ++++++++++---- tests/ExACT_alignStandardsPage.js | 48 ++++++++++---- tests/ExACT_contentPage.js | 48 ++++++++++---- tests/ExACT_dashboardMyContent.js | 48 ++++++++++---- tests/ExACT_editItem.js | 48 ++++++++++---- tests/ExACT_editItemAddConcept.js | 48 ++++++++++---- tests/ExACT_frameworkFrameworkGroupsDIV.js | 50 ++++++++++---- tests/ExACT_frameworkFrameworkSettingsDIV.js | 70 +++++++++++++------- tests/ExACT_frameworkManagementPage.js | 48 ++++++++++---- tests/ExACT_frameworkPublishFrameworkDIV.js | 38 +++++++++-- tests/ExACT_frameworkPublishingPage.js | 48 ++++++++++---- tests/ExACT_landingPage.js | 48 ++++++++++---- tests/ExACT_login.js | 48 ++++++++++---- 14 files changed, 511 insertions(+), 175 deletions(-) diff --git a/tests/ExACT_alignConceptsPage.js b/tests/ExACT_alignConceptsPage.js index a32fe99..fc591d1 100644 --- a/tests/ExACT_alignConceptsPage.js +++ b/tests/ExACT_alignConceptsPage.js @@ -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; @@ -3452,13 +3452,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { + 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 { diff --git a/tests/ExACT_alignContentPage.js b/tests/ExACT_alignContentPage.js index f8f1697..4adf7f3 100644 --- a/tests/ExACT_alignContentPage.js +++ b/tests/ExACT_alignContentPage.js @@ -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; @@ -2328,13 +2328,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { + 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 { diff --git a/tests/ExACT_alignStandardsPage.js b/tests/ExACT_alignStandardsPage.js index 34d7379..8a6c87f 100644 --- a/tests/ExACT_alignStandardsPage.js +++ b/tests/ExACT_alignStandardsPage.js @@ -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; @@ -5473,13 +5473,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { + 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 { diff --git a/tests/ExACT_contentPage.js b/tests/ExACT_contentPage.js index f72b8a0..da057f3 100644 --- a/tests/ExACT_contentPage.js +++ b/tests/ExACT_contentPage.js @@ -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; @@ -2667,13 +2667,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { + 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 { diff --git a/tests/ExACT_dashboardMyContent.js b/tests/ExACT_dashboardMyContent.js index 9cb5315..6591e20 100644 --- a/tests/ExACT_dashboardMyContent.js +++ b/tests/ExACT_dashboardMyContent.js @@ -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; @@ -3004,13 +3004,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { + 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 { diff --git a/tests/ExACT_editItem.js b/tests/ExACT_editItem.js index e5f7d3e..712e1d8 100644 --- a/tests/ExACT_editItem.js +++ b/tests/ExACT_editItem.js @@ -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; @@ -2702,13 +2702,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { + 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 { diff --git a/tests/ExACT_editItemAddConcept.js b/tests/ExACT_editItemAddConcept.js index 1f7b0c8..b88d795 100644 --- a/tests/ExACT_editItemAddConcept.js +++ b/tests/ExACT_editItemAddConcept.js @@ -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; @@ -9727,13 +9727,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { + 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 { diff --git a/tests/ExACT_frameworkFrameworkGroupsDIV.js b/tests/ExACT_frameworkFrameworkGroupsDIV.js index cf1de22..4aa5f1a 100644 --- a/tests/ExACT_frameworkFrameworkGroupsDIV.js +++ b/tests/ExACT_frameworkFrameworkGroupsDIV.js @@ -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; @@ -2824,13 +2824,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { - await step.action(); - const screenshotPath = await takeScreenshot(driver, stepIndex, step.description); - worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath); + try { + //Screenshot of failed step + await step.action(); + + //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 { diff --git a/tests/ExACT_frameworkFrameworkSettingsDIV.js b/tests/ExACT_frameworkFrameworkSettingsDIV.js index 5951df1..0dcb4c0 100644 --- a/tests/ExACT_frameworkFrameworkSettingsDIV.js +++ b/tests/ExACT_frameworkFrameworkSettingsDIV.js @@ -31,17 +31,17 @@ const steps = [ }, //Dashboard title - { - description: 'Validate dashboard title', - action: async () => { - const elementText = await driver.findElement(By.css('.e-heading')).getText(); - if (elementText === 'Correlation Dashboard') { - console.log(`Passed: "${elementText}" title matched as expected`); - } else { - throw new Error(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`); - } + { + description: 'Validate dashboard title', + action: async () => { + const elementText = await driver.findElement(By.css('.e-heading')).getText(); + if (elementText === 'Correlation Dashboard') { + console.log(`Passed: "${elementText}" title matched as expected`); + } else { + throw new Error(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`); } - }, + } + }, //Align icon color -gray { @@ -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; @@ -1786,13 +1786,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { - await step.action(); - const screenshotPath = await takeScreenshot(driver, stepIndex, step.description); - worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath); + try { + //Screenshot of failed step + await step.action(); + + //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 { diff --git a/tests/ExACT_frameworkManagementPage.js b/tests/ExACT_frameworkManagementPage.js index ecc64de..0e89188 100644 --- a/tests/ExACT_frameworkManagementPage.js +++ b/tests/ExACT_frameworkManagementPage.js @@ -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; @@ -4190,13 +4190,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { + 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 { diff --git a/tests/ExACT_frameworkPublishFrameworkDIV.js b/tests/ExACT_frameworkPublishFrameworkDIV.js index c399ff3..2405faa 100644 --- a/tests/ExACT_frameworkPublishFrameworkDIV.js +++ b/tests/ExACT_frameworkPublishFrameworkDIV.js @@ -3044,13 +3044,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { + 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 { diff --git a/tests/ExACT_frameworkPublishingPage.js b/tests/ExACT_frameworkPublishingPage.js index b6ba148..e5613aa 100644 --- a/tests/ExACT_frameworkPublishingPage.js +++ b/tests/ExACT_frameworkPublishingPage.js @@ -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; @@ -3208,13 +3208,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { + 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 { diff --git a/tests/ExACT_landingPage.js b/tests/ExACT_landingPage.js index c037591..e5a1300 100644 --- a/tests/ExACT_landingPage.js +++ b/tests/ExACT_landingPage.js @@ -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; @@ -523,13 +523,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { + 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 { diff --git a/tests/ExACT_login.js b/tests/ExACT_login.js index d7ef705..fcb7ee7 100644 --- a/tests/ExACT_login.js +++ b/tests/ExACT_login.js @@ -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; @@ -416,13 +416,37 @@ try { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); - try { + 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 {