From fb5ce957fc1891c9cbd255c9a3b0290f27e3d303 Mon Sep 17 00:00:00 2001 From: jhuerta Date: Thu, 5 Nov 2026 12:57:00 -0800 Subject: [PATCH] Added and Completed View Queued Report Page script --- index.js | 5 +- .../reportViewQueuedReportsPageResults.xlsx | Bin 0 -> 23861 bytes tests/Report/reportViewQueuedReportsPage.js | 1710 +++++++++++++++++ 3 files changed, 1714 insertions(+), 1 deletion(-) create mode 100644 results/reportViewQueuedReportsPageResults.xlsx create mode 100644 tests/Report/reportViewQueuedReportsPage.js diff --git a/index.js b/index.js index 59a9479..2f36e22 100644 --- a/index.js +++ b/index.js @@ -35,6 +35,7 @@ import activityReportPage from './tests/ActivityReport/ActivityReportPage.js'; //REPORT import reportBuildYourReportPage from './tests/Report/reportBuildYourReportPage.js'; +import reportViewQueuedReportsPage from './tests/Report/reportViewQueuedReportsPage.js'; //APPROVE import approvePage from './tests/Approve/approvePage.js'; @@ -89,7 +90,8 @@ app.get('/', (req, res) => {
Activity Report Page

REPORT

-
Report Page
+
Build Your Report Page
+
View Queued Reports Page

APPROVE

Approve Page
@@ -144,6 +146,7 @@ app.get('/activityReportPage', activityReportPage); //ACTIVITY REPORT app.get('/reportBuildYourReportPage', reportBuildYourReportPage); +app.get('/reportViewQueuedReportsPage', reportViewQueuedReportsPage); //APPROVE app.get('/approvePage', approvePage); diff --git a/results/reportViewQueuedReportsPageResults.xlsx b/results/reportViewQueuedReportsPageResults.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..0c1a1f4ebc3f3f44a2f7bda5e633bb1c7b88c9f6 GIT binary patch literal 23861 zcmeHP-ES<(Rritwp+!+xB}fqxQZrIeP~w^C`5t3WWRLB=cdvb~vAuUUi(u*L?wRT9 zp6=f6p0S+(+H4S7u>vV!LGXaYL!=;~z)A^Xg_b`9ctJd{9}x*?UwA>{f#0d>ud1o` z9s63Kz}}U2s;f_(I=`w@r%qL!uA_UOc=|JI>A!D1_1o|K^^dKs(cjM^^TMsY654K5 zJNLu0k?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ests/Report/reportViewQueuedReportsPage.js new file mode 100644 index 0000000..b576154 --- /dev/null +++ b/tests/Report/reportViewQueuedReportsPage.js @@ -0,0 +1,1710 @@ +import { Builder, By, Key, until, Select, Browser } from 'selenium-webdriver'; +import { Options as ChromeOptions } from 'selenium-webdriver/chrome.js'; +import fs, { link } from 'fs'; +import XLSX from 'xlsx'; +import path from 'path'; + +const reportViewQueuedReportsPage = (req, res) => { + res.send('

ExACT Automated Test Script: Report - View Queued Reports Page(reportViewQueuedReportsPage); Initiated

'); + (async function example() { + let driver = await new Builder() + .forBrowser('chrome') + .setChromeOptions( + new ChromeOptions() + .addArguments('--disable-features=MediaRouter') + .addArguments('--disable-extensions') + .addArguments('--disable-background-networking') + .addArguments('--log-level=3') + ) + .build(); + let testStatus = 'Failed'; + let workbook; + let worksheet; + const startTime = new Date().toISOString(); + +//CONSTANTS - QUEUED REPORTS LIST +//Expected rows in the queued reports table, top to bottom. Update this list when the reports change. +//downloadFile is the file name in the download link (/exact/reports/exact_juan/) +const expectedReports = [ + { reportId: '18070', title: 'ECS3010_01.67', format: 'html', status: 'Completed', size: '23KB', created: 'Feb 25 2026 07:30pm PST', lastRun: 'Feb 25 2026 07:31pm PST', downloadFile: 'ECS3010Test1.67.html' }, + { reportId: '18068', title: 'ECS3010_01.8', format: 'html', status: 'Completed', size: '0B', created: 'Feb 25 2026 07:18pm PST', lastRun: 'Feb 25 2026 07:20pm PST', downloadFile: 'ECS3010Test1.8.html' }, + { reportId: '18067', title: 'checking123', format: 'html', status: 'Completed', size: '1KB', created: 'Feb 25 2026 05:27pm PST', lastRun: 'Feb 25 2026 05:28pm PST', downloadFile: 'check123.html' }, + { reportId: '17786', title: 'Will It Add To Queue', format: 'html', status: 'Completed', size: '1KB', created: 'Feb 06 2026 03:50pm PST', lastRun: 'Feb 06 2026 03:51pm PST', downloadFile: 'Testing3010.html' }, + { reportId: '8999', title: 'checking', format: 'html', status: 'Completed', size: '28KB', created: 'Jul 16 2024 05:30pm PDT', lastRun: 'Jul 16 2024 05:31pm PDT', downloadFile: 'newcheck.html' }, + { reportId: '8998', title: 'LatestReportInBackground', format: 'html', status: 'Completed', size: '70KB', created: 'Jul 16 2024 05:14pm PDT', lastRun: 'Jul 16 2024 05:15pm PDT', downloadFile: 'Latest.html' }, + { reportId: '8781', title: 'SoDontLook', format: 'xls', status: 'Completed', size: '506B', created: 'May 17 2024 10:31pm PDT', lastRun: 'May 17 2024 10:32pm PDT', downloadFile: 'ThisBeMyFile.xls' }, + { reportId: '8779', title: 'Test Inc.', format: 'doc', status: 'Completed', size: '27KB', created: 'May 17 2024 10:28pm PDT', lastRun: 'May 17 2024 10:29pm PDT', downloadFile: 'WordToYa.doc' }, + { reportId: '8778', title: 'What Eves', format: 'pdf', status: 'Completed', size: '848KB', created: 'May 17 2024 10:00pm PDT', lastRun: 'May 17 2024 10:01pm PDT', downloadFile: 'IDontThinkSo.pdf' }, + { reportId: '8758', title: 'Comparing UI icons', format: 'html', status: 'Completed', size: '61KB', created: 'May 16 2024 01:15pm PDT', lastRun: 'May 16 2024 01:18pm PDT', downloadFile: 'Checking.html' }, +]; + +//Format badge background color for each report format +const formatBadgeColors = { + html: 'rgba(0, 0, 0, 1)', + xls: 'rgba(29, 111, 66, 1)', + doc: 'rgba(25, 91, 192, 1)', + pdf: 'rgba(255, 0, 0, 1)', +}; + +const steps = [ + { description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://correlation.edgate.com/exact/login.php') }, + { description: 'Expand browser', action: async () => await driver.manage().window().maximize() }, + + //Login + { + description: 'Login', + action: async () => { + const multipleChecks = 'Log In'; + + console.log('------------->| REPORT - VIEW QUEUED REPORTS PAGE |<-------------'); + const errors = []; + + await driver.findElement(By.css('.form-control:nth-child(2)')).sendKeys('exact_juan'); + await driver.findElement(By.css('.passfield')).sendKeys('Edgate1!'); + await driver.findElement(By.css('.login')).click(); + console.log('----->| NEXT ACTION: Entered credentials and logged in'); + + //Wait for page readyState + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'ExACT Dashboard did not fully load within 30 seconds'); + + //Wait for the dashboard container to exist in DOM + await driver.wait( + until.elementLocated(By.css('.gap-idle-wrap > img')), + 30000, + 'Dashboard image did not appear within 30 seconds' + ); + + //Wait for it to be: visible + await driver.wait(async () => { + try { + const img = await driver.findElement(By.css('.gap-idle-wrap > img')); + return await img.isDisplayed(); + } catch (e) { + return false; + } + }, 30000, 'Dashboard image did not become visible within 30 seconds'); + + //Wait for any loading spinners to disappear + await driver.wait(async () => { + try { + const spinners = await driver.findElements(By.css('.spinner-border')); + for (const spinner of spinners) { + if (await spinner.isDisplayed()) return false; + } + return true; + } catch (e) { + return true; + } + }, 30000, 'Loading spinners did not disappear within 30 seconds'); + + //Wait for the slowest resource to complete + await driver.wait(async () => { + const completed = await driver.executeScript(` + const entries = performance.getEntriesByType('resource'); + return entries.some(entry => + entry.name.includes('content_sets.php') && + entry.responseEnd > 0 + ); + `); + return completed; + }, 30000, 'My Content widget (content_sets.php) did not complete loading within 30 seconds'); + console.log('Passed: My Content widget (content_sets.php) loaded successfully - Dashboard fully loaded'); + + //Final sleep to allow any remaining dynamic content to settle + await driver.sleep(2000); + + console.log('Passed: ExACT Dashboard loaded successfully'); + + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + } + }, + + //Dashboard title + { + description: 'Dashboard title text, size, and color', + action: async () => { + const multipleChecks = 'Dashboard title'; + + const element = await driver.findElement(By.css('.e-heading')); + + //Get text, font, size, and color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Correlation Dashboard') { + console.log('Passed: Dashboard title text matched as expected'); + } else { + errors.push(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`); + } + + //font + if (elementFont === `"DM Serif Display", serif`) { + console.log('Passed: Dashboard title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard title font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '32px') { + console.log('Passed: Dashboard title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard title text font-size "32px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //NEXT ACTION + { + description: 'Click Report navigation link', + action: async () => { + await driver.findElement(By.linkText('Report')).click(); + console.log('----->| NEXT ACTION: Clicked Report navigation link'); + + //Wait for page readyState + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Report page did not fully load within 30 seconds'); + + //Wait until the element exists in the DOM + const reportPageTitle = await driver.wait( + until.elementLocated(By.css('h2')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(reportPageTitle), + 30000 + ); + } + }, + + //Report page title + { + description: 'Report page title text, size, and color', + action: async () => { + const multipleChecks = 'Report page title'; + + const element = await driver.findElement(By.css('h2')); + + //Get text, font, size, and color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Report') { + console.log('Passed: Report page title text matched as expected'); + } else { + errors.push(`Expected: "Report"; Actual: "${elementText}"`); + } + + //font + if (elementFont === `"DM Serif Display", serif`) { + console.log('Passed: Report page title font-family matched as expected'); + } else { + errors.push(`Expected: Report page title font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '32px') { + console.log('Passed: Report page title text font-size matched as expected'); + } else { + errors.push(`Expected: Report page title text font-size "32px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Report page title text color matched as expected'); + } else { + errors.push(`Expected: Report page title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Build your report tab + { + description: 'Build your report tab title text, size, color, and background color', + action: async () => { + const multipleChecks = 'Build your report tab title'; + + const element = await driver.findElement(By.linkText('Build your report')); + + //Get text, font, size, color, and background color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + const elementBgColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //element text + if (elementText === 'Build your report') { + console.log('Passed: Build your report tab title text matched as expected'); + } else { + errors.push(`Expected: "Build your report"; Actual: "${elementText}"`); + } + + //element font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Build your report tab title font-family matched as expected'); + } else { + errors.push(`Expected: Build your report tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //element size + if (elementSize === '15px') { + console.log('Passed: Build your report tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Build your report tab title text font-size "15px"; Actual: "${elementSize}"`); + } + + //element color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Build your report tab title text color matched as expected'); + } else { + errors.push(`Expected: Build your report tab title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //element background color + if (elementBgColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Build your report tab title background color matched as expected'); + } else { + errors.push(`Expected: Build your report tab title background color: "rgba(40, 39, 90, 1)"; Actual: "${elementBgColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //View queued reports tab + { + description: 'View queued reports tab title text, size, color, and background color', + action: async () => { + const multipleChecks = 'View queued reports tab title'; + + const element = await driver.findElement(By.linkText('View queued reports')); + + //Get text, font, size, color, and background color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + const elementBgColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //element text + if (elementText === 'View queued reports') { + console.log('Passed: View queued reports tab title text matched as expected'); + } else { + errors.push(`Expected: "View queued reports"; Actual: "${elementText}"`); + } + + //element font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: View queued reports tab title font-family matched as expected'); + } else { + errors.push(`Expected: View queued reports tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //element size + if (elementSize === '15px') { + console.log('Passed: View queued reports tab title text font-size matched as expected'); + } else { + errors.push(`Expected: View queued reports tab title text font-size "15px"; Actual: "${elementSize}"`); + } + + //element color + if (elementColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: View queued reports tab title text color matched as expected'); + } else { + errors.push(`Expected: View queued reports tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`); + } + + //element background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: View queued reports tab title background color matched as expected'); + } else { + errors.push(`Expected: View queued reports tab title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Specialty Reports tab + { + description: 'Specialty Reports tab title text, size, color, and background color', + action: async () => { + const multipleChecks = 'Specialty Reports tab title'; + + const element = await driver.findElement(By.linkText('Specialty Reports')); + + //Get text, font, size, color, and background color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + const elementBgColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //element text + if (elementText === 'Specialty Reports') { + console.log('Passed: Specialty Reports tab title text matched as expected'); + } else { + errors.push(`Expected: "Specialty Reports"; Actual: "${elementText}"`); + } + + //element font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Specialty Reports tab title font-family matched as expected'); + } else { + errors.push(`Expected: Specialty Reports tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //element size + if (elementSize === '15px') { + console.log('Passed: Specialty Reports tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Specialty Reports tab title text font-size "15px"; Actual: "${elementSize}"`); + } + + //element color + if (elementColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Specialty Reports tab title text color matched as expected'); + } else { + errors.push(`Expected: Specialty Reports tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`); + } + + //element background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Specialty Reports tab title background color matched as expected'); + } else { + errors.push(`Expected: Specialty Reports tab title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //NEXT ACTION + { + description: 'Click View queued reports tab', + action: async () => { + await driver.findElement(By.linkText('View queued reports')).click(); + console.log('----->| NEXT ACTION: Clicked View Queued Reports tab'); + + //Wait for page readyState + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'View Queued Reports page did not fully load within 30 seconds'); + + //Wait until the element exists in the DOM + const viewQueuedReportsPageTitle = await driver.wait( + until.elementLocated(By.css('h2')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(viewQueuedReportsPageTitle), + 30000 + ); + } + }, + + //Report page title + { + description: 'Report page title text, size, and color', + action: async () => { + const multipleChecks = 'Report page title'; + + const element = await driver.findElement(By.css('h2')); + + //Get text, font, size, and color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Report') { + console.log('Passed: Report page title text matched as expected'); + } else { + errors.push(`Expected: "Report"; Actual: "${elementText}"`); + } + + //font + if (elementFont === `"DM Serif Display", serif`) { + console.log('Passed: Report page title font-family matched as expected'); + } else { + errors.push(`Expected: Report page title font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '32px') { + console.log('Passed: Report page title text font-size matched as expected'); + } else { + errors.push(`Expected: Report page title text font-size "32px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Report page title text color matched as expected'); + } else { + errors.push(`Expected: Report page title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Build your report tab + { + description: 'Build your report tab title text, size, color, and background color', + action: async () => { + const multipleChecks = 'Build your report tab title'; + + const element = await driver.findElement(By.linkText('Build your report')); + + //Get text, font, size, color, and background color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + const elementBgColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //element text + if (elementText === 'Build your report') { + console.log('Passed: Build your report tab title text matched as expected'); + } else { + errors.push(`Expected: "Build your report"; Actual: "${elementText}"`); + } + + //element font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Build your report tab title font-family matched as expected'); + } else { + errors.push(`Expected: Build your report tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //element size + if (elementSize === '15px') { + console.log('Passed: Build your report tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Build your report tab title text font-size "15px"; Actual: "${elementSize}"`); + } + + //element color + if (elementColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Build your report tab title text color matched as expected'); + } else { + errors.push(`Expected: Build your report tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`); + } + + //element background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Build your report tab title background color matched as expected'); + } else { + errors.push(`Expected: Build your report tab title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //View queued reports tab + { + description: 'View queued reports tab title text, size, color, and background color', + action: async () => { + const multipleChecks = 'View queued reports tab title'; + + const element = await driver.findElement(By.linkText('View queued reports')); + + //Get text, font, size, color, and background color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + const elementBgColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //element text + if (elementText === 'View queued reports') { + console.log('Passed: View queued reports tab title text matched as expected'); + } else { + errors.push(`Expected: "View queued reports"; Actual: "${elementText}"`); + } + + //element font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: View queued reports tab title font-family matched as expected'); + } else { + errors.push(`Expected: View queued reports tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //element size + if (elementSize === '15px') { + console.log('Passed: View queued reports tab title text font-size matched as expected'); + } else { + errors.push(`Expected: View queued reports tab title text font-size "15px"; Actual: "${elementSize}"`); + } + + //element color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: View queued reports tab title text color matched as expected'); + } else { + errors.push(`Expected: View queued reports tab title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //element background color + if (elementBgColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: View queued reports tab title background color matched as expected'); + } else { + errors.push(`Expected: View queued reports tab title background color: "rgba(40, 39, 90, 1)"; Actual: "${elementBgColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Specialty Reports tab + { + description: 'Specialty Reports tab title text, size, color, and background color', + action: async () => { + const multipleChecks = 'Specialty Reports tab title'; + + const element = await driver.findElement(By.linkText('Specialty Reports')); + + //Get text, font, size, color, and background color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + const elementBgColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //element text + if (elementText === 'Specialty Reports') { + console.log('Passed: Specialty Reports tab title text matched as expected'); + } else { + errors.push(`Expected: "Specialty Reports"; Actual: "${elementText}"`); + } + + //element font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Specialty Reports tab title font-family matched as expected'); + } else { + errors.push(`Expected: Specialty Reports tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //element size + if (elementSize === '15px') { + console.log('Passed: Specialty Reports tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Specialty Reports tab title text font-size "15px"; Actual: "${elementSize}"`); + } + + //element color + if (elementColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Specialty Reports tab title text color matched as expected'); + } else { + errors.push(`Expected: Specialty Reports tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`); + } + + //element background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Specialty Reports tab title background color matched as expected'); + } else { + errors.push(`Expected: Specialty Reports tab title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //COLUMN TITLE ROW + //Report ID column title + { + description: 'Report ID column title text, size, and color', + action: async () => { + const multipleChecks = 'Report ID column title'; + + const element = await driver.findElement(By.css('.bg-secondary > td:nth-child(2)')); + + //Get text, font, size, and color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + const elementBgColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Report ID') { + console.log('Passed: Report ID column title text matched as expected'); + } else { + errors.push(`Expected: Column title to be: "Report ID"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Report ID column title font-family matched as expected'); + } else { + errors.push(`Expected: Report ID column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Report ID column title text font-size matched as expected'); + } else { + errors.push(`Expected: Report ID column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Report ID column title text color matched as expected'); + } else { + errors.push(`Expected: Report ID column title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //element background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Report ID column title background color matched as expected'); + } else { + errors.push(`Expected: Report ID column title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Title column title + { + description: 'Title column title text, size, and color', + action: async () => { + const multipleChecks = 'Title column title'; + + const element = await driver.findElement(By.css('.bg-secondary > td:nth-child(3)')); + + //Get text, font, size, and color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + const elementBgColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Title') { + console.log('Passed: Title column title text matched as expected'); + } else { + errors.push(`Expected: Column title to be: "Title"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Title column title font-family matched as expected'); + } else { + errors.push(`Expected: Title column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Title column title text font-size matched as expected'); + } else { + errors.push(`Expected: Title column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Title column title text color matched as expected'); + } else { + errors.push(`Expected: Title column title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //element background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Title column title background color matched as expected'); + } else { + errors.push(`Expected: Title column title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Format column title + { + description: 'Format column title text, size, and color', + action: async () => { + const multipleChecks = 'Format column title'; + + const element = await driver.findElement(By.css('.bg-secondary > td:nth-child(4)')); + + //Get text, font, size, and color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + const elementBgColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Format') { + console.log('Passed: Format column title text matched as expected'); + } else { + errors.push(`Expected: Column title to be: "Format"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Format column title font-family matched as expected'); + } else { + errors.push(`Expected: Format column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Format column title text font-size matched as expected'); + } else { + errors.push(`Expected: Format column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Format column title text color matched as expected'); + } else { + errors.push(`Expected: Format column title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //element background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Format column title background color matched as expected'); + } else { + errors.push(`Expected: Format column title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Status column title + { + description: 'Status column title text, size, and color', + action: async () => { + const multipleChecks = 'Status column title'; + + const element = await driver.findElement(By.css('.bg-secondary > td:nth-child(5)')); + + //Get text, font, size, and color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + const elementBgColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Status') { + console.log('Passed: Status column title text matched as expected'); + } else { + errors.push(`Expected: Column title to be: "Status"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Status column title font-family matched as expected'); + } else { + errors.push(`Expected: Status column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Status column title text font-size matched as expected'); + } else { + errors.push(`Expected: Status column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Status column title text color matched as expected'); + } else { + errors.push(`Expected: Status column title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //element background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Status column title background color matched as expected'); + } else { + errors.push(`Expected: Status column title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Size column title + { + description: 'Size column title text, size, and color', + action: async () => { + const multipleChecks = 'Size column title'; + + const element = await driver.findElement(By.css('.bg-secondary > td:nth-child(6)')); + + //Get text, font, size, and color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + const elementBgColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Size') { + console.log('Passed: Size column title text matched as expected'); + } else { + errors.push(`Expected: Column title to be: "Size"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Size column title font-family matched as expected'); + } else { + errors.push(`Expected: Size column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Size column title text font-size matched as expected'); + } else { + errors.push(`Expected: Size column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Size column title text color matched as expected'); + } else { + errors.push(`Expected: Size column title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //element background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Size column title background color matched as expected'); + } else { + errors.push(`Expected: Size column title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Created column title + { + description: 'Created column title text, size, and color', + action: async () => { + const multipleChecks = 'Created column title'; + + const element = await driver.findElement(By.css('.bg-secondary > td:nth-child(7)')); + + //Get text, font, size, and color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + const elementBgColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Created') { + console.log('Passed: Created column title text matched as expected'); + } else { + errors.push(`Expected: Column title to be: "Created"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Created column title font-family matched as expected'); + } else { + errors.push(`Expected: Created column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Created column title text font-size matched as expected'); + } else { + errors.push(`Expected: Created column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Created column title text color matched as expected'); + } else { + errors.push(`Expected: Created column title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //element background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Created column title background color matched as expected'); + } else { + errors.push(`Expected: Created column title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Last Run column title + { + description: 'Last Run column title text, size, and color', + action: async () => { + const multipleChecks = 'Last Run column title'; + + const element = await driver.findElement(By.css('.bg-secondary > td:nth-child(8)')); + + //Get text, font, size, and color + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementColor = await element.getCssValue('color'); + const elementBgColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Last Run') { + console.log('Passed: Last Run column title text matched as expected'); + } else { + errors.push(`Expected: Column title to be: "Last Run"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Last Run column title font-family matched as expected'); + } else { + errors.push(`Expected: Last Run column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Last Run column title text font-size matched as expected'); + } else { + errors.push(`Expected: Last Run column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Last Run column title text color matched as expected'); + } else { + errors.push(`Expected: Last Run column title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //element background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Last Run column title background color matched as expected'); + } else { + errors.push(`Expected: Last Run column title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //QUEUED REPORTS LIST + //Row count + { + description: 'Queued reports list row count', + action: async () => { + //Report rows are the rows that have a report[] checkbox - this skips the column title row + const rows = await driver.findElements(By.xpath('//tr[.//input[@name="report[]"]]')); + + if (rows.length === expectedReports.length) { + console.log(`Passed: Queued reports list row count matched as expected (${rows.length})`); + } else { + throw new Error(`Expected: Queued reports list to have ${expectedReports.length} rows; Actual: ${rows.length}`); + } + } + }, + + //One step per expected row: Checkbox, Report ID, Title, Format, Status, Size, Created, Last Run, and Download icon + ...expectedReports.map((expected, index) => ({ + description: `Queued reports list row ${index + 1} (${expected.reportId} - ${expected.title}) values`, + action: async () => { + const multipleChecks = `Queued reports list row ${index + 1}`; + + const row = await driver.findElement(By.xpath(`(//tr[.//input[@name="report[]"]])[${index + 1}]`)); + const cells = await row.findElements(By.css('td')); + + //Track all errors + const errors = []; + + //Checkbox - displayed, tied to this report ID, and not checked + const checkboxes = cells[0] ? await cells[0].findElements(By.css('input[type="checkbox"]')) : []; + if (checkboxes.length > 0 && await checkboxes[0].isDisplayed()) { + console.log(`Passed: ${multipleChecks} Checkbox was displayed as expected`); + + const checkboxValue = await checkboxes[0].getAttribute('value'); + if (checkboxValue === expected.reportId) { + console.log(`Passed: ${multipleChecks} Checkbox value matched as expected`); + } else { + errors.push(`Expected: ${multipleChecks} Checkbox value to be: "${expected.reportId}"; Actual: "${checkboxValue}"`); + } + + if (!(await checkboxes[0].isSelected())) { + console.log(`Passed: ${multipleChecks} Checkbox was not checked as expected`); + } else { + errors.push(`Expected: ${multipleChecks} Checkbox was checked`); + } + } else { + errors.push(`Expected: ${multipleChecks} Checkbox was not displayed`); + } + + //Text columns + const columns = [ + { name: 'Report ID', expected: expected.reportId, cell: cells[1] }, + { name: 'Title', expected: expected.title, cell: cells[2] }, + { name: 'Format', expected: expected.format, cell: cells[3] }, + { name: 'Status', expected: expected.status, cell: cells[4] }, + { name: 'Size', expected: expected.size, cell: cells[5] }, + { name: 'Created', expected: expected.created, cell: cells[6] }, + { name: 'Last Run', expected: expected.lastRun, cell: cells[7] }, + ]; + + for (const column of columns) { + const actual = column.cell ? (await column.cell.getText()).trim() : '(cell missing)'; + if (actual === column.expected) { + console.log(`Passed: ${multipleChecks} ${column.name} matched as expected`); + } else { + errors.push(`Expected: ${multipleChecks} ${column.name} to be: "${column.expected}"; Actual: "${actual}"`); + } + } + + //Format badge background color + const badges = cells[3] ? await cells[3].findElements(By.css('.badge')) : []; + if (badges.length > 0) { + const expectedBadgeColor = formatBadgeColors[expected.format]; + const badgeColor = await badges[0].getCssValue('background-color'); + if (badgeColor === expectedBadgeColor) { + console.log(`Passed: ${multipleChecks} Format badge background color matched as expected`); + } else { + errors.push(`Expected: ${multipleChecks} Format badge background color: "${expectedBadgeColor}"; Actual: "${badgeColor}"`); + } + } else { + errors.push(`Expected: ${multipleChecks} Format badge was not displayed`); + } + + //Status check mark icon + const statusIcons = cells[4] ? await cells[4].findElements(By.css('.text-success .glyphicon-ok-sign')) : []; + if (statusIcons.length > 0 && await statusIcons[0].isDisplayed()) { + console.log(`Passed: ${multipleChecks} Status check mark icon was displayed as expected`); + } else { + errors.push(`Expected: ${multipleChecks} Status check mark icon was not displayed`); + } + + //Download icon, link, and tool-tip + const downloadLinks = cells[8] ? await cells[8].findElements(By.css('a')) : []; + if (downloadLinks.length > 0) { + const downloadIcons = await downloadLinks[0].findElements(By.css('i.fa-download')); + if (downloadIcons.length > 0 && await downloadIcons[0].isDisplayed()) { + console.log(`Passed: ${multipleChecks} Download icon was displayed as expected`); + } else { + errors.push(`Expected: ${multipleChecks} Download icon was not displayed`); + } + + //href - browser returns the full URL, so compare the ending path + const expectedHref = `/exact/reports/exact_juan/${expected.downloadFile}`; + const actualHref = await downloadLinks[0].getAttribute('href'); + if (actualHref && actualHref.endsWith(expectedHref)) { + console.log(`Passed: ${multipleChecks} Download link href matched as expected`); + } else { + errors.push(`Expected: ${multipleChecks} Download link href to end with: "${expectedHref}"; Actual: "${actualHref}"`); + } + + //tool-tip + const expectedTooltip = `Download ${expected.downloadFile}`; + const actualTooltip = await downloadLinks[0].getAttribute('title'); + if (actualTooltip === expectedTooltip) { + console.log(`Passed: ${multipleChecks} Download link tool-tip matched as expected`); + } else { + errors.push(`Expected: ${multipleChecks} Download link tool-tip to be: "${expectedTooltip}"; Actual: "${actualTooltip}"`); + } + } else { + errors.push(`Expected: ${multipleChecks} Download link was not displayed`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + } + ) + ), + + //Re-run Report Button + { + description: 'Re-run Report button text, font, size, color, button color, and icon', + action: async () => { + const multipleChecks = 'Re-run Report button'; + + const elementIcon = await driver.findElement(By.css('.fa-repeat')); + const element = await driver.findElement(By.css('.btn-primary')); + + //Get button text, text font, text size, text color, and button color + const elementText = await element.getText(''); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon present + if (await elementIcon.isDisplayed()) { + console.log('Passed: Re-run Report button icon was displayed as expected'); + } else { + errors.push('Expected: Re-run Report button icon was not displayed'); + } + + //text + if (elementText === 'Re-run Report') { + console.log('Passed: Re-run Report button text matched as expected'); + } else { + errors.push(`Expected: "Re-run Report"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Re-run Report button text font matched as expected'); + } else { + errors.push(`Expected: Re-run Report button text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Re-run Report button text font-size matched as expected'); + } else { + errors.push(`Expected: Re-run Report button text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Re-run Report button text color matched as expected'); + } else { + errors.push(`Expected: Re-run Report button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Re-run Report button background color matched as expected'); + } else { + errors.push(`Expected: Re-run Report button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Delete Button + { + description: 'Delete button text, font, size, color, button color, and icon', + action: async () => { + const multipleChecks = 'Delete button'; + + const elementIcon = await driver.findElement(By.css('.fa-times-circle')); + const element = await driver.findElement(By.css('#delbtn')); + + //Get button text, text font, text size, text color, and button color + const elementText = await element.getText(''); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon present + if (await elementIcon.isDisplayed()) { + console.log('Passed: Delete button icon was displayed as expected'); + } else { + errors.push('Expected: Delete button icon was not displayed'); + } + + //text + if (elementText === 'Delete') { + console.log('Passed: Delete button text matched as expected'); + } else { + errors.push(`Expected: "Delete"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Delete button text font matched as expected'); + } else { + errors.push(`Expected: Delete button text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Delete button text font-size matched as expected'); + } else { + errors.push(`Expected: Delete button text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Delete button text color matched as expected'); + } else { + errors.push(`Expected: Delete button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(220, 53, 69, 1)') { + console.log('Passed: Delete button background color matched as expected'); + } else { + errors.push(`Expected: Delete button background color: "rgba(220, 53, 69, 1)"; Actual: "${elementButtonColor}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //FOOTER + //EdGate Copyright Logo + { + description: 'EdGate Copyright Logo', + action: async () => { + const multipleChecks = 'EdGate Copyright Logo'; + + const element = await driver.findElement(By.css('footer .pull-right > a')); + const elementLogo = await element.findElement(By.css('img')); + const expectedHref = 'https://www.edgate.com/'; + + //Track all errors + const errors = []; + + //icon present + if (await elementLogo.isDisplayed()) { + console.log('Passed: EdGate Copyright Logo was displayed as expected'); + } else { + errors.push('Expected: EdGate Copyright Logo was not displayed'); + } + + //href - browser resolves the link with a trailing slash, so remove it before comparing + const actualHref = await element.getAttribute('href'); + if (actualHref && actualHref === expectedHref) { + console.log('Passed: EdGate Copyright Logo href matched as expected'); + } else { + errors.push(`Expected: EdGate Copyright Logo href to be: "https://www.edgate.com/"; actual: "${actualHref}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //NEXT ACTION + { + description: 'Log Out', + action: async () => { + const multipleChecks = 'Log Out'; + + //Track all errors + const errors = []; + + await driver.findElement(By.css('#navbarDropdown > span')).click(); + await driver.sleep(2000); + await driver.findElement(By.linkText('Log Out')).click(); + console.log('----->| NEXT ACTION: Clicked User Profile and Logged Out'); + + //Wait until the element exists in the DOM + const exactLogo = await driver.wait( + until.elementLocated(By.css('.logo')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(exactLogo), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'ExACT Langing page did not fully load within 30 seconds'); + console.log('Passed: ExACT Landing Page loaded successfully'); + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, +]; + +const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => { + const json_data = XLSX.utils.sheet_to_json(worksheet, { header: 1 }); + json_data.push([stepIndex, stepDescription, status, timestamp, screenshotPath]); + return XLSX.utils.aoa_to_sheet(json_data); +}; + +const takeScreenshot = async (driver, stepIndex, stepDescription) => { + const screenshot = await driver.takeScreenshot(); + + const dir = path.join('screenshots', 'reportViewQueuedReportsPage'); + + const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`; + const screenshotPath = path.join(dir, screenshotFileName); + fs.writeFileSync(screenshotPath, screenshot, 'base64'); + return screenshotPath; +}; + +const resultsFile = path.join('results', 'reportViewQueuedReportsPageResults.xlsx'); + +const clearOldResults = () => { + //Remove old screenshots + const screenshotDir = path.join('screenshots', 'reportViewQueuedReportsPage'); + if (fs.existsSync(screenshotDir)) { + fs.rmSync(screenshotDir, { recursive: true, force: true }); + } + fs.mkdirSync(screenshotDir, { recursive: true }); + + //Remove old Excel file + if (fs.existsSync(resultsFile)) { + fs.unlinkSync(resultsFile); + } + fs.mkdirSync('results', { recursive: true }); +}; + +try { + //Initialize workbook and worksheet + clearOldResults(); + + //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 + worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, ''); + + let allStepsPassed = true; + + const failedSteps = []; //Track failed steps + + for (const step of steps) { + const stepIndex = steps.indexOf(step) + 1; + const timestamp = new Date().toISOString(); + + 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) { + //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}`); + failedSteps.push(`Step ${stepIndex}: ${step.description} - ${error.message}`); //Track failed step + testStatus = 'Failed'; + allStepsPassed = false; + } + } + + if (allStepsPassed) { + console.log('------------->| THE END |<-------------'); + console.log('PASSED: Report - View Queued Reports Page(reportViewQueuedReportsPage); All test steps completed successfully'); + testStatus = 'Passed'; + } else { + console.log('------------->| THE END |<-------------'); + console.log('FAILED: Report - View Queued Reports Page(reportViewQueuedReportsPage); One or more test steps failed'); + console.log('FAILED STEPS:'); + failedSteps.forEach(step => console.error(` ✗ ${step}`)); + testStatus = 'Failed'; + } + + //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 + workbook.Sheets['Sheet1'] = worksheet; + XLSX.writeFile(workbook, resultsFile); +} finally { + await driver.quit(); +} + })(); +} + +export default reportViewQueuedReportsPage;