diff --git a/index.js b/index.js
index cc10c26..a53f6bd 100644
--- a/index.js
+++ b/index.js
@@ -28,6 +28,7 @@ import alignAutoAlignPage from './tests/Align/alignAutoAlignPage.js';
//UPLOAD
import uploadSubmitAResourcePage from './tests/Upload/uploadSubmitAResourcePage.js';
import uploadBatchUploadPage from './tests/Upload/uploadBatchUpload.js';
+import uploadImportAlignmentsPage from './tests/Upload/uploadImportAlignmentsPage.js';
//Content
import ExACT_contentPage from './tests/ExACT_contentPage.js';
@@ -73,6 +74,7 @@ app.get('/', (req, res) => {
UPLOAD
+
| UPLOAD - IMPORT ALIGNMENTS 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 Upload navigation link',
+ action: async () => {
+ await driver.findElement(By.linkText('Upload')).click();
+ console.log('----->| NEXT ACTION: Clicked Upload navigation link');
+
+ //Wait for page readyState
+ await driver.wait(async () => {
+ const readyState = await driver.executeScript('return document.readyState');
+ return readyState === 'complete';
+ }, 30000, 'Align page did not fully load within 30 seconds');
+
+ //Wait until the element exists in the DOM
+ const uploadTitle = await driver.wait(
+ until.elementLocated(By.css('h2')),
+ 30000
+ );
+
+ //Wait until it becomes visible
+ await driver.wait(
+ until.elementIsVisible(uploadTitle),
+ 30000
+ );
+ }
+ },
+
+ //Upload page title
+ {
+ description: 'Upload page title text, size, and color',
+ action: async () => {
+ const multipleChecks = 'Upload 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 === 'Upload') {
+ console.log('Passed: Upload page title text matched as expected');
+ } else {
+ errors.push(`Expected: "Upload"; Actual: "${elementText}"`);
+ }
+
+ //font
+ if (elementFont === `"DM Serif Display", serif`) {
+ console.log('Passed: Upload page title font-family matched as expected');
+ } else {
+ errors.push(`Expected: Upload page title font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
+ }
+
+ //size
+ if (elementSize === '32px') {
+ console.log('Passed: Upload page title text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Upload page title text font-size "32px"; Actual: "${elementSize}"`);
+ }
+
+ //color
+ if (elementColor === 'rgba(40, 39, 90, 1)') {
+ console.log('Passed: Upload page title text color matched as expected');
+ } else {
+ errors.push(`Expected: Upload 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'));
+ }
+ }
+ },
+
+ //Submit A Resource tab
+ {
+ description: 'Submit A Resource tab title text, size, color, and background color',
+ action: async () => {
+ const multipleChecks = 'Submit A Resource tab title';
+
+ const element = await driver.findElement(By.linkText('Submit A Resource'));
+
+ //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 === 'Submit A Resource') {
+ console.log('Passed: Submit A Resource tab title text matched as expected');
+ } else {
+ errors.push(`Expected: "Submit A Resource"; Actual: "${elementText}"`);
+ }
+
+ //element font
+ if (elementFont === 'Poppins, sans-serif') {
+ console.log('Passed: Submit A Resource tab title font-family matched as expected');
+ } else {
+ errors.push(`Expected: Submit A Resource tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
+ }
+
+ //element size
+ if (elementSize === '15px') {
+ console.log('Passed: Submit A Resource tab title text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Submit A Resource tab title text font-size "15px"; Actual: "${elementSize}"`);
+ }
+
+ //element color
+ if (elementColor === 'rgba(255, 255, 255, 1)') {
+ console.log('Passed: Submit A Resource tab title text color matched as expected');
+ } else {
+ errors.push(`Expected: Submit A Resource tab title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
+ }
+
+ //element background color
+ if (elementBgColor === 'rgba(40, 39, 90, 1)') {
+ console.log('Passed: Submit A Resource tab title background color matched as expected');
+ } else {
+ errors.push(`Expected: Submit A Resource 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'));
+ }
+ }
+ },
+
+ //Batch Upload tab
+ {
+ description: 'Batch Upload tab title text, size, color, and background color',
+ action: async () => {
+ const multipleChecks = 'Batch Upload tab title';
+
+ const element = await driver.findElement(By.linkText('Batch Upload'));
+
+ //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 === 'Batch Upload') {
+ console.log('Passed: Batch Upload tab title text matched as expected');
+ } else {
+ errors.push(`Expected: "Batch Upload"; Actual: "${elementText}"`);
+ }
+
+ //element font
+ if (elementFont === 'Poppins, sans-serif') {
+ console.log('Passed: Batch Upload tab title font-family matched as expected');
+ } else {
+ errors.push(`Expected: Batch Upload tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
+ }
+
+ //element size
+ if (elementSize === '15px') {
+ console.log('Passed: Batch Upload tab title text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Batch Upload tab title text font-size "15px"; Actual: "${elementSize}"`);
+ }
+
+ //element color
+ if (elementColor === 'rgba(182, 186, 181, 1)') {
+ console.log('Passed: Batch Upload tab title text color matched as expected');
+ } else {
+ errors.push(`Expected: Batch Upload tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`);
+ }
+
+ //element background color
+ if (elementBgColor === 'rgba(0, 0, 0, 0)') {
+ console.log('Passed: Batch Upload tab title background color matched as expected');
+ } else {
+ errors.push(`Expected: Batch Upload 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'));
+ }
+ }
+ },
+
+ //Import Alignments tab
+ {
+ description: 'Import Alignments tab title text, size, color, and background color',
+ action: async () => {
+ const multipleChecks = 'Import Alignments tab title';
+
+ const element = await driver.findElement(By.linkText('Import Alignments'));
+
+ //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 === 'Import Alignments') {
+ console.log('Passed: Import Alignments tab title text matched as expected');
+ } else {
+ errors.push(`Expected: "Import Alignments"; Actual: "${elementText}"`);
+ }
+
+ //element font
+ if (elementFont === 'Poppins, sans-serif') {
+ console.log('Passed: Import Alignments tab title font-family matched as expected');
+ } else {
+ errors.push(`Expected: Import Alignments tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
+ }
+
+ //element size
+ if (elementSize === '15px') {
+ console.log('Passed: Import Alignments tab title text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Import Alignments tab title text font-size "15px"; Actual: "${elementSize}"`);
+ }
+
+ //element color
+ if (elementColor === 'rgba(182, 186, 181, 1)') {
+ console.log('Passed: Import Alignments tab title text color matched as expected');
+ } else {
+ errors.push(`Expected: Import Alignments tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`);
+ }
+
+ //element background color
+ if (elementBgColor === 'rgba(0, 0, 0, 0)') {
+ console.log('Passed: Import Alignments tab title background color matched as expected');
+ } else {
+ errors.push(`Expected: Import Alignments 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 Import Alignments tab',
+ action: async () => {
+ await driver.findElement(By.linkText('Import Alignments')).click();
+ console.log('----->| NEXT ACTION: Clicked Import Alignments tab');
+
+ //Wait for page readyState
+ await driver.wait(async () => {
+ const readyState = await driver.executeScript('return document.readyState');
+ return readyState === 'complete';
+ }, 30000, 'Import Alignments page did not fully load within 30 seconds');
+
+ //Wait until the element exists in the DOM
+ const importalignmentsPageTitle = await driver.wait(
+ until.elementLocated(By.css('h2')),
+ 30000
+ );
+
+ //Wait until it becomes visible
+ await driver.wait(
+ until.elementIsVisible(importalignmentsPageTitle),
+ 30000
+ );
+ }
+ },
+
+ //Import Alignments - Step 1 page title
+ {
+ description: 'Import Alignments - Step 1 title text, size, and color',
+ action: async () => {
+ const multipleChecks = 'Import Alignments - Step 1 ';
+
+ 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 === 'Import Alignments - Step 1') {
+ console.log('Passed: Import Alignments - Step 1 title text matched as expected');
+ } else {
+ errors.push(`Expected: "Import Alignments - Step 1"; Actual: "${elementText}"`);
+ }
+
+ //font
+ if (elementFont === `"DM Serif Display", serif`) {
+ console.log('Passed: Import Alignments - Step 1 title font-family matched as expected');
+ } else {
+ errors.push(`Expected: Import Alignments - Step 1 title font-family "DM Serif Display", serif"; Actual: ${elementFont}`);
+ }
+
+ //size
+ if (elementSize === '32px') {
+ console.log('Passed: Import Alignments - Step 1 title text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Import Alignments - Step 1 title text font-size "32px"; Actual: "${elementSize}"`);
+ }
+
+ //color
+ if (elementColor === 'rgba(40, 39, 90, 1)') {
+ console.log('Passed: Import Alignments - Step 1 title text color matched as expected');
+ } else {
+ errors.push(`Expected: Import Alignments - Step 1 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'));
+ }
+ }
+ },
+
+ //Submit A Resource tab
+ {
+ description: 'Submit A Resource tab title text, size, color, and background color',
+ action: async () => {
+ const multipleChecks = 'Submit A Resource tab title';
+
+ const element = await driver.findElement(By.linkText('Submit A Resource'));
+
+ //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 === 'Submit A Resource') {
+ console.log('Passed: Submit A Resource tab title text matched as expected');
+ } else {
+ errors.push(`Expected: "Submit A Resource"; Actual: "${elementText}"`);
+ }
+
+ //element font
+ if (elementFont === 'Poppins, sans-serif') {
+ console.log('Passed: Submit A Resource tab title font-family matched as expected');
+ } else {
+ errors.push(`Expected: Submit A Resource tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
+ }
+
+ //element size
+ if (elementSize === '15px') {
+ console.log('Passed: Submit A Resource tab title text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Submit A Resource tab title text font-size "15px"; Actual: "${elementSize}"`);
+ }
+
+ //element color
+ if (elementColor === 'rgba(182, 186, 181, 1)') {
+ console.log('Passed: Submit A Resource tab title text color matched as expected');
+ } else {
+ errors.push(`Expected: Submit A Resource tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`);
+ }
+
+ //element background color
+ if (elementBgColor === 'rgba(0, 0, 0, 0)') {
+ console.log('Passed: Submit A Resource tab title background color matched as expected');
+ } else {
+ errors.push(`Expected: Submit A Resource 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'));
+ }
+ }
+ },
+
+ //Batch Upload tab
+ {
+ description: 'Batch Upload tab title text, size, color, and background color',
+ action: async () => {
+ const multipleChecks = 'Batch Upload tab title';
+
+ const element = await driver.findElement(By.linkText('Batch Upload'));
+
+ //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 === 'Batch Upload') {
+ console.log('Passed: Batch Upload tab title text matched as expected');
+ } else {
+ errors.push(`Expected: "Batch Upload"; Actual: "${elementText}"`);
+ }
+
+ //element font
+ if (elementFont === 'Poppins, sans-serif') {
+ console.log('Passed: Batch Upload tab title font-family matched as expected');
+ } else {
+ errors.push(`Expected: Batch Upload tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
+ }
+
+ //element size
+ if (elementSize === '15px') {
+ console.log('Passed: Batch Upload tab title text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Batch Upload tab title text font-size "15px"; Actual: "${elementSize}"`);
+ }
+
+ //element color
+ if (elementColor === 'rgba(182, 186, 181, 1)') {
+ console.log('Passed: Batch Upload tab title text color matched as expected');
+ } else {
+ errors.push(`Expected: Batch Upload tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`);
+ }
+
+ //element background color
+ if (elementBgColor === 'rgba(0, 0, 0, 0)') {
+ console.log('Passed: Batch Upload tab title background color matched as expected');
+ } else {
+ errors.push(`Expected: Batch Upload 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'));
+ }
+ }
+ },
+
+ //Import Alignments tab
+ {
+ description: 'Import Alignments tab title text, size, color, and background color',
+ action: async () => {
+ const multipleChecks = 'Import Alignments tab title';
+
+ const element = await driver.findElement(By.linkText('Import Alignments'));
+
+ //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 === 'Import Alignments') {
+ console.log('Passed: Import Alignments tab title text matched as expected');
+ } else {
+ errors.push(`Expected: "Import Alignments"; Actual: "${elementText}"`);
+ }
+
+ //element font
+ if (elementFont === 'Poppins, sans-serif') {
+ console.log('Passed: Import Alignments tab title font-family matched as expected');
+ } else {
+ errors.push(`Expected: Import Alignments tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
+ }
+
+ //element size
+ if (elementSize === '15px') {
+ console.log('Passed: Import Alignments tab title text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Import Alignments tab title text font-size "15px"; Actual: "${elementSize}"`);
+ }
+
+ //element color
+ if (elementColor === 'rgba(255, 255, 255, 1)') {
+ console.log('Passed: Import Alignments tab title text color matched as expected');
+ } else {
+ errors.push(`Expected: Import Alignments tab title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
+ }
+
+ //element background color
+ if (elementBgColor === 'rgba(40, 39, 90, 1)') {
+ console.log('Passed: Import Alignments tab title background color matched as expected');
+ } else {
+ errors.push(`Expected: Import Alignments 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'));
+ }
+ }
+ },
+
+ //Alignment Type label
+ {
+ description: 'Alignment Type label text, size, and color',
+ action: async () => {
+ const multipleChecks = 'Alignment Type label ';
+
+ const element = await driver.findElement(By.css('.form-row:nth-child(1) > .form-group:nth-child(1) > label'));
+
+ //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 === 'Alignment Type') {
+ console.log('Passed: Alignment Type label text matched as expected');
+ } else {
+ errors.push(`Expected: "Alignment Type"; Actual: "${elementText}"`);
+ }
+
+ //font
+ if (elementFont === 'Poppins, sans-serif') {
+ console.log('Passed: Alignment Type label font-family matched as expected');
+ } else {
+ errors.push(`Expected: Alignment Type label font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
+ }
+
+ //size
+ if (elementSize === '13px') {
+ console.log('Passed: Alignment Type label text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Alignment Type label text font-size "13px"; Actual: "${elementSize}"`);
+ }
+
+ //color
+ if (elementColor === 'rgba(40, 39, 90, 1)') {
+ console.log('Passed: Alignment Type label text color matched as expected');
+ } else {
+ errors.push(`Expected: Alignment Type label 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'));
+ }
+ }
+ },
+
+ //Alignment Type dropdown values
+ {
+ description: 'Alignment Type dropdown values',
+ action: async () => {
+ const multipleChecks = 'Alignment Type dropdown values';
+
+ const dropdown = await driver.wait(until.elementLocated(By.css('#import_type')), 5000);
+
+ //Wrap with Select class for full dropdown functionality
+ const selectElement = new Select(dropdown);
+ //Track all errors
+ const errors = [];
+
+ //Verify default selected value
+ const defaultOption = await selectElement.getFirstSelectedOption();
+ const defaultText = await defaultOption.getText();
+ const elementFont = await defaultOption.getCssValue('font-family');
+ const elementSize = await defaultOption.getCssValue('font-size');
+ const elementColor = await defaultOption.getCssValue('color');
+
+
+ if (defaultText === 'Concept Based') {
+ console.log('Passed: Alignment Type dropdown default value matched as expected');
+ } else {
+ errors.push(`Expected: Alignment Type dropdown default value "Concept Based"; Actual: "${defaultText}"`);
+ }
+
+ //font
+ if (elementFont === 'Poppins, sans-serif') {
+ console.log('Passed: Alignment Type label dropdown default font-family matched as expected');
+ } else {
+ errors.push(`Expected: Alignment Type label dropdown default font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
+ }
+
+ //size
+ if (elementSize === '13px') {
+ console.log('Passed: Alignment Type label dropdown default text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Alignment Type label dropdown default text font-size "13px"; Actual: "${elementSize}"`);
+ }
+
+ //color
+ if (elementColor === 'rgba(40, 39, 90, 1)') {
+ console.log('Passed: Alignment Type label dropdown default text color matched as expected');
+ } else {
+ errors.push(`Expected: Alignment Type label dropdown default text color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
+ }
+
+ //Verify all dropdown options
+ const options = await selectElement.getOptions();
+ const expected = [
+ 'Concept Based',
+ 'Direct Alignment'
+ ];
+
+ const actual = [];
+ for (const opt of options) {
+ const text = (await opt.getText()).trim();
+ actual.push(text);
+ }
+
+ if (JSON.stringify(actual) === JSON.stringify(expected)) {
+ console.log('Passed: Alignment Type dropdown list matched as expected');
+ } else {
+ errors.push(`Expected: Alignment Type dropdown list: ${JSON.stringify(expected)}; Actual: ${JSON.stringify(actual)}`);
+ }
+
+ //Throw summary if any validation failed
+ if (errors.length > 0) {
+ if (errors.length > 1) {
+ errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
+ }
+ throw new Error(errors.join('\n'));
+ }
+ }
+ },
+
+ //Import File label
+ {
+ description: 'Import File label text, size, and color',
+ action: async () => {
+ const multipleChecks = 'Import File label ';
+
+ const element = await driver.findElement(By.css('.col-md-6:nth-child(2) > label'));
+
+ //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 === 'Import File') {
+ console.log('Passed: Import File label text matched as expected');
+ } else {
+ errors.push(`Expected: "Import File"; Actual: "${elementText}"`);
+ }
+
+ //font
+ if (elementFont === 'Poppins, sans-serif') {
+ console.log('Passed: Import File label font-family matched as expected');
+ } else {
+ errors.push(`Expected: Import File label font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
+ }
+
+ //size
+ if (elementSize === '13px') {
+ console.log('Passed: Import File label text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Import File label text font-size "13px"; Actual: "${elementSize}"`);
+ }
+
+ //color
+ if (elementColor === 'rgba(40, 39, 90, 1)') {
+ console.log('Passed: Import File label text color matched as expected');
+ } else {
+ errors.push(`Expected: Import File label 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'));
+ }
+ }
+ },
+
+ //Import Choose File
+ {
+ description: 'Import Choose File',
+ action: async () => {
+ const multipleChecks = 'Import Choose File';
+
+ const element = await driver.findElement(By.css('#import > div > div > div:nth-child(1) > div:nth-child(2) > input[type=hidden]:nth-child(2)'));
+
+ //Get text, font, size, and color
+ const elementText = await element.getText();
+ const elementName = await element.getAttribute('name');
+ const elementValue = await element.getAttribute('value');
+
+ //Track all errors
+ const errors = [];
+
+ //name
+ if (elementName === 'MAX_FILE_SIZE') {
+ console.log('Passed: Import File name: MAX_FILE_SIZE text matched as expected');
+ } else {
+ errors.push(`Expected: Import File name to be: "MAX_FILE_SIZE"; Actual: ${elementName}`);
+ }
+
+ //value
+ if (elementValue === '30000000') {
+ console.log('Passed: Import File value: 30000000 matched as expected');
+ } else {
+ errors.push(`Expected: Import File value to be: "30000000"; Actual: "${elementValue}"`);
+ }
+
+ //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'));
+ }
+ }
+ },
+
+ //Content Set label
+ {
+ description: 'Content Set label text, size, and color',
+ action: async () => {
+ const multipleChecks = 'Content Set label';
+
+ const element = await driver.findElement(By.css('.form-row:nth-child(2) > .col-md-6 > label'));
+
+ //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 === 'Content Set') {
+ console.log('Passed: Content Set label text matched as expected');
+ } else {
+ errors.push(`Expected: "Content Set"; Actual: "${elementText}"`);
+ }
+
+ //font
+ if (elementFont === 'Poppins, sans-serif') {
+ console.log('Passed: Content Set label font-family matched as expected');
+ } else {
+ errors.push(`Expected: Content Set label font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
+ }
+
+ //size
+ if (elementSize === '13px') {
+ console.log('Passed: Content Set label text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Content Set label text font-size "13px"; Actual: "${elementSize}"`);
+ }
+
+ //color
+ if (elementColor === 'rgba(40, 39, 90, 1)') {
+ console.log('Passed: Content Set label text color matched as expected');
+ } else {
+ errors.push(`Expected: Content Set label 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'));
+ }
+ }
+ },
+
+ //Content Set dropdown values
+ {
+ description: 'Content Set dropdown values',
+ action: async () => {
+ const multipleChecks = 'Content Set dropdown values';
+
+ const dropdown = await driver.wait(until.elementLocated(By.css('#load_org')), 5000);
+
+ //Wrap with Select class for full dropdown functionality
+ const selectElement = new Select(dropdown);
+ //Track all errors
+ const errors = [];
+
+ //Verify default selected value
+ const defaultOption = await selectElement.getFirstSelectedOption();
+ const defaultText = await defaultOption.getText();
+ const elementFont = await defaultOption.getCssValue('font-family');
+ const elementSize = await defaultOption.getCssValue('font-size');
+ const elementColor = await defaultOption.getCssValue('color');
+
+
+ if (defaultText === 'Pick a Content Set') {
+ console.log('Passed: Content Set dropdown default value matched as expected');
+ } else {
+ errors.push(`Expected: Content Set dropdown default value "Content Set"; Actual: "${defaultText}"`);
+ }
+
+ //font
+ if (elementFont === 'Poppins, sans-serif') {
+ console.log('Passed: Content Set label dropdown default font-family matched as expected');
+ } else {
+ errors.push(`Expected: Content Set label dropdown default font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
+ }
+
+ //size
+ if (elementSize === '13px') {
+ console.log('Passed: Content Set label dropdown default text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Content Set label dropdown default text font-size "13px"; Actual: "${elementSize}"`);
+ }
+
+ //color
+ if (elementColor === 'rgba(40, 39, 90, 1)') {
+ console.log('Passed: Content Set label dropdown default text color matched as expected');
+ } else {
+ errors.push(`Expected: Content Set label dropdown default text color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
+ }
+
+ //Verify all dropdown options
+ const options = await selectElement.getOptions();
+ const expected = [
+ 'Pick a Content Set',
+ 'US History III',
+ 'English I',
+ 'Algebra',
+ 'Biology',
+ 'Copy Move Delete Test 1',
+ 'Copy Move Delete Test 2',
+ 'Import Align - Concept Based 1',
+ 'Import Align - Concept Based 2',
+ 'Import Align - Direct Align 1',
+ 'Import Align - Direct Align 2',
+ 'Math Alignment Import Test',
+ 'create me',
+ 'Illustrative Math Test 1',
+ 'Illustrative Math Test 2',
+ 'Khan URL test',
+ 'seesaw test',
+ 'ECS-3037 On Prod TC2',
+ 'ECS-3037 On Prod TC1',
+ 'webinar test',
+ 'Review Screen Open',
+ 'New One For Agust Post Night',
+ 'Post NIght July26',
+ 'create import test'
+ ];
+
+ const actual = [];
+ for (const opt of options) {
+ const text = (await opt.getText()).trim();
+ actual.push(text);
+ }
+
+ if (JSON.stringify(actual) === JSON.stringify(expected)) {
+ console.log('Passed: Content Set label dropdown list matched as expected');
+ } else {
+ errors.push(`Expected: Content Set label dropdown list: ${JSON.stringify(expected)}; Actual: ${JSON.stringify(actual)}`);
+ }
+
+ //Throw summary if any validation failed
+ if (errors.length > 0) {
+ if (errors.length > 1) {
+ errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
+ }
+ throw new Error(errors.join('\n'));
+ }
+ }
+ },
+
+ //Match Threshold label
+ {
+ description: 'Match Threshold label text, size, and color',
+ action: async () => {
+ const multipleChecks = 'Match Threshold label ';
+
+ const element = await driver.findElement(By.css('.col-md-2 > label'));
+
+ //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 === 'Match Threshold') {
+ console.log('Passed: Match Threshold label text matched as expected');
+ } else {
+ errors.push(`Expected: "Match Threshold"; Actual: "${elementText}"`);
+ }
+
+ //font
+ if (elementFont === 'Poppins, sans-serif') {
+ console.log('Passed: Match Threshold label font-family matched as expected');
+ } else {
+ errors.push(`Expected: Match Threshold label font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
+ }
+
+ //size
+ if (elementSize === '13px') {
+ console.log('Passed: Match Threshold label text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Match Threshold label text font-size "13px"; Actual: "${elementSize}"`);
+ }
+
+ //color
+ if (elementColor === 'rgba(40, 39, 90, 1)') {
+ console.log('Passed: Match Threshold label text color matched as expected');
+ } else {
+ errors.push(`Expected: Match Threshold label 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'));
+ }
+ }
+ },
+
+ //Match Threshold dropdown values
+ {
+ description: 'Match Threshold dropdown values',
+ action: async () => {
+ const multipleChecks = 'Match Threshold dropdown values';
+
+ const dropdown = await driver.wait(until.elementLocated(By.css('#thresh')), 5000);
+
+ //Wrap with Select class for full dropdown functionality
+ const selectElement = new Select(dropdown);
+ //Track all errors
+ const errors = [];
+
+ //Verify default selected value
+ const defaultOption = await selectElement.getFirstSelectedOption();
+ const defaultText = await defaultOption.getText();
+ const elementFont = await defaultOption.getCssValue('font-family');
+ const elementSize = await defaultOption.getCssValue('font-size');
+ const elementColor = await defaultOption.getCssValue('color');
+
+
+ if (defaultText === 'High') {
+ console.log('Passed: Match Threshold dropdown default value matched as expected');
+ } else {
+ errors.push(`Expected: Match Threshold dropdown default value "High"; Actual: "${defaultText}"`);
+ }
+
+ //font
+ if (elementFont === 'Poppins, sans-serif') {
+ console.log('Passed: Match Threshold label dropdown default font-family matched as expected');
+ } else {
+ errors.push(`Expected: Match Threshold label dropdown default font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
+ }
+
+ //size
+ if (elementSize === '13px') {
+ console.log('Passed: Match Threshold label dropdown default text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Match Threshold label dropdown default text font-size "13px"; Actual: "${elementSize}"`);
+ }
+
+ //color
+ if (elementColor === 'rgba(40, 39, 90, 1)') {
+ console.log('Passed: Match Threshold label dropdown default text color matched as expected');
+ } else {
+ errors.push(`Expected: Content Match Thresholdl dropdown default text color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
+ }
+
+ //Verify all dropdown options
+ const options = await selectElement.getOptions();
+ const expected = [
+ 'Exact',
+ 'High',
+ 'Medium',
+ 'Low'
+ ];
+
+ const actual = [];
+ for (const opt of options) {
+ const text = (await opt.getText()).trim();
+ actual.push(text);
+ }
+
+ if (JSON.stringify(actual) === JSON.stringify(expected)) {
+ console.log('Passed: Match Threshold dropdown list matched as expected');
+ } else {
+ errors.push(`Expected: Match Threshold dropdown list: ${JSON.stringify(expected)}; Actual: ${JSON.stringify(actual)}`);
+ }
+
+ //Throw summary if any validation failed
+ if (errors.length > 0) {
+ if (errors.length > 1) {
+ errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
+ }
+ throw new Error(errors.join('\n'));
+ }
+ }
+ },
+
+
+ //Import button
+ {
+ description: 'Import button',
+ action: async () => {
+ const multipleChecks = 'Import button';
+
+ 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 = [];
+
+ //text
+ if (elementText === 'Import') {
+ console.log('Passed: Import button text matched as expected');
+ } else {
+ errors.push(`Expected: "Import"; Actual: "${elementText}"`);
+ }
+
+ //font-family
+ if (elementTextFont === "Poppins, sans-serif") {
+ console.log('Passed: Import button text font matched as expected');
+ } else {
+ errors.push(`Expected: Import button text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
+ }
+
+ //font size
+ if (elementTextSize === '16px') {
+ console.log('Passed: Import button text font-size matched as expected');
+ } else {
+ errors.push(`Expected: Import button text font-size "16px"; Actual: "${elementTextSize}"`);
+ }
+
+ //color
+ if (elementTextColor === 'rgba(255, 255, 255, 1)') {
+ console.log('Passed: Import button text color matched as expected');
+ } else {
+ errors.push(`Expected: Import button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
+ }
+
+ //button color
+ if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
+ console.log('Passed: Import button background color matched as expected');
+ } else {
+ errors.push(`Expected: Import 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'));
+ }
+ }
+ },
+
+
+
+ //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', 'uploadImportAlignmentsPage');
+
+ 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', 'uploadImportAlignmentsPageResults.xlsx');
+
+const clearOldResults = () => {
+ //Remove old screenshots
+ const screenshotDir = path.join('screenshots', 'uploadImportAlignmentsPage');
+ 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: Align - Upload - ImportAlignments Page(uploadImportAlignmentsPage); All test steps completed successfully');
+ testStatus = 'Passed';
+ } else {
+ console.log('------------->| THE END |<-------------');
+ console.log('FAILED: Align - Upload - ImportAlignments Page(uploadImportAlignmentsPage); 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 uploadImportAlignmentsPage;