diff --git a/correlationsDashboard.xlsx b/correlationsDashboard.xlsx new file mode 100644 index 0000000..2dcb73f Binary files /dev/null and b/correlationsDashboard.xlsx differ diff --git a/frameworkManagementPageResults.xlsx b/frameworkManagementPageResults.xlsx index 539a1a6..aa70ba3 100644 Binary files a/frameworkManagementPageResults.xlsx and b/frameworkManagementPageResults.xlsx differ diff --git a/index.js b/index.js index d48e6f0..2ba8335 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ import express from 'express'; import ExACT_landingPage from './tests/ExACT_landingPage.js'; //import ExACT_login from './tests/ExACT_login.js'; //Dashboard -import ExACT_dashboard from './tests/ExACT_dashboard.js'; +import correlationsDashboard from './tests/correlationsDashboard.js'; import ExACT_dashboardMyContent from './tests/ExACT_dashboardMyContent.js'; import ExACT_dashboardSemanticStandardsComparison from './tests/ExACT_dashboardSemanticStandardsComparison.js'; import dashboardMyStandards from './tests/dashboardMyStandards.js'; @@ -18,7 +18,7 @@ import ExACT_alignStandardsPage from './tests/ExACT_alignStandardsPage.js'; import ExACT_editItemAddConcept from './tests/ExACT_editItemAddConcept.js'; import ExACT_alignConceptsPage from './tests/ExACT_alignConceptsPage.js'; //Framework -import ExACT_frameworkManagementPage from './tests/ExACT_frameworkManagementPage.js'; +import frameworkManagementPage from './tests/frameworkManagementPage.js'; import ExACT_frameworkPublishingPage from './tests/ExACT_frameworkPublishingPage.js'; import ExACT_frameworkPublishFrameworkDIV from './tests/ExACT_frameworkPublishFrameworkDIV.js'; import ExACT_frameworkFrameworkGroupsDIV from './tests/ExACT_frameworkFrameworkGroupsDIV.js'; @@ -37,7 +37,7 @@ app.get('/', (req, res) => {
ExACT Landing Page

DASHBOARD

-
Correlations Dashboard
+
Correlations Dashboard
My Content Widget
Semantic Standards Comparison Widget
My Standards Widget
@@ -55,8 +55,7 @@ app.get('/', (req, res) => {
Align Concepts Page

FRAMEWORKS

-
Framework Management Page
- +
Framework Management Page
Framework Publishing Page
Publish Framework DIV
Framework Groups DIV
@@ -71,7 +70,7 @@ app.get('/', (req, res) => { //Login //app.get('/ExACT_login', ExACT_login); //Dashboard - app.get('/ExACT_dashboard', ExACT_dashboard); + app.get('/correlationsDashboard', correlationsDashboard); //My Content app.get('/ExACT_dashboardMyContent', ExACT_dashboardMyContent); app.get('/ExACT_dashboardSemanticStandardsComparison', ExACT_dashboardSemanticStandardsComparison); @@ -88,7 +87,7 @@ app.get('/', (req, res) => { app.get('/ExACT_editItemAddConcept', ExACT_editItemAddConcept); app.get('/ExACT_alignConceptsPage', ExACT_alignConceptsPage); //Framework - app.get('/ExACT_frameworkManagementPage', ExACT_frameworkManagementPage); + app.get('/frameworkManagementPage', frameworkManagementPage); app.get('/ExACT_frameworkPublishingPage', ExACT_frameworkPublishingPage); app.get('/ExACT_frameworkPublishFrameworkDIV', ExACT_frameworkPublishFrameworkDIV); app.get('/ExACT_frameworkFrameworkGroupsDIV', ExACT_frameworkFrameworkGroupsDIV); diff --git a/tests/ExACT_dashboard.js b/tests/correlationsDashboard.js similarity index 98% rename from tests/ExACT_dashboard.js rename to tests/correlationsDashboard.js index 85467fc..19a0c16 100644 --- a/tests/ExACT_dashboard.js +++ b/tests/correlationsDashboard.js @@ -5,8 +5,8 @@ import XLSX from 'xlsx'; import path from 'path'; import { brotliCompress } from 'zlib'; -const ExACT_dashboard = (req, res) => { - res.send('

ExACT Automated Test Script: Correlations Dashboard (ExACT_dashboard) | Initiated

'); +const correlationsDashboard = (req, res) => { + res.send('

ExACT Automated Test Script: Correlations Dashboard (correlationsDashboard) | Initiated

'); (async function example() { let driver = await new Builder() .forBrowser('chrome') @@ -25,23 +25,7 @@ const ExACT_dashboard = (req, res) => { //CONSTANTS //My Content Widget -const myContentItemTotals = '5035 items'; -//Latest Standards Update Widget -const latestStandardsUpdateTitle1 = 'Washington DC - Financial Literacy'; -const latestStandardsUpdateSubTitle1 = '(AD 2024) Grades 9-12'; -const latestStandardsUpdateDate1 = 'October 6, 2026'; -const latestStandardsUpdateTitle2 = 'Virginia - Career Development'; -const latestStandardsUpdateSubTitle2 = '(AD 2004) Grades K-5,6-8,9-12'; -const latestStandardsUpdateDate2 = 'October 5, 2026'; -const latestStandardsUpdateTitle3 = 'Arizona Career Exploration 2024 - Career Technical Education'; -const latestStandardsUpdateSubTitle3 = '(AD 2024) Grades 6-8'; -const latestStandardsUpdateDate3 = 'October 5, 2026'; -const latestStandardsUpdateTitle4 = 'Arizona Career Awareness 2024 - Career Technical Education'; -const latestStandardsUpdateSubTitle4 = '(AD 2024) Grades K-5'; -const latestStandardsUpdateDate4 = 'October 5, 2026'; -const latestStandardsUpdateTitle5 = 'Idaho - Arts Education'; -const latestStandardsUpdateSubTitle5 = '(AD 2024) Grades K,1,2,3,4,5,6,7,8,9,10,11,12'; -const latestStandardsUpdateDate5 = 'October 1, 2026'; +const myContentItemTotals = '5038 items'; const steps = [ { description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://correlation.edgate.com/exact/login.php') }, @@ -1380,12 +1364,12 @@ const steps = [ { position: 14, name: 'Copy Move Delete Test 1', count: '35', href: '/exact/contentset_edit_modal.php?id=1228574323' }, { position: 15, name: 'ECS-3037 On Prod TC2', count: '26', href: '/exact/contentset_edit_modal.php?id=1473840373' }, { position: 16, name: 'ECS-3037 On Prod TC1', count: '24', href: '/exact/contentset_edit_modal.php?id=1473840197' }, - { position: 17, name: 'create me', count: '8', href: '/exact/contentset_edit_modal.php?id=1427607301' }, + { position: 17, name: 'create me', count: '10', href: '/exact/contentset_edit_modal.php?id=1427607301' }, { position: 18, name: 'Illustrative Math Test 1', count: '5', href: '/exact/contentset_edit_modal.php?id=1473839901' }, { position: 19, name: 'Illustrative Math Test 2', count: '5', href: '/exact/contentset_edit_modal.php?id=1473840078' }, { position: 20, name: 'webinar test', count: '5', href: '/exact/contentset_edit_modal.php?id=1476429225' }, - { position: 21, name: 'New One For Agust Post Night', count: '0', href: '/exact/contentset_edit_modal.php?id=1478966652' }, - { position: 22, name: 'create import test', count: '0', href: '/exact/contentset_edit_modal.php?id=1478966441' } + { position: 21, name: 'create import test', count: '1', href: '/exact/contentset_edit_modal.php?id=1478966441' }, + { position: 22, name: 'New One For Agust Post Night', count: '0', href: '/exact/contentset_edit_modal.php?id=1478966652' } ]; for (const exp of expected) { @@ -3407,10 +3391,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateTitle1) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 1 title matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateTitle1}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 1 title to not be empty; Actual: Empty string'; errors.push(message); } @@ -3467,10 +3451,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateSubTitle1) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 1 sub-title matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateSubTitle1}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 1 sub-title to not be empty; Actual: Empty string'; errors.push(message); } @@ -3527,10 +3511,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateDate1) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 1 date matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateDate1}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 1 date to not be empty; Actual: Empty string'; errors.push(message); } @@ -3587,10 +3571,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateTitle2) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 2 title matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateTitle2}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 2 title to not be empty; Actual: Empty string'; errors.push(message); } @@ -3647,10 +3631,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateSubTitle2) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 2 sub-title matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateSubTitle2}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 2 sub-title to not be empty; Actual: Empty string'; errors.push(message); } @@ -3707,10 +3691,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateDate2) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 2 date matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateDate2}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 2 date to not be empty; Actual: Empty string'; errors.push(message); } @@ -3767,10 +3751,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateTitle3) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 3 title matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateTitle3}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 3 title to not be empty; Actual: Empty string'; errors.push(message); } @@ -3827,10 +3811,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateSubTitle3) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 3 sub-title matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateSubTitle3}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 3 sub-title to not be empty; Actual: Empty string'; errors.push(message); } @@ -3887,10 +3871,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateDate3) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 3 date matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateDate3}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 3 date to not be empty; Actual: Empty string'; errors.push(message); } @@ -3947,10 +3931,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateTitle4) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 4 title matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateTitle4}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 4 title to not be empty; Actual: Empty string'; errors.push(message); } @@ -4007,10 +3991,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateSubTitle4) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 4 sub-title matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateSubTitle4}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 4 sub-title to not be empty; Actual: Empty string'; errors.push(message); } @@ -4067,10 +4051,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateDate4) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 4 date matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateDate4}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 4 date to not be empty; Actual: Empty string'; errors.push(message); } @@ -4127,10 +4111,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateTitle5) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 5 title matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateTitle5}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 5 title to not be empty; Actual: Empty string'; errors.push(message); } @@ -4187,10 +4171,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateSubTitle5) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 5 sub-title matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateSubTitle5}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 5 sub-title to not be empty; Actual: Empty string'; errors.push(message); } @@ -4247,10 +4231,10 @@ const steps = [ const errors = []; //Validate text - if (elementText === latestStandardsUpdateDate5) { + if (elementText.trim() !== '') { console.log('Passed: Latest Standards Update 5 date matched as expected'); } else { - const message = `Expected: "${latestStandardsUpdateDate5}"; Actual: "${elementText}"`; + const message = 'Expected: Latest Standards Update 5 date to not be empty; Actual: Empty string'; errors.push(message); } @@ -5490,7 +5474,7 @@ const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, scree const takeScreenshot = async (driver, stepIndex, stepDescription) => { const screenshot = await driver.takeScreenshot(); - const dir = path.join('screenshots', 'dashboard'); + const dir = path.join('screenshots', 'correlationsDashboard'); const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`; const screenshotPath = path.join(dir, screenshotFileName); @@ -5500,15 +5484,15 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => { const clearOldResults = () => { //Remove old screenshots - const screenshotDir = path.join('screenshots', 'dashboard'); + const screenshotDir = path.join('screenshots', 'correlationsDashboard'); if (fs.existsSync(screenshotDir)) { fs.rmSync(screenshotDir, { recursive: true, force: true }); } fs.mkdirSync(screenshotDir, { recursive: true }); //Remove old Excel file - if (fs.existsSync('dashboard.xlsx')) { - fs.unlinkSync('dashboard.xlsx'); + if (fs.existsSync('correlationsDashboard.xlsx')) { + fs.unlinkSync('correlationsDashboard.xlsx'); } }; @@ -5570,11 +5554,11 @@ try { if (allStepsPassed) { console.log('------------->| THE END |<-------------'); - console.log('PASSED: DASHBOARD (ExACT_dashboard); All test steps completed successfully'); + console.log('PASSED: CORRELATIONS DASHBOARD (correlationsDashboard); All test steps completed successfully'); testStatus = 'Passed'; } else { console.log('------------->| THE END |<-------------'); - console.log('FAILED: DASHBOARD (ExACT_dashboard); One or more test steps failed'); + console.log('FAILED: CORRELATIONS DASHBOARD (correlationsDashboard); One or more test steps failed'); console.log('FAILED STEPS:'); failedSteps.forEach(step => console.error(` ✗ ${step}`)); testStatus = 'Failed'; @@ -5586,11 +5570,11 @@ try { //Write the updated worksheet back to the workbook and save it workbook.Sheets['Sheet1'] = worksheet; - XLSX.writeFile(workbook, 'dashboard.xlsx'); + XLSX.writeFile(workbook, 'correlationsDashboard.xlsx'); } finally { await driver.quit(); } })(); } -export default ExACT_dashboard; +export default correlationsDashboard; diff --git a/tests/ExACT_frameworkManagementPage.js b/tests/frameworkManagementPage.js similarity index 94% rename from tests/ExACT_frameworkManagementPage.js rename to tests/frameworkManagementPage.js index 0e89188..591c17b 100644 --- a/tests/ExACT_frameworkManagementPage.js +++ b/tests/frameworkManagementPage.js @@ -1,103 +1,243 @@ -import { Builder, By, Key, until } from 'selenium-webdriver'; +import { Builder, By, Key, until, Select, Browser } from 'selenium-webdriver'; +import { Options as ChromeOptions } from 'selenium-webdriver/chrome.js'; import fs from 'fs'; import XLSX from 'xlsx'; import path from 'path'; -const ExACT_frameworkManagementPage = (req, res) => { - res.send('

ExACT Automated Test Script: Framework Management Page(ExACT_frameworkManagementPage); Initiated

'); +const frameworkManagementPage = (req, res) => { + res.send('

ExACT Automated Test Script: Framework Management Page(frameworkManagementPage); Initiated

'); (async function example() { - let driver = await new Builder().forBrowser('chrome').build(); + 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 +//My Content Widget +const myContentItemTotals = '5038 items'; + const steps = [ - { description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://stage.edgate.com/exact/login.php') }, //PROD - https://correlation.edgate.com/exact/login.php + { 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: 'Enter username', action: async () => await driver.findElement(By.css('.form-control:nth-child(2)')).sendKeys('exact_juan') }, - { description: 'Enter password', action: async () => await driver.findElement(By.css('.passfield')).sendKeys('Edgate1!') }, - { description: 'Click Login button', action: async () => await driver.findElement(By.css('.login')).click() }, - { description: 'Wait for login process to complete', action: async () => await driver.sleep(10000) }, - - //Wait for dashboard to load - Correlation Coverages View Details button - { - description: 'Wait for dashboard load to completely', + //Login + { + description: 'Login', action: async () => { - return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false); + const multipleChecks = 'Log In'; + console.log('------------->| CORRELATION DASHBOARD |<-------------'); + 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: 'Validate dashboard title', + description: 'Dashboard title text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.e-heading')).getText(); - if (elementText !== 'Correlation Dashboard') { - throw new Error(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`); + 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')); } - console.log('Passed: Dashboard title matched as expected'); } }, - //Align icon color -gray + //NEXT ACTION { - description: 'Validate Align icon color', + description: 'Click Frameworks navigation link', action: async () => { - const elementStyle = await driver.findElement(By.css('.fb-align')).getCssValue('color'); - if (elementStyle !== 'rgba(99, 99, 99, 1)') { - throw new Error(`Align icon color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Align icon color matched as expected'); - } - }, + await driver.findElement(By.linkText('Frameworks')).click(); + console.log('----->| NEXT ACTION: Clicked Frameworks navigation link'); - //NEXT ACTION - Navigate to Framework Management page - { description: 'Click Frameworks navigation link', action: async () => await driver.findElement(By.linkText('Frameworks')).click() }, + //Wait until the element exists in the DOM + const pageTitle = await driver.wait( + until.elementLocated(By.css('h2')), + 30000 + ); - //Wait for page to load - Correlation Coverages View Details button - { - description: 'Wait for page to load', - action: async () => { - return await driver.wait(until.elementLocated(By.css('h2')), 10000).catch(() => false); + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(pageTitle), + 30000 + ); } }, //Framework Management page title { - description: 'Validate Framework Management page title', + description: 'Framework Management page title text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('h2')).getText(); - if (elementText !== 'Framework Management') { - throw new Error(`Expected: "Framework Management" page title; Actual: "${elementText}"`); - } - console.log('Passed: Framework Management page title matched as expected'); - } - }, + const multipleChecks = 'Framework Management page title'; + const element = await driver.findElement(By.css('h2')); - //Framework Management page title text color -dark blue - { - description: 'Validate Framework Management page title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('h2')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Framework Management page title text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Framework Management page title text color matched as expected'); - } - }, + //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'); - //Framework Management page title text font - { - description: 'Validate Framework Management page title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('h2')).getCssValue('font-size'); - if (elementStyle !== '32px') { - throw new Error(`Framework Management page title text font-size did not match; Actual: "${elementStyle}"`); + //Track all errors + const errors = []; + + //text + if (elementText === 'Framework Management') { + console.log('Passed: Framework Management page title text matched as expected'); + } else { + errors.push(`Expected: "Framework Management"; Actual: "${elementText}"`); + } + + //font + if (elementFont === `"DM Serif Display", serif`) { + console.log('Passed: Framework Management page title font-family matched as expected'); + } else { + errors.push(`Expected: Framework Management page title font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '32px') { + console.log('Passed: Framework Management page title text font-size matched as expected'); + } else { + errors.push(`Expected: Framework Management page title text font-size "32px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Framework Management page title text color matched as expected'); + } else { + errors.push(`Expected: Framework Management 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')); } - console.log('Passed: Framework Management page title text font-size matched as expected'); } }, @@ -136,7 +276,7 @@ const steps = [ console.log('Passed: Publishing button color matched as expected'); } }, - +/* //NEXT ACTION - Click Publishing button { description: 'Click Publishing button', action: async () => await driver.findElement(By.linkText('Publishing')).click() }, @@ -4097,7 +4237,7 @@ const steps = [ //NEXT ACTION - Close DIV { description: 'Click Close button', action: async () => await driver.findElement(By.css('#modalclose')).click() }, { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, - +*/ //LOG OUT //NEXT ACTION - Log out { description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() }, @@ -4231,10 +4371,10 @@ try { const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); if (loginButton && allStepsPassed) { - console.log('PASSED: Framework Management Page(ExACT_frameworkManagementPage); All test steps completed successfully'); + console.log('PASSED: Framework Management Page(frameworkManagementPage); All test steps completed successfully'); testStatus = 'Passed'; } else { - console.log('FAILED: Framework Management Page(ExACT_frameworkManagementPage); One or more test steps failed'); + console.log('FAILED: Framework Management Page(frameworkManagementPage); One or more test steps failed'); testStatus = 'Failed'; } @@ -4251,4 +4391,4 @@ try { })(); } -export default ExACT_frameworkManagementPage; +export default frameworkManagementPage;