diff --git a/.gitignore b/.gitignore index 59dac2c..761d279 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules -screenshots \ No newline at end of file +screenshots +.vscode/ +.claude/ diff --git a/contentPageResults.xlsx b/contentPageResults.xlsx index 9134b2a..493eb04 100644 Binary files a/contentPageResults.xlsx and b/contentPageResults.xlsx differ diff --git a/dashboard.xlsx b/dashboard.xlsx new file mode 100644 index 0000000..b41f11a Binary files /dev/null and b/dashboard.xlsx differ diff --git a/dashboardMyContentResults.xlsx b/dashboardMyContentResults.xlsx index 999332f..ed66727 100644 Binary files a/dashboardMyContentResults.xlsx and b/dashboardMyContentResults.xlsx differ diff --git a/dashboardMyStandardsResults.xlsx b/dashboardMyStandardsResults.xlsx index 4406e17..950c831 100644 Binary files a/dashboardMyStandardsResults.xlsx and b/dashboardMyStandardsResults.xlsx differ diff --git a/editItemResults.xlsx b/editItemResults.xlsx index 1c9ba36..11b14c3 100644 Binary files a/editItemResults.xlsx and b/editItemResults.xlsx differ diff --git a/index.js b/index.js index c029807..d48e6f0 100644 --- a/index.js +++ b/index.js @@ -1,9 +1,14 @@ import express from 'express'; import ExACT_landingPage from './tests/ExACT_landingPage.js'; -import ExACT_login from './tests/ExACT_login.js'; +//import ExACT_login from './tests/ExACT_login.js'; //Dashboard -import ExACT_dashboardMyContent from './tests/ExACT_DashboardMyContent.js'; +import ExACT_dashboard from './tests/ExACT_dashboard.js'; +import ExACT_dashboardMyContent from './tests/ExACT_dashboardMyContent.js'; +import ExACT_dashboardSemanticStandardsComparison from './tests/ExACT_dashboardSemanticStandardsComparison.js'; +import dashboardMyStandards from './tests/dashboardMyStandards.js'; + import myStandardsSearchAlignedContent from './tests/myStandardsSearchAlignedContent.js'; + import myStandardsSearchRelatedStandards from './tests/myStandardsSearchRelatedStandards.js'; //Content import ExACT_contentPage from './tests/ExACT_contentPage.js'; import ExACT_editItem from './tests/ExACT_editItem.js'; @@ -28,47 +33,54 @@ app.get('/', (req, res) => {

ExACT Automated Regression Scripts

(Click the corresponding link to execute the desired script)
-
ExACT Landing Page
- -
Login
+

EDGATE LANDING PAGE

+
ExACT Landing Page

DASHBOARD

+
Correlations Dashboard
My Content Widget
+
Semantic Standards Comparison Widget
+
My Standards Widget
+
My Standards Search - Aligned Content
+
My Standards Search - Related Standards

CONTENT

Content Page
-
Edit Item
+
Edit Item

ALIGN

Align Content Page
-
Align - Edit Content and Align Concept
- -
Align Standards Page
- -
Align Concepts Page
+
Align - Edit Content and Align Concept
+
Align Standards Page
+
Align Concepts Page

FRAMEWORKS

Framework Management Page
-
Framework Publishing Page
-
Publish Framework DIV
-
Framework Groups DIV
-
Framework Settings DIV
+
Framework Publishing Page
+
Publish Framework DIV
+
Framework Groups DIV
+
Framework Settings DIV

`); }) //Landing: -app.get('/ExACT_landingPage', ExACT_landingPage); + app.get('/ExACT_landingPage', ExACT_landingPage); //Login -app.get('/ExACT_login', ExACT_login); + //app.get('/ExACT_login', ExACT_login); //Dashboard + app.get('/ExACT_dashboard', ExACT_dashboard); //My Content app.get('/ExACT_dashboardMyContent', ExACT_dashboardMyContent); + app.get('/ExACT_dashboardSemanticStandardsComparison', ExACT_dashboardSemanticStandardsComparison); + app.get('/dashboardMyStandards', dashboardMyStandards); + app.get('/myStandardsSearchAlignedContent', myStandardsSearchAlignedContent); + app.get('/myStandardsSearchRelatedStandards', myStandardsSearchRelatedStandards); //Content -app.get('/ExACT_contentPage', ExACT_contentPage); - //Edit Item + app.get('/ExACT_contentPage', ExACT_contentPage); +//Edit Item app.get('/ExACT_editItem', ExACT_editItem); //Align app.get('/ExACT_alignContentPage', ExACT_alignContentPage); @@ -81,6 +93,7 @@ app.get('/ExACT_contentPage', ExACT_contentPage); app.get('/ExACT_frameworkPublishFrameworkDIV', ExACT_frameworkPublishFrameworkDIV); app.get('/ExACT_frameworkFrameworkGroupsDIV', ExACT_frameworkFrameworkGroupsDIV); app.get('/ExACT_frameworkFrameworkSettingsDIV', ExACT_frameworkFrameworkSettingsDIV); -app.listen(8000, () => { + + app.listen(8000, () => { console.log('Server is up and running on port 8000'); }); \ No newline at end of file diff --git a/landingPageResults.xlsx b/landingPageResults.xlsx index 1b9a9b4..63aa776 100644 Binary files a/landingPageResults.xlsx and b/landingPageResults.xlsx differ diff --git a/myStandardsSearchRelatedStandardsResults.xlsx b/myStandardsSearchRelatedStandardsResults.xlsx new file mode 100644 index 0000000..c1575ad Binary files /dev/null and b/myStandardsSearchRelatedStandardsResults.xlsx differ diff --git a/tests/ExACT_contentPage.js b/tests/ExACT_contentPage.js index da057f3..64eda3d 100644 --- a/tests/ExACT_contentPage.js +++ b/tests/ExACT_contentPage.js @@ -1,683 +1,1582 @@ -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'; +import { brotliCompress } from 'zlib'; const ExACT_contentPage = (req, res) => { - res.send('

ExACT Automated Test Script - Content Page(ExACT_contentPage): Initiated

'); + res.send('

ExACT Automated Test Script: CONTENT - Content Page (ExACT_contentPage) | 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 -const createContentSetName = 'Automated - QA Content Set - To be deleted'; - 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('------------->| EDIT ITEM |<-------------'); + 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 320 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: 'Validate 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}"`); - } - console.log('Passed: Dashboard title matched as expected'); - } - }, + const multipleChecks = 'Dashboard title'; + const element = await driver.findElement(By.css('.e-heading')); - //Dashboard title text color -dark blue - { - description: 'Validate dashboard title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.e-heading')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Dashboard title text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Dashboard title text color matched as expected'); - } - }, + //Get text, font, size, and 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'); - //Dashboard title text font size - { - description: 'Validate dashboard title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.e-heading')).getCssValue('font-size'); - if (elementStyle !== '32px') { - throw new Error(`Expected: Dashboard title text font-size did not match; Actual: "${elementStyle}"`); + //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-family + if (elementTextFont === `"DM Serif Display", serif`) { + console.log('Passed: Dashboard title font matched as expected'); + } else { + errors.push(`Expected: Dashboard title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '32px') { + console.log('Passed: Dashboard title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard title text font-size "32px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === '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: "${elementTextColor}"`); + } + + //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 text font-size matched as expected'); } }, //MY CONTENT WIDGET + //Dashboard My Content Widget title { - description: 'Validate dashboard My Content widget title', + description: 'Validate My Content widget title text, color, and size', action: async () => { - const elementText = await driver.findElement(By.css('.h-100 h2:nth-child(2)')).getText(); - if (elementText !== 'My Content') { - throw new Error(`Expected: "My Content"; Actual: "${elementText}"`); + const multipleChecks = 'My Content widget title'; + const element = await driver.findElement(By.css('.h-100 h2:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'My Content') { + console.log('Passed: My Content widget title text matched as expected'); + } else { + errors.push(`Expected: "My Content"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: My Content widget title font matched as expected'); + } else { + errors.push(`Expected: My Content widget title font "Poppins, sans-serif", serif; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '18px') { + console.log('Passed: My Content widget title text font-size matched as expected'); + } else { + errors.push(`Expected: My Content widget title text font-size "18px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: My Content widget title text color matched as expected'); + } else { + errors.push(`Expected: My Content widget title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 - My Content Widget title matched as expected'); } }, - //Dashboard My Content Widget title text color -dark blue + //My Content total item Count (SPECIAL CASE: with button) { - description: 'Validate dashboard My Content widget title text color', + description: 'Validate My Content total item count', action: async () => { - const elementStyle = await driver.findElement(By.css('.h-100 h2:nth-child(2)')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Dashboard - My Content Widget title text color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'My Content total item count'; + const element = await driver.findElement(By.css('#badge_content_total')); + + //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 === '3415 items') { + console.log('Passed: Total item count button text matched as expected'); + } else { + errors.push(`Expected: "3415 items"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Total item count button text font matched as expected'); + } else { + errors.push(`Expected: Total item count button text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13.5px') { + console.log('Passed: Total item count button text font-size matched as expected'); + } else { + errors.push(`Expected: Total item count button text font-size "13.5px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Total item count button text color matched as expected'); + } else { + errors.push(`Expected: Total item count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Total item count button background color matched as expected'); + } else { + errors.push(`Expected: Total item count button background color: "rgba(0, 0, 0, 0)"; 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')); } - console.log('Passed: Dashboard - My Content Widget title text color matched as expected'); } }, - //Dashboard My Content Widget title text font size - { - description: 'Validate dashboard My Content widget title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.h-100 h2:nth-child(2)')).getCssValue('font-size'); - if (elementStyle !== '18px') { - throw new Error(`Expected: Dashboard - My Content Widget title text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Dashboard - My Content Widget title text font-size matched as expected'); - } - }, - - //Dashboard My Content Item Count - { - description: 'Validate Dashboard My Content Item Count', - action: async () => { - const elementText = await driver.findElement(By.css('#badge_content_total')).getText(); - if (elementText !== '3552 items') { - throw new Error(`Expected: "3552 items"; Actual: "${elementText}"`); - } - console.log('Passed: Dashboard - My Content Item Count matched as expected'); - } - }, - - //Dashboard My Content Item Count button color -dark blue - { - description: 'Validate Dashboard My Content Item Count button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#badge_content_total')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Dashboard - My Content Item Count button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Dashboard - My Content Item Count button color matched as expected'); - } - }, - - //Dashboard My Content Item Count text color -white - { - description: 'Validate Dashboard My Content Item Count font color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#badge_content_total')).getCssValue('color'); - if (elementStyle !== 'rgba(255, 255, 255, 1)') { - throw new Error(`Expected: Dashboard - My Content Item Count font color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Dashboard - My Content Item Count font color matched as expected'); - } - }, - - //Dashboard My Content Item Count title text font size - { - description: 'Validate Dashboard My Content Item Count text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#badge_content_total')).getCssValue('font-size'); - if (elementStyle !== '13.5px') { - throw new Error(`Expected: Dashboard - My Content Item Count text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Dashboard - My Content Item Count title text font-size matched as expected'); - } - }, - - //Ellipsis icon color -dark blue + //Ellipsis icon color { description: 'Validate ellipsis icon color', action: async () => { const elementStyle = await driver.findElement(By.css('.fa-ellipsis-h')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Ellipsis icon color did not match; Actual: "${elementStyle}"`); + if (elementStyle === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Ellipsis icon color matched as expected'); + } else { + errors.push(`Expected: Ellipsis icon color did not match; Actual: "${elementStyle}"`); } - console.log('Passed: Ellipsis icon color matched as expected'); } }, - //Search icon color -dark blue + //Search icon color { description: 'Validate search icon color', action: async () => { const elementStyle = await driver.findElement(By.css('.col-12 > .fa')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Search icon color did not match; Actual: "${elementStyle}"`); + if (elementStyle === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Search icon color matched as expected'); + } else { + errors.push(`Expected: Search icon color did not match; Actual: "${elementStyle}"`); } - console.log('Passed: Search icon color matched as expected'); } }, //Filter textbox placeholder { - description: 'Validate Filter placeholder text', + description: 'Validate Filter textbox placeholder text', action: async () => { - const elementValue = await driver.findElement(By.css('#content-org-filter')).getAttribute('placeholder'); - if (elementValue !== 'filter...') { - throw new Error(`Expected: "filter..."; Actual: "${elementValue}"`); + const multipleChecks = 'Filter textbox'; + const element = await driver.findElement(By.css('#content-org-filter')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'filter...') { + console.log('Passed: Filter placeholder text matched as expected'); + } else { + errors.push(`Expected: "filter..." placeholder; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Filter placeholder text font matched as expected'); + } else { + errors.push(`Expected: Filter placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13.5px') { + console.log('Passed: Filter placeholder text font-size matched as expected'); + } else { + errors.push(`Expected: Filter placeholder text font-size "13.5px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Filter placeholder text color matched as expected'); + } else { + errors.push(`Expected: Filter placeholder text color: "rgb(108, 117, 125)"; 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: Filter placeholder text matched as expected'); } }, - //Sort label + /*Sort label { - description: 'Validate sort label', + description: 'Validate My Sort label', action: async () => { - const elementText = await driver.findElement(By.css('.col-4')).getText(); - if (elementText !== 'Sort:') { - throw new Error(`Expected: "Sort:"; Actual: "${elementText}"`); + const multipleChecks = 'Sort label'; + const element = await driver.findElement(By.css('.col-4')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Sort:') { + console.log('Passed: Sort: label text matched as expected'); + } else { + errors.push(`Expected: "Sort:" label; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Sort: label text font matched as expected'); + } else { + errors.push(`Expected: Sort: label text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: Sort: label text font-size matched as expected'); + } else { + errors.push(`Expected: Sort: label text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Sort: label text color matched as expected'); + } else { + errors.push(`Expected: Sort: label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Sort label matched as expected'); } }, - //Sort Dropdown [should be: "Count", option] + //Sort dropdown values (SPECIAL CASE: validate default selection) { - description: 'Validate sort dropdown option', + description: 'Validate Sort dropdown values', action: async () => { - const elementOption = await driver.findElement(By.css('#orgsort > option:nth-child(1)')).getAttribute('value'); - if (elementOption !== 'count') { - throw new Error(`Expected: "count"; Actual: "${elementOption}"`); + const multipleChecks = 'Sort dropdown values'; + const dropdown = await driver.wait(until.elementLocated(By.css('#orgsort')), 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(); + + if (defaultText === 'Count') { + console.log('Passed: Sort: dropdown default value matched as expected'); + } else { + errors.push(`Expected: Sort dropdown default value "Count"; Actual: "${defaultText}"`); + } + + //Verify all dropdown options + const options = await selectElement.getOptions(); + const expected = [ + 'Count', + 'Name' + ]; + + 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: Sort: dropdown list matched as expected'); + } else { + errors.push(`Expected: Sort 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')); } - console.log('Passed: Sort dropdown option matched as expected'); } }, - //Biology-QA + //My Content - Biology Content Set { - description: 'Validate Biology-QA title', + description: 'Validate Biology Content Set', action: async () => { - const elementText = await driver.findElement(By.linkText('Biology - QA')).getText(); - if (elementText !== 'Biology - QA') { - throw new Error(`Expected: "Biology - QA"; Actual: "${elementText}"`); + const multipleChecks = 'My Content - Biology Content Set'; + const elementContent = await driver.findElement(By.xpath(`//a[contains(.,'Biology')]`)).getText(); + const elementURL = await driver.findElement(By.xpath('(//ul[@id="content-org-list"])[1]/li/div[@class="orgname"]/a[2]')).getAttribute('href'); + const elementCount = await driver.findElement(By.xpath('//li/div/span')).getText(); + + //Get link + //const linkHref = await elementURL.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementContent === 'Biology') { + console.log('Passed: Biology listed in first place as expected'); + } else { + errors.push(`Expected: First place: "Biology" ; Actual: "${elementContent}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821587') { + console.log('Passed: Biology edit icon link listed in first place as expected'); + } else { + errors.push(`Expected: First place: "https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821587"; Actual: "${elementURL}"`); + } + + //count + if (elementCount === '1493') { + console.log('Passed: Biology content count listed in first place as expected'); + } else { + errors.push(`Expected: First place: Biology content count: "1493"; Actual: "${elementCount}"`); + } + + //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: Biology-QA link title matched as expected'); } }, - //Biology-QA edit icon color - { - description: 'Validate Biology-QA edit icon color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .fa')).getCssValue('color'); - if (elementStyle !== 'rgba(73, 80, 87, 1)') { - throw new Error(`Expected: Biology-QA edit icon color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Bioloby-QA edit icon color matched as expected'); - } - }, - - //Biology-QA Count - { - description: 'Validate Biology-QA Count', - action: async () => { - const elementText = await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .badge')).getText(); - if (elementText !== '1046') { - throw new Error(`Expected: "1046"; Actual: "${elementText}"`); - } - console.log('Passed: Biology-QA Count matched as expected'); - } - }, - - //Biology-QA Count text font size - { - description: 'Validate Biology-QA Count text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .badge')).getCssValue('font-size'); - if (elementStyle !== '12.87px') { - throw new Error(`Expected: Dashboard - Biology-QA Count text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Dashboard - MBiology-QA Count title text font-size matched as expected'); - } - }, - - //NEXT ACTION - NAVIGATE TO CONTENT PAGE - { description: 'Click Biology - QA link', action: async () => await driver.findElement(By.linkText('Biology - QA')).click() }, - - //Wait for Biology - QA Content page to load + //NEXT ACTION { - description: 'Wait for Content page load to completely', + description: 'Click Biology content link', action: async () => { - return await driver.wait(until.elementLocated(By.css('.float-left:nth-child(5)')), 10000).catch(() => false); + await driver.findElement(By.linkText('Biology')).click(); + console.log('----->| NEXT ACTION: Clicked Biology content link'); + + //Wait for page to load completely + 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 until the element exists in the DOM + const filterResultsLabel = await driver.wait( + until.elementLocated(By.css('.well > b')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(filterResultsLabel), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Biology content page did not fully load within 30 seconds'); + console.log('Passed: Biology content page loaded successfully'); } }, - //FILTERS + //Filter Section + //Filter Results title { description: 'Validate Filter Results title', action: async () => { - const elementText = await driver.findElement(By.css('.well > b')).getText(); - if (elementText !== 'Filter Results') { - throw new Error(`Expected: "Filter Results"; Actual: "${elementText}"`); - } - console.log('Passed: Filter Results title matched as expected'); - } - }, + const multipleChecks = 'Filter Results title'; + const element = await driver.findElement(By.css('.well > b')); - //Filter Results title font size - { - description: 'Validate Filter Results title font size', - action: async () => { - const elementText = await driver.findElement(By.css('.well > b')).getCssValue('font-size'); - if (elementText !== '13px') { - throw new Error(`Expected: Filter Results title font size to be "13px"; Actual: "${elementText}"`); - } - console.log('Passed: Filter Results title font size matched as expected'); - } - }, + //Get text, font, size, and 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'); - //Content Set title - { - description: 'Validate Content Set title', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(1) > b')).getText(); - if (elementText !== 'Content Set') { - throw new Error(`Expected: "Content Set" title; Actual: "${elementText}"`); - } - console.log('Passed: Content Set title matched as expected'); - } - }, + //Track all errors + const errors = []; - //Content Set title font size - { - description: 'Validate Content Set title font size', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(1) > b')).getCssValue('font-size'); - if (elementText !== '13px') { - throw new Error(`Expected: Content Set title font size to be "13px"; Actual: "${elementText}"`); + //text + if (elementText === 'Filter Results') { + console.log('Passed: Filter Results title matched as expected'); + } else { + errors.push(`Expected: Title: "Filter Results"; Actual: "${elementText}"`); } - console.log('Passed: Content Set title font size matched as expected'); - } - }, - //Biology - QA checkbox - { - description: 'Verify Biology - QA checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metaorgobjectid873576067')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Biology - QA checkbox icon not found'); + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Filter Results title font matched as expected'); + } else { + errors.push(`Expected: Filter Results title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); } - console.log('Passed: Biology - QA checkbox icon present'); - } - }, - //Biology - QA label - { - description: 'Validate Biology - QA label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(1) > label')).getText(); - if (elementText !== 'Biology - QA') { - throw new Error(`Expected: "Biology - QA"; Actual: "${elementText}"`); + //font size + if (elementTextSize === '13px') { + console.log('Passed: Filter Results title font-size matched as expected'); + } else { + errors.push(`Expected: Filter Results title font-size "13px"; Actual: "${elementTextSize}"`); } - console.log('Passed: Biology - QA label matched as expected'); - } - }, - //Biology - QA count - { - description: 'Validate Biology - QA count', - action: async () => { - try { - const element = await driver.findElement(By.css('.form-group:nth-child(1)')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'Biology - QA (1046)'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Filter Results title color matched as expected'); + } else { + errors.push(`Expected: Filter Results title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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`); } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging - } - } - }, - //Grade title - { - description: 'Validate Grade title', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(3) > b')).getText(); - if (elementText !== 'Grade') { - throw new Error(`Expected: "Grade" title; Actual: "${elementText}"`); + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Grade title matched as expected'); - } - }, - - //Grade title font size - { - description: 'Validate Grade title font size', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(3) > b')).getCssValue('font-size'); - if (elementText !== '13px') { - throw new Error(`Expected: Grade title font size to be "13px"; Actual: "${elementText}"`); - } - console.log('Passed: Grade title font size matched as expected'); - } - }, - - //9th grade checkbox - { - description: 'Verify 9th grade checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metagrades49')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: 9th grade checkbox icon not found'); - } - console.log('Passed: 9th grade checkbox icon present'); - } - }, - - //9th grade label - { - description: 'Validate 9th grade label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(3) > label:nth-child(4)')).getText(); - if (elementText !== '9') { - throw new Error(`Expected: "9"; Actual: "${elementText}"`); - } - console.log('Passed: 9th label matched as expected'); - } - }, - - //10th grade checkbox - { - description: 'Verify 10th grade checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metagrades51')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: 10th grade checkbox icon not found'); - } - console.log('Passed: 10th grade checkbox icon present'); - } - }, - - //10th grade label - { - description: 'Validate 10th grade label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(3) > label:nth-child(7)')).getText(); - if (elementText !== '10') { - throw new Error(`Expected: "10"; Actual: "${elementText}"`); - } - console.log('Passed: 10th label matched as expected'); - } - }, - - //11th grade checkbox - { - description: 'Verify 11th grade checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metagrades52')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: 11th grade checkbox icon not found'); - } - console.log('Passed: 11th grade checkbox icon present'); - } - }, - - //11th grade label - { - description: 'Validate 11th grade label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(3) > label:nth-child(10)')).getText(); - if (elementText !== '11') { - throw new Error(`Expected: "11"; Actual: "${elementText}"`); - } - console.log('Passed: 11th label matched as expected'); - } - }, - - //12th grade checkbox - { - description: 'Verify 12th grade checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metagrades53')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: 12th grade checkbox icon not found'); - } - console.log('Passed: 12th grade checkbox icon present'); - } - }, - - //12th grade label - { - description: 'Validate 12th grade label', - action: async () => { - const elementText = await driver.findElement(By.css('label:nth-child(13)')).getText(); - if (elementText !== '12') { - throw new Error(`Expected: "12"; Actual: "${elementText}"`); - } - console.log('Passed: 12th label matched as expected'); - } - }, - - //8th grade checkbox - { - description: 'Verify 8th grade checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metagrades48')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: 8th grade checkbox icon not found'); - } - console.log('Passed: 8th grade checkbox icon present'); - } - }, - - //8th grade label - { - description: 'Validate 8th grade label', - action: async () => { - const elementText = await driver.findElement(By.css('label:nth-child(16)')).getText(); - if (elementText !== '8') { - throw new Error(`Expected: "8"; Actual: "${elementText}"`); - } - console.log('Passed: 8th label matched as expected'); - } - }, - - //More link - { - description: 'Validate More link', - action: async () => { - const elementText = await driver.findElement(By.linkText('More>>')).getText(); - if (elementText !== 'More>>') { - throw new Error(`Expected: "More>>"; Actual: "${elementText}"`); - } - console.log('Passed: More>> link matched as expected'); - } - }, - - //Subject title - { - description: 'Validate Subject title', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > b')).getText(); - if (elementText !== 'Subject') { - throw new Error(`Expected: "Subject" title; Actual: "${elementText}"`); - } - console.log('Passed: Subject title matched as expected'); - } - }, - - //Subject title font size - { - description: 'Validate Subject title font size', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > b')).getCssValue('font-size'); - if (elementText !== '13px') { - throw new Error(`Expected: Subject title font size to be "13px"; Actual: "${elementText}"`); - } - console.log('Passed: Subject title font size matched as expected'); - } - }, - - //Science checkbox - { - description: 'Verify Science checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metasubjectsScience')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Science checkbox icon not found'); - } - console.log('Passed: Science checkbox icon present'); - } - }, - - //Science label - { - description: 'Validate Science label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(4)')).getText(); - if (elementText !== 'Science') { - throw new Error(`Expected: "Science"; Actual: "${elementText}"`); - } - console.log('Passed: Science label matched as expected'); - } - }, - - //Language Arts checkbox (changed place with Mathemtics?) - { - description: 'Verify Language Arts checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metasubjectsLanguage\\ Arts')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Language Arts checkbox icon not found'); - } - console.log('Passed: Language Arts checkbox icon present'); } }, - //Language Arts label (changeed place with Mathematics?) + //Content Set filter title { - description: 'Validate Language Arts label', + description: 'Validate Content Set filter title', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(7)')).getText(); - if (elementText !== 'Language Arts') { - throw new Error(`Expected: "Language Arts"; Actual: "${elementText}"`); + const multipleChecks = 'Content Set filter title'; + const element = await driver.findElement(By.css('.form-group:nth-child(1) > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set') { + console.log('Passed: Content Set filter title matched as expected'); + } else { + errors.push(`Expected: Filter title: "Content Set"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Content Set filter title font matched as expected'); + } else { + errors.push(`Expected: Content Set filter title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Content Set filter title font-size matched as expected'); + } else { + errors.push(`Expected: Content Set filter title font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content Set filter title color matched as expected'); + } else { + errors.push(`Expected: Content Set filter title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Language Arts label matched as expected'); } }, - //Mathematics checkbox (switched with Language Arts?) + //Biology (1493) filter label { - description: 'Verify Mathematics checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metasubjectsMathematics')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Mathematics checkbox icon not found'); - } - console.log('Passed: Mathematics checkbox icon present'); - } - }, - - //Mathematics label (switched with Language Arts?) - { - description: 'Validate Mathematics label', + description: 'Validate Biology filter label', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(10)')).getText(); - if (elementText !== 'Mathematics') { - throw new Error(`Expected: "Mathematics"; Actual: "${elementText}"`); + const multipleChecks = 'Biology filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metaorgobjectid585821587')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(1) > label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Biology filter checkbox present'); + } else { + errors.push('Biology filter checkbox was not found'); + } + + //text + if (elementText === 'Biology') { + console.log('Passed: Biology filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Biology"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Biology filter label font matched as expected'); + } else { + errors.push(`Expected: Biology filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Biology filter label font-size matched as expected'); + } else { + errors.push(`Expected: Biology filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Biology filter label color matched as expected'); + } else { + errors.push(`Expected: Biology filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Mathematics label matched as expected'); } }, - //Social Studies checkbox + //Grade filter title { - description: 'Verify Social Studies checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metasubjectsSocial\\ Studies')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Social Studies checkbox icon not found'); - } - console.log('Passed: Social Studies checkbox icon present'); - } - }, - - //Social Studies label - { - description: 'Validate Social Studies label', + description: 'Validate Grade filter title', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(13)')).getText(); - if (elementText !== 'Social Studies') { - throw new Error(`Expected: "Social Studies"; Actual: "${elementText}"`); + const multipleChecks = 'Grade filter title'; + const element = await driver.findElement(By.css('.form-group:nth-child(3) > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Grade') { + console.log('Passed: Grade filter title matched as expected'); + } else { + errors.push(`Expected: Filter title: "Grade"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade filter title font matched as expected'); + } else { + errors.push(`Expected: Grade filter title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade filter title font-size matched as expected'); + } else { + errors.push(`Expected: Grade filter title font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade filter title color matched as expected'); + } else { + errors.push(`Expected: Grade filter title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Social Studies label matched as expected'); } }, - //Social and Emotional Learning checkbox + //Grade 9 (1251) filter label { - description: 'Verify Social and Emotional Learning checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metasubjectsSocial\\ and\\ Emotional\\ Learning')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Social and Emotional Learning checkbox icon not found'); + description: 'Validate Grade 9 filter label', + action: async () => { + const multipleChecks = 'Grade 9 filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metagrades49')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(3) > label:nth-child(4)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Grade 9 filter checkbox present'); + } else { + errors.push('Grade 9 filter checkbox was not found'); + } + + //text + if (elementText === '9') { + console.log('Passed: Grade 9 filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "9"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade 9 filter label font matched as expected'); + } else { + errors.push(`Expected: Grade 9 filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 9 filter label font-size matched as expected'); + } else { + errors.push(`Expected: Grade 9 filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 9 filter label color matched as expected'); + } else { + errors.push(`Expected: Grade 9 filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Social and Emotional Learning checkbox icon present'); } }, - //Social and Emotional Learning label + //Grade 10 (1231) filter label { - description: 'Validate Social and Emotional Learning label', + description: 'Validate Grade 10 filter label', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(16)')).getText(); - if (elementText !== 'Social and Emotional Learning') { - throw new Error(`Expected: "Social and Emotional Learning"; Actual: "${elementText}"`); + const multipleChecks = 'Grade 10 filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metagrades51')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(3) > label:nth-child(7)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Grade 10 filter checkbox present'); + } else { + errors.push('Grade 10 filter checkbox was not found'); + } + + //text + if (elementText === '10') { + console.log('Passed: Grade 10 filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "10"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade 10 filter label font matched as expected'); + } else { + errors.push(`Expected: Grade 10 filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 10 filter label font-size matched as expected'); + } else { + errors.push(`Expected: Grade 10 filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 10 filter label color matched as expected'); + } else { + errors.push(`Expected: Grade 10 filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Grade 11 (1226) filter label + { + description: 'Validate Grade 11 filter label', + action: async () => { + const multipleChecks = 'Grade 11 filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metagrades52')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(3) > label:nth-child(10)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Grade 11 filter checkbox present'); + } else { + errors.push('Grade 11 filter checkbox was not found'); + } + + //text + if (elementText === '11') { + console.log('Passed: Grade 11 filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "11"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade 11 filter label font matched as expected'); + } else { + errors.push(`Expected: Grade 11 filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 11 filter label font-size matched as expected'); + } else { + errors.push(`Expected: Grade 11 filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 11 filter label color matched as expected'); + } else { + errors.push(`Expected: Grade 11 filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Grade 12 (1224) filter label + { + description: 'Validate Grade 12 filter label', + action: async () => { + const multipleChecks = 'Grade 12 filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metagrades53')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(3) > label:nth-child(13)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Grade 12 filter checkbox present'); + } else { + errors.push('Grade 12 filter checkbox was not found'); + } + + //text + if (elementText === '12') { + console.log('Passed: Grade 12 filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "12"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade 12 filter label font matched as expected'); + } else { + errors.push(`Expected: Grade 12 filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 12 filter label font-size matched as expected'); + } else { + errors.push(`Expected: Grade 12 filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 12 filter label color matched as expected'); + } else { + errors.push(`Expected: Grade 12 filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Grade 8 (1063) filter label + { + description: 'Validate Grade 8 filter label', + action: async () => { + const multipleChecks = 'Grade 8 filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metagrades48')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(3) > label:nth-child(16)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Grade 8 filter checkbox present'); + } else { + errors.push('Grade 8 filter checkbox was not found'); + } + + //text + if (elementText === '8') { + console.log('Passed: Grade 8 filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "8"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade 8 filter label font matched as expected'); + } else { + errors.push(`Expected: Grade 8 filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 8 filter label font-size matched as expected'); + } else { + errors.push(`Expected: Grade 8 filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 8 filter label color matched as expected'); + } else { + errors.push(`Expected: Grade 8 filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //More>> filter link + { + description: 'Validate More filter link', + action: async () => { + const multipleChecks = 'More>> filter link'; + const element = await driver.findElement(By.linkText('More>>')); + + //Get text, font, size, and 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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'More>>') { + console.log('Passed: More>> filter link matched as expected'); + } else { + errors.push(`Expected: Filter link: "More>>"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: More>> filter link font matched as expected'); + } else { + errors.push(`Expected: More>> filter link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: More>> filter link font-size matched as expected'); + } else { + errors.push(`Expected: More>> filter link font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: More>> filter link color matched as expected'); + } else { + errors.push(`Expected: More>> filter link color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits#') { + console.log('Passed: More>> URL filter link listed as expected'); + } else { + errors.push(`Expected: More>> URL filter link: "https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits#"; Actual: "${elementURL}"`); + } + + //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')); + } + } + }, + + //Subject filter title + { + description: 'Validate Subject filter title', + action: async () => { + const multipleChecks = 'Subject filter title'; + const element = await driver.findElement(By.css('.form-group:nth-child(6) > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Subject') { + console.log('Passed: Subject filter title matched as expected'); + } else { + errors.push(`Expected: Filter title: "Subject"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Subject filter title font matched as expected'); + } else { + errors.push(`Expected: Subject filter title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Subject filter title font-size matched as expected'); + } else { + errors.push(`Expected: Subject filter title font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Subject filter title color matched as expected'); + } else { + errors.push(`Expected: Subject filter title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Science (1493) filter label + { + description: 'Validate Science filter label', + action: async () => { + const multipleChecks = 'Science filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metasubjectsScience')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(4)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Science filter checkbox present'); + } else { + errors.push('Science filter checkbox was not found'); + } + + //text + if (elementText === 'Science') { + console.log('Passed: Science filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Science"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Science filter label font matched as expected'); + } else { + errors.push(`Expected: Science filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Science filter label font-size matched as expected'); + } else { + errors.push(`Expected: Science filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Science filter label color matched as expected'); + } else { + errors.push(`Expected: Science filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Social Studies (28) filter label + { + description: 'Validate Social Studies filter label', + action: async () => { + const multipleChecks = 'Social Studies filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metasubjectsSocial\\ Studies')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(7)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Social Studies filter checkbox present'); + } else { + errors.push('Social Studies filter checkbox was not found'); + } + + //text + if (elementText === 'Social Studies') { + console.log('Passed: Social Studies filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Social Studies"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Social Studies filter label font matched as expected'); + } else { + errors.push(`Expected: Social Studies filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Social Studies filter label font-size matched as expected'); + } else { + errors.push(`Expected: Social Studies filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Social Studies filter label color matched as expected'); + } else { + errors.push(`Expected: Social Studies filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Technology Education (8) filter label + { + description: 'Validate Technology Education filter label', + action: async () => { + const multipleChecks = 'Technology Education filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metasubjectsTechnology\\ Education')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(10)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Technology Education filter checkbox present'); + } else { + errors.push('Technology Education filter checkbox was not found'); + } + + //text + if (elementText === 'Technology Education') { + console.log('Passed: Technology Education filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Technology Education"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Technology Education filter label font matched as expected'); + } else { + errors.push(`Expected: Technology Education filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Technology Education filter label font-size matched as expected'); + } else { + errors.push(`Expected: Technology Education filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Technology Education filter label color matched as expected'); + } else { + errors.push(`Expected: Technology Education filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Language Arts (3) filter label + { + description: 'Validate Language Arts filter label', + action: async () => { + const multipleChecks = 'Language Arts filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metasubjectsLanguage\\ Arts')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(13)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Language Arts filter checkbox present'); + } else { + errors.push('Language Arts filter checkbox was not found'); + } + + //text + if (elementText === 'Language Arts') { + console.log('Passed: Language Arts filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Language Arts"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Language Arts filter label font matched as expected'); + } else { + errors.push(`Expected: Language Arts filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Language Arts filter label font-size matched as expected'); + } else { + errors.push(`Expected: Language Arts filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Language Arts filter label color matched as expected'); + } else { + errors.push(`Expected: Language Arts filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Mathematics (3) filter label + { + description: 'Validate Mathematics filter label', + action: async () => { + const multipleChecks = 'Mathematics filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metasubjectsMathematics')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(16)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Mathematics filter checkbox present'); + } else { + errors.push('Mathematics filter checkbox was not found'); + } + + //text + if (elementText === 'Mathematics') { + console.log('Passed: Mathematics filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Mathematics"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Mathematics filter label font matched as expected'); + } else { + errors.push(`Expected: Mathematics filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Mathematics filter label font-size matched as expected'); + } else { + errors.push(`Expected: Mathematics filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Mathematics filter label color matched as expected'); + } else { + errors.push(`Expected: Mathematics filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Social and Emotional Learning label matched as expected'); } }, @@ -685,119 +1584,251 @@ const steps = [ { description: 'Validate Alignment Status title', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(8) > b')).getText(); - if (elementText !== 'Alignment Status') { - throw new Error(`Expected: "Alignment Status" title; Actual: "${elementText}"`); + const multipleChecks = 'Alignment Status title'; + const element = await driver.findElement(By.css('.form-group:nth-child(8) > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Alignment Status') { + console.log('Passed: Alignment Status title matched as expected'); + } else { + errors.push(`Expected: Title: "Alignment Status"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Alignment Status title font matched as expected'); + } else { + errors.push(`Expected: Alignment Status title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Alignment Status title font-size matched as expected'); + } else { + errors.push(`Expected: Alignment Status title font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Alignment Status title color matched as expected'); + } else { + errors.push(`Expected: Alignment Status title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Alignment Status title matched as expected'); } }, - //Alignment Status title font size + //Not Aligned (1049) filter label { - description: 'Validate Alignment Status title font size', + description: 'Validate Not Aligned filter label', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(8) > b')).getCssValue('font-size'); - if (elementText !== '13px') { - throw new Error(`Expected: Alignment Status title font size to be "13px"; Actual: "${elementText}"`); + const multipleChecks = 'Not Aligned filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metaAlignmentStatusNot\\ Aligned')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(8) > label:nth-child(4)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Not Aligned filter checkbox present'); + } else { + errors.push('Not Aligned filter checkbox was not found'); + } + + //text + if (elementText === 'Not Aligned') { + console.log('Passed: Not Aligned filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Not Aligned"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Not Aligned filter label font matched as expected'); + } else { + errors.push(`Expected: Not Aligned filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Not Aligned filter label font-size matched as expected'); + } else { + errors.push(`Expected: Not Aligned filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Not Aligned filter label color matched as expected'); + } else { + errors.push(`Expected: Not Aligned filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Alignment Status title font size matched as expected'); } }, - //Not Aligned checkbox + //ECS Alignment (427) filter label { - description: 'Verify Not Aligned checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metaAlignmentStatusNot\\ Aligned')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Not Aligned checkbox icon not found'); - } - console.log('Passed: Not Aligned checkbox icon present'); - } - }, - - //Not Aligned label - { - description: 'Validate Not Aligned label', + description: 'Validate ECS Alignment filter label', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(8) > label:nth-child(4)')).getText(); - if (elementText !== 'Not Aligned') { - throw new Error(`Expected: "Not Aligned"; Actual: "${elementText}"`); + const multipleChecks = 'ECS Alignment filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metaAlignmentStatusECS\\ Alignment')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(8) > label:nth-child(7)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: ECS Alignment filter checkbox present'); + } else { + errors.push('ECS Alignment filter checkbox was not found'); + } + + //text + if (elementText === 'ECS Alignment') { + console.log('Passed: ECS Alignment filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "ECS Alignment"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: ECS Alignment filter label font matched as expected'); + } else { + errors.push(`Expected: ECS Alignment filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: ECS Alignment filter label font-size matched as expected'); + } else { + errors.push(`Expected: ECS Alignment filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: ECS Alignment filter label color matched as expected'); + } else { + errors.push(`Expected: ECS Alignment filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Not Aligned label matched as expected'); } }, - //ECS Alignment checkbox + //Pending (17) filter label { - description: 'Verify ECS Alignment checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metaAlignmentStatusECS\\ Alignment')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: ECS Alignment checkbox icon not found'); - } - console.log('Passed: ECS Alignment checkbox icon present'); - } - }, - - //ECS Alignment label - { - description: 'Validate ECS Alignment label', + description: 'Validate Pending filter label', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(8) > label:nth-child(7)')).getText(); - if (elementText !== 'ECS Alignment') { - throw new Error(`Expected: "ECS Alignment"; Actual: "${elementText}"`); - } - console.log('Passed: ECS Alignment label matched as expected'); - } - }, + const multipleChecks = 'Pending filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metaAlignmentStatusPending')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(8) > label:nth-child(10)')); - //Pending checkbox - { - description: 'Verify Pending checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metaAlignmentStatusPending')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Pending checkbox icon not found'); - } - console.log('Passed: Pending checkbox icon present'); - } - }, + //Get text, font, size, and 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'); - //Pending label - { - description: 'Validate Pending label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(8) > label:nth-child(10)')).getText(); - if (elementText !== 'Pending') { - throw new Error(`Expected: "Pending"; Actual: "${elementText}"`); - } - console.log('Passed: Pending label matched as expected'); - } - }, + //Track all errors + const errors = []; - //Aligned checkbox - { - description: 'Verify Aligned checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metaAlignmentStatusAligned')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Aligned checkbox icon not found'); + //checkbox + if (elementCheckbox) { + console.log('Passed: Pending filter checkbox present'); + } else { + errors.push('Pending filter checkbox was not found'); } - console.log('Passed: Aligned checkbox icon present'); - } - }, - //Aligned label - { - description: 'Validate Aligned label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(8) > label:nth-child(13)')).getText(); - if (elementText !== 'Aligned') { - throw new Error(`Expected: "Aligned"; Actual: "${elementText}"`); + //text + if (elementText === 'Pending') { + console.log('Passed: Pending filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Pending"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Pending filter label font matched as expected'); + } else { + errors.push(`Expected: Pending filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Pending filter label font-size matched as expected'); + } else { + errors.push(`Expected: Pending filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Pending filter label color matched as expected'); + } else { + errors.push(`Expected: Pending filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Aligned label matched as expected'); } }, @@ -805,1813 +1836,7288 @@ const steps = [ { description: 'Validate Reset All link', action: async () => { - const elementText = await driver.findElement(By.linkText('Reset All')).getText(); - if (elementText !== 'Reset All') { - throw new Error(`Expected: "Reset All"; Actual: "${elementText}"`); + const multipleChecks = 'Reset All link'; + const element = await driver.findElement(By.linkText('Reset All')); + + //Get text, font, size, and 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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Reset All') { + console.log('Passed: Reset All link matched as expected'); + } else { + errors.push(`Expected: Link: "Reset All"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Reset All link font matched as expected'); + } else { + errors.push(`Expected: Reset All link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Reset All link font-size matched as expected'); + } else { + errors.push(`Expected: Reset All link font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Reset All link color matched as expected'); + } else { + errors.push(`Expected: Reset All link color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits#') { + console.log('Passed: Reset All URL link listed as expected'); + } else { + errors.push(`Expected: Reset All URL link: "https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits#"; Actual: "${elementURL}"`); + } + + //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: Reset All link matched as expected'); } }, - - //CONTENT RESULTS - PAGINATION ROW + + //Page Breadcrumbs + //Home link { description: 'Validate Home link', action: async () => { - const elementText = await driver.findElement(By.linkText('Home')).getText(); - if (elementText !== 'Home') { - throw new Error(`Expected: "Home"; Actual: "${elementText}"`); + const multipleChecks = 'Home link'; + const element = await driver.findElement(By.linkText('Home')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Home') { + console.log('Passed: Home link matched as expected'); + } else { + errors.push(`Expected: Link: "Home"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Home link font matched as expected'); + } else { + errors.push(`Expected: Home link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Home link font-size matched as expected'); + } else { + errors.push(`Expected: Home link font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Home link color matched as expected'); + } else { + errors.push(`Expected: Home link color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Home link matched as expected'); } }, - //Content breadcrumb + //Content link { - description: 'Validate Content breadcrumb', + description: 'Validate Content link', action: async () => { - const elementText = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)')).getText(); - if (elementText !== 'Content') { - throw new Error(`Expected: "Content"; Actual: "${elementText}"`); + const multipleChecks = 'Content link'; + const element = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content') { + console.log('Passed: Content link matched as expected'); + } else { + errors.push(`Expected: Link: "Content"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Content link font matched as expected'); + } else { + errors.push(`Expected: Content link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Content link font-size matched as expected'); + } else { + errors.push(`Expected: Content link font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content link color matched as expected'); + } else { + errors.push(`Expected: Content link color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Content link matched as expected'); } }, - - //Content breadcrumb text color -green - { - description: 'Validate Content breadcrumb text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Content breadcrumb text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Content breadcrumb text color matched as expected'); - } - }, - + //Detail View button { - description: 'Validate Detail View button text', + description: 'Validate Detail View button', action: async () => { - const elementText = await driver.findElement(By.linkText('Detail View')).getText(); - if (elementText !== 'Detail View') { - throw new Error(`Expected: "Detail View" button text; Actual: "${elementText}"`); - } - console.log('Passed: Detail View button text matched as expected'); - } - }, + const multipleChecks = 'Detail View button'; + const element = await driver.findElement(By.linkText('Detail View')); - //Detail View button color -green - { - description: 'Validate Detail View button color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Detail View')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Detail View button color did not match; Actual: "${elementStyle}"`); + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'Detail View') { + console.log('Passed: Detail View button text matched as expected'); + } else { + errors.push(`Expected: "Detail View"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Detail View button text font matched as expected'); + } else { + errors.push(`Expected: Detail View button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Detail View button text font-size matched as expected'); + } else { + errors.push(`Expected: Detail View button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Detail View button text color matched as expected'); + } else { + errors.push(`Expected: Detail View button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Detail View button background color matched as expected'); + } else { + errors.push(`Expected: Detail View 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')); } - console.log('Passed: Detail View button color matched as expected'); } }, //Edit View button { - description: 'Validate Edit View button text', + description: 'Validate Edit View button', action: async () => { - const elementText = await driver.findElement(By.linkText('Edit View')).getText(); - if (elementText !== 'Edit View') { - throw new Error(`Expected: "Edit View" button text; Actual: "${elementText}"`); - } - console.log('Passed: Edit View button text matched as expected'); - } - }, + const multipleChecks = 'Edit View button'; + const element = await driver.findElement(By.linkText('Edit View')); - //Edit View button color -white - { - description: 'Validate Edit View button color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Edit View')).getCssValue('background-color'); - if (elementStyle !== 'rgba(248, 249, 250, 1)') { - throw new Error(`Expected: Edit View button color did not match; Actual: "${elementStyle}"`); + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'Edit View') { + console.log('Passed: Edit View button text matched as expected'); + } else { + errors.push(`Expected: "Edit View"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Edit View button text font matched as expected'); + } else { + errors.push(`Expected: Edit View button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Edit View button text font-size matched as expected'); + } else { + errors.push(`Expected: Edit View button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Edit View button text color matched as expected'); + } else { + errors.push(`Expected: Edit View button text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(248, 249, 250, 1)') { + console.log('Passed: Edit View button background color matched as expected'); + } else { + errors.push(`Expected: Edit View button background color: "rgba(248, 249, 250, 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')); } - console.log('Passed: Edit View button color matched as expected'); } }, //Save icon { - description: 'Verify Save icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.float-right > a:nth-child(1) > img')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Save icon not found'); - } - console.log('Passed: Save icon present'); - } - }, - - //Save icon tool-tip - { - description: 'Validate Save icon tool-tip', + description: 'Validate Save icon', action: async () => { - const elementStyle = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div > div.col-xs-12.col-sm-9 > div.float-right.ml-1 > a:nth-child(1)')).getAttribute('title'); - if (elementStyle !== 'Save This Search') { - throw new Error(`Expected: "Save This Search"; Actual: "${elementStyle}"`); + const multipleChecks = 'Save icon'; + const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div > div.col-xs-12.col-sm-9 > div.float-right.ml-1 > a:nth-child(1)')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Save icon present'); + } else { + errors.push('Save icon was not found'); + } + + //text + if (elementText === 'Save This Search') { + console.log('Passed: Save icon tool-tip matched as expected'); + } else { + errors.push(`Expected: Save icon tool-tip: "Save This Search"; Actual: "${elementText}"`); + } + + //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: Save This Search tool-tip matched as expected'); } }, //Print icon { - description: 'Verify Print icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.icon-link > img')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Print icon not found'); + description: 'Validate Print icon', + action: async () => { + const multipleChecks = 'Print icon'; + const element = await driver.findElement(By.css('.icon-link > img')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Print icon present'); + } else { + errors.push('Print icon was not found'); + } + + //text + if (elementText === 'Print This Page') { + console.log('Passed: Print icon tool-tip matched as expected'); + } else { + errors.push(`Expected: Print icon tool-tip: "Print This Page"; Actual: "${elementText}"`); + } + + //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: Print icon present'); } }, - - //Printicon tool-tip + + //Results 1 - 25 of 1493 label { - description: 'Validate Print icon tool-tip', + description: 'Validate Results 1 - 25 of 1493 label text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.css('.icon-link > img')).getAttribute('title'); - if (elementStyle !== 'Print This Page') { - throw new Error(`Expected: "Print This Page"; Actual: "${elementStyle}"`); - } - console.log('Passed: Print This Page tool-tip matched as expected'); - } - }, + const multipleChecks = 'Results 1 - 25 of 1493 label'; + const element = await driver.findElement(By.css('.float-left:nth-child(5)')); - //Results 1-25 of 1046 label - { - description: 'Validate Results 1-25 of 1046 label', - action: async () => { - const elementText = await driver.findElement(By.css('.float-left:nth-child(5)')).getText(); - if (elementText !== 'Results 1 - 25 of 1046') { - throw new Error(`Expected: "Results 1 - 25 of 1046" label; Actual: "${elementText}"`); + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Results 1 - 25 of 1493') { + console.log('Passed: Results 1 - 25 of 1493 label text matched as expected'); + } else { + errors.push(`Expected: Label: "Results 1 - 25 of 1493"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Results 1 - 25 of 1493 label font matched as expected'); + } else { + errors.push(`Expected: Results 1 - 25 of 1493 label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Results 1 - 25 of 1493 label text font-size matched as expected'); + } else { + errors.push(`Expected: Results 1 - 25 of 1493 label text font-size "132px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Results 1 - 25 of 1493 label text color matched as expected'); + } else { + errors.push(`Expected: Results 1 - 25 of 1493 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Results 1 - 25 of 1046 label matched as expected'); } }, //PAGINATION BUTTONS - //Show button text + + //Show button { - description: 'Validate Show button text', + description: 'Validate Show button', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(6) #contentlimit')).getText(); - if (elementText !== 'Show') { - throw new Error(`Expected: "Show" button text; Actual: "${elementText}"`); + const multipleChecks = 'Show button'; + const element = await driver.findElement(By.css('.form-group:nth-child(6) #contentlimit')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'Show') { + console.log('Passed: Show button text matched as expected'); + } else { + errors.push(`Expected: "Show"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Show button text font matched as expected'); + } else { + errors.push(`Expected: Show button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Show button text font-size matched as expected'); + } else { + errors.push(`Expected: Show button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Show button text color matched as expected'); + } else { + errors.push(`Expected: Show button text color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(233, 236, 239, 1)') { + console.log('Passed: Show button background color matched as expected'); + } else { + errors.push(`Expected: Show button background color: "rgba(233, 236, 239, 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')); } - console.log('Passed: Show button text matched as expected'); } }, - //Show dropdown [should be: "25", option] + //Show dropdown { - description: 'Validate Show dropdown option', + description: 'Validate Show dropdown', action: async () => { - const elementOption = await driver.findElement(By.css('.form-group:nth-child(6) #inputlimit')).getAttribute('value'); - if (elementOption !== '25') { - throw new Error(`Expected: "25"; Actual: "${elementOption}"`); + const multipleChecks = 'Show dropdown'; + const element = await driver.findElement(By.css('.form-group:nth-child(6) #inputlimit')); + + //Get text, font, color, and size + const elementText = await element.getAttribute('value'); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === '25') { + console.log('Passed: Show dropdown default text matched as expected'); + } else { + errors.push(`Expected: Show dropdown default: "25"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Show dropdown text font matched as expected'); + } else { + errors.push(`Expected: Show dropdown text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Show dropdown text font-size matched as expected'); + } else { + errors.push(`Expected: Show dropdown text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Show dropdown text color matched as expected'); + } else { + errors.push(`Expected: Show dropdown text color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Show dropdown background color matched as expected'); + } else { + errors.push(`Expected: Show dropdown background color: "rgba(255, 255, 255, 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')); } - console.log('Passed: Show dropdown option matched as expected'); } }, - //Pagination 1 button text + //Pagination 1 button { - description: 'Validate pagination 1 button text', + description: 'Validate Pagination 1 button', action: async () => { - const elementText = await driver.findElement(By.linkText('1')).getText(); - if (elementText !== '1') { - throw new Error(`Expected: Pagination "1" button text; Actual: "${elementText}"`); + const multipleChecks = 'Pagination 1 button'; + const element = await driver.findElement(By.linkText('1')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === '1') { + console.log('Passed: Pagination button 1 text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "1"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button 1 text font matched as expected'); + } else { + errors.push(`Expected: Pagination button 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button 1 text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button 1 text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button 1 text color matched as expected'); + } else { + errors.push(`Expected: Pagination button 1 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button 1 background color matched as expected'); + } else { + errors.push(`Expected: Pagination button 1 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')); } - console.log('Passed: Pagination 1 button text matched as expected'); } }, - //Pagination 1 background color -green + //Pagination 2 button { - description: 'Validate pagination 1 button color', + description: 'Validate Pagination 2 button', action: async () => { - const elementStyle = await driver.findElement(By.linkText('1')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Pagination 1 button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Pagination 2 button'; + const element = await driver.findElement(By.linkText('2')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === '2') { + console.log('Passed: Pagination button 2 text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "2"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button 2 text font matched as expected'); + } else { + errors.push(`Expected: Pagination button 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button 2 text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button 2 text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button 2 text color matched as expected'); + } else { + errors.push(`Expected: Pagination button 2 text color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button 2 background color matched as expected'); + } else { + errors.push(`Expected: Pagination button 2 background color: "rgba(255, 255, 255, 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')); } - console.log('Passed: Pagination 1 button color matched as expected'); } }, - //Pagination 2 button text + //Pagination 3 button { - description: 'Validate pagination 2 button text', + description: 'Validate Pagination 3 button', action: async () => { - const elementText = await driver.findElement(By.linkText('2')).getText(); - if (elementText !== '2') { - throw new Error(`Expected: Pagination "2" button text; Actual: "${elementText}"`); + const multipleChecks = 'Pagination 3 button'; + const element = await driver.findElement(By.linkText('3')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === '3') { + console.log('Passed: Pagination button 3 text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "3"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button 3 text font matched as expected'); + } else { + errors.push(`Expected: Pagination button 3 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button 3 text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button 3 text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button 3 text color matched as expected'); + } else { + errors.push(`Expected: Pagination button 3 text color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button 3 background color matched as expected'); + } else { + errors.push(`Expected: Pagination button 3 background color: "rgba(255, 255, 255, 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')); } - console.log('Passed: Pagination 2 button text matched as expected'); } }, - //Pagination 2 text color -green + //Pagination 4 button { - description: 'Validate pagination 2 text color', + description: 'Validate Pagination 4 button', action: async () => { - const elementStyle = await driver.findElement(By.linkText('2')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Pagination 2 text color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Pagination 4 button'; + const element = await driver.findElement(By.linkText('4')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === '4') { + console.log('Passed: Pagination button 4 text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "4"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button 4 text font matched as expected'); + } else { + errors.push(`Expected: Pagination button 4 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button 4 text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button 4 text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button 4 text color matched as expected'); + } else { + errors.push(`Expected: Pagination button 4 text color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button 4 background color matched as expected'); + } else { + errors.push(`Expected: Pagination button 4 background color: "rgba(255, 255, 255, 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')); } - console.log('Passed: Pagination 2 text color matched as expected'); } }, - //Pagination 3 button text + //Pagination 5 button { - description: 'Validate pagination 3 button text', + description: 'Validate Pagination 5 button', action: async () => { - const elementText = await driver.findElement(By.linkText('3')).getText(); - if (elementText !== '3') { - throw new Error(`Expected: Pagination "3" button text; Actual: "${elementText}"`); - } - console.log('Passed: Pagination 3 button text matched as expected'); - } - }, + const multipleChecks = 'Pagination 5 button'; + const element = await driver.findElement(By.linkText('5')); - //Pagination 3 text color -green - { - description: 'Validate pagination 3 text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('3')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Pagination 3 text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Pagination 3 text color matched as expected'); - } - }, + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); - //Pagination 4 button text - { - description: 'Validate pagination 4 button text', - action: async () => { - const elementText = await driver.findElement(By.linkText('4')).getText(); - if (elementText !== '4') { - throw new Error(`Expected: Pagination "4" button text; Actual: "${elementText}"`); - } - console.log('Passed: Pagination 4 button text matched as expected'); - } - }, + //Track all errors + const errors = []; - //Pagination 4 text color -green - { - description: 'Validate pagination 4 text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('4')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Pagination 4 text color did not match; Actual: "${elementStyle}"`); + //text + if (elementText === '5') { + console.log('Passed: Pagination button 5 text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "5"; Actual: "${elementText}"`); } - console.log('Passed: Pagination 4 text color matched as expected'); - } - }, - //Pagination 5 button text - { - description: 'Validate pagination 5 button text', - action: async () => { - const elementText = await driver.findElement(By.linkText('5')).getText(); - if (elementText !== '5') { - throw new Error(`Expected: Pagination "5" button text; Actual: "${elementText}"`); + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button 5 text font matched as expected'); + } else { + errors.push(`Expected: Pagination button 5 text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - console.log('Passed: Pagination 5 button text matched as expected'); - } - }, - //Pagination 5 text color -green - { - description: 'Validate pagination 5 text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('5')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Pagination 5 text color did not match; Actual: "${elementStyle}"`); + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button 5 text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button 5 text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color | automation issue + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button 5 text color matched as expected'); + } else { + errors.push(`Expected: Pagination button 5 text color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //button color | automation issue + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button 5 background color matched as expected'); + } else { + errors.push(`Expected: Pagination button 5 background color: "rgba(255, 255, 255, 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')); } - console.log('Passed: Pagination 5 text color matched as expected'); } }, //Pagination separator icon { description: 'Verify Pagination separator icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.linkText('...')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Pagination separator icon not found'); - } - console.log('Passed: Pagination separator icon present'); - } - }, - - //Pagination 42 button text - { - description: 'Validate pagination 42 button text', action: async () => { - const elementText = await driver.findElement(By.linkText('42')).getText(); - if (elementText !== '42') { - throw new Error(`Expected: Pagination "42" button text; Actual: "${elementText}"`); + const element = await driver.wait(until.elementLocated(By.linkText('...')), 5000).catch(() => false); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Pagination separator icon present'); + } else { + errors.push('Pagination separater icon not found'); } - console.log('Passed: Pagination 42 button text matched as expected'); } }, - //Pagination 42 text color -green + //Pagination 60 button { - description: 'Validate pagination 42 text color', + description: 'Validate Pagination 60 button', action: async () => { - const elementStyle = await driver.findElement(By.linkText('42')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Pagination 42 text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Pagination 42 text color matched as expected'); - } - }, + const multipleChecks = 'Pagination 60 button'; + const element = await driver.findElement(By.linkText('60')); - //Pagination Show All button text - { - description: 'Validate pagination Show All button text', - action: async () => { - const elementText = await driver.findElement(By.linkText('Show All')).getText(); - if (elementText !== 'Show All') { - throw new Error(`Expected: Pagination "Show All" button text; Actual: "${elementText}"`); - } - console.log('Passed: Pagination Show All button text matched as expected'); - } - }, + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); - //Pagination Show All text color -green - { - description: 'Validate pagination Show All text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Show All')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Pagination Show All text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Pagination Show All text color matched as expected'); - } - }, + //Track all errors + const errors = []; - //CONTENT RESULTS - CONTENT ITEMS - //Content 1 Title - { - description: 'Validate Content 1 title', - action: async () => { - const elementText = await driver.findElement(By.linkText('AAA My Test III')).getText(); - if (elementText !== 'AAA My Test III') { - throw new Error(`Expected: Content 1 item "AAA My Test III" title; Actual: "${elementText}"`); + //text + if (elementText === '60') { + console.log('Passed: Pagination button 60 text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "60"; Actual: "${elementText}"`); } - console.log('Passed: Content 1 item AAA My Test III title matched as expected'); - } - }, - //Content 1 Title font size - { - description: 'Validate Content 1 item AAA My Test III title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('AAA My Test III')).getCssValue('font-size'); - if (elementStyle !== '13px') { - throw new Error(`Expected: Content 1 item "AAA My Test III" text font-size did not match; Actual: "${elementStyle}"`); + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button 60 text font matched as expected'); + } else { + errors.push(`Expected: Pagination button 60 text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - console.log('Passed: Content 1 item AAA My Test III title text font-size matched as expected'); - } - }, - //Content 1 edit icon - { - description: 'Verify Content 1 edit icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.card:nth-child(8) .lo-title .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Content 1 edit icon not found'); + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button 60 text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button 60 text font-size "14px"; Actual: "${elementSize}"`); } - console.log('Passed: Content 1 edit icon present'); - } - }, - //Content 1 edit button text - { - description: 'Validate Content 1 edit button text', - action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(8) .ml-3')).getText(); - if (elementText !== 'Edit') { - throw new Error(`Expected: Content 1 "Edit" button text; Actual: "${elementText}"`); + //text color + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button 60 text color matched as expected'); + } else { + errors.push(`Expected: Pagination button 60 text color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); } - console.log('Passed: Content 1 Edit button text matched as expected'); - } - }, - //Content 1 edit button color -green - { - description: 'Validate Content 1 Edit button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.card:nth-child(8) .ml-3')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Content 1 Edit button color did not match; Actual: "${elementStyle}"`); + //button color + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button 60 background color matched as expected'); + } else { + errors.push(`Expected: Pagination button 60 background color: "rgba(255, 255, 255, 1)"; Actual: "${elementButtonColor}"`); } - console.log('Passed: Content 1 Edit button color matched as expected'); - } - }, - //Content 1 description - { - description: 'Validate Content 1 description', - action: async () => { - try { - const element = await driver.findElement(By.css('.card:nth-child(8) .lo-descr')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'Yes, it should work! Perhaps'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); + //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`); } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } } }, - //Content 1 content set label + //Pagination Show All button { - description: 'Validate Content 1 content set label', + description: 'Validate Pagination Show All button', action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(8) small')).getText(); - if (elementText !== 'Content Set: Biology - QA') { - throw new Error(`Expected: Content 1 content set label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Pagination Show All button'; + const element = await driver.findElement(By.linkText('Show All')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'Show All') { + console.log('Passed: Pagination button Show All text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "Show All"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button Show All text font matched as expected'); + } else { + errors.push(`Expected: Pagination button Show All text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button Show All text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button Show All text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button Show All text color matched as expected'); + } else { + errors.push(`Expected: Pagination button Show All text color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button Show All background color matched as expected'); + } else { + errors.push(`Expected: Pagination button Show All background color: "rgba(255, 255, 255, 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')); } - console.log('Passed: Content 1 content set label matched as expected'); } }, - //Content 1 alignment label + //Content result card 1 title { - description: 'Validate Content 1 ECS Alignement label', + description: 'Validate Content result card 1 title', action: async () => { - const elementText = await driver.findElement(By.css('#alignstatuslink874454004 > .display-alignment')).getText(); - if (elementText !== 'Aligned (reset)') { - throw new Error(`Expected: Content 1 ECS Alignement label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 1 title'; + const element = await driver.findElement(By.linkText('2010 Gulf of Mexico Oil Spills')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === '2010 Gulf of Mexico Oil Spills') { + console.log('Passed: Content result card 1 title text matched as expected'); + } else { + errors.push(`Expected: Content result card 1 title: "2010 Gulf of Mexico Oil Spills"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 title text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 title text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 1 title text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 title text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content result card 1 title text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 title text color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //url + if (elementURL === 'http://sciencenetlinks.com/collections/2010-gulf-mexico-oil-spill/') { + console.log('Passed: Content result card 1 URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 1 URL: "http://sciencenetlinks.com/collections/2010-gulf-mexico-oil-spill/"; Actual: "${elementURL}"`); + } + + //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: Content 1 ECS Alignement label matched as expected'); } }, - //Content 1 alignment reset label + //Content result card 1 edit button { - description: 'Validate Content 1 ECS Alignement reset label', + description: 'Validate Content result card 1 edit button', action: async () => { - const elementText = await driver.findElement(By.css('#alignstatuslink874454004 b')).getText(); - if (elementText !== 'reset') { - throw new Error(`Expected: Content 1 ECS Alignement reset label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 1 edit button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(8) .lo-title .fa')); + const element = await driver.findElement(By.css('.card:nth-child(8) .ml-3')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 1 button "Edit" icon is present'); + } else { + errors.push('Content result card 1 button "Edit" icon was not found'); + } + + //text + if (elementText === 'Edit') { + console.log('Passed: Content result card 1 Edit button text matched as expected'); + } else { + errors.push(`Expected: Content result card 1 button text: "Edit"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 Edit button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Edit button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Content result card 1 Edit button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Edit button text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 1 Edit button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Edit button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 1 Edit button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Edit 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')); } - console.log('Passed: Content 1 ECS Alignement reset label matched as expected'); } }, - //Content 1 alignment reset label font size + //Content result card 1 thumbnail { - description: 'Validate Content 1 ECS Alignement reset label text font size', + description: 'Verify Content result card 1 thumbnail', action: async () => { - const elementStyle = await driver.findElement(By.css('#alignstatuslink874454004 b')).getCssValue('font-size'); - if (elementStyle !== '13px') { - throw new Error(`Expected: Content 1 ECS Alignement reset label text font-size did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Content result card 1 thumbnail'; + const element = await driver.wait(until.elementLocated(By.css('#pub > div:nth-child(8) > div > div > div:nth-child(1) > a')), 5000).catch(() => false); + const elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //thumbnail + if (element) { + console.log('Passed: Content result card 1 thumbnail present'); + } else { + errors.push('Content result card 1 thumbnail not found'); + } + + //url + if (elementURL === 'http://sciencenetlinks.com/collections/2010-gulf-mexico-oil-spill/') { + console.log('Passed: Content result card 1 thumbnail URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 1 thumbnail URL: "http://sciencenetlinks.com/collections/2010-gulf-mexico-oil-spill/"; Actual: "${elementURL}"`); + } + + //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: Content 1 ECS Alignement reset label text font-size matched as expected'); } }, - //Content 1 view standards button icon + //Content result card 1 View Details button { - description: 'Verify Content 1 View Standards button icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.card:nth-child(8) .well .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Content 1 View Standards button icon not found'); - } - console.log('Passed: Content 1 View Standards button icon present'); - } - }, - - //Content 1 view standards button text - { - description: 'Validate Content 1 View Standards button text', + description: 'Validate Content result card 1 View Details button', action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(8) .well > .btn')).getText(); - if (elementText !== 'View Standards') { - throw new Error(`Expected: Content 1 View Standards button text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 1 View Details button'; + const element = await driver.findElement(By.css('.card:nth-child(8) > .card-body > div > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'View Details') { + console.log('Passed: Content result card 1 View Details button text matched as expected'); + } else { + errors.push(`Expected: Content result card 1 button text: "View Details"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 View Details button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Details button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 1 View Details button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Details button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 1 View Details button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Details button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 1 View Details button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Details 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')); } - console.log('Passed: Content 1 View Standards button text matched as expected'); } }, - //Content 1 view standards button color -green + //Content result card 1 View Details - details (SPECIAL CASE: trim text) { - description: 'Validate Content 1 view standards button color', + description: 'Validate Content result card 1 View Details info', action: async () => { - const elementStyle = await driver.findElement(By.css('.card:nth-child(8) .well > .btn')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Content 1 View Standards button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Content result card 1 View Details info'; + + //Track all errors + const errors = []; + + //Target the specific content div using the matching onclick ID + const contentText = await driver.executeScript(` + const viewDetailsBtn = document.querySelector('a[onclick*="content1162099584"]'); + if (!viewDetailsBtn) return 'button not found'; + const div = viewDetailsBtn.previousElementSibling; + if (!div) return 'div not found'; + return div.innerHTML + .replace(/
/gi, '\\n') + .replace(/<[^>]+>/g, '') + .trim(); + `); + //console.log('----->| DEBUG content text:', contentText); + + const expectedLines = [ + 'Alignment Status: Pending', + 'Content Type: Lesson Plan', + 'Format: HTML', + 'Free or Fee: Free', + 'Grade Range: K to 12', + 'Language: English', + 'Level-On Target: K', + 'Source: Science NetLinks', + 'Subject(s): Science', + 'Target Audience: Teacher' + ]; + + const actualLines = contentText + .split('\n') + .map(line => line.trim()) + .filter(line => line !== ''); + + //console.log('----->| DEBUG actual lines:', JSON.stringify(actualLines)); + + for (const expectedLine of expectedLines) { + if (actualLines.includes(expectedLine)) { + console.log(`Passed: Content result card 1 details: ${expectedLine} text matched as expected`); + } else { + errors.push(`Expected: "${expectedLine}" text not found in content 1 details`); + } } - console.log('Passed: Content 1 View Standards button color matched as expected'); + + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + } + }, + + //Content result card 1 description + { + description: 'Validate Content result card 1 description', + action: async () => { + const multipleChecks = 'Content result card 1 description'; + const element = await driver.findElement(By.css('.card:nth-child(8) .lo-descr')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Extract the bare text node (everything that's not a tag) + const elementTrimmedText = await driver.executeScript(` + const el = arguments[0]; + for (const node of el.childNodes) { + if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) { + return node.textContent.trim(); + } + } + return null; + `, element); + + //Track all errors + const errors = []; + + //text + if (elementTrimmedText === 'This collection page from Science NetLinks offers a selection of resources that might be useful in teaching about the 2010 Deepwater Horizon oil spill in the Gulf of Mexico. Resources include lessons on animal diversity, social trade-offs, water purification, and risk assessment as well as videos, audio podcasts, and interactive tools that relate to the oil spill, fossil fuels, oceanography, and pollution.') { + console.log('Passed: Content result card 1 description text found and matched as expected'); + } else { + errors.push(`Expected: Content result card 1 description text to contain: "This collection page from Science NetLinks offers a selection of resources that might be useful in teaching about the 2010 Deepwater Horizon oil spill in the Gulf of Mexico. Resources include lessons on animal diversity, social trade-offs, water purification, and risk assessment as well as videos, audio podcasts, and interactive tools that relate to the oil spill, fossil fuels, oceanography, and pollution."; Actual: "${elementTrimmedText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 description text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 description text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 1 description text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 description text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 1 description text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 description text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 1 Content Set + { + description: 'Validate Content result card 1 Content Set', + action: async () => { + const multipleChecks = 'Content result card 1 Content Set'; + const element = await driver.findElement(By.css('.card:nth-child(8) small')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set: Biology') { + console.log('Passed: Content result card 1 Content Set: Biology text matched as expected'); + } else { + errors.push(`Expected: Content result card 1: "Content Set: Biology"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 Content Set: Biology text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Content Set: Biology text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '10.4px') { + console.log('Passed: Content result card 1 Content Set: Biology text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Content Set: Biology text font-size "10.4px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 1 Content Set: Biology text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Content Set: Biology text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 1 Alignment Status + { + description: 'Validate Content result card 1 Alignment Status', + action: async () => { + const multipleChecks = 'Content result card 1 Alignment Status'; + const element = await driver.findElement(By.css('#alignstatuslink1162099584 > .display-alignment')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Alignment Pending (reset)') { + console.log('Passed: Content result card 1 Alignment Pending (reset) text matched as expected'); + } else { + errors.push(`Expected: Content result card 1: "Alignment Pending (reset)"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 Alignment Pending (reset) text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Alignment Pending (reset) text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 1 Alignment Pending (reset) text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Alignment Pending (reset) text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 1 Alignment Pending (reset) text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Alignment Pending (reset) text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 1 Alignment Status + { + description: 'Validate Content result card 1 Alignment Status', + action: async () => { + const multipleChecks = 'Content result card 1 Alignment Status'; + const element = await driver.findElement(By.css('#alignstatuslink1162099584 b')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'reset') { + console.log('Passed: Content result card 1 reset text matched as expected'); + } else { + errors.push(`Expected: Content result card 1: "reset"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 reset text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 reset text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 1 reset text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 reset text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 1 reset text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 reset text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 1 View Standards button + { + description: 'Validate Content result card 1 View Standards button', + action: async () => { + const multipleChecks = 'Content result card 1 View Standards button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(8) .well .fa')); + const element = await driver.findElement(By.css('.card:nth-child(8) .well > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 1 button "View Standards" icon is present'); + } else { + errors.push('Content result card 1 button "View Standards" icon was not found'); + } + + //text + if (elementText === 'View Standards') { + console.log('Passed: Content result card 1 View Standards button text matched as expected'); + } else { + errors.push(`Expected: Content result card 1 button text: "View Standards"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 View Standards button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Standards button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 1 View Standards button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Standards button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 1 View Standards button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Standards button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 1 View Standards button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Standards 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')); + } + } + }, + + //Content result card 2 title + { + description: 'Validate Content result card 2 title', + action: async () => { + const multipleChecks = 'Content result card 2 title'; + const element = await driver.findElement(By.linkText('3-variable linear system word problem x www')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === '3-variable linear system word problem x www') { + console.log('Passed: Content result card 2 title text matched as expected'); + } else { + errors.push(`Expected: Content result card 2 title: "3-variable linear system word problem x www"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 title text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 title text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 2 title text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 title text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content result card 2 title text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 title text color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //url + if (elementURL === 'https://www.khanacademy.org/math/algebra-home/alg-system-of-equations/alg-systems-with-three-variables/v/three-equation-application-problem') { + console.log('Passed: Content result card 2 URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 2 URL: "https://www.khanacademy.org/math/algebra-home/alg-system-of-equations/alg-systems-with-three-variables/v/three-equation-application-problem"; Actual: "${elementURL}"`); + } + + //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 result card 2 edit button + { + description: 'Validate Content result card 2 edit button', + action: async () => { + const multipleChecks = 'Content result card 2 edit button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(9) .lo-title .fa')); + const element = await driver.findElement(By.css('.card:nth-child(9) .ml-3')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 2 button "Edit" icon is present'); + } else { + errors.push('Content result card 2 button "Edit" icon was not found'); + } + + //text + if (elementText === 'Edit') { + console.log('Passed: Content result card 2 Edit button text matched as expected'); + } else { + errors.push(`Expected: Content result card 2 button text: "Edit"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 Edit button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Edit button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Content result card 2 Edit button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Edit button text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 2 Edit button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Edit button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 2 Edit button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Edit 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')); + } + } + }, + + //Content result card 2 thumbnail + { + description: 'Verify Content result card 2 thumbnail', + action: async () => { + const multipleChecks = 'Content result card 2 thumbnail'; + const element = await driver.wait(until.elementLocated(By.css('#pub > div:nth-child(9) > div > div > div:nth-child(1) > a')), 5000).catch(() => false); + const elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //thumbnail + if (element) { + console.log('Passed: Content result card 2 thumbnail present'); + } else { + errors.push('Content result card 2 thumbnail not found'); + } + + //url + if (elementURL === 'https://www.khanacademy.org/math/algebra-home/alg-system-of-equations/alg-systems-with-three-variables/v/three-equation-application-problem') { + console.log('Passed: Content result card 2 thumbnail URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 2 thumbnail URL: "https://www.khanacademy.org/math/algebra-home/alg-system-of-equations/alg-systems-with-three-variables/v/three-equation-application-problem"; Actual: "${elementURL}"`); + } + + //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 result card 2 View Details button + { + description: 'Validate Content result card 2 View Details button', + action: async () => { + const multipleChecks = 'Content result card 2 View Details button'; + const element = await driver.findElement(By.css('.card:nth-child(9) > .card-body > div > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'View Details') { + console.log('Passed: Content result card 2 View Details button text matched as expected'); + } else { + errors.push(`Expected: Content result card 2 button text: "View Details"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 View Details button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Details button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 2 View Details button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Details button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 2 View Details button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Details button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 2 View Details button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Details 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')); + } + } + }, + + //Content result card 2 View Details - details (SPECIAL CASE: trim text) + { + description: 'Validate Content result card 2 View Details info', + action: async () => { + const multipleChecks = 'Content result card 2 View Details info'; + + //Track all errors + const errors = []; + + //Target the specific content div using the matching onclick ID {NEED TO FIX CONTENT ID NUMBER} + const contentText = await driver.executeScript(` + const viewDetailsBtn = document.querySelector('a[onclick*="content1339323207"]'); + if (!viewDetailsBtn) return 'button not found'; + const div = viewDetailsBtn.previousElementSibling; + if (!div) return 'div not found'; + return div.innerHTML + .replace(/
/gi, '\\n') + .replace(/<[^>]+>/g, '') + .trim(); + `); + //console.log('----->| DEBUG content text:', contentText); + + const expectedLines = [ + 'Alignment Status: Not Aligned', + 'Content Type: Tutorial', + 'Descriptors: Khan, Khan Academy', + 'Format: Online Video', + 'Free or Fee: Free', + 'Grade Range: 7 to 12', + 'Language: English', + 'Learning Style: Visual', + 'Level-On Target: 9', + 'Source: Khan Academy', + 'Subject(s): Mathematics', + 'Target Audience: Student' + ]; + + const actualLines = contentText + .split('\n') + .map(line => line.trim()) + .filter(line => line !== ''); + + //console.log('----->| DEBUG actual lines:', JSON.stringify(actualLines)); + + for (const expectedLine of expectedLines) { + if (actualLines.includes(expectedLine)) { + console.log(`Passed: Content result card 2 details: ${expectedLine} text matched as expected`); + } else { + errors.push(`Expected: "${expectedLine}" text not found in content 2 details`); + } + } + + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + } + }, + + //Content result card 2 description + { + description: 'Validate Content result card 2 description', + action: async () => { + const multipleChecks = 'Content result card 2 description'; + const element = await driver.findElement(By.css('.card:nth-child(9) .lo-descr')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Extract the bare text node (everything that's not a tag) + const elementTrimmedText = await driver.executeScript(` + const el = arguments[0]; + for (const node of el.childNodes) { + if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) { + return node.textContent.trim(); + } + } + return null; + `, element); + + //Track all errors + const errors = []; + + //text + if (elementTrimmedText === 'Learn how to make the most out of the familiar algebraic techniques in order to solve systems of three equations with three variables.') { + console.log('Passed: Content result card 2 description text found and matched as expected'); + } else { + errors.push(`Expected: Content result card 2 description text to contain: "Learn how to make the most out of the familiar algebraic techniques in order to solve systems of three equations with three variables."; Actual: "${elementTrimmedText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 description text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 description text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 2 description text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 description text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 2 description text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 description text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 2 Content Set + { + description: 'Validate Content result card 2 Content Set', + action: async () => { + const multipleChecks = 'Content result card 2 Content Set'; + const element = await driver.findElement(By.css('.card:nth-child(9) small')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set: Biology') { + console.log('Passed: Content result card 2 Content Set: Biology text matched as expected'); + } else { + errors.push(`Expected: Content result card 2: "Content Set: Biology"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 Content Set: Biology text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Content Set: Biology text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '10.4px') { + console.log('Passed: Content result card 2 Content Set: Biology text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Content Set: Biology text font-size "10.4px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 2 Content Set: Biology text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Content Set: Biology text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 2 Alignment Status + { + description: 'Validate Content result card 2 Alignment Status', + action: async () => { + const multipleChecks = 'Content result card 2 Alignment Status'; + const element = await driver.findElement(By.css('#alignstatuslink1339323207 > .display-alignment')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Not Aligned') { + console.log('Passed: Content result card 2 Not Aligned text matched as expected'); + } else { + errors.push(`Expected: Content result card 2: "Not Aligned"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 Not Aligned text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Not Aligned text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 2 Not Aligned text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Not Aligned text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 2 Not Aligned text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Not Aligned text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 2 View Standards button + { + description: 'Validate Content result card 2 View Standards button', + action: async () => { + const multipleChecks = 'Content result card 2 View Standards button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(9) .well .fa')); + const element = await driver.findElement(By.css('.card:nth-child(9) .well > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 2 button "View Standards" icon is present'); + } else { + errors.push('Content result card 2 button "View Standards" icon was not found'); + } + + //text + if (elementText === 'View Standards') { + console.log('Passed: Content result card 2 View Standards button text matched as expected'); + } else { + errors.push(`Expected: Content result card 2 button text: "View Standards"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 View Standards button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Standards button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 2 View Standards button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Standards button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 2 View Standards button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Standards button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 2 View Standards button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Standards 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')); + } + } + }, + + //NEXT ACTION + { + description: 'Click 8th grade filter', + action: async () => { + await driver.findElement(By.css('#metagrades48')).click(); + console.log('----->| NEXT ACTION: Applied 8th grade filter'); + + //Wait for page to load completely + 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 until the element exists in the DOM + const filteredResultsClearLink = await driver.wait( + until.elementLocated(By.linkText('Clear')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(filteredResultsClearLink), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Biology content page did not fully load within 30 seconds'); + console.log('Passed: Biology content page loaded successfully'); } }, - //Content 2 Title + //Filter Section + + //Filtered Results title { - description: 'Validate Content 2 title', + description: 'Validate Filtered Results title', action: async () => { - const elementText = await driver.findElement(By.linkText('Abrupt Climate Change')).getText(); - if (elementText !== 'Abrupt Climate Change') { - throw new Error(`Expected: Content 1 item "Abrupt Climate Change" title; Actual: "${elementText}"`); + const multipleChecks = 'Filtered Results title'; + const element = await driver.findElement(By.css('.well > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Filter Results') { + console.log('Passed: Filtered Results title matched as expected'); + } else { + errors.push(`Expected: Title: "Filter Results"; Actual: "${elementText}"`); } - console.log('Passed: Content 1 item Abrupt Climate Change title matched as expected'); - } - }, - //Content 1 Title font size - { - description: 'Validate Content 1 item Abrupt Climate Change title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Abrupt Climate Change')).getCssValue('font-size'); - if (elementStyle !== '13px') { - throw new Error(`Expected: Content 1 item "Abrupt Climate Change" text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Content 1 item Abrupt Climate Change title text font-size matched as expected'); - } -}, - - //Content 2 edit icon - { - description: 'Verify Content 2 edit icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.card:nth-child(9) .lo-title .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Content 2 edit icon not found'); + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Filtered Results title font matched as expected'); + } else { + errors.push(`Expected: Filtered Results title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); } - console.log('Passed: Content 2 edit icon present'); - } - }, - //Content 2 edit button text - { - description: 'Validate pagination Show All button text', - action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(9) .ml-3')).getText(); - if (elementText !== 'Edit') { - throw new Error(`Expected: Content 2 "Edit" button text; Actual: "${elementText}"`); + //font size + if (elementTextSize === '13px') { + console.log('Passed: Filtered Results title font-size matched as expected'); + } else { + errors.push(`Expected: Filtered Results title font-size "13px"; Actual: "${elementTextSize}"`); } - console.log('Passed: Content 2 Edit button text matched as expected'); - } - }, - //Content 2 edit button color -green - { - description: 'Validate Content 2 Edit button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.card:nth-child(9) .ml-3')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Content 2 Edit button color did not match; Actual: "${elementStyle}"`); + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Filtered Results title color matched as expected'); + } else { + errors.push(`Expected: Filtered Results title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); } - console.log('Passed: Content 2 Edit button color matched as expected'); - } - }, - //Content 2 description - { - description: 'Validate Content 2 description', - action: async () => { - try { - const element = await driver.findElement(By.css('.card:nth-child(9) .lo-descr')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'This Science NetLinks lesson focuses on a current issue in science in order to help students understand the process by which scientific knowledge is developed and refined. In this lesson, students are introduced to some recent ideas about abrupt climate change. This gives them a glimpse into how scientific theories are formed and refined by new data.'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: "This Science NetLinks lesson focuses on a current issue..." text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: "This Science NetLinks lesson focuses on a current issue..." text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); + //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`); } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } } }, - - //Content 2 content set label + + //Content Set filtered title { - description: 'Validate Content 2 content set label', + description: 'Validate Content Set filtered title', action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(9) small')).getText(); - if (elementText !== 'Content Set: Biology - QA') { - throw new Error(`Expected: Content 2 content set label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Content Set filtered title'; + const element = await driver.findElement(By.css('.form-group:nth-child(1) > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set') { + console.log('Passed: Content Set filtered title matched as expected'); + } else { + errors.push(`Expected: Filtered title: "Content Set"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Content Set filtered title font matched as expected'); + } else { + errors.push(`Expected: Content Set filtered title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Content Set filtered title font-size matched as expected'); + } else { + errors.push(`Expected: Content Set filtered title font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content Set filtered title color matched as expected'); + } else { + errors.push(`Expected: Content Set filtered title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Content 2 content set label matched as expected'); } }, - //Content 2 alignment label + //Biology (1063) filtered label { - description: 'Validate Content 2 ECS Alignement label', + description: 'Validate Biology filtered label', action: async () => { - const elementText = await driver.findElement(By.css('#alignstatuslink873578650 > .display-alignment')).getText(); - if (elementText !== 'Alignment Pending (reset)') { - throw new Error(`Expected: Content 2 Alignement Pending label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Biology filtered label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metaorgobjectid585821587')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(1) > label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Biology filtered checkbox present'); + } else { + errors.push('Biology filtered checkbox was not found'); + } + + //text + if (elementText === 'Biology') { + console.log('Passed: Biology filtered label matched as expected'); + } else { + errors.push(`Expected: Filtered label: "Biology"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Biology filter label font matched as expected'); + } else { + errors.push(`Expected: Biology filtered label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Biology filtered label font-size matched as expected'); + } else { + errors.push(`Expected: Biology filtered label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Biology filtered label color matched as expected'); + } else { + errors.push(`Expected: Biology filtered label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Content 2 Alignement Pending label matched as expected'); } }, - //Content 2 Alignment Pending reset label + //Grade filtered title { - description: 'Validate Content 2 Alignement Pending reset label', + description: 'Validate Grade filtered title', action: async () => { - const elementText = await driver.findElement(By.css('#alignstatuslink873578650 b')).getText(); - if (elementText !== 'reset') { - throw new Error(`Expected: Content 2 Alignement Pending reset label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Grade filtered title'; + const element = await driver.findElement(By.css('b:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Grade') { + console.log('Passed: Grade filtered title matched as expected'); + } else { + errors.push(`Expected: Filtered title: "Grade"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade filtered title font matched as expected'); + } else { + errors.push(`Expected: Grade filtered title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade filtered title font-size matched as expected'); + } else { + errors.push(`Expected: Grade filtered title font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade filtered title color matched as expected'); + } else { + errors.push(`Expected: Grade filtered title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Content 2 Alignement Pending reset label matched as expected'); } }, - //Content 2 Alignment Pending reset label font size + //Clear filtered link { - description: 'Validate Content 2 Alignment Pending reset label text font size', + description: 'Validate Clear filtered link', action: async () => { - const elementStyle = await driver.findElement(By.css('#alignstatuslink873578650 b')).getCssValue('font-size'); - if (elementStyle !== '13px') { - throw new Error(`Expected: Content 2 Alignment Pending reset label text font-size did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Clear filtered link'; + const element = await driver.findElement(By.linkText('Clear')); + + //Get text, font, size, and 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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Clear') { + console.log('Passed: Clear filtered link matched as expected'); + } else { + errors.push(`Expected: Filtered link: "Clear"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Clear filtered link font matched as expected'); + } else { + errors.push(`Expected: Clear filtered link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '10.4px') { + console.log('Passed: Clear filtered link font-size matched as expected'); + } else { + errors.push(`Expected: Clear filtered link font-size "10.4px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Clear filtered link color matched as expected'); + } else { + errors.push(`Expected: Clear filtered link color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits#') { + console.log('Passed: Clear URL filtered link listed as expected'); + } else { + errors.push(`Expected: Clear URL filtered link: "https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits#"; Actual: "${elementURL}"`); + } + + //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: Content 2 Alignment Pending reset label text font-size matched as expected'); } }, - //Content 2 view standards button icon + //See All>> filtered link { - description: 'Verify Content 2 View Standards button icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.card:nth-child(9) .well .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Content 2 View Standards button icon not found'); - } - console.log('Passed: Content 2 View Standards button icon present'); - } - }, - - //Content 2 view standards button text - { - description: 'Validate Content 2 View Standards button text', + description: 'Validate See All filtered link', action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(9) .well > .btn')).getText(); - if (elementText !== 'View Standards') { - throw new Error(`Expected: Content 2 View Standards button text did not match; Actual: "${elementText}"`); + const multipleChecks = 'See All>> filtered link'; + const element = await driver.findElement(By.linkText('See All>>')); + + //Get text, font, size, and 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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'See All>>') { + console.log('Passed: See All>> filtered link matched as expected'); + } else { + errors.push(`Expected: Filtered link: "See All>>"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: See All>> filtered link font matched as expected'); + } else { + errors.push(`Expected: See All>> filtered link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: See All>> filtered link font-size matched as expected'); + } else { + errors.push(`Expected: See All>> filtered link font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: See All>> filtered link color matched as expected'); + } else { + errors.push(`Expected: See All>> filtered link color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits#facetlist_grades') { + console.log('Passed: See All>> URL filtered link listed as expected'); + } else { + errors.push(`Expected: See All>> URL filtered link: "https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits#facetlist_grades"; Actual: "${elementURL}"`); + } + + //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: Content 2 View Standards button text matched as expected'); } }, - //Content 2 view standards button color -green + //Grade 8 (1063) filtered label { - description: 'Validate Content 2 view standards button color', + description: 'Validate Grade 8 filtered label', action: async () => { - const elementStyle = await driver.findElement(By.css('.card:nth-child(9) .well > .btn')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Content 2 View Standards button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Grade 8 filtered label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metagrades48')), 5000).catch(() => false); + const element = await driver.findElement(By.css('label:nth-child(6)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Grade 8 filtered checkbox present'); + } else { + errors.push('Grade 8 filtered checkbox was not found'); + } + + //text + if (elementText === '8') { + console.log('Passed: Grade 8 filtered label matched as expected'); + } else { + errors.push(`Expected: Filtered label: "8"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade 8 filtered label font matched as expected'); + } else { + errors.push(`Expected: Grade 8 filtered label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 8 filtered label font-size matched as expected'); + } else { + errors.push(`Expected: Grade 8 filtered label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 8 filtered label color matched as expected'); + } else { + errors.push(`Expected: Grade 8 filtered label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Content 2 View Standards button color matched as expected'); } }, - //NEXT ACTION - APPLY FILTERS - { description: 'Apply 8th grade filter', action: async () => await driver.findElement(By.css('#metagrades48')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(5000) }, - - //Clear link + //Grade Y9 (1059) filter label { - description: 'Validate Clear link text', + description: 'Validate Grade Y9 filter label', action: async () => { - const elementText = await driver.findElement(By.css('small > a')).getText(); - if (elementText !== 'Clear') { - throw new Error(`Expected: "Clear" text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Grade 9 filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metagrades241201753')), 5000).catch(() => false); + const element = await driver.findElement(By.css('label:nth-child(9)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Grade Y9 filter checkbox present'); + } else { + errors.push('Grade Y9 filter checkbox was not found'); + } + + //text + if (elementText === 'Y9') { + console.log('Passed: Grade Y9 filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Y9"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade Y9 filter label font matched as expected'); + } else { + errors.push(`Expected: Grade Y9 filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade Y9 filter label font-size matched as expected'); + } else { + errors.push(`Expected: Grade Y9 filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade Y9 filter label color matched as expected'); + } else { + errors.push(`Expected: Grade Y9 filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Clear text matched as expected'); } }, + //Grade KS3 (1051) filter label + { + description: 'Validate Grade KS3 filter label', + action: async () => { + const multipleChecks = 'Grade KS3 filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metagrades74576248')), 5000).catch(() => false); + const element = await driver.findElement(By.css('label:nth-child(12)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Grade KS3 filter checkbox present'); + } else { + errors.push('Grade KS3 filter checkbox was not found'); + } + + //text + if (elementText === 'KS3') { + console.log('Passed: Grade KS3 filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "KS3"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade KS3 filter label font matched as expected'); + } else { + errors.push(`Expected: Grade KS3 filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade KS3 filter label font-size matched as expected'); + } else { + errors.push(`Expected: Grade KS3 filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade KS3 filter label color matched as expected'); + } else { + errors.push(`Expected: Grade KS3 filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Grade 7 (1226) filter label + { + description: 'Validate Grade 7 filter label', + action: async () => { + const multipleChecks = 'Grade 7 filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metagrades47')), 5000).catch(() => false); + const element = await driver.findElement(By.css('label:nth-child(15)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Grade 7 filter checkbox present'); + } else { + errors.push('Grade 7 filter checkbox was not found'); + } + + //text + if (elementText === '7') { + console.log('Passed: Grade 7 filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "7"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade 7 filter label font matched as expected'); + } else { + errors.push(`Expected: Grade 7 filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 7 filter label font-size matched as expected'); + } else { + errors.push(`Expected: Grade 7 filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 7 filter label color matched as expected'); + } else { + errors.push(`Expected: Grade 7 filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Grade Y8 (1041) filter label + { + description: 'Validate Grade Y8 filter label', + action: async () => { + const multipleChecks = 'Grade Y8 filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metagrades241201752')), 5000).catch(() => false); + const element = await driver.findElement(By.css('label:nth-child(18)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Grade Y8 filter checkbox present'); + } else { + errors.push('Grade Y8 filter checkbox was not found'); + } + + //text + if (elementText === 'Y8') { + console.log('Passed: Grade Y8 filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Y8"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade Y8 filter label font matched as expected'); + } else { + errors.push(`Expected: Grade Y8 filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade Y8 filter label font-size matched as expected'); + } else { + errors.push(`Expected: Grade Y8 filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade Y8 filter label color matched as expected'); + } else { + errors.push(`Expected: Grade Y8 filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //More>> filter link + { + description: 'Validate More filter link', + action: async () => { + const multipleChecks = 'More>> filter link'; + const element = await driver.findElement(By.linkText('More>>')); + + //Get text, font, size, and 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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'More>>') { + console.log('Passed: More>> filter link matched as expected'); + } else { + errors.push(`Expected: Filter link: "More>>"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: More>> filter link font matched as expected'); + } else { + errors.push(`Expected: More>> filter link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: More>> filter link font-size matched as expected'); + } else { + errors.push(`Expected: More>> filter link font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: More>> filter link color matched as expected'); + } else { + errors.push(`Expected: More>> filter link color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits#') { + console.log('Passed: More>> URL filter link listed as expected'); + } else { + errors.push(`Expected: More>> URL filter link: "https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits#"; Actual: "${elementURL}"`); + } + + //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')); + } + } + }, + + //Subject filter title + { + description: 'Validate Subject filter title', + action: async () => { + const multipleChecks = 'Subject filter title'; + const element = await driver.findElement(By.css('.form-group:nth-child(6) > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Subject') { + console.log('Passed: Subject filter title matched as expected'); + } else { + errors.push(`Expected: Filter title: "Subject"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Subject filter title font matched as expected'); + } else { + errors.push(`Expected: Subject filter title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Subject filter title font-size matched as expected'); + } else { + errors.push(`Expected: Subject filter title font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Subject filter title color matched as expected'); + } else { + errors.push(`Expected: Subject filter title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Science (1063) filter label + { + description: 'Validate Science filter label', + action: async () => { + const multipleChecks = 'Science filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metasubjectsScience')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(4)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Science filter checkbox present'); + } else { + errors.push('Science filter checkbox was not found'); + } + + //text + if (elementText === 'Science') { + console.log('Passed: Science filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Science"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Science filter label font matched as expected'); + } else { + errors.push(`Expected: Science filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Science filter label font-size matched as expected'); + } else { + errors.push(`Expected: Science filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Science filter label color matched as expected'); + } else { + errors.push(`Expected: Science filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Social Studies (15) filter label + { + description: 'Validate Social Studies filter label', + action: async () => { + const multipleChecks = 'Social Studies filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metasubjectsSocial\\ Studies')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(7)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Social Studies filter checkbox present'); + } else { + errors.push('Social Studies filter checkbox was not found'); + } + + //text + if (elementText === 'Social Studies') { + console.log('Passed: Social Studies filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Social Studies"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Social Studies filter label font matched as expected'); + } else { + errors.push(`Expected: Social Studies filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Social Studies filter label font-size matched as expected'); + } else { + errors.push(`Expected: Social Studies filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Social Studies filter label color matched as expected'); + } else { + errors.push(`Expected: Social Studies filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Technology Education (8) filter label + { + description: 'Validate Technology Education filter label', + action: async () => { + const multipleChecks = 'Technology Education filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metasubjectsTechnology\\ Education')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(10)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Technology Education filter checkbox present'); + } else { + errors.push('Technology Education filter checkbox was not found'); + } + + //text + if (elementText === 'Technology Education') { + console.log('Passed: Technology Education filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Technology Education"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Technology Education filter label font matched as expected'); + } else { + errors.push(`Expected: Technology Education filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Technology Education filter label font-size matched as expected'); + } else { + errors.push(`Expected: Technology Education filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Technology Education filter label color matched as expected'); + } else { + errors.push(`Expected: Technology Education filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 Status title + { + description: 'Validate Alignment Status title', + action: async () => { + const multipleChecks = 'Alignment Status title'; + const element = await driver.findElement(By.css('.form-group:nth-child(8) > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Alignment Status') { + console.log('Passed: Alignment Status title matched as expected'); + } else { + errors.push(`Expected: Title: "Alignment Status"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Alignment Status title font matched as expected'); + } else { + errors.push(`Expected: Alignment Status title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Alignment Status title font-size matched as expected'); + } else { + errors.push(`Expected: Alignment Status title font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Alignment Status title color matched as expected'); + } else { + errors.push(`Expected: Alignment Status title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Not Aligned (671) filter label + { + description: 'Validate Not Aligned filter label', + action: async () => { + const multipleChecks = 'Not Aligned filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metaAlignmentStatusNot\\ Aligned')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(8) > label:nth-child(4)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Not Aligned filter checkbox present'); + } else { + errors.push('Not Aligned filter checkbox was not found'); + } + + //text + if (elementText === 'Not Aligned') { + console.log('Passed: Not Aligned filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Not Aligned"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Not Aligned filter label font matched as expected'); + } else { + errors.push(`Expected: Not Aligned filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Not Aligned filter label font-size matched as expected'); + } else { + errors.push(`Expected: Not Aligned filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Not Aligned filter label color matched as expected'); + } else { + errors.push(`Expected: Not Aligned filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //ECS Alignment (380) filter label + { + description: 'Validate ECS Alignment filter label', + action: async () => { + const multipleChecks = 'ECS Alignment filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metaAlignmentStatusECS\\ Alignment')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(8) > label:nth-child(7)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: ECS Alignment filter checkbox present'); + } else { + errors.push('ECS Alignment filter checkbox was not found'); + } + + //text + if (elementText === 'ECS Alignment') { + console.log('Passed: ECS Alignment filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "ECS Alignment"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: ECS Alignment filter label font matched as expected'); + } else { + errors.push(`Expected: ECS Alignment filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: ECS Alignment filter label font-size matched as expected'); + } else { + errors.push(`Expected: ECS Alignment filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: ECS Alignment filter label color matched as expected'); + } else { + errors.push(`Expected: ECS Alignment filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Pending (12) filter label + { + description: 'Validate Pending filter label', + action: async () => { + const multipleChecks = 'Pending filter label'; + const elementCheckbox = await driver.wait(until.elementLocated(By.css('#metaAlignmentStatusPending')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-group:nth-child(8) > label:nth-child(10)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //checkbox + if (elementCheckbox) { + console.log('Passed: Pending filter checkbox present'); + } else { + errors.push('Pending filter checkbox was not found'); + } + + //text + if (elementText === 'Pending') { + console.log('Passed: Pending filter label matched as expected'); + } else { + errors.push(`Expected: Filter label: "Pending"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Pending filter label font matched as expected'); + } else { + errors.push(`Expected: Pending filter label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Pending filter label font-size matched as expected'); + } else { + errors.push(`Expected: Pending filter label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Pending filter label color matched as expected'); + } else { + errors.push(`Expected: Pending filter label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Reset All link + { + description: 'Validate Reset All link', + action: async () => { + const multipleChecks = 'Reset All link'; + const element = await driver.findElement(By.linkText('Reset All')); + + //Get text, font, size, and 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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Reset All') { + console.log('Passed: Reset All link matched as expected'); + } else { + errors.push(`Expected: Link: "Reset All"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Reset All link font matched as expected'); + } else { + errors.push(`Expected: Reset All link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Reset All link font-size matched as expected'); + } else { + errors.push(`Expected: Reset All link font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Reset All link color matched as expected'); + } else { + errors.push(`Expected: Reset All link color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits#') { + console.log('Passed: Reset All URL link listed as expected'); + } else { + errors.push(`Expected: Reset All URL link: "https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits#"; Actual: "${elementURL}"`); + } + + //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')); + } + } + }, + + //Page Breadcrumbs + //Home link { description: 'Validate Home link', action: async () => { - const elementText = await driver.findElement(By.linkText('Home')).getText(); - if (elementText !== 'Home') { - throw new Error(`Expected: "Home"; Actual: "${elementText}"`); + const multipleChecks = 'Home link'; + const element = await driver.findElement(By.linkText('Home')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Home') { + console.log('Passed: Home link matched as expected'); + } else { + errors.push(`Expected: Link: "Home"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Home link font matched as expected'); + } else { + errors.push(`Expected: Home link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Home link font-size matched as expected'); + } else { + errors.push(`Expected: Home link font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Home link color matched as expected'); + } else { + errors.push(`Expected: Home link color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Home link matched as expected'); } }, - //Content breadcrumb + //Content link { - description: 'Validate Content breadcrumb', + description: 'Validate Content link', action: async () => { - const elementText = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)')).getText(); - if (elementText !== 'Content') { - throw new Error(`Expected: "Content"; Actual: "${elementText}"`); + const multipleChecks = 'Content link'; + const element = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content') { + console.log('Passed: Content link matched as expected'); + } else { + errors.push(`Expected: Link: "Content"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Content link font matched as expected'); + } else { + errors.push(`Expected: Content link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Content link font-size matched as expected'); + } else { + errors.push(`Expected: Content link font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content link color matched as expected'); + } else { + errors.push(`Expected: Content link color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Content link matched as expected'); } }, - - //Content breadcrumb text color -green - { - description: 'Validate Content breadcrumb text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Content breadcrumb text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Content breadcrumb text color matched as expected'); - } - }, - + //Detail View button { - description: 'Validate Detail View button text', + description: 'Validate Detail View button', action: async () => { - const elementText = await driver.findElement(By.linkText('Detail View')).getText(); - if (elementText !== 'Detail View') { - throw new Error(`Expected: "Detail View" button text; Actual: "${elementText}"`); - } - console.log('Passed: Detail View button text matched as expected'); - } - }, + const multipleChecks = 'Detail View button'; + const element = await driver.findElement(By.linkText('Detail View')); - //Detail View button color -green - { - description: 'Validate Detail View button color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Detail View')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Detail View button color did not match; Actual: "${elementStyle}"`); + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'Detail View') { + console.log('Passed: Detail View button text matched as expected'); + } else { + errors.push(`Expected: "Detail View"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Detail View button text font matched as expected'); + } else { + errors.push(`Expected: Detail View button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Detail View button text font-size matched as expected'); + } else { + errors.push(`Expected: Detail View button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Detail View button text color matched as expected'); + } else { + errors.push(`Expected: Detail View button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Detail View button background color matched as expected'); + } else { + errors.push(`Expected: Detail View 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')); } - console.log('Passed: Detail View button color matched as expected'); } }, //Edit View button { - description: 'Validate Edit View button text', + description: 'Validate Edit View button', action: async () => { - const elementText = await driver.findElement(By.linkText('Edit View')).getText(); - if (elementText !== 'Edit View') { - throw new Error(`Expected: "Edit View" button text; Actual: "${elementText}"`); - } - console.log('Passed: Edit View button text matched as expected'); - } - }, + const multipleChecks = 'Edit View button'; + const element = await driver.findElement(By.linkText('Edit View')); - //Edit View button color -white - { - description: 'Validate Edit View button color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Edit View')).getCssValue('background-color'); - if (elementStyle !== 'rgba(248, 249, 250, 1)') { - throw new Error(`Expected: Edit View button color did not match; Actual: "${elementStyle}"`); + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'Edit View') { + console.log('Passed: Edit View button text matched as expected'); + } else { + errors.push(`Expected: "Edit View"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Edit View button text font matched as expected'); + } else { + errors.push(`Expected: Edit View button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Edit View button text font-size matched as expected'); + } else { + errors.push(`Expected: Edit View button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Edit View button text color matched as expected'); + } else { + errors.push(`Expected: Edit View button text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(248, 249, 250, 1)') { + console.log('Passed: Edit View button background color matched as expected'); + } else { + errors.push(`Expected: Edit View button background color: "rgba(248, 249, 250, 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')); } - console.log('Passed: Edit View button color matched as expected'); } }, //Save icon { - description: 'Verify Save icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.float-right > a:nth-child(1) > img')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Save icon not found'); - } - console.log('Passed: Save icon present'); - } - }, - - //Save icon tool-tip - { - description: 'Validate Save icon tool-tip', + description: 'Validate Save icon', action: async () => { - const elementStyle = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div > div.col-xs-12.col-sm-9 > div.float-right.ml-1 > a:nth-child(1)')).getAttribute('title'); - if (elementStyle !== 'Save This Search') { - throw new Error(`Expected: "Save This Search"; Actual: "${elementStyle}"`); + const multipleChecks = 'Save icon'; + const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div > div.col-xs-12.col-sm-9 > div.float-right.ml-1 > a:nth-child(1)')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Save icon present'); + } else { + errors.push('Save icon was not found'); + } + + //text + if (elementText === 'Save This Search') { + console.log('Passed: Save icon tool-tip matched as expected'); + } else { + errors.push(`Expected: Save icon tool-tip: "Save This Search"; Actual: "${elementText}"`); + } + + //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: Save This Search tool-tip matched as expected'); } }, //Print icon { - description: 'Verify Print icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.icon-link > img')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Print icon not found'); + description: 'Validate Print icon', + action: async () => { + const multipleChecks = 'Print icon'; + const element = await driver.findElement(By.css('.icon-link > img')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Print icon present'); + } else { + errors.push('Print icon was not found'); + } + + //text + if (elementText === 'Print This Page') { + console.log('Passed: Print icon tool-tip matched as expected'); + } else { + errors.push(`Expected: Print icon tool-tip: "Print This Page"; Actual: "${elementText}"`); + } + + //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: Print icon present'); } }, - //Printicon tool-tip + //Applied filter button { - description: 'Validate Print icon tool-tip', + description: 'Validate Applied filter button', action: async () => { - const elementStyle = await driver.findElement(By.css('.icon-link > img')).getAttribute('title'); - if (elementStyle !== 'Print This Page') { - throw new Error(`Expected: "Print This Page"; Actual: "${elementStyle}"`); + const multipleChecks = 'Applied filter button'; + const element = await driver.findElement(By.css('.badge')); + const elementIcon = await driver.findElement(By.css('.glyphicon')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementButtonIconColor = await elementIcon.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Grade: 8') { + console.log('Passed: Applied filter Grade: 8 button text matched as expected'); + } else { + errors.push(`Expected: Applied filter button text: "Grade: 8"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Applied filter Grade: 8 button text font matched as expected'); + } else { + errors.push(`Expected: Applied filter Grade: 8 button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '11.7px') { + console.log('Passed: Applied filter Grade: 8 button text font-size matched as expected'); + } else { + errors.push(`Expected: Applied filter Grade: 8 button text font-size "11.7px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Applied filter Grade: 8 button text color matched as expected'); + } else { + errors.push(`Expected: Applied filter Grade: 8 button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Applied filter Grade: 8 button background color matched as expected'); + } else { + errors.push(`Expected: Applied filter Grade: 8 button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`); + } + + //icon + if (elementIcon) { + console.log('Passed: Applied filter button "Grade: 8" icon is present'); + } else { + errors.push('Applied filter button "Grade: 8" icon was not found'); + } + + //icon color + if (elementButtonIconColor === 'rgba(255, 0, 0, 1)') { + console.log('Passed: Applied filter Grade: 8 icon text color matched as expected'); + } else { + errors.push(`Expected: Applied filter Grade: 8 icon text color: "rgba(255, 0, 0, 1)"; Actual: "${elementButtonIconColor}"`); + } + + //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: Print This Page tool-tip matched as expected'); } }, - - //APPLIED FILTER - //Grade8 filter button + + //Results 1 - 25 of 1063 label { - description: 'Validate Grade 8 filter button text', + description: 'Validate Results 1 - 25 of 1063 label text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.badge')).getText(); - if (elementText !== 'Grade: 8') { - throw new Error(`Expected: "Grade: 8" text did not match; Actual: "${elementText}"`); - } - console.log('Passed: Grade 8 text matched as expected'); - } - }, + const multipleChecks = 'Results 1 - 25 of 1063 label'; + const element = await driver.findElement(By.css('.float-left:nth-child(6)')); - //Grade8 filter button color -dark gray - { - description: 'Verify grade 8 filter buttion close icon color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.badge')).getCssValue('background-color'); - if (elementStyle !== 'rgba(108, 117, 125, 1)') { - throw new Error(`Expected: Grade 8 button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Grade 8 button color matched as expected'); - } - }, + //Get text, font, size, and 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'); - //Grade8 filter button close icon color -red - { - description: 'Verify grade 8 filter buttion close icon color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.glyphicon')).getCssValue('color'); - if (elementStyle !== 'rgba(255, 0, 0, 1)') { - throw new Error(`Expected: Grade 8 button close icon color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Grade 8 button close icon color matched as expected'); - } - }, + //Track all errors + const errors = []; - //Filtered esults 1-25 of 667 label - { - description: 'Validate Filtered Results 1-25 of 6676 label', - action: async () => { - const elementText = await driver.findElement(By.css('.float-left:nth-child(6)')).getText(); - if (elementText !== 'Results 1 - 25 of 667') { - throw new Error(`Expected: Filtered "Results 1 - 25 of 667" label; Actual: "${elementText}"`); + //text + if (elementText === 'Results 1 - 25 of 1063') { + console.log('Passed: Results 1 - 25 of 1063 label text matched as expected'); + } else { + errors.push(`Expected: Label: "Results 1 - 25 of 1063"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Results 1 - 25 of 10693 label font matched as expected'); + } else { + errors.push(`Expected: Results 1 - 25 of 1063 label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Results 1 - 25 of 1063 label text font-size matched as expected'); + } else { + errors.push(`Expected: Results 1 - 25 of 1063 label text font-size "132px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Results 1 - 25 of 1063 label text color matched as expected'); + } else { + errors.push(`Expected: Results 1 - 25 of 1063 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Filtered Results 1 - 25 of 667 label matched as expected'); } }, //PAGINATION BUTTONS - //Show button text + + //Show button { - description: 'Validate Show button text', + description: 'Validate Show button', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(7) #contentlimit')).getText(); - if (elementText !== 'Show') { - throw new Error(`Expected: "Show" button text; Actual: "${elementText}"`); - } - console.log('Passed: Show button text matched as expected'); - } - }, + const multipleChecks = 'Show button'; + const element = await driver.findElement(By.css('.form-group:nth-child(7) #contentlimit')); - //Show dropdown [should be: "25", option] - { - description: 'Validate Show dropdown option', - action: async () => { - const elementOption = await driver.findElement(By.css('.form-group:nth-child(7) #inputlimit')).getAttribute('value'); - if (elementOption !== '25') { - throw new Error(`Expected: "25"; Actual: "${elementOption}"`); - } - console.log('Passed: Show dropdown option matched as expected'); - } - }, + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); - //Pagination 1 button text - { - description: 'Validate pagination 1 button text', - action: async () => { - const elementText = await driver.findElement(By.linkText('1')).getText(); - if (elementText !== '1') { - throw new Error(`Expected: Pagination "1" button text; Actual: "${elementText}"`); - } - console.log('Passed: Pagination 1 button text matched as expected'); - } - }, + //Track all errors + const errors = []; - //Pagination 1 background color -green - { - description: 'Validate pagination 1 button color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('1')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Pagination 1 button color did not match; Actual: "${elementStyle}"`); + //text + if (elementText === 'Show') { + console.log('Passed: Show button text matched as expected'); + } else { + errors.push(`Expected: "Show"; Actual: "${elementText}"`); } - console.log('Passed: Pagination 1 button color matched as expected'); - } - }, - //Pagination 2 button text - { - description: 'Validate pagination 2 button text', - action: async () => { - const elementText = await driver.findElement(By.linkText('2')).getText(); - if (elementText !== '2') { - throw new Error(`Expected: Pagination "2" button text; Actual: "${elementText}"`); + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Show button text font matched as expected'); + } else { + errors.push(`Expected: Show button text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - console.log('Passed: Pagination 2 button text matched as expected'); - } - }, - //Pagination 2 text color -green - { - description: 'Validate pagination 2 text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('2')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Pagination 2 text color did not match; Actual: "${elementStyle}"`); + //font size + if (elementSize === '14px') { + console.log('Passed: Show button text font-size matched as expected'); + } else { + errors.push(`Expected: Show button text font-size "14px"; Actual: "${elementSize}"`); } - console.log('Passed: Pagination 2 text color matched as expected'); - } - }, - //Pagination 3 button text - { - description: 'Validate pagination 3 button text', - action: async () => { - const elementText = await driver.findElement(By.linkText('3')).getText(); - if (elementText !== '3') { - throw new Error(`Expected: Pagination "3" button text; Actual: "${elementText}"`); + //text color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Show button text color matched as expected'); + } else { + errors.push(`Expected: Show button text color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); } - console.log('Passed: Pagination 3 button text matched as expected'); - } - }, - //Pagination 3 text color -green - { - description: 'Validate pagination 3 text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('3')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Pagination 3 text color did not match; Actual: "${elementStyle}"`); + //button color + if (elementButtonColor === 'rgba(233, 236, 239, 1)') { + console.log('Passed: Show button background color matched as expected'); + } else { + errors.push(`Expected: Show button background color: "rgba(233, 236, 239, 1)"; Actual: "${elementButtonColor}"`); } - console.log('Passed: Pagination 3 text color matched as expected'); - } - }, - //Pagination 4 button text - { - description: 'Validate pagination 4 button text', - action: async () => { - const elementText = await driver.findElement(By.linkText('4')).getText(); - if (elementText !== '4') { - throw new Error(`Expected: Pagination "4" button text; Actual: "${elementText}"`); - } - console.log('Passed: Pagination 4 button text matched as expected'); - } - }, - - //Pagination 4 text color -green - { - description: 'Validate pagination 4 text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('4')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Pagination 4 text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Pagination 4 text color matched as expected'); - } - }, - - //Pagination 5 button text - { - description: 'Validate pagination 5 button text', - action: async () => { - const elementText = await driver.findElement(By.linkText('5')).getText(); - if (elementText !== '5') { - throw new Error(`Expected: Pagination "5" button text; Actual: "${elementText}"`); - } - console.log('Passed: Pagination 5 button text matched as expected'); - } - }, - - //Pagination 5 text color -green - { - description: 'Validate pagination 5 text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('5')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Pagination 5 text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Pagination 5 text color matched as expected'); - } - }, - - //Pagination separator icon - { - description: 'Verify Pagination separator icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.linkText('...')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Pagination separator icon not found'); - } - console.log('Passed: Pagination separator icon present'); - } - }, - - //Filtered pagination 27 button text - { - description: 'Validate Filtered pagination 27 button text', - action: async () => { - const elementText = await driver.findElement(By.linkText('27')).getText(); - if (elementText !== '27') { - throw new Error(`Expected: Filtered pagination "27" button text; Actual: "${elementText}"`); - } - console.log('Passed: FilteredpPagination 27 button text matched as expected'); - } - }, - - //Filtered pagination 27 text color -green - { - description: 'Validate pagination 27 text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('27')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Filtered pagination 27 text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Filtered pagination 27 text color matched as expected'); - } - }, - - //Pagination Show All button text - { - description: 'Validate pagination Show All button text', - action: async () => { - const elementText = await driver.findElement(By.linkText('Show All')).getText(); - if (elementText !== 'Show All') { - throw new Error(`Expected: Pagination "Show All" button text; Actual: "${elementText}"`); - } - console.log('Passed: Pagination Show All button text matched as expected'); - } - }, - - //Pagination Show All text color -green - { - description: 'Validate pagination Show All text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Show All')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Pagination Show All text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Pagination Show All text color matched as expected'); - } - }, - - //CONTENT RESULTS - CONTENT ITEMS - //Filtered Content 1 Title - { - description: 'Validate Content 1 title', - action: async () => { - const elementText = await driver.findElement(By.linkText('All Species Inventory')).getText(); - if (elementText !== 'All Species Inventory') { - throw new Error(`Expected: Filtered Content 1 item "All Species Inventory" title; Actual: "${elementText}"`); - } - console.log('Passed: Filtered Content 1 item All Species Inventory title matched as expected'); - } - }, - - //Filtered Content 1 Title font size - { - description: 'Validate Filtered Content 1 title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('All Species Inventory')).getCssValue('font-size'); - if (elementStyle !== '13px') { - throw new Error(`Expected: Filtered content 1 item "All Species Inventory" tile text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Content 1 item All Species Inventory title text font-size matched as expected'); - } - }, - - //Filtered Content 1 edit icon - { - description: 'Verify Filtered Content 1 edit icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.card:nth-child(8) .lo-title .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Filtered Content 1 edit icon not found'); - } - console.log('Passed: Filtered Content 1 edit icon present'); - } - }, - - //Filtered Content 1 edit button text - { - description: 'Validate Filtered Content 1 edit button text', - action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(8) .ml-3')).getText(); - if (elementText !== 'Edit') { - throw new Error(`Expected: Filtered Content 1 "Edit" button text; Actual: "${elementText}"`); - } - console.log('Passed: Filtered Content 1 Edit button text matched as expected'); - } - }, - - //Filtered Content 1 edit button color -green - { - description: 'Validate Filtered Content 1 Edit button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.card:nth-child(8) .ml-3')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Filtered Content 1 Edit button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Filtered Content 1 Edit button color matched as expected'); - } - }, - - //Filtered Content 1 description - { - description: 'Validate Filtered Content 1 description', - action: async () => { - try { - const element = await driver.findElement(By.css('.card:nth-child(8) .lo-descr')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = `In this Science Update, from Science NetLinks, you'll hear about how plants are gradually moving to higher altitudes to escape global warming. Science Updates are audio interviews with scientists and are accompanied by a set of questions as well as links to related Science NetLinks lessons and other related resources.`; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: "In this Science Update, from Science NetLinks, you'll hear..." text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: "In this Science Update, from Science NetLinks, you'll hear..." text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); + //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`); } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } } }, - //Filtered Content 1 content set label + //Show dropdown { - description: 'Validate Filtered Content 1 content set label', + description: 'Validate Show dropdown', action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(8) small')).getText(); - if (elementText !== 'Content Set: Biology - QA') { - throw new Error(`Expected: Filtered Content 1 content set label did not match; Actual: "${elementText}"`); - } - console.log('Passed: Filtered Content 1 content set label matched as expected'); - } - }, + const multipleChecks = 'Show dropdown'; + const element = await driver.findElement(By.css('.form-group:nth-child(7) #inputlimit')); - //Filtered Content 1 alignment label - { - description: 'Validate Filtered Content 1 Alignment Pending label', - action: async () => { - const elementText = await driver.findElement(By.css('#alignstatuslink873578654 > .display-alignment')).getText(); - if (elementText !== 'Alignment Pending (reset)') { - throw new Error(`Expected: Filtered Content 1 Alignment Pending label did not match; Actual: "${elementText}"`); - } - console.log('Passed: Filtered Content 1 Alignment Pending label matched as expected'); - } - }, + //Get text, font, color, and size + const elementText = await element.getAttribute('value'); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); - //Filtered Content 1 alignment reset label - { - description: 'Validate Filtered Content 1 Alignment Pending reset label', - action: async () => { - const elementText = await driver.findElement(By.css('#alignstatuslink873578654 b')).getText(); - if (elementText !== 'reset') { - throw new Error(`Expected: Filtered Content 1 Alignment Pending reset label did not match; Actual: "${elementText}"`); - } - console.log('Passed: Filtered Content 1 Alignment Pending reset label matched as expected'); - } - }, + //Track all errors + const errors = []; - //Filtered Content 1 Title font size - { - description: 'Validate Filtered Content 1 title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#alignstatuslink873578654 b')).getCssValue('font-size'); - if (elementStyle !== '13px') { - throw new Error(`Expected: Filtered content 1 item "All Species Inventory" reset link text font-size did not match; Actual: "${elementStyle}"`); + //text + if (elementText === '25') { + console.log('Passed: Show dropdown default text matched as expected'); + } else { + errors.push(`Expected: Show dropdown default: "25"; Actual: "${elementText}"`); } - console.log('Passed: Content 1 item All Species Inventory reset link text font-size matched as expected'); - } - }, - //Filtered Content 1 view standards button icon - { - description: 'Verify Content 1 View Standards button icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.card:nth-child(8) .well .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Content 1 View Standards button icon not found'); + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Show dropdown text font matched as expected'); + } else { + errors.push(`Expected: Show dropdown text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - console.log('Passed: Content 1 View Standards button icon present'); - } - }, - //Filtered Content 1 view standards button text - { - description: 'Validate Content 1 View Standards button text', - action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(8) .well > .btn')).getText(); - if (elementText !== 'View Standards') { - throw new Error(`Expected: Content 1 View Standards button text did not match; Actual: "${elementText}"`); + //font size + if (elementSize === '14px') { + console.log('Passed: Show dropdown text font-size matched as expected'); + } else { + errors.push(`Expected: Show dropdown text font-size "14px"; Actual: "${elementSize}"`); } - console.log('Passed: Content 1 View Standards button text matched as expected'); - } - }, - //Filtered Content 1 view standards button color -green - { - description: 'Validate Content 1 view standards button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.card:nth-child(8) .well > .btn')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Content 1 View Standards button color did not match; Actual: "${elementStyle}"`); + //text color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Show dropdown text color matched as expected'); + } else { + errors.push(`Expected: Show dropdown text color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); } - console.log('Passed: Content 1 View Standards button color matched as expected'); - } - }, - - //Filtered Content 2 Title - { - description: 'Validate Filtered Content 2 title', - action: async () => { - const elementText = await driver.findElement(By.linkText('Altered Elephant Behavior')).getText(); - if (elementText !== 'Altered Elephant Behavior') { - throw new Error(`Expected: Filtered Content 2 item "Altered Elephant Behavior" title; Actual: "${elementText}"`); - } - console.log('Passed: Filtered Content 2 item Altered Elephant Behavior title matched as expected'); - } - }, - //Filtered Content 2 Title font size - { - description: 'Validate Filtered Content 2 title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Altered Elephant Behavior')).getCssValue('font-size'); - if (elementStyle !== '13px') { - throw new Error(`Expected: Filtered content 2 item "Altered Elephant Behavior" tile text font-size did not match; Actual: "${elementStyle}"`); + //button color + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Show dropdown background color matched as expected'); + } else { + errors.push(`Expected: Show dropdown background color: "rgba(255, 255, 255, 1)"; Actual: "${elementButtonColor}"`); } - console.log('Passed: Content 2 item Altered Elephant Behavior title text font-size matched as expected'); - } - }, - //Filtered Content 2 edit icon - { - description: 'Verify Content 2 edit icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.card:nth-child(9) .lo-title .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Content 2 edit icon not found'); - } - console.log('Passed: Content 2 edit icon present'); - } - }, - - //Filtered Content 2 edit button text - { - description: 'Validate pagination Show All button text', - action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(9) .ml-3')).getText(); - if (elementText !== 'Edit') { - throw new Error(`Expected: Content 2 "Edit" button text; Actual: "${elementText}"`); - } - console.log('Passed: Content 2 Edit button text matched as expected'); - } - }, - - //Filtered Content 2 edit button color -green - { - description: 'Validate Content 2 Edit button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.card:nth-child(9) .ml-3')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Content 2 Edit button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Content 2 Edit button color matched as expected'); - } - }, - - //Filtered Content 2 description - { - description: 'Validate Filtered Content 2 description', - action: async () => { - try { - const element = await driver.findElement(By.css('.card:nth-child(2) .lo-descr')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'Poaching is causing alarming changes in the behavior of African elephants.'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); + //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`); } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } } }, - //Filtered Content 2 content set label + //Pagination 1 button { - description: 'Validate Filtered Content 2 content set label', + description: 'Validate Pagination 1 button', action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(2) small')).getText(); - if (elementText !== 'Content Set: Biology - QA') { - throw new Error(`Expected: Filtered Content 2 content set label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Pagination 1 button'; + const element = await driver.findElement(By.linkText('1')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === '1') { + console.log('Passed: Pagination button 1 text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "1"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button 1 text font matched as expected'); + } else { + errors.push(`Expected: Pagination button 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button 1 text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button 1 text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button 1 text color matched as expected'); + } else { + errors.push(`Expected: Pagination button 1 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button 1 background color matched as expected'); + } else { + errors.push(`Expected: Pagination button 1 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')); } - console.log('Passed: Filtered Content 2 content set label matched as expected'); } }, - //Filtered Content 2 Not Aligned label (previously: ECS alignment - reset) + //Pagination 2 button { - description: 'Validate Filtered Content 2 Not Aligned label', + description: 'Validate Pagination 2 button', action: async () => { - const elementText = await driver.findElement(By.css('#alignstatuslink873578655 > .display-alignment')).getText(); - if (elementText !== 'Not Aligned') { - throw new Error(`Expected: Filtered Content 2 "Not Aligned" label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Pagination 2 button'; + const element = await driver.findElement(By.linkText('2')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === '2') { + console.log('Passed: Pagination button 2 text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "2"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button 2 text font matched as expected'); + } else { + errors.push(`Expected: Pagination button 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button 2 text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button 2 text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button 2 text color matched as expected'); + } else { + errors.push(`Expected: Pagination button 2 text color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button 2 background color matched as expected'); + } else { + errors.push(`Expected: Pagination button 2 background color: "rgba(255, 255, 255, 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')); } - console.log('Passed: Filtered Content 2 Not Aligned label matched as expected'); } }, - //Filtered Content 2 view standards button icon + //Pagination 3 button { - description: 'Verify Content 2 View Standards button icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.card:nth-child(9) .well .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Content 2 View Standards button icon not found'); - } - console.log('Passed: Content 2 View Standards button icon present'); - } - }, - - //Filtered Content 2 view standards button text - { - description: 'Validate Content 2 View Standards button text', + description: 'Validate Pagination 3 button', action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(9) .well > .btn')).getText(); - if (elementText !== 'View Standards') { - throw new Error(`Expected: Content 2 View Standards button text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Pagination 3 button'; + const element = await driver.findElement(By.linkText('3')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === '3') { + console.log('Passed: Pagination button 3 text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "3"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button 3 text font matched as expected'); + } else { + errors.push(`Expected: Pagination button 3 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button 3 text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button 3 text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button 3 text color matched as expected'); + } else { + errors.push(`Expected: Pagination button 3 text color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button 3 background color matched as expected'); + } else { + errors.push(`Expected: Pagination button 3 background color: "rgba(255, 255, 255, 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')); } - console.log('Passed: Content 2 View Standards button text matched as expected'); } }, - //Filtered Content 2 view standards button color -green + //Pagination 4 button { - description: 'Validate Content 2 view standards button color', + description: 'Validate Pagination 4 button', action: async () => { - const elementStyle = await driver.findElement(By.css('.card:nth-child(9) .well > .btn')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Content 2 View Standards button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Pagination 4 button'; + const element = await driver.findElement(By.linkText('4')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === '4') { + console.log('Passed: Pagination button 4 text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "4"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button 4 text font matched as expected'); + } else { + errors.push(`Expected: Pagination button 4 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button 4 text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button 4 text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button 4 text color matched as expected'); + } else { + errors.push(`Expected: Pagination button 4 text color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button 4 background color matched as expected'); + } else { + errors.push(`Expected: Pagination button 4 background color: "rgba(255, 255, 255, 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')); } - console.log('Passed: Content 2 View Standards button color matched as expected'); } }, - //NEXT ACTION - VIEW EDIT MODE - { description: 'Click Edit View button', action: async () => await driver.findElement(By.linkText('Edit View')).click() }, + //Pagination 5 button + { + description: 'Validate Pagination 5 button', + action: async () => { + const multipleChecks = 'Pagination 5 button'; + const element = await driver.findElement(By.linkText('5')); - //Wait for page to load - Correlation Coverages View Details button + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === '5') { + console.log('Passed: Pagination button 5 text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "5"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button 5 text font matched as expected'); + } else { + errors.push(`Expected: Pagination button 5 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button 5 text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button 5 text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color | automation issue + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button 5 text color matched as expected'); + } else { + errors.push(`Expected: Pagination button 5 text color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //button color | automation issue + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button 5 background color matched as expected'); + } else { + errors.push(`Expected: Pagination button 5 background color: "rgba(255, 255, 255, 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')); + } + } + }, + + //Pagination separator + { + description: 'Verify Pagination separator is present', + action: async () => { + const element = await driver.wait(until.elementLocated(By.linkText('...')), 5000).catch(() => false); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Pagination separator icon present'); + } else { + errors.push('Pagination separater icon not found'); + } + } + }, + + //Pagination 43 button + { + description: 'Validate Pagination 43 button', + action: async () => { + const multipleChecks = 'Pagination 43 button'; + const element = await driver.findElement(By.linkText('43')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === '43') { + console.log('Passed: Pagination button 43 text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "43"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button 43 text font matched as expected'); + } else { + errors.push(`Expected: Pagination button 43 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button 43 text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button 43 text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button 43 text color matched as expected'); + } else { + errors.push(`Expected: Pagination button 43 text color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button 43 background color matched as expected'); + } else { + errors.push(`Expected: Pagination button 43 background color: "rgba(255, 255, 255, 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')); + } + } + }, + + //Pagination Show All button + { + description: 'Validate Pagination Show All button', + action: async () => { + const multipleChecks = 'Pagination Show All button'; + const element = await driver.findElement(By.linkText('Show All')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'Show All') { + console.log('Passed: Pagination button Show All text matched as expected'); + } else { + errors.push(`Expected: Pagination button: "Show All"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Pagination button Show All text font matched as expected'); + } else { + errors.push(`Expected: Pagination button Show All text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Pagination button Show All text font-size matched as expected'); + } else { + errors.push(`Expected: Pagination button Show All text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Pagination button Show All text color matched as expected'); + } else { + errors.push(`Expected: Pagination button Show All text color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Pagination button Show All background color matched as expected'); + } else { + errors.push(`Expected: Pagination button Show All background color: "rgba(255, 255, 255, 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')); + } + } + }, + + //Content result card 1 title + { + description: 'Validate Content result card 1 title', + action: async () => { + const multipleChecks = 'Content result card 1 title'; + const element = await driver.findElement(By.linkText('2010 Gulf of Mexico Oil Spills')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === '2010 Gulf of Mexico Oil Spills') { + console.log('Passed: Content result card 1 title text matched as expected'); + } else { + errors.push(`Expected: Content result card 1 title: "2010 Gulf of Mexico Oil Spills"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 title text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 title text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 1 title text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 title text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content result card 1 title text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 title text color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/click.php?iItemId=1162099584') { + console.log('Passed: Content result card 1 URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 1 URL: "https://correlation.edgate.com/exact/click.php?iItemId=1162099584"; Actual: "${elementURL}"`); + } + + //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 result card 1 edit button + { + description: 'Validate Content result card 1 edit button', + action: async () => { + const multipleChecks = 'Content result card 1 edit button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(8) .lo-title .fa')); + const element = await driver.findElement(By.css('.card:nth-child(8) .ml-3')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 1 button "Edit" icon is present'); + } else { + errors.push('Content result card 1 button "Edit" icon was not found'); + } + + //text + if (elementText === 'Edit') { + console.log('Passed: Content result card 1 Edit button text matched as expected'); + } else { + errors.push(`Expected: Content result card 1 button text: "Edit"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 Edit button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Edit button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Content result card 1 Edit button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Edit button text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 1 Edit button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Edit button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 1 Edit button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Edit 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')); + } + } + }, + + //Content result card 1 thumbnail + { + description: 'Verify Content result card 1 thumbnail', + action: async () => { + const multipleChecks = 'Content result card 1 thumbnail'; + const element = await driver.wait(until.elementLocated(By.css('#pub > div:nth-child(9) > div:nth-child(1) > div > div > div:nth-child(1) > a')), 5000).catch(() => false); + const elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //thumbnail + if (element) { + console.log('Passed: Content result card 1 thumbnail present'); + } else { + errors.push('Content result card 1 thumbnail not found'); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/click.php?iItemId=1162099584') { + console.log('Passed: Content result card 1 thumbnail URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 1 thumbnail URL: "https://correlation.edgate.com/exact/click.php?iItemId=1162099584"; Actual: "${elementURL}"`); + } + + //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 result card 1 View Details button + { + description: 'Validate Content result card 1 View Details button', + action: async () => { + const multipleChecks = 'Content result card 1 View Details button'; + const element = await driver.findElement(By.css('.card:nth-child(8) > .card-body > div > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'View Details') { + console.log('Passed: Content result card 1 View Details button text matched as expected'); + } else { + errors.push(`Expected: Content result card 1 button text: "View Details"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 View Details button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Details button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 1 View Details button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Details button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 1 View Details button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Details button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 1 View Details button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Details 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')); + } + } + }, + + //Content result card 1 View Details - details (SPECIAL CASE: trim text) + { + description: 'Validate Content result card 1 View Details info', + action: async () => { + const multipleChecks = 'Content result card 1 View Details info'; + + //Track all errors + const errors = []; + + //Target the specific content div using the matching onclick ID + const contentText = await driver.executeScript(` + const viewDetailsBtn = document.querySelector('a[onclick*="content1162099584"]'); + if (!viewDetailsBtn) return 'button not found'; + const div = viewDetailsBtn.previousElementSibling; + if (!div) return 'div not found'; + return div.innerHTML + .replace(/
/gi, '\\n') + .replace(/<[^>]+>/g, '') + .trim(); + `); + //console.log('----->| DEBUG content text:', contentText); + + const expectedLines = [ + 'Alignment Status: Pending', + 'Content Type: Lesson Plan', + 'Format: HTML', + 'Free or Fee: Free', + 'Grade Range: K to 12', + 'Language: English', + 'Level-On Target: K', + 'Source: Science NetLinks', + 'Subject(s): Science', + 'Target Audience: Teacher' + ]; + + const actualLines = contentText + .split('\n') + .map(line => line.trim()) + .filter(line => line !== ''); + + //console.log('----->| DEBUG actual lines:', JSON.stringify(actualLines)); + + for (const expectedLine of expectedLines) { + if (actualLines.includes(expectedLine)) { + console.log(`Passed: Content result card 1 details: ${expectedLine} text matched as expected`); + } else { + errors.push(`Expected: "${expectedLine}" text not found in content 1 details`); + } + } + + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + } + }, + + //Content result card 1 description + { + description: 'Validate Content result card 1 description', + action: async () => { + const multipleChecks = 'Content result card 1 description'; + const element = await driver.findElement(By.css('.card:nth-child(1) .lo-descr')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Extract the bare text node (everything that's not a tag) + const elementTrimmedText = await driver.executeScript(` + const el = arguments[0]; + for (const node of el.childNodes) { + if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) { + return node.textContent.trim(); + } + } + return null; + `, element); + + //Track all errors + const errors = []; + + //text + if (elementTrimmedText === 'This collection page from Science NetLinks offers a selection of resources that might be useful in teaching about the 2010 Deepwater Horizon oil spill in the Gulf of Mexico. Resources include lessons on animal diversity, social trade-offs, water purification, and risk assessment as well as videos, audio podcasts, and interactive tools that relate to the oil spill, fossil fuels, oceanography, and pollution.') { + console.log('Passed: Content result card 1 description text found and matched as expected'); + } else { + errors.push(`Expected: Content result card 1 description text to contain: "This collection page from Science NetLinks offers a selection of resources that might be useful in teaching about the 2010 Deepwater Horizon oil spill in the Gulf of Mexico. Resources include lessons on animal diversity, social trade-offs, water purification, and risk assessment as well as videos, audio podcasts, and interactive tools that relate to the oil spill, fossil fuels, oceanography, and pollution."; Actual: "${elementTrimmedText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 description text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 description text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 1 description text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 description text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 1 description text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 description text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 1 Content Set + { + description: 'Validate Content result card 1 Content Set', + action: async () => { + const multipleChecks = 'Content result card 1 Content Set'; + const element = await driver.findElement(By.css('.card:nth-child(8) small')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set: Biology') { + console.log('Passed: Content result card 1 Content Set: Biology text matched as expected'); + } else { + errors.push(`Expected: Content result card 1: "Content Set: Biology"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 Content Set: Biology text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Content Set: Biology text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '10.4px') { + console.log('Passed: Content result card 1 Content Set: Biology text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Content Set: Biology text font-size "10.4px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 1 Content Set: Biology text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Content Set: Biology text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 1 Alignment Status + { + description: 'Validate Content result card 1 Alignment Status', + action: async () => { + const multipleChecks = 'Content result card 1 Alignment Status'; + const element = await driver.findElement(By.css('#alignstatuslink1162099584 > .display-alignment')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Alignment Pending (reset)') { + console.log('Passed: Content result card 1 Alignment Pending (reset) text matched as expected'); + } else { + errors.push(`Expected: Content result card 1: "Alignment Pending (reset)"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 Alignment Pending (reset) text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Alignment Pending (reset) text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 1 Alignment Pending (reset) text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Alignment Pending (reset) text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 1 Alignment Pending (reset) text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Alignment Pending (reset) text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 1 Alignment Status + { + description: 'Validate Content result card 1 Alignment Status', + action: async () => { + const multipleChecks = 'Content result card 1 Alignment Status'; + const element = await driver.findElement(By.css('#alignstatuslink1162099584 b')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'reset') { + console.log('Passed: Content result card 1 reset text matched as expected'); + } else { + errors.push(`Expected: Content result card 1: "reset"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 reset text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 reset text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 1 reset text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 reset text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 1 reset text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 reset text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 1 View Standards button + { + description: 'Validate Content result card 1 View Standards button', + action: async () => { + const multipleChecks = 'Content result card 1 View Standards button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(8) .well .fa')); + const element = await driver.findElement(By.css('.card:nth-child(8) .well > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 1 button "View Standards" icon is present'); + } else { + errors.push('Content result card 1 button "View Standards" icon was not found'); + } + + //text + if (elementText === 'View Standards') { + console.log('Passed: Content result card 1 View Standards button text matched as expected'); + } else { + errors.push(`Expected: Content result card 1 button text: "View Standards"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 View Standards button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Standards button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 1 View Standards button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Standards button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 1 View Standards button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Standards button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 1 View Standards button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Standards 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')); + } + } + }, + + //Content result card 2 title + { + description: 'Validate Content result card 2 title', + action: async () => { + const multipleChecks = 'Content result card 2 title'; + const element = await driver.findElement(By.linkText('A Geologic History of Earth')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'A Geologic History of Earth') { + console.log('Passed: Content result card 2 title text matched as expected'); + } else { + errors.push(`Expected: Content result card 2 title: "A Geologic History of Earth"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 title text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 title text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 2 title text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 title text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content result card 2 title text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 title text color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/click.php?iItemId=1215718830') { + console.log('Passed: Content result card 2 URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 2 URL: "https://correlation.edgate.com/exact/click.php?iItemId=1215718830"; Actual: "${elementURL}"`); + } + + //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 result card 2 edit button + { + description: 'Validate Content result card 2 edit button', + action: async () => { + const multipleChecks = 'Content result card 2 edit button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(2) .lo-title .fa')); + const element = await driver.findElement(By.css('.card:nth-child(2) .ml-3')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 2 button "Edit" icon is present'); + } else { + errors.push('Content result card 2 button "Edit" icon was not found'); + } + + //text + if (elementText === 'Edit') { + console.log('Passed: Content result card 2 Edit button text matched as expected'); + } else { + errors.push(`Expected: Content result card 2 button text: "Edit"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 Edit button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Edit button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Content result card 2 Edit button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Edit button text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 2 Edit button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Edit button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 2 Edit button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Edit 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')); + } + } + }, + + //Content result card 2 thumbnail + { + description: 'Verify Content result card 2 thumbnail', + action: async () => { + const multipleChecks = 'Content result card 2 thumbnail'; + const element = await driver.wait(until.elementLocated(By.css('#pub > div:nth-child(9) > div:nth-child(2) > div > div > div:nth-child(1) > a')), 5000).catch(() => false); + const elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //thumbnail + if (element) { + console.log('Passed: Content result card 2 thumbnail present'); + } else { + errors.push('Content result card 2 thumbnail not found'); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/click.php?iItemId=1215718830') { + console.log('Passed: Content result card 2 thumbnail URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 2 thumbnail URL: "https://correlation.edgate.com/exact/click.php?iItemId=1215718830"; Actual: "${elementURL}"`); + } + + //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 result card 2 View Details button + { + description: 'Validate Content result card 2 View Details button', + action: async () => { + const multipleChecks = 'Content result card 2 View Details button'; + const element = await driver.findElement(By.css('.card:nth-child(2) > .card-body > div > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'View Details') { + console.log('Passed: Content result card 2 View Details button text matched as expected'); + } else { + errors.push(`Expected: Content result card 2 button text: "View Details"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 View Details button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Details button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 2 View Details button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Details button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 2 View Details button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Details button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 2 View Details button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Details 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')); + } + } + }, + + //Content result card 2 View Details - details (SPECIAL CASE: trim text) + { + description: 'Validate Content result card 2 View Details info', + action: async () => { + const multipleChecks = 'Content result card 2 View Details info'; + + //Track all errors + const errors = []; + + //Target the specific content div using the matching onclick ID + const contentText = await driver.executeScript(` + const viewDetailsBtn = document.querySelector('a[onclick*="content1215718830"]'); + if (!viewDetailsBtn) return 'button not found'; + const div = viewDetailsBtn.previousElementSibling; + if (!div) return 'div not found'; + return div.innerHTML + .replace(/
/gi, '\\n') + .replace(/<[^>]+>/g, '') + .trim(); + `); + //console.log('----->| DEBUG content text:', contentText); + + const expectedLines = [ + 'Alignment Status: Pending' + ]; + + const actualLines = contentText + .split('\n') + .map(line => line.trim()) + .filter(line => line !== ''); + + //console.log('----->| DEBUG actual lines:', JSON.stringify(actualLines)); + + for (const expectedLine of expectedLines) { + if (actualLines.includes(expectedLine)) { + console.log(`Passed: Content result card 2 details: ${expectedLine} text matched as expected`); + } else { + errors.push(`Expected: "${expectedLine}" text not found in content 2 details`); + } + } + + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + } + }, + + //Content result card 2 description + { + description: 'Validate Content result card 2 description', + action: async () => { + const multipleChecks = 'Content result card 2 description'; + const element = await driver.findElement(By.css('.card:nth-child(2) .lo-descr')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Extract the bare text node (everything that's not a tag) + const elementTrimmedText = await driver.executeScript(` + const el = arguments[0]; + for (const node of el.childNodes) { + if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) { + return node.textContent.trim(); + } + } + return null; + `, element); + + //Track all errors + const errors = []; + + //text + if (elementTrimmedText === 'It began as the controversial theory of continental drift - the idea that the continents we know on earth today were not always in the positions they are in now. In the last century, scientists have been able to probe the earth as never before, revealing surprising evidence that has led wide support to what is now generally known as Plate Tectonics.') { + console.log('Passed: Content result card 2 description text found and matched as expected'); + } else { + errors.push(`Expected: Content result card 2 description text to contain: "It began as the controversial theory of continental drift - the idea that the continents we know on earth today were not always in the positions they are in now. In the last century, scientists have been able to probe the earth as never before, revealing surprising evidence that has led wide support to what is now generally known as Plate Tectonics."; Actual: "${elementTrimmedText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 description text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 description text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 2 description text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 description text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 2 description text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 description text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 2 Content Set + { + description: 'Validate Content result card 2 Content Set', + action: async () => { + const multipleChecks = 'Content result card 2 Content Set'; + const element = await driver.findElement(By.css('.card:nth-child(9) small')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set: Biology') { + console.log('Passed: Content result card 2 Content Set: Biology text matched as expected'); + } else { + errors.push(`Expected: Content result card 2: "Content Set: Biology"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 Content Set: Biology text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Content Set: Biology text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '10.4px') { + console.log('Passed: Content result card 2 Content Set: Biology text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Content Set: Biology text font-size "10.4px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 2 Content Set: Biology text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Content Set: Biology text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 2 Alignment Status + { + description: 'Validate Content result card 2 Alignment Status', + action: async () => { + const multipleChecks = 'Content result card 2 Alignment Status'; + const element = await driver.findElement(By.css('#alignstatuslink1162099584 > .display-alignment')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Alignment Pending (reset)') { + console.log('Passed: Content result card 2 Alignment Pending (reset) text matched as expected'); + } else { + errors.push(`Expected: Content result card 2: "Alignment Pending (reset)"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 Alignment Pending (reset) text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Alignment Pending (reset) text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 2 Alignment Pending (reset) text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Alignment Pending (reset) text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 2 Alignment Pending (reset) text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Alignment Pending (reset) text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 2 Alignment Status + { + description: 'Validate Content result card 2 Alignment Status', + action: async () => { + const multipleChecks = 'Content result card 2 Alignment Status'; + const element = await driver.findElement(By.css('#alignstatuslink1162099584 b')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'reset') { + console.log('Passed: Content result card 2 reset text matched as expected'); + } else { + errors.push(`Expected: Content result card 2: "reset"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 reset text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 reset text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 2 reset text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 reset text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 2 reset text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 reset text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 2 View Standards button + { + description: 'Validate Content result card 2 View Standards button', + action: async () => { + const multipleChecks = 'Content result card 2 View Standards button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(9) .well .fa')); + const element = await driver.findElement(By.css('.card:nth-child(9) .well > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 2 button "View Standards" icon is present'); + } else { + errors.push('Content result card 2 button "View Standards" icon was not found'); + } + + //text + if (elementText === 'View Standards') { + console.log('Passed: Content result card 2 View Standards button text matched as expected'); + } else { + errors.push(`Expected: Content result card 2 button text: "View Standards"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 View Standards button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Standards button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 2 View Standards button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Standards button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 2 View Standards button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Standards button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 2 View Standards button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Standards 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')); + } + } + }, + + //NEXT ACTION { - description: 'Wait for Actions button to load', + description: 'Click Technology Education filter', action: async () => { - return await driver.wait(until.elementLocated(By.linkText('Actions')), 10000).catch(() => false); + await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(10)')).click(); + console.log('----->| NEXT ACTION: Applied Technology Education subject filter'); + + //Wait for page to load completely + 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 until the element exists in the DOM + const filteredResultsClearLink = await driver.wait( + until.elementLocated(By.css('.form-group:nth-child(6) > small > a')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(filteredResultsClearLink), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Biology content page did not fully load within 30 seconds'); + console.log('Passed: Biology content page loaded successfully'); } }, - //Detail View button + //Applied filter button { - description: 'Validate Detail View button text', + description: 'Validate Applied filter button', action: async () => { - const elementText = await driver.findElement(By.linkText('Detail View')).getText(); - if (elementText !== 'Detail View') { - throw new Error(`Expected: "Detail View" button text; Actual: "${elementText}"`); + const multipleChecks = 'Applied filter button'; + const element = await driver.findElement(By.css('.badge:nth-child(4)')); + const elementIcon = await driver.findElement(By.css('.badge:nth-child(4) .glyphicon')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementButtonIconColor = await elementIcon.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Subject: Technology Education') { + console.log('Passed: Applied filter Grade: Technology Education button text matched as expected'); + } else { + errors.push(`Expected: Applied filter button text: "Grade: Technology Education"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Applied filter Grade: Technology Education button text font matched as expected'); + } else { + errors.push(`Expected: Applied filter Grade: Technology Education button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '11.7px') { + console.log('Passed: Applied filter Grade: Technology Education button text font-size matched as expected'); + } else { + errors.push(`Expected: Applied filter Grade: Technology Education button text font-size "11.7px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Applied filter Grade: Technology Education button text color matched as expected'); + } else { + errors.push(`Expected: Applied filter Grade: Technology Education button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Applied filter Grade: Technology Education button background color matched as expected'); + } else { + errors.push(`Expected: Applied filter Grade: Technology Education button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`); + } + + //icon + if (elementIcon) { + console.log('Passed: Applied filter button "Grade: Technology Education" icon is present'); + } else { + errors.push('Applied filter button "Grade: Technology Education" icon was not found'); + } + + //icon color + if (elementButtonIconColor === 'rgba(255, 0, 0, 1)') { + console.log('Passed: Applied filter Grade: Technology Education icon text color matched as expected'); + } else { + errors.push(`Expected: Applied filter Grade: Technology Education icon text color: "rgba(255, 0, 0, 1)"; Actual: "${elementButtonIconColor}"`); + } + + //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: Detail View button text matched as expected'); } }, - //Detail View button color -white + //Results 1 - 8 of 8 label { - description: 'Validate Detail View button color', + description: 'Validate Results 1 - 8 of 8 label text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.linkText('Detail View')).getCssValue('background-color'); - if (elementStyle !== 'rgba(248, 249, 250, 1)') { - throw new Error(`Expected: Detail View button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Results 1 - 8 of 8 label'; + const element = await driver.findElement(By.css('.float-left:nth-child(7)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Results 1 - 8 of 8') { + console.log('Passed: Results 1 - 8 label text matched as expected'); + } else { + errors.push(`Expected: Label: "Results 1 - 8 of 8"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Results 1 - 8 of 8 label font matched as expected'); + } else { + errors.push(`Expected: Results 1 - 8 of 8 label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Results 1 - 8 of 8 label text font-size matched as expected'); + } else { + errors.push(`Expected: Results 1 - 8 of 8 label text font-size "132px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Results 1 - 8 of 8 label text color matched as expected'); + } else { + errors.push(`Expected: Results 1 - 8 of 8 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Detail View button color matched as expected'); } }, - //Edit View button + //Content result card 1 title { - description: 'Validate Edit View button text', + description: 'Validate Content result card 1 title', action: async () => { - const elementText = await driver.findElement(By.linkText('Edit View')).getText(); - if (elementText !== 'Edit View') { - throw new Error(`Expected: "Edit View" button text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 1 title'; + const element = await driver.findElement(By.linkText(`Computer Science Discoveries ('21 -'22)`)); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === `Computer Science Discoveries ('21 -'22)`) { + console.log('Passed: Content result card 1 title text matched as expected'); + } else { + errors.push(`Expected: Content result card 1 title: "Computer Science Discoveries ('21 -'22)"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 title text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 title text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 1 title text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 title text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content result card 1 title text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 title text color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/click.php?iItemId=1215718916') { + console.log('Passed: Content result card 1 URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 1 URL: "https://correlation.edgate.com/exact/click.php?iItemId=1215718916"; Actual: "${elementURL}"`); + } + + //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: Edit View button text matched as expected'); } }, - //Edit View button color -dark blue + //Content result card 1 edit button { - description: 'Validate Edit View button color', + description: 'Validate Content result card 1 edit button', action: async () => { - const elementStyle = await driver.findElement(By.linkText('Edit View')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Edit View button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Content result card 1 edit button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(1) .lo-title .fa')); + const element = await driver.findElement(By.css('.card:nth-child(1) .ml-3')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 1 button "Edit" icon is present'); + } else { + errors.push('Content result card 1 button "Edit" icon was not found'); + } + + //text + if (elementText === 'Edit') { + console.log('Passed: Content result card 1 Edit button text matched as expected'); + } else { + errors.push(`Expected: Content result card 1 button text: "Edit"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 Edit button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Edit button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Content result card 1 Edit button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Edit button text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 1 Edit button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Edit button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 1 Edit button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Edit 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')); } - console.log('Passed: Edit View button color matched as expected'); } }, - //Select All checkbox + //Content result card 1 thumbnail { - description: 'Verify Select All checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#selectToggle')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Select All checkbox icon not found'); - } - console.log('Passed: Select All checkbox icon present'); - } - }, - - //Select All label - { - description: 'Validate Select All label', + description: 'Verify Content result card 1 thumbnail', action: async () => { - const elementText = await driver.findElement(By.css('.btn-default')).getText(); - if (elementText !== 'Select All / None') { - throw new Error(`Expected: "Select All / None" label; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 1 thumbnail'; + const element = await driver.wait(until.elementLocated(By.css('#pub > div:nth-child(9) > div:nth-child(1) > div > div > div:nth-child(1) > a')), 5000).catch(() => false); + const elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //thumbnail + if (element) { + console.log('Passed: Content result card 1 thumbnail present'); + } else { + errors.push('Content result card 1 thumbnail not found'); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/click.php?iItemId=1215718916') { + console.log('Passed: Content result card 1 thumbnail URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 1 thumbnail URL: "https://correlation.edgate.com/exact/click.php?iItemId=1215718916"; Actual: "${elementURL}"`); + } + + //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: Select All / None label matched as expected'); } }, - //Actions button + //Content result card 1 View Details button { - description: 'Validate Actions button text', + description: 'Validate Content result card 1 View Details button', action: async () => { - const elementText = await driver.findElement(By.linkText('Actions')).getText(); - if (elementText !== 'Actions') { - throw new Error(`Expected: "Actions" button text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 1 View Details button'; + const element = await driver.findElement(By.css('.card:nth-child(1) > .card-body > div > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'View Details') { + console.log('Passed: Content result card 1 View Details button text matched as expected'); + } else { + errors.push(`Expected: Content result card 1 button text: "View Details"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 View Details button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Details button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 1 View Details button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Details button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 1 View Details button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Details button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 1 View Details button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Details 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')); } - console.log('Passed: Actions button text matched as expected'); } }, - //Actions button color -green + //Content result card 1 View Details - details (SPECIAL CASE: trim text) { - description: 'Validate Actions button color', + description: 'Validate Content result card 1 View Details info', action: async () => { - const elementStyle = await driver.findElement(By.linkText('Actions')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Actions button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Content result card 1 View Details info'; + + //Track all errors + const errors = []; + + //Target the specific content div using the matching onclick ID + const contentText = await driver.executeScript(` + const viewDetailsBtn = document.querySelector('a[onclick*="content1215718916"]'); + if (!viewDetailsBtn) return 'button not found'; + const div = viewDetailsBtn.previousElementSibling; + if (!div) return 'div not found'; + return div.innerHTML + .replace(/
/gi, '\\n') + .replace(/<[^>]+>/g, '') + .trim(); + `); + //console.log('----->| DEBUG content text:', contentText); + + const expectedLines = [ + 'Alignment Status: ECS Alignment' + ]; + + const actualLines = contentText + .split('\n') + .map(line => line.trim()) + .filter(line => line !== ''); + + //console.log('----->| DEBUG actual lines:', JSON.stringify(actualLines)); + + for (const expectedLine of expectedLines) { + if (actualLines.includes(expectedLine)) { + console.log(`Passed: Content result card 1 details: ${expectedLine} text matched as expected`); + } else { + errors.push(`Expected: "${expectedLine}" text not found in content 1 details`); + } + } + + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); } - console.log('Passed: Actions button color matched as expected'); } }, - //First content item checkbox (All Species Inventory) + //Content result card 1 description { - description: 'Verify All Species Inventory alignment checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#cu873578654')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: All Species Inventory alignment checkbox icon not found'); - } - console.log('Passed: All Species Inventory alignment checkbox icon present'); - } - }, - - //First content link - { - description: 'Validate All Species Inventory link text', + description: 'Validate Content result card 1 description', action: async () => { - const elementText = await driver.findElement(By.linkText('All Species Inventory')).getText(); - if (elementText !== 'All Species Inventory') { - throw new Error(`Expected: "All Species Inventory" link text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 1 description'; + const element = await driver.findElement(By.css('.card:nth-child(1) .lo-descr')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Extract the bare text node (everything that's not a tag) + const elementTrimmedText = await driver.executeScript(` + const el = arguments[0]; + for (const node of el.childNodes) { + if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) { + return node.textContent.trim(); + } + } + return null; + `, element); + + //Track all errors + const errors = []; + + //text + if (elementTrimmedText === 'Computer Science Discoveries (CS Discoveries) is an introductory computer science course that empowers students to create authentic artifacts and engage with computer science as a medium for creativity, communication, problem solving, and fun.') { + console.log('Passed: Content result card 1 description text found and matched as expected'); + } else { + errors.push(`Expected: Content result card 1 description text to contain: "Computer Science Discoveries (CS Discoveries) is an introductory computer science course that empowers students to create authentic artifacts and engage with computer science as a medium for creativity, communication, problem solving, and fun."; Actual: "${elementTrimmedText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 description text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 description text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 1 description text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 description text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 1 description text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 description text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: All Species Inventory link text matched as expected'); } }, - //First content item edit button + //Content result card 1 Content Set { - description: 'Validate All Species Inventory Edit button text', + description: 'Validate Content result card 1 Content Set', action: async () => { - const elementText = await driver.findElement(By.css('#\\38 73578654 .ml-3')).getText(); - if (elementText !== 'Edit') { - throw new Error(`Expected: All Species Inventory alignment "Edit" button text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 1 Content Set'; + const element = await driver.findElement(By.css('.card:nth-child(1) small')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set: Biology') { + console.log('Passed: Content result card 1 Content Set: Biology text matched as expected'); + } else { + errors.push(`Expected: Content result card 1: "Content Set: Biology"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 Content Set: Biology text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Content Set: Biology text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '10.4px') { + console.log('Passed: Content result card 1 Content Set: Biology text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Content Set: Biology text font-size "10.4px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 1 Content Set: Biology text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 Content Set: Biology text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: All Species Inventory alignment "Edit" button text matched as expected'); } }, - //First content item edit button color -green + //Content result card 1 Alignment Status { - description: 'Validate All Species Inventory Edit button color', + description: 'Validate Content result card 1 Alignment Status', action: async () => { - const elementStyle = await driver.findElement(By.css('#\\38 73578654 .ml-3')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: All Species Inventory "Edit" button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Content result card 1 Alignment Status'; + const element = await driver.findElement(By.css('#alignstatuslink1215718916 > .display-alignment')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'ECS Alignment (reset)') { + console.log('Passed: Content result card 1 ECS Alignment (reset) text matched as expected'); + } else { + errors.push(`Expected: Content result card 1: "ECS Alignment (reset)"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 ECS Alignment (reset) text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 ECS Alignment (reset) text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 1 ECS Alignment (reset) text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 ECS Alignment (reset) text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 1 ECS Alignment (reset) text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 ECS Alignment (reset) text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: All Species Inventory alignment "Edit" button color matched as expected'); } }, - //First content item alignment pending text + //Content result card 1 Alignment Status { - description: 'Validate All Species Inventory alignment pending text', + description: 'Validate Content result card 1 Alignment Status', action: async () => { - const elementText = await driver.findElement(By.css('#alignstatuslink873578654 > .display-alignment')).getText(); - if (elementText !== 'Alignment Pending (reset)') { - throw new Error(`Expected: All Species Inventory alignment "Alignment Pending" text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 1 Alignment Status'; + const element = await driver.findElement(By.css('#alignstatuslink1215718916 b')); //CHECK THIS 1162099584 + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'reset') { + console.log('Passed: Content result card 1 reset text matched as expected'); + } else { + errors.push(`Expected: Content result card 1: "reset"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 reset text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 reset text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 1 reset text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 reset text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 1 reset text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 reset text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: All Species Inventory alignment "Alignment Pending" text matched as expected'); } }, - //First content item alignment pending text (reset) + //Content result card 1 View Standards button { - description: 'Validate All Species Inventory alignment reset text', + description: 'Validate Content result card 1 View Standards button', action: async () => { - const elementText = await driver.findElement(By.css('#alignstatuslink873578654 > div > a > b')).getText(); - if (elementText !== 'reset') { - throw new Error(`Expected: All Species Inventory alignment "(reset)" text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 1 View Standards button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(1) .well .fa')); + const element = await driver.findElement(By.css('.card:nth-child(1) .well > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 1 button "View Standards" icon is present'); + } else { + errors.push('Content result card 1 button "View Standards" icon was not found'); + } + + //text + if (elementText === 'View Standards') { + console.log('Passed: Content result card 1 View Standards button text matched as expected'); + } else { + errors.push(`Expected: Content result card 1 button text: "View Standards"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 1 View Standards button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Standards button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 1 View Standards button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Standards button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 1 View Standards button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Standards button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 1 View Standards button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 1 View Standards 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')); } - console.log('Passed: All Species Inventory alignment "(reset)" text matched as expected'); } }, - //Second content item checkbox (Altered Elephant Behavior) + //Content result card 2 title { - description: 'Verify Altered Elephant Behavior checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#cu873578655')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Altered Elephant Behavior checkbox icon not found'); - } - console.log('Passed: Altered Elephant Behavior checkbox icon present'); - } - }, - - //Second content link - { - description: 'Validate Altered Elephant Behavior link text', + description: 'Validate Content result card 2 title', action: async () => { - const elementText = await driver.findElement(By.linkText('Altered Elephant Behavior')).getText(); - if (elementText !== 'Altered Elephant Behavior') { - throw new Error(`Expected: "Altered Elephant Behavior" link text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 2 title'; + const element = await driver.findElement(By.linkText(`Unit 1 - Problem Solving and Computing ('21-'22)`)); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === `Unit 1 - Problem Solving and Computing ('21-'22)`) { + console.log('Passed: Content result card 2 title text matched as expected'); + } else { + errors.push(`Expected: Content result card 2 title: "Unit 1 - Problem Solving and Computing ('21-'22)"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 title text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 title text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 2 title text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 title text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content result card 2 title text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 title text color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/click.php?iItemId=1215719217') { + console.log('Passed: Content result card 2 URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 2 URL: "https://correlation.edgate.com/exact/click.php?iItemId=1215719217"; Actual: "${elementURL}"`); + } + + //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: Altered Elephant Behavior link text matched as expected'); } }, - //Second content item edit button + //Content result card 2 edit button { - description: 'Validate Altered Elephant Behavior Edit button text', + description: 'Validate Content result card 2 edit button', action: async () => { - const elementText = await driver.findElement(By.css('#\\38 73578655 .ml-3')).getText(); - if (elementText !== 'Edit') { - throw new Error(`Expected: Altered Elephant Behavior "Edit" button text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 2 edit button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(2) .lo-title .fa')); + const element = await driver.findElement(By.css('.card:nth-child(2) .ml-3')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 2 button "Edit" icon is present'); + } else { + errors.push('Content result card 2 button "Edit" icon was not found'); + } + + //text + if (elementText === 'Edit') { + console.log('Passed: Content result card 2 Edit button text matched as expected'); + } else { + errors.push(`Expected: Content result card 2 button text: "Edit"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 Edit button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Edit button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Content result card 2 Edit button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Edit button text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 2 Edit button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Edit button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 2 Edit button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Edit 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')); } - console.log('Passed: Altered Elephant Behavior "Edit" button text matched as expected'); } }, - //Second content item edit button color -green + //Content result card 2 thumbnail { - description: 'Validate Altered Elephant Behavior Edit button color', + description: 'Verify Content result card 2 thumbnail', action: async () => { - const elementStyle = await driver.findElement(By.css('#\\38 73578655 .ml-3')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Altered Elephant Behavior Edit button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Content result card 2 thumbnail'; + const element = await driver.wait(until.elementLocated(By.css('#pub > div:nth-child(9) > div:nth-child(2) > div > div > div:nth-child(1) > a')), 5000).catch(() => false); + const elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //thumbnail + if (element) { + console.log('Passed: Content result card 2 thumbnail present'); + } else { + errors.push('Content result card 2 thumbnail not found'); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/click.php?iItemId=1215719217') { + console.log('Passed: Content result card 2 thumbnail URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 2 thumbnail URL: "https://correlation.edgate.com/exact/click.php?iItemId=1215719217"; Actual: "${elementURL}"`); + } + + //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: Altered Elephant Behavior "Edit" button color matched as expected'); } }, - //Second content item Not Aligned text (previously: ECS Alignment (reset) + //Content result card 2 View Details button { - description: 'Validate Altered Elephant Behavior Not Aligned text', + description: 'Validate Content result card 2 View Details button', action: async () => { - const elementText = await driver.findElement(By.css('#alignstatuslink873578655 > .display-alignment')).getText(); - if (elementText !== 'Not Aligned') { - throw new Error(`Expected: Altered Elephant Behavior "Not Aligned" text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 2 View Details button'; + const element = await driver.findElement(By.css('.card:nth-child(2) > .card-body > div > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'View Details') { + console.log('Passed: Content result card 2 View Details button text matched as expected'); + } else { + errors.push(`Expected: Content result card 2 button text: "View Details"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 View Details button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Details button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 2 View Details button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Details button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 2 View Details button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Details button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 2 View Details button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Details 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')); } - console.log('Passed: Altered Elephant Behavior Not Aligned text matched as expected'); } }, - //NEXT ACTION - VIEW ACTION ITEMS - { description: 'Click Actions button', action: async () => await driver.findElement(By.linkText('Actions')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, - - //Move link + //Content result card 2 View Details - details (SPECIAL CASE: trim text) { - description: 'Validate Move link text', + description: 'Validate Content result card 2 View Details info', action: async () => { - const elementText = await driver.findElement(By.linkText('Move')).getText(); - if (elementText !== 'Move') { - throw new Error(`Expected: "Move" button text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 2 View Details info'; + + //Track all errors + const errors = []; + + //Target the specific content div using the matching onclick ID + const contentText = await driver.executeScript(` + const viewDetailsBtn = document.querySelector('a[onclick*="content1215719217"]'); + if (!viewDetailsBtn) return 'button not found'; + const div = viewDetailsBtn.previousElementSibling; + if (!div) return 'div not found'; + return div.innerHTML + .replace(/
/gi, '\\n') + .replace(/<[^>]+>/g, '') + .trim(); + `); + //console.log('----->| DEBUG content text:', contentText); + + const expectedLines = [ + 'Alignment Status: ECS Alignment' + ]; + + const actualLines = contentText + .split('\n') + .map(line => line.trim()) + .filter(line => line !== ''); + + //console.log('----->| DEBUG actual lines:', JSON.stringify(actualLines)); + + for (const expectedLine of expectedLines) { + if (actualLines.includes(expectedLine)) { + console.log(`Passed: Content result card 2 details: ${expectedLine} text matched as expected`); + } else { + errors.push(`Expected: "${expectedLine}" text not found in content 2 details`); + } + } + + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); } - console.log('Passed: Move button text matched as expected'); } }, - //Copy link + //Content result card 2 description { - description: 'Validate Copy link text', + description: 'Validate Content result card 2 description', action: async () => { - const elementText = await driver.findElement(By.linkText('Copy')).getText(); - if (elementText !== 'Copy') { - throw new Error(`Expected: "Copy" button text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 2 description'; + const element = await driver.findElement(By.css('.card:nth-child(2) .lo-descr')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Extract the bare text node (everything that's not a tag) + const elementTrimmedText = await driver.executeScript(` + const el = arguments[0]; + for (const node of el.childNodes) { + if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) { + return node.textContent.trim(); + } + } + return null; + `, element); + + //Track all errors + const errors = []; + + //text + if (elementTrimmedText === `Problem Solving and Computing is a highly interactive and collaborative introduction to the field of somputer science, as framed within the broader pursuit of solving problems. You'll practice using a problem solving process to address a series of puzzles, challenges, and real world scenarios. Next, you'll learn how computers input, output, store, and process information to help humans solve problems. The unit concludes with a project in which you design an application that helps solve a problem of your choosing.`) { + console.log('Passed: Content result card 2 description text found and matched as expected'); + } else { + errors.push(`Expected: Content result card 2 description text to contain: "Problem Solving and Computing is a highly interactive and collaborative introduction to the field of somputer science, as framed within the broader pursuit of solving problems. You'll practice using a problem solving process to address a series of puzzles, challenges, and real world scenarios. Next, you'll learn how computers input, output, store, and process information to help humans solve problems. The unit concludes with a project in which you design an application that helps solve a problem of your choosing."; Actual: "${elementTrimmedText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 description text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 description text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 2 description text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 description text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 2 description text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 description text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Copy button text matched as expected'); } }, - //Edit Metadata link + //Content result card 2 Content Set { - description: 'Validate Edit Metadata link text', + description: 'Validate Content result card 2 Content Set', action: async () => { - const elementText = await driver.findElement(By.linkText('Edit Metadata')).getText(); - if (elementText !== 'Edit Metadata') { - throw new Error(`Expected: "Edit Metadata" button text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 2 Content Set'; + const element = await driver.findElement(By.css('.card:nth-child(2) small')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set: Biology') { + console.log('Passed: Content result card 2 Content Set: Biology text matched as expected'); + } else { + errors.push(`Expected: Content result card 2: "Content Set: Biology"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 Content Set: Biology text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Content Set: Biology text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '10.4px') { + console.log('Passed: Content result card 2 Content Set: Biology text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Content Set: Biology text font-size "10.4px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 2 Content Set: Biology text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 Content Set: Biology text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Edit Metadata button text matched as expected'); } }, - //Tag Concepts link + //Content result card 2 Alignment Status { - description: 'Validate Tag Concepts link text', + description: 'Validate Content result card 2 Alignment Status', action: async () => { - const elementText = await driver.findElement(By.linkText('Tag Concepts')).getText(); - if (elementText !== 'Tag Concepts') { - throw new Error(`Expected: "Tag Concepts" button text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 2 Alignment Status'; + const element = await driver.findElement(By.css('#alignstatuslink1215719217 > .display-alignment')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'ECS Alignment (reset)') { + console.log('Passed: Content result card 2 ECS Alignment (reset) text matched as expected'); + } else { + errors.push(`Expected: Content result card 2: "ECS Alignment (reset)"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 ECS Alignment (reset) text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 ECS Alignment (reset) text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 2 ECS Alignment (reset) text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 ECS Alignment (reset) text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 2 ECS Alignment (reset) text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 ECS Alignment (reset) text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Tag Concepts button text matched as expected'); } }, - //AutoAlign link + //Content result card 2 Alignment Status { - description: 'Validate AutoAlign link text', + description: 'Validate Content result card 2 Alignment Status', action: async () => { - const elementText = await driver.findElement(By.linkText('AutoAlign')).getText(); - if (elementText !== 'AutoAlign') { - throw new Error(`Expected: "AutoAlign" button text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 2 Alignment Status'; + const element = await driver.findElement(By.css('#alignstatuslink1215719217 b')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'reset') { + console.log('Passed: Content result card 2 reset text matched as expected'); + } else { + errors.push(`Expected: Content result card 2: "reset"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 reset text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 reset text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 2 reset text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 reset text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 2 reset text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 reset text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: AutoAlign button text matched as expected'); } }, - //Delete link + //Content result card 2 View Standards button { - description: 'Validate Delete link text', + description: 'Validate Content result card 2 View Standards button', action: async () => { - const elementText = await driver.findElement(By.linkText('Delete')).getText(); - if (elementText !== 'Delete') { - throw new Error(`Expected: "Delete" button text; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 2 View Standards button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(2) .well .fa')); + const element = await driver.findElement(By.css('.card:nth-child(2) .well > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 2 button "View Standards" icon is present'); + } else { + errors.push('Content result card 2 button "View Standards" icon was not found'); + } + + //text + if (elementText === 'View Standards') { + console.log('Passed: Content result card 2 View Standards button text matched as expected'); + } else { + errors.push(`Expected: Content result card 2 button text: "View Standards"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 2 View Standards button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Standards button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 2 View Standards button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Standards button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 2 View Standards button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Standards button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 2 View Standards button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 2 View Standards 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')); } - console.log('Passed: Delete button text matched as expected'); } }, - - //Delete text color -red - { - description: 'Validate Delte text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Delete')).getCssValue('color'); - if (elementStyle !== 'rgba(220, 53, 69, 1)') { - throw new Error(`Expected: Actions Delete text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Actions Delete text color matched as expected'); - } - }, - - //NEXT ACTION - Reset | ECS-2920 - { description: 'Click Actions button', action: async () => await driver.findElement(By.linkText('Actions')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, - { description: 'Click Detail View button', action: async () => await driver.findElement(By.linkText('Detail View')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, - - //Wait for page to load - Content 1 edit button +*/ + //NEXT ACTION { - description: 'Wait for Content 1 edit button to load', + description: 'Log Out', action: async () => { - return await driver.wait(until.elementLocated(By.css('.card:nth-child(8) .lo-title .fa')), 10000).catch(() => false); - } - }, + const multipleChecks = 'Log Out'; + + //Track all errors + const errors = []; - //LOG OUT - //NEXT ACTION - Log out - { description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, - { description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + 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 for login screen to load - { - description: 'Wait for log out process to complete', - action: async () => { - return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false); + //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')); + } } }, ]; @@ -2663,26 +9169,24 @@ try { 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 + try { await step.action(); - - //Log a successful step with no screenshot worksheet = logStep( worksheet, step.description, 'Passed', stepIndex, timestamp, - null //No screenshot for passed steps + null ); } catch (error) { - //Only take screenshot if the step fails const screenshotPath = await takeScreenshot( driver, stepIndex, @@ -2699,19 +9203,21 @@ try { ); console.error(`Step ${stepIndex} FAILED: ${error.message}`); + failedSteps.push(`Step ${stepIndex}: ${step.description} - ${error.message}`); //Track failed step testStatus = 'Failed'; allStepsPassed = false; } } - //Check if log out was successful - const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); - - if (loginButton && allStepsPassed) { - console.log('PASSED: ECS-2920 | Content Page(ExACT_contentPage); All test steps completed successfully'); + if (allStepsPassed) { + console.log('------------->| THE END |<-------------'); + console.log('PASSED: CONTENT - Content Page (ExACT_contentPage); All test steps completed successfully'); testStatus = 'Passed'; } else { - console.log('FAILED: ECS-2920 | Content Page(ExACT_contentPage); One or more test steps failed'); + console.log('------------->| THE END |<-------------'); + console.log('FAILED: CONTENT - Content Page (ExACT_contentPage); One or more test steps failed'); + console.log('FAILED STEPS:'); + failedSteps.forEach(step => console.error(` ✗ ${step}`)); testStatus = 'Failed'; } @@ -2725,7 +9231,7 @@ try { } finally { await driver.quit(); } -})(); + })(); } export default ExACT_contentPage; diff --git a/tests/ExACT_dashboard.js b/tests/ExACT_dashboard.js new file mode 100644 index 0000000..85467fc --- /dev/null +++ b/tests/ExACT_dashboard.js @@ -0,0 +1,5596 @@ +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'; +import { brotliCompress } from 'zlib'; + +const ExACT_dashboard = (req, res) => { + res.send('

ExACT Automated Test Script: Correlations Dashboard (ExACT_dashboard) | 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 +//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 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('------------->| 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 HEADER + //ExACT Dashboard Logo + { + description: 'Validate ExACT Dashboard Logo', + action: async () => { + const multipleChecks = 'ExACT Dashboard Logo'; + const element = await driver.findElement(By.css('span > img')); + const expectedSrc = 'https://correlation.edgate.com/exact/images/exact.svg'; + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: ExACT by edgate logo was displayed as expected'); + } else { + errors.push('Expected: ExACT by edgate logo was not displayed'); + } + + //image src + const actualSrc = await element.getAttribute('src'); + if (actualSrc && actualSrc === expectedSrc) { + console.log(`Passed: Logo src "${actualSrc}" matched expected`); + } else { + errors.push(`Expected: Logo src: "${expectedSrc}"; but found "${actualSrc}"`); + } + + //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')); + } + } + }, + + //Navigation show/hide icon + { + description: 'Validate Navigation panel show/hide icon', + action: async () => { + const multipleChecks = 'Navigation panel show/hide icon'; + const element = await driver.findElement(By.css('.fa-bars')); + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: Navigation panel show/hide icon was displayed as expected'); + } else { + errors.push('Expected: Navigation panel show/hide icon 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')); + } + } + }, + + //Search textbox + { + description: 'Validate Search textbox', + action: async () => { + const multipleChecks = 'Search textbox'; + const element = await driver.findElement(By.css('.searchbar-input')); + const elementIcon = await driver.findElement(By.css('.searchbar-submit > .fa')).getCssValue('color'); + + //Get text, font, size, and color + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Search...') { + console.log('Passed: Search textbox placeholder text matched as expected'); + } else { + errors.push(`Expected: "Search..." placeholder; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Search textbox placeholder text font matched as expected'); + } else { + errors.push(`Expected: Search textbox placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13.5px') { + console.log('Passed: Search textbox placeholder text font-size matched as expected'); + } else { + errors.push(`Expected: Search textbox placeholder text font-size "13.5px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgb(204, 204, 204)') { + console.log('Passed: Search textbox placeholder text color matched as expected'); + } else { + errors.push(`Expected: Search textbox placeholder text color: "rgb(204, 204, 204)"; Actual: "${elementColor}"`); + } + + //search icon color + if (elementIcon === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Search icon color matched as expected'); + } else { + errors.push(`Expected: Search icon color did not match; Actual: "${elementIcon}"`); + } + + //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')); + } + } + }, + + //ExACT Help Icon + { + description: 'Validate ExACT Help Icon', + action: async () => { + const multipleChecks = 'ExACT Help Icon'; + const element = await driver.findElement(By.css('.e-help path')); + const link = await driver.findElement(By.css('.e-help a.user-profile')); + const expectedHref = 'https://correlation.edgate.com/exact/help.php'; + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: ExACT Help icon was displayed as expected'); + } else { + errors.push('Expected: ExACT Help icon was not displayed'); + } + + //href + const actualHref = await link.getAttribute('href'); + if (actualHref && actualHref === expectedHref) { + console.log(`Passed: Help icon href "${actualHref}" matched as expected`); + } else { + errors.push(`Expected: Help icon href to be "${expectedHref}"; but found "${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')); + } + } + }, + + //Notification Icon + { + description: 'Validate Notification Icon', + action: async () => { + const multipleChecks = 'Notification Icon'; + const element = await driver.findElement(By.css('#navbarDropdown > svg')); + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: Notification icon was displayed as expected'); + } else { + errors.push('Expected: Notification icon 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')); + } + } + }, + + //Profile dropdown + { + description: 'Validate Profile Dropdown', + action: async () => { + const multipleChecks = 'Profile Dropdown'; + const element = await driver.findElement(By.css('#navbarDropdown > span')).getText(); + const userIcon = await driver.findElement(By.css('.fa-user')); + const downCarrotIcon = await driver.findElement(By.css('.nav-item:nth-child(1) > #navbarDropdown')); + + //Track all errors + const errors = []; + + //text + if (element === 'Juan Huerta') { + console.log('Passed: Profile dropdown text matched as expected'); + } else { + errors.push(`Expected: "Juan Huerta"; Actual: "${element}"`); + } + + //User icon + if (await userIcon.isDisplayed()) { + console.log('Passed: User profile dropdown icon was displayed as expected'); + } else { + errors.push('Expected: User profile dropdown icon was not displayed'); + } + + //Down carrot icon + if (await downCarrotIcon.isDisplayed()) { + console.log('Passed: Profile down carrot icon was displayed as expected'); + } else { + errors.push('Expected: Profile down carrot icon 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')); + } + } + }, + + //NAVIGATION PANEL + //Dashboard + { + description: 'Validate Dashboard Navigation title text, size, and color', + action: async () => { + const multipleChecks = 'Dashboard Navigation title'; + const elementIcon = await driver.findElement(By.css('.fb-dashboard')); + const element = await driver.findElement(By.linkText('Dashboard')); + const expectedHref = 'https://correlation.edgate.com/exact/'; + + //Get text, font, size, and 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 elementBGTextColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (await elementIcon.isDisplayed()) { + console.log('Passed: Dashboard Navigation icon was displayed as expected'); + } else { + errors.push('Expected: Dashboard Navigation icon was not displayed'); + } + + //text + if (elementText === 'Dashboard') { + console.log('Passed: Dashboard Navigation title text matched as expected'); + } else { + errors.push(`Expected: "Dashboard"; Actual: "${elementText}"`); + } + + //href + const actualHref = await element.getAttribute('href'); + if (actualHref && actualHref === expectedHref) { + console.log(`Passed: Dashboard Navigation href "${actualHref}" matched as expected`); + } else { + errors.push(`Expected: Dashboard Navigation href to be "${expectedHref}"; but found "${actualHref}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard Navigation title font matched as expected'); + } else { + errors.push(`Expected: Dashboard Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Dashboard Navigation title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard Navigation title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(250, 250, 250, 1)') { + console.log('Passed: Dashboard Navigation title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard Navigation title text color: "rgba(250, 250, 250, 1)"; Actual: "${elementTextColor}"`); + } + + //background color + if (elementBGTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Dashboard Navigation title background color matched as expected'); + } else { + errors.push(`Expected: Dashboard Navigation title background color: "rgba(48, 200, 172, 1)"; Actual: "${elementBGTextColor}"`); + } + + //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')); + } + } + }, + + //Frameworks + { + description: 'Validate Frameworks Navigation title text, size, and color', + action: async () => { + const multipleChecks = 'Frameworks Navigation title'; + const elementIcon = await driver.findElement(By.css('.fb-framework')); + const element = await driver.findElement(By.linkText('Frameworks')); + const expectedHref = 'https://correlation.edgate.com/exact/frameworks.php'; + + //Get text, font, size, and 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 elementBGTextColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (await elementIcon.isDisplayed()) { + console.log(`Passed: Frameworks Navigation icon was displayed as expected`); + } else { + errors.push('Expected: Frameworks Navigation icon was not displayed'); + } + + //text + if (elementText === 'Frameworks') { + console.log('Passed: Frameworks Navigation title text matched as expected'); + } else { + errors.push(`Expected: "Frameworks"; Actual: "${elementText}"`); + } + + //href + const actualHref = await element.getAttribute('href'); + if (actualHref && actualHref === expectedHref) { + console.log(`Passed: Frameworks Navigation href "${actualHref}" matched as expected`); + } else { + errors.push(`Expected: Frameworks Navigation href to be "${expectedHref}"; but found "${actualHref}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Frameworks Navigation title font matched as expected'); + } else { + errors.push(`Expected: Frameworks Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Frameworks Navigation title text font-size matched as expected'); + } else { + errors.push(`Expected: Frameworks Navigation title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Frameworks Navigation title text color matched as expected'); + } else { + errors.push(`Expected: Frameworks Navigation title text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //background color + if (elementBGTextColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Frameworks Navigation title background color matched as expected'); + } else { + errors.push(`Expected: Frameworks Navigation title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBGTextColor}"`); + } + + //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')); + } + } + }, + + //Align + { + description: 'Validate Align Navigation title text, size, and color', + action: async () => { + const multipleChecks = 'Align Navigation title'; + const elementIcon = await driver.findElement(By.css('.fb-align')); + const element = await driver.findElement(By.linkText('Align')); + const expectedHref = 'https://correlation.edgate.com/exact/browse.php'; + + //Get text, font, size, and 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 elementBGTextColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (await elementIcon.isDisplayed()) { + console.log(`Passed: Align Navigation icon was displayed as expected`); + } else { + errors.push('Expected: Align Navigation icon was not displayed'); + } + + //text + if (elementText === 'Align') { + console.log('Passed: Align Navigation title text matched as expected'); + } else { + errors.push(`Expected: "Align"; Actual: "${elementText}"`); + } + + //href + const actualHref = await element.getAttribute('href'); + if (actualHref && actualHref === expectedHref) { + console.log(`Passed: Align Navigation href "${actualHref}" matched as expected`); + } else { + errors.push(`Expected: Align Navigation href to be "${expectedHref}"; but found "${actualHref}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Align Navigation title font matched as expected'); + } else { + errors.push(`Expected: Align Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Align Navigation title text font-size matched as expected'); + } else { + errors.push(`Expected: Align Navigation title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Align Navigation title text color matched as expected'); + } else { + errors.push(`Expected: Align Navigation title text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //background color + if (elementBGTextColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Align Navigation title background color matched as expected'); + } else { + errors.push(`Expected: Align Navigation title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBGTextColor}"`); + } + + //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')); + } + } + }, + + //Upload + { + description: 'Validate Upload Navigation title text, size, and color', + action: async () => { + const multipleChecks = 'Upload Navigation title'; + const elementIcon = await driver.findElement(By.css('.fb-upload')); + const element = await driver.findElement(By.linkText('Upload')); + const expectedHref = 'https://correlation.edgate.com/exact/submit.php'; + + //Get text, font, size, and 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 elementBGTextColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (await elementIcon.isDisplayed()) { + console.log(`Passed: Upload Navigation icon was displayed as expected`); + } else { + errors.push('Expected: Upload Navigation icon was not displayed'); + } + + //text + if (elementText === 'Upload') { + console.log('Passed: Upload Navigation title text matched as expected'); + } else { + errors.push(`Expected: "Upload"; Actual: "${elementText}"`); + } + + //href + const actualHref = await element.getAttribute('href'); + if (actualHref && actualHref === expectedHref) { + console.log(`Passed: Upload Navigation href "${actualHref}" matched as expected`); + } else { + errors.push(`Expected: Upload Navigation href to be "${expectedHref}"; but found "${actualHref}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Upload Navigation title font matched as expected'); + } else { + errors.push(`Expected: Upload Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Upload Navigation title text font-size matched as expected'); + } else { + errors.push(`Expected: Upload Navigation title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Upload Navigation title text color matched as expected'); + } else { + errors.push(`Expected: Upload Navigation title text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //background color + if (elementBGTextColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Upload Navigation title background color matched as expected'); + } else { + errors.push(`Expected: Upload Navigation title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBGTextColor}"`); + } + + //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')); + } + } + }, + + //Activity Report + { + description: 'Validate Activity Report Navigation title text, size, and color', + action: async () => { + const multipleChecks = 'Activity Report Navigation title'; + const elementIcon = await driver.findElement(By.css('.fb-upload')); + const element = await driver.findElement(By.linkText('Activity Report')); + const expectedHref = 'https://correlation.edgate.com/exact/activity_reporting.php'; + + //Get text, font, size, and 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 elementBGTextColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (await elementIcon.isDisplayed()) { + console.log(`Passed: Activity Report Navigation icon was displayed as expected`); + } else { + errors.push('Expected: Activity Report Navigation icon was not displayed'); + } + + //text + if (elementText === 'Activity Report') { + console.log('Passed: Activity Report Navigation title text matched as expected'); + } else { + errors.push(`Expected: "Activity Report"; Actual: "${elementText}"`); + } + + //href + const actualHref = await element.getAttribute('href'); + if (actualHref && actualHref === expectedHref) { + console.log(`Passed: Activity Report Navigation href "${actualHref}" matched as expected`); + } else { + errors.push(`Expected: Activity Report Navigation href to be "${expectedHref}"; but found "${actualHref}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Activity Report Navigation title font matched as expected'); + } else { + errors.push(`Expected: Activity Report Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Activity Report Navigation title text font-size matched as expected'); + } else { + errors.push(`Expected: Activity Report Navigation title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Activity Report Navigation title text color matched as expected'); + } else { + errors.push(`Expected: Activity Report Navigation title text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //background color + if (elementBGTextColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Activity Report Navigation title background color matched as expected'); + } else { + errors.push(`Expected: Activity Report Navigation title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBGTextColor}"`); + } + + //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')); + } + } + }, + + //Report + { + description: 'Validate Report Navigation title text, size, and color', + action: async () => { + const multipleChecks = 'Report Navigation title'; + const elementIcon = await driver.findElement(By.css('.fb-upload')); + const element = await driver.findElement(By.linkText('Report')); + const expectedHref = 'https://correlation.edgate.com/exact/reports.php'; + + //Get text, font, size, and 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 elementBGTextColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (await elementIcon.isDisplayed()) { + console.log(`Passed: Report Navigation icon was displayed as expected`); + } else { + errors.push('Expected: Report Navigation icon was not displayed'); + } + + //text + if (elementText === 'Report') { + console.log('Passed: Report Navigation title text matched as expected'); + } else { + errors.push(`Expected: "Report"; Actual: "${elementText}"`); + } + + //href + const actualHref = await element.getAttribute('href'); + if (actualHref && actualHref === expectedHref) { + console.log(`Passed: Report Navigation href "${actualHref}" matched as expected`); + } else { + errors.push(`Expected: Report Navigation href to be "${expectedHref}"; but found "${actualHref}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Report Navigation title font matched as expected'); + } else { + errors.push(`Expected: Report Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Report Navigation title text font-size matched as expected'); + } else { + errors.push(`Expected: Report Navigation title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Report Navigation title text color matched as expected'); + } else { + errors.push(`Expected: Report Navigation title text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //background color + if (elementBGTextColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Report Navigation title background color matched as expected'); + } else { + errors.push(`Expected: Report Navigation title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBGTextColor}"`); + } + + //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')); + } + } + }, + + //Approve + { + description: 'Validate Approve Navigation title text, size, and color', + action: async () => { + const multipleChecks = 'Approve Navigation title'; + const elementIcon = await driver.findElement(By.css('.fb-upload')); + const element = await driver.findElement(By.linkText('Approve')); + const expectedHref = 'https://correlation.edgate.com/exact/approvecontent.php'; + + //Get text, font, size, and 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 elementBGTextColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (await elementIcon.isDisplayed()) { + console.log(`Passed: Approve Navigation icon was displayed as expected`); + } else { + errors.push('Expected: Approve Navigation icon was not displayed'); + } + + //text + if (elementText === 'Approve') { + console.log('Passed: Approve Navigation title text matched as expected'); + } else { + errors.push(`Expected: "Approve"; Actual: "${elementText}"`); + } + + //href + const actualHref = await element.getAttribute('href'); + if (actualHref && actualHref === expectedHref) { + console.log(`Passed: Approve Navigation href "${actualHref}" matched as expected`); + } else { + errors.push(`Expected: Approve Navigation href to be "${expectedHref}"; but found "${actualHref}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Approve Navigation title font matched as expected'); + } else { + errors.push(`Expected: Approve Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Approve Navigation title text font-size matched as expected'); + } else { + errors.push(`Expected: Approve Navigation title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Approve Navigation title text color matched as expected'); + } else { + errors.push(`Expected: Approve Navigation title text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //background color + if (elementBGTextColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Approve Navigation title background color matched as expected'); + } else { + errors.push(`Expected: Approve Navigation title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBGTextColor}"`); + } + + //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')); + } + } + }, + + //DASHBOARD + //Dashboard title + { + description: 'Validate 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 elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = 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-family + if (elementTextFont === `"DM Serif Display", serif`) { + console.log('Passed: Dashboard title font matched as expected'); + } else { + errors.push(`Expected: Dashboard title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '32px') { + console.log('Passed: Dashboard title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard title text font-size "32px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === '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: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //MY CONTENT WIDGET + //My Content Widget title + { + description: 'Validate My Content widget title text, color, and size', + action: async () => { + const multipleChecks = 'My Content widget title'; + const element = await driver.findElement(By.css('.h-100 h2:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'My Content') { + console.log('Passed: My Content widget title text matched as expected'); + } else { + errors.push(`Expected: "My Content"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: My Content widget title font matched as expected'); + } else { + errors.push(`Expected: My Content widget title font "Poppins, sans-serif", serif; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '18px') { + console.log('Passed: My Content widget title text font-size matched as expected'); + } else { + errors.push(`Expected: My Content widget title text font-size "18px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: My Content widget title text color matched as expected'); + } else { + errors.push(`Expected: My Content widget title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content total item Count + { + description: 'Validate My Content total item count', + action: async () => { + const multipleChecks = 'My Content total item count'; + const element = await driver.findElement(By.css('#badge_content_total')); + + //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 === myContentItemTotals) { + console.log('Passed: Total item count button text matched as expected'); + } else { + errors.push(`Expected: "${myContentItemTotals}"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Total item count button text font matched as expected'); + } else { + errors.push(`Expected: Total item count button text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13.5px') { + console.log('Passed: Total item count button text font-size matched as expected'); + } else { + errors.push(`Expected: Total item count button text font-size "13.5px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Total item count button text color matched as expected'); + } else { + errors.push(`Expected: Total item count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Total item count button background color matched as expected'); + } else { + errors.push(`Expected: Total item count button background color: "rgba(40, 39, 90, 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')); + } + } + }, + + //Ellipsis icon color + { + description: 'Validate ellipsis icon color', + action: async () => { + const elementStyle = await driver.findElement(By.css('.fa-ellipsis-h')).getCssValue('color'); + if (elementStyle === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Ellipsis icon color matched as expected'); + } else { + errors.push(`Expected: Ellipsis icon color did not match; Actual: "${elementStyle}"`); + } + } + }, + + //My Content - filter row + //Filter textbox placeholder + { + description: 'Validate Filter placeholder text', + action: async () => { + const multipleChecks = 'Filter textbox'; + const elementIcon = await driver.findElement(By.css('.col-12 > .fa')).getCssValue('color'); + const element = await driver.findElement(By.css('#content-org-filter')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('placeholder'); + + //filter icon color + if (elementIcon === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Filter icon color matched as expected'); + } else { + errors.push(`Expected: Filter icon color did not match; Actual: "${elementIcon}"`); + } + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'filter...') { + console.log('Passed: Filter placeholder text matched as expected'); + } else { + errors.push(`Expected: "filter..." placeholder; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Filter placeholder text font matched as expected'); + } else { + errors.push(`Expected: Filter placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13.5px') { + console.log('Passed: Filter placeholder text font-size matched as expected'); + } else { + errors.push(`Expected: Filter placeholder text font-size "13.5px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Filter placeholder text color matched as expected'); + } else { + errors.push(`Expected: Filter placeholder text color: "rgb(108, 117, 125)"; 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')); + } + } + }, + + //Sort label + { + description: 'Validate My Sort label', + action: async () => { + const multipleChecks = 'Sort label'; + const element = await driver.findElement(By.css('.col-4')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Sort:') { + console.log('Passed: Sort: label text matched as expected'); + } else { + errors.push(`Expected: "Sort:" label; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Sort: label text font matched as expected'); + } else { + errors.push(`Expected: Sort: label text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: Sort: label text font-size matched as expected'); + } else { + errors.push(`Expected: Sort: label text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Sort: label text color matched as expected'); + } else { + errors.push(`Expected: Sort: label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Sort dropdown values + { + description: 'Validate Sort dropdown values', + action: async () => { + const multipleChecks = 'Sort dropdown values'; + const dropdown = await driver.wait(until.elementLocated(By.css('#orgsort')), 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(); + + if (defaultText === 'Count') { + console.log('Passed: Sort: dropdown default value matched as expected'); + } else { + errors.push(`Expected: Sort dropdown default value "Count"; Actual: "${defaultText}"`); + } + + //Verify all dropdown options + const options = await selectElement.getOptions(); + const expected = [ + 'Count', + 'Name' + ]; + + 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: Sort: dropdown list matched as expected'); + } else { + errors.push(`Expected: Sort 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')); + } + } + }, + + //My Content - Sort by Count (default) + { + description: 'Validate sort order by Count', + action: async () => { + const multipleChecks = 'My Content - Sort order by Count'; + const errors = []; + + const rows = await driver.executeScript(` + const results = []; + const items = document.querySelectorAll('#mycontentlist .orgname'); + items.forEach((item, index) => { + const nameLink = item.querySelector('a:first-child'); + const name = nameLink ? nameLink.textContent.trim() : ''; + const editLink = item.querySelector('a.ml-2'); + const href = editLink ? editLink.getAttribute('href') : ''; + const countSpan = item.closest('li').querySelector('.badge.contnet_set_count'); + const count = countSpan ? countSpan.textContent.trim() : ''; + results.push({ position: index + 1, name, href, count }); + }); + return results; + `); + + const expected = [ + { position: 1, name: 'Biology', count: '1493', href: '/exact/contentset_edit_modal.php?id=585821587' }, + { position: 2, name: 'Khan URL test', count: '1118', href: '/exact/contentset_edit_modal.php?id=1474381884' }, + { position: 3, name: 'Math Alignment Import Test', count: '730', href: '/exact/contentset_edit_modal.php?id=1423792414' }, + { position: 4, name: 'English I', count: '388', href: '/exact/contentset_edit_modal.php?id=585821585' }, + { position: 5, name: 'Copy Move Delete Test 2', count: '327', href: '/exact/contentset_edit_modal.php?id=1228574325' }, + { position: 6, name: 'Post NIght July26', count: '278', href: '/exact/contentset_edit_modal.php?id=1476789487' }, + { position: 7, name: 'Algebra', count: '194', href: '/exact/contentset_edit_modal.php?id=585821586' }, + { position: 8, name: 'seesaw test', count: '156', href: '/exact/contentset_edit_modal.php?id=1476742363' }, + { position: 9, name: 'US History III', count: '67', href: '/exact/contentset_edit_modal.php?id=585821589' }, + { position: 10, name: 'Import Align - Concept Based 1', count: '44', href: '/exact/contentset_edit_modal.php?id=1323320445' }, + { position: 11, name: 'Import Align - Concept Based 2', count: '44', href: '/exact/contentset_edit_modal.php?id=1323322624' }, + { position: 12, name: 'Import Align - Direct Align 1', count: '44', href: '/exact/contentset_edit_modal.php?id=1323322921' }, + { position: 13, name: 'Import Align - Direct Align 2', count: '44', href: '/exact/contentset_edit_modal.php?id=1323322923' }, + { 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: 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' } + ]; + + for (const exp of expected) { + const actual = rows[exp.position - 1]; + if (!actual) { + errors.push(`Position ${exp.position}: row not found`); + continue; + } + + const nameMatch = actual.name === exp.name; + const countMatch = actual.count === exp.count; + //Use includes() for href if exp.hrefContains is defined, otherwise exact match + const hrefMatch = exp.hrefContains + ? actual.href.includes(exp.hrefContains) + : actual.href === exp.href; + + if (nameMatch && countMatch && hrefMatch) { + console.log(`Passed: Sort Order ${exp.position} - ${exp.name} | Count: ${exp.count} | href | All matched as expected`); + } else { + if (!nameMatch) errors.push(`Sort Order ${exp.position} name - Expected: "${exp.name}"; Actual: "${actual.name}"`); + if (!countMatch) errors.push(`Sort Order ${exp.position} count - Expected: "${exp.count}"; Actual: "${actual.count}"`); + if (!hrefMatch) errors.push(`Sort Order ${exp.position} href - Expected: "${exp.href}"; Actual: "${actual.href}"`); + } + } + + //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')); + } + } + }, + + //MY STANDARDS WIDGET + //My Standards Widget title (active) + { + description: 'Validate My Standards Widget title text, color, and size', + action: async () => { + const multipleChecks = 'My Standards Widget title (active)'; + const element = await driver.findElement(By.css('#mystd-tab')); + + //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 === 'My Standards') { + console.log('Passed: My Standards Widget title matched as expected'); + } else { + errors.push(`Expected: My Standards; Actual: "${elementText}"`); + } + + //font + if (elementFont === `Poppins, sans-serif`) { + console.log('Passed: My Standards Widget title font-family matched as expected'); + } else { + errors.push(`Expected: My Standards Widget title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: My Standards Widget title text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards Widget title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: My Standards Widget title text color matched as expected'); + } else { + errors.push(`Expected: My Standards Widget 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')); + } + } + }, + + //My Standards - Other Available Standards tab title + { + description: 'Validate Other Available Standards tab title text, color, and size', + action: async () => { + const multipleChecks = 'Other Available Standards tab title'; + const element = await driver.findElement(By.css('#availstd-tab')); + + //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 === 'Other Available Standards') { + console.log('Passed: Other Available Standards tab title matched as expected'); + } else { + errors.push(`Expected: "Other Available Standards"; Actual: "${elementText}"`); + } + + //font + if (elementFont === `Poppins, sans-serif`) { + console.log('Passed: Other Available Standards tab title font-family matched as expected'); + } else { + errors.push(`Expected: Other Available Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: Other Available Standards tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Other Available Standards tab title text color matched as expected'); + } else { + errors.push(`Expected: Other Available Standards tab title text color "rgba(182, 186, 181, 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')); + } + } + }, + + //My Standards dropdown + { + description: 'Validate My Standards dropdown list and value', + action: async () => { + const multipleChecks = 'My Standards dropdown list'; + const elementDropdown = await driver.findElement(By.css('#stdparent')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); + + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'United States Standards') { + console.log('Passed: My Standards dropdown text matched as expected'); + } else { + throw new Error(`Expected: My Standards: "United States Standards"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards dropdown font-family matched as expected'); + } else { + errors.push(`Expected: My Standards dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: My Standards dropdown font-size matched as expected'); + } else { + errors.push(`Expected: My Standards dropdown font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: My Standards dropdown color matched as expected'); + } else { + errors.push(`Expected: My Standards dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const expected = [ + 'ACTFL', + 'Australia', + 'California', + 'Canada', + 'Common Core Standards', + 'Creating Org', + 'Demo Client Standards', + 'Demo Standards', + 'New Folder', + 'QA Client Test Frameworks', + 'United States Standards', + 'WIDA' + ]; + + 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: My Standards Dropdown list matched as expected'); + } else { + throw new Error(`Expected: My Standards Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //My Standards - Organization column title + { + description: 'Validate My Standards - Organization column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards - Organization column title' + const element = await driver.findElement(By.css('.table:nth-child(2) th:nth-child(1)')); + + //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 === 'Organization') { + console.log('Passed: My Standards - Organization column title matched as expected'); + } else { + errors.push(`Expected: My Standards - "Organization" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - Organization column title font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: My Standards - Organization column title text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: My Standards - Organization column title text color matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //My Standards - Export column title + { + description: 'Validate My Standards - Export column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards - Export column title'; + const element = await driver.findElement(By.css('.table:nth-child(2) > thead .text-center: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Export') { + console.log('Passed: My Standards - Export column title matched as expected'); + } else { + errors.push(`Expected: My Standards - "Export" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - Export column title font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - Export column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: My Standards - Export column title text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - Export column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: My Standards - Export column title text color matched as expected'); + } else { + errors.push(`Expected: My Standards - Export column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //My Standards - Manage column title + { + description: 'Validate My Standards - Manage column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards - Manage column title'; + const element = await driver.findElement(By.css('.text-center: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Manage') { + console.log('Passed: My Standards - Manage column title matched as expected'); + } else { + errors.push(`Expected: My Standards - "Manage" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - Manage column title font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - Manage column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: My Standards - Manage column title text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - Manage column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: My Standards - Manage column title text color matched as expected'); + } else { + errors.push(`Expected: My Standards Manage column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //My Standards - More Info column title + { + description: 'Validate My Standards - More Info column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards - More Info column title'; + const element = await driver.findElement(By.css('.table-sm > thead .text-center: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'More Info') { + console.log('Passed: My Standards - More Info column title matched as expected'); + } else { + errors.push(`Expected: My Standards - "More Info" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - More Info column title font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - More Info column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: My Standards - More Info column title text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - More Info column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: My Standards - More Info column title text color matched as expected'); + } else { + errors.push(`Expected: My Standards - More Info column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //My Standards - View column title + { + description: 'Validate My Standards - View column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards - View column title'; + const element = await driver.findElement(By.css('thead .text-center: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'View') { + console.log('Passed: My Standards - View column title matched as expected'); + } else { + errors.push(`Expected: My Standards - "View" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - View column title font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - View column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: My Standards - View column title text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - View column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: My Standards - View column title text color matched as expected'); + } else { + errors.push(`Expected: My Standards - View column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //My Standards = Alabama + { + description: 'Validate My Standards - Organization = Alabama Standards text', + action: async () => { + const multipleChecks = 'My Standards - Organization = Alabama'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Alabama') { + console.log("Passed: My Standards - Organization = Alabama text matched as expected"); + } else { + throw new Error(`Expected: My Standards - Organization = "Alabama"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - Organization = Alabama text font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Alabama text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: My Standards - Organization = Alabama text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Alabama text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: My Standards - Organization = Alabama text color matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Alabama text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: My Standards - Organization = Alabama - Export icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Alabama - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: My Standards - Organization = Alabama icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Alabama: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: My Standards - Organization = Alabama - View icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Alabama - View icon not found'); + } + + //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')); + } + } + }, + + //My Standards = Arizona + { + description: 'Validate My Standards - Organization = Arizona Standards text', + action: async () => { + const multipleChecks = 'My Standards - Organization = Arizona'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(2) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Arizona') { + console.log("Passed: My Standards - Organization = Arizona text matched as expected"); + } else { + throw new Error(`Expected: My Standards - Organization = "Arizona"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - Organization = Arizona text font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Arizona text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: My Standards - Organization = Arizona text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Arizona text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: My Standards - Organization = Arizona text color matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Arizona text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: My Standards - Organization = Arizona - Export icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Arizona - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: My Standards - Organization = Arizona icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Arizona: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: My Standards - Organization = Arizona - View icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Arizona - View icon not found'); + } + + //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')); + } + } + }, + + //My Standards = California + { + description: 'Validate My Standards - Organization = California Standards text', + action: async () => { + const multipleChecks = 'My Standards - Organization = California'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(3) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'California') { + console.log("Passed: My Standards - Organization = California text matched as expected"); + } else { + throw new Error(`Expected: My Standards - Organization = "California"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - Organization = California text font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = California text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: My Standards - Organization = California text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = California text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: My Standards - Organization = California text color matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = California text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: My Standards - Organization = California - Export icon is present'); + } else { + errors.push('Expected: My Standards - Organization = California - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: My Standards - Organization = California icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = California: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: My Standards - Organization = California - View icon is present'); + } else { + errors.push('Expected: My Standards - Organization = California - View icon not found'); + } + + //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')); + } + } + }, + + //My Standards = Florida + { + description: 'Validate My Standards - Organization = Florida Standards text', + action: async () => { + const multipleChecks = 'My Standards - Organization = Florida'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(4) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Florida') { + console.log("Passed: My Standards - Organization = Florida text matched as expected"); + } else { + throw new Error(`Expected: My Standards - Organization = "Florida"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - Organization = Florida text font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Florida text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: My Standards - Organization = Florida text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Florida text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: My Standards - Organization = Florida text color matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Florida text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: My Standards - Organization = Florida - Export icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Florida - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: My Standards - Organization = Florida icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Florida: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: My Standards - Organization = Florida - View icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Florida - View icon not found'); + } + + //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')); + } + } + }, + + //My Standards = Georgia + { + description: 'Validate My Standards - Organization = Georgia Standards text', + action: async () => { + const multipleChecks = 'My Standards - Organization = Georgia'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(5) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Georgia') { + console.log("Passed: My Standards - Organization = Georgia text matched as expected"); + } else { + throw new Error(`Expected: My Standards - Organization = "Georgia"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - Organization = Georgia text font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Georgia text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: My Standards - Organization = Georgia text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Georgia text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: My Standards - Organization = Georgia text color matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Georgia text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: My Standards - Organization = Georgia - Export icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Georgia - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: My Standards - Organization = Georgia icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Georgia: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: My Standards - Organization = Georgia - View icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Georgia - View icon not found'); + } + + //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')); + } + } + }, + + //My Standards = Illinois + { + description: 'Validate My Standards - Organization = Illinois Standards text', + action: async () => { + const multipleChecks = 'My Standards - Organization = Illinois'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(6) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Illinois') { + console.log("Passed: My Standards - Organization = Illinois text matched as expected"); + } else { + throw new Error(`Expected: My Standards - Organization = "Illinois"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - Organization = Illinois text font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Illinois text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: My Standards - Organization = Illinois text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Illinois text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: My Standards - Organization = Illinois text color matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Illinois text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: My Standards - Organization = Illinois - Export icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Illinois - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: My Standards - Organization = Illinois icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Illinois: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: My Standards - Organization = Illinois - View icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Illinois - View icon not found'); + } + + //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')); + } + } + }, + + //My Standards = New York + { + description: 'Validate My Standards - Organization = New York Standards text', + action: async () => { + const multipleChecks = 'My Standards - Organization = New York'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(7) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'New York') { + console.log("Passed: My Standards - Organization = New York text matched as expected"); + } else { + throw new Error(`Expected: My Standards - Organization = "New York"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - Organization = New York text font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = New York text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: My Standards - Organization = New York text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = New York text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: My Standards - Organization = New York text color matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = New York text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: My Standards - Organization = New York - Export icon is present'); + } else { + errors.push('Expected: My Standards - Organization = New York - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: My Standards - Organization = New York icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = New York: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: My Standards - Organization = New York - View icon is present'); + } else { + errors.push('Expected: My Standards - Organization = New York - View icon not found'); + } + + //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')); + } + } + }, + + //My Standards = Texas + { + description: 'Validate My Standards - Organization = Texas Standards text', + action: async () => { + const multipleChecks = 'My Standards - Organization = Texas'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(8) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Texas') { + console.log("Passed: My Standards - Organization = Texas text matched as expected"); + } else { + throw new Error(`Expected: My Standards - Organization = "Texas"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - Organization = Texas text font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Texas text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: My Standards - Organization = Texas text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Texas text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: My Standards - Organization = Texas text color matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Texas text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: My Standards - Organization = Texas - Export icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Texas - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: My Standards - Organization = Texas icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Texas: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: My Standards - Organization = Texas - View icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Texas - View icon not found'); + } + + //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')); + } + } + }, + + //My Standards = Washington + { + description: 'Validate My Standards - Organization = Washington Standards text', + action: async () => { + const multipleChecks = 'My Standards - Organization = Washington'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(9) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Washington') { + console.log("Passed: My Standards - Organization = Washington text matched as expected"); + } else { + throw new Error(`Expected: My Standards - Organization = "Washington"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: My Standards - Organization = Washington text font-family matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Washington text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: My Standards - Organization = Washington text font-size matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Washington text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: My Standards - Organization = Washington text color matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Washington text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: My Standards - Organization = Washington - Export icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Washington - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: My Standards - Organization = Washington icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: My Standards - Organization = Washington: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: My Standards - Organization = Washington - View icon is present'); + } else { + errors.push('Expected: My Standards - Organization = Washington - View icon not found'); + } + + //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')); + } + } + }, + + //CORRELATION COVERAGES WIDGET + //Correlation Coverages Widget title + { + description: 'Validate Correlation Coverages Widget title text, color, and size', + action: async () => { + const multipleChecks = 'Correlation Coverages Widget title'; + const element = await driver.findElement(By.css('.dash-gap-card 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 === 'Correlation Coverages') { + console.log('Passed: Correlation Coverages Widget title matched as expected'); + } else { + errors.push(`Expected: Correlation Coverages; Actual: "${elementText}"`); + } + + //font + if (elementFont === `Poppins, sans-serif`) { + console.log('Passed: Correlation Coverages Widget title font-family matched as expected'); + } else { + errors.push(`Expected: Correlation Coverages Widget title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '18px') { + console.log('Passed: Correlation Coverages Widget title text font-size matched as expected'); + } else { + errors.push(`Expected: Correlation Coverages Widget title text font-size "18px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Correlation Coverages Widget title text color matched as expected'); + } else { + errors.push(`Expected: Correlation Coverages Widget 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')); + } + } + }, + + //Filters button + { + description: 'Validate Filters button', + action: async () => { + const multipleChecks = 'Filters button'; + const element = await driver.findElement(By.css('.gap-filters-wrap > .btn')); + const elementIcon = await element.findElement(By.css('.btn-primary > img')); + + //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 === 'Filters') { + console.log('Passed: Filters button text matched as expected'); + } else { + errors.push(`Expected: "${myContentItemTotals}"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Filters button text font matched as expected'); + } else { + errors.push(`Expected: Filters button text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Filters button text font-size matched as expected'); + } else { + errors.push(`Expected: Filters button text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Filters button text color matched as expected'); + } else { + errors.push(`Expected: Filters button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Filters button background color matched as expected'); + } else { + errors.push(`Expected: Filters button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`); + } + + //icon present + if (await elementIcon.isDisplayed()) { + console.log('Passed: Filters button icon was displayed as expected'); + } else { + errors.push('Expected: Filters button icon 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')); + } + } + }, + + //Correlation Coverages Widget sub-title + { + description: 'Validate Correlation Coverages Widget sub-title text, color, and size', + action: async () => { + const multipleChecks = 'Correlation Coverages Widget sub-title'; + const element = await driver.findElement(By.css('.gap-idle-text')); + + //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 === 'Please click the Filters button above to select filters and view Correlation Coverage') { + console.log('Passed: Correlation Coverages Widget sub-title matched as expected'); + } else { + errors.push(`Expected: "Please click the Filters button above to select filters and view Correlation Coverage"; Actual: "${elementText}"`); + } + + //font + if (elementFont === `Poppins, sans-serif`) { + console.log('Passed: Correlation Coverages Widget sub-title font-family matched as expected'); + } else { + errors.push(`Expected: Correlation Coverages Widget sub-title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Correlation Coverages Widget sub-title text font-size matched as expected'); + } else { + errors.push(`Expected: Correlation Coverages Widget sub-title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Correlation Coverages Widget sub-title text color matched as expected'); + } else { + errors.push(`Expected: Correlation Coverages Widget sub-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')); + } + } + }, + + //Correlation Coverages Default Image + { + description: 'Validate Correlation Coverages Default Image', + action: async () => { + const multipleChecks = 'Correlation Coverages Default Image'; + const element = await driver.findElement(By.css('.gap-idle-wrap > img')); + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: Correlation Coverages default image was displayed as expected'); + } else { + errors.push('Expected: Correlation Coverages default image 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')); + } + } + }, + + //SEMANTIC STANDARDS COMPARISON WIDGET + //Scroll to widget Semantic Standards Comparsion widget + { + description: 'Scroll to Semantic Standards Comparison Wiget 2', + action: async () => { + const location = await driver.findElement(By.css('#sscMapPane > p')); + await driver.executeScript("arguments[0].scrollIntoView({block: 'center'});", location); + await driver.sleep(2000); + } + }, + + //Semantic Standards Comparison Widget title + { + description: 'Validate Semantic Standards Comparison Widget title text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.standards-compare 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 = []; + + //Validate text + if (elementText === 'Semantic Standards Comparison') { + console.log('Passed: Semantic Standards Comparison Widget title matched as expected'); + } else { + const message = `Expected: Semantic Standards Comparison; Actual: "${elementText}"`; + errors.push(message); + } + + //font + if (elementFont === `Poppins, sans-serif`) { + console.log('Passed: Semantic Standards Comparison Widget sub-title font-family matched as expected'); + } else { + errors.push(`Expected: Semantic Standards Comparison Widget sub-title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Semantic Standards Comparison Widget title text color matched as expected'); + } else { + const message = `Expected: Semantic Standards Comparison Widget title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '18px') { + console.log('Passed: Semantic Standards Comparison Widget title text font-size matched as expected'); + } else { + const message = `Expected: Semantic Standards Comparison Widget title text font-size "18px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //National Standards tab title, text, and font size (active) + { + description: 'Validate National Standards tab title text, color, and size', + action: async () => { + const element = await driver.findElement(By.css('#sscMap-tab')); + + //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 = []; + + //Validate text + if (elementText === 'National Standards') { + console.log('Passed: National Standards tab title matched as expected'); + } else { + const message = `Expected: National Standards; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: National Standards tab title text font matched as expected'); + } else { + const message = `Expected: National Standards tab title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: National Standards tab title text color matched as expected'); + } else { + const message = `Expected: National Standards tab title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '15px') { + console.log('Passed: National Standards tab title text font-size matched as expected'); + } else { + const message = `Expected: National Standards tab title text font-size "15px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Custom Comparison tab title and color (dimmed) + { + description: 'Validate Custom Comparison tab title, text color, and size', + action: async () => { + const element = await driver.findElement(By.css('#sscFilterLaunch-tab')); + + //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 = []; + + //Validate text + if (elementText === 'Custom Comparison') { + console.log('Passed: Custom Comparison tab title matched as expected'); + } else { + const message = `Expected: "Custom Comparison" tab title; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Custom Comparison tab title text font matched as expected'); + } else { + const message = `Expected: Custom Comparison tab title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color -gray + if (elementColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Custom Comparison tab title color matched as expected'); + } else { + const message = `Expected: Custom Comparison tab title color "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '15px') { + console.log('Passed: Custom Comparison tab title font size matched as expected'); + } else { + const message = `Expected: Custom Comparison tab title font size "15px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Custom Comparison - State Dropdown values + { + description: 'Validate Custom Comparison - State Dropdown values', + action: async () => { + const elementDropdown = await driver.findElement(By.css('#compstate')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); + + const elementValue = await selectedOption.getAttribute('value'); + const elementText = await selectedOption.getText(); + + const options = await elementDropdown.findElements(By.css('option')); + + //Track all errors + const errors = []; + + if (elementValue === '') { + console.log('Passed: Custom Comparison - State Dropdown value Please select a state, matched as expected'); + } else { + throw new Error(`Expected: Custom Comparison - State Dropdown value "Please select a state"; Actual: "${elementText}"`); + } + + const expected = [ + 'Please select a state', + 'Alabama', + 'Arizona', + 'California', + 'Florida', + 'Georgia', + 'Illinois', + 'New York', + 'Texas', + 'Washington' + ]; + 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: Custom Comparison - State Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Custom Comparison - State Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Custom Comparison - State dropdown Go button validation + { + description: 'Validate Go button', + action: async () => { + const multipleChecks = 'Go button'; + const element = await driver.findElement(By.css('#compbtn')); + + //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 === 'Go') { + console.log('Passed: Go button text matched as expected'); + } else { + errors.push(`Expected: "${myContentItemTotals}"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Go button text font matched as expected'); + } else { + errors.push(`Expected: Go button text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Go button text font-size matched as expected'); + } else { + errors.push(`Expected: Go button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Go button text color matched as expected'); + } else { + errors.push(`Expected: Go button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Go button background color matched as expected'); + } else { + errors.push(`Expected: Go 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')); + } + } + }, + + //Semantic Standards Comparison sub-title, text, font, size, and color + { + description: 'Validate Semantic Standards Comparison sub-title text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('#sscMapPane > p')); + + //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 = []; + + //Validate text + if (elementText === 'View semantic comparisons of state standards to national sets') { + console.log('Passed: Semantic Standards Comparison sub-title matched as expected'); + } else { + const message = `Expected: "View semantic comparisons of state standards to national sets"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Semantic Standards Comparison sub-title text font matched as expected'); + } else { + const message = `Expected: Semantic Standards Comparison sub-title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Semantic Standards Comparison sub-title text color matched as expected'); + } else { + const message = `Expected: Semantic Standards Comparison sub-title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '13px') { + console.log('Passed: Semantic Standards Comparison sub-title text font-size matched as expected'); + } else { + const message = `Expected: Semantic Standards Comparison sub-title text font-size "13px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //LATEST STANDARDS UPDATE WIDGET + //Scroll to bottom of page + { + description: 'Scroll to bottom of page', + action: async () => { + await driver.executeScript('window.scrollTo(0, document.body.scrollHeight);'); + await driver.sleep(2000); + } + }, + + + //Latest Standards Update Widget title, text, font, size, and color + { + description: 'Validate Latest Standards Update Widget text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.latest-standards 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 = []; + + //Validate text + if (elementText === 'Latest Standards Updates') { + console.log('Passed: Latest Standards Update Widget title matched as expected'); + } else { + const message = `Expected: "Latest Standards Updates"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update Widget title text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update Widget title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update Widget title text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update Widget title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '18px') { + console.log('Passed: Latest Standards Update Widget title text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update Widget title text font-size "18px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //See More Button + { + description: 'Validate See More button text, size, and color', + action: async () => { + const multipleChecks = 'See More button'; + const element = await driver.findElement(By.linkText('See More')); + const elementIcon = await driver.findElement(By.css('.e-btn:nth-child(1) > .icon-See-More')); + const expectedHref = 'https://correlation.edgate.com/pic/standards-updates.html'; + + //Get text, font, size, and 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 elementBGTextColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'See More') { + console.log('Passed: See More button text matched as expected'); + } else { + errors.push(`Expected: "See More"; Actual: "${elementText}"`); + } + + //href + const actualHref = await element.getAttribute('href'); + if (actualHref && actualHref === expectedHref) { + console.log(`Passed: See More href "${actualHref}" matched as expected`); + } else { + errors.push(`Expected: See More button href to be "${expectedHref}"; but found "${actualHref}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: See More button font matched as expected'); + } else { + errors.push(`Expected: See More button font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: See More button text font-size matched as expected'); + } else { + errors.push(`Expected: See More button text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: See More button text color matched as expected'); + } else { + errors.push(`Expected: See More button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //background color + if (elementBGTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: See More button background color matched as expected'); + } else { + errors.push(`Expected: See More button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementBGTextColor}"`); + } + + //icon + if (await elementIcon.isDisplayed()) { + console.log('Passed: See More button icon was displayed as expected'); + } else { + errors.push('Expected: See More button icon 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')); + } + } + }, + + //Latest Standards Update Update 1 title, text, font, size, and color + { + description: 'Validate Latest Standards Update 1 title, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(1) > h4')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateTitle1) { + console.log('Passed: Latest Standards Update 1 title matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateTitle1}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 1 title text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 1 title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 1 title text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 1 title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '15px') { + console.log('Passed: Latest Standards Update 1 title text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 1 title text font-size "15px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 1 sub-title, text, font, size, and color + { + description: 'Validate Latest Standards Update 1 sub-title, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(1) > p')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateSubTitle1) { + console.log('Passed: Latest Standards Update 1 sub-title matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateSubTitle1}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 1 sub-title text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 1 sub-title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 1 sub-title text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 1 sub-title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '12px') { + console.log('Passed: Latest Standards Update 1 sub-title text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 1 sub-title text font-size "12px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 1 date, text, font, size, and color + { + description: 'Validate Latest Standards Update 1 date, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(1) em')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateDate1) { + console.log('Passed: Latest Standards Update 1 date matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateDate1}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 1 date text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 1 date text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 1 date text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 1 date text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '12px') { + console.log('Passed: Latest Standards Update 1 date text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 1 date text font-size "12px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 2 title, text, font, size, and color + { + description: 'Validate Latest Standards Update 2 title, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(2) > h4')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateTitle2) { + console.log('Passed: Latest Standards Update 2 title matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateTitle2}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 2 title text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 2 title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 2 title text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 2 title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '15px') { + console.log('Passed: Latest Standards Update 2 title text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 2 title text font-size "15px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 2 sub-title, text, font, size, and color + { + description: 'Validate Latest Standards Update 2 sub-title, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(2) > p')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateSubTitle2) { + console.log('Passed: Latest Standards Update 2 sub-title matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateSubTitle2}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 2 sub-title text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 2 sub-title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 2 sub-title text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 2 sub-title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '12px') { + console.log('Passed: Latest Standards Update 2 sub-title text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 2 sub-title text font-size "12px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 2 date, text, font, size, and color + { + description: 'Validate Latest Standards Update 2 date, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(2) em')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateDate2) { + console.log('Passed: Latest Standards Update 2 date matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateDate2}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 2 date text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 2 date text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 2 date text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 2 date text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '12px') { + console.log('Passed: Latest Standards Update 2 date text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 2 date text font-size "12px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 3 title, text, font, size, and color + { + description: 'Validate Latest Standards Update 3 title, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(3) > h4')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateTitle3) { + console.log('Passed: Latest Standards Update 3 title matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateTitle3}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 3 title text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 3 title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 3 title text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 3 title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '15px') { + console.log('Passed: Latest Standards Update 3 title text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 3 title text font-size "15px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 3 sub-title, text, font, size, and color + { + description: 'Validate Latest Standards Update 3 sub-title, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(3) > p')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateSubTitle3) { + console.log('Passed: Latest Standards Update 3 sub-title matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateSubTitle3}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 3 sub-title text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 3 sub-title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 3 sub-title text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 3 sub-title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '12px') { + console.log('Passed: Latest Standards Update 3 sub-title text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 3 sub-title text font-size "12px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 3 date, text, font, size, and color + { + description: 'Validate Latest Standards Update 3 date, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(3) em')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateDate3) { + console.log('Passed: Latest Standards Update 3 date matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateDate3}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 3 date text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 3 date text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 3 date text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 3 date text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '12px') { + console.log('Passed: Latest Standards Update 3 date text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 3 date text font-size "12px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 4 title, text, font, size, and color + { + description: 'Validate Latest Standards Update 4 title, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(4) > h4')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateTitle4) { + console.log('Passed: Latest Standards Update 4 title matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateTitle4}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 4 title text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 4 title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 4 title text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 4 title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '15px') { + console.log('Passed: Latest Standards Update 4 title text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 4 title text font-size "15px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 4 sub-title, text, font, size, and color + { + description: 'Validate Latest Standards Update 4 sub-title, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(4) > p')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateSubTitle4) { + console.log('Passed: Latest Standards Update 4 sub-title matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateSubTitle4}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 4 sub-title text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 4 sub-title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 4 sub-title text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 4 sub-title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '12px') { + console.log('Passed: Latest Standards Update 4 sub-title text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 4 sub-title text font-size "12px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 4 date, text, font, size, and color + { + description: 'Validate Latest Standards Update 4 date, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(4) em')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateDate4) { + console.log('Passed: Latest Standards Update 4 date matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateDate4}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 4 date text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 4 date text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 4 date text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 4 date text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '12px') { + console.log('Passed: Latest Standards Update 4 date text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 4 date text font-size "12px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 5 title, text, font, size, and color + { + description: 'Validate Latest Standards Update 5 title, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(5) > h4')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateTitle5) { + console.log('Passed: Latest Standards Update 5 title matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateTitle5}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 5 title text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 5 title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 5 title text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 5 title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '15px') { + console.log('Passed: Latest Standards Update 5 title text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 5 title text font-size "15px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 5 sub-title, text, font, size, and color + { + description: 'Validate Latest Standards Update 5 sub-title, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(5) > p')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateSubTitle5) { + console.log('Passed: Latest Standards Update 5 sub-title matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateSubTitle5}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 5 sub-title text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 5 sub-title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 5 sub-title text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 5 sub-title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '12px') { + console.log('Passed: Latest Standards Update 5 sub-title text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 5 sub-title text font-size "12px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Latest Standards Update Update 5 date, text, font, size, and color + { + description: 'Validate Latest Standards Update 5 date, text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('.mb-4:nth-child(5) em')); + + //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 = []; + + //Validate text + if (elementText === latestStandardsUpdateDate5) { + console.log('Passed: Latest Standards Update 5 date matched as expected'); + } else { + const message = `Expected: "${latestStandardsUpdateDate5}"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Latest Standards Update 5 date text font matched as expected'); + } else { + const message = `Expected: Latest Standards Update 5 date text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Latest Standards Update 5 date text color matched as expected'); + } else { + const message = `Expected: Latest Standards Update 5 date text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '12px') { + console.log('Passed: Latest Standards Update 5 date text font-size matched as expected'); + } else { + const message = `Expected: Latest Standards Update 5 date text font-size "12px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //FAVORITE REPORTS WIDGET + //Favorite Reports Widget title, text, font, size, and color + { + description: 'Validate Favorite Reports Widget text, font, size, and color', + action: async () => { + const element = await driver.findElement(By.css('h2: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'); + + //Track all errors + const errors = []; + + //Validate text + if (elementText === 'Favorite Reports') { + console.log('Passed: Favorite Reports Widget title matched as expected'); + } else { + const message = `Expected: "Favorite Reports"; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Favorite Reports Widget title text font matched as expected'); + } else { + const message = `Expected: Favorite Reports Widget title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Favorite Reports Widget title text color matched as expected'); + } else { + const message = `Expected: Favorite Reports Widget title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + errors.push(message); + } + + //Validate font size + if (elementSize === '18px') { + console.log('Passed: Favorite Reports Widget title text font-size matched as expected'); + } else { + const message = `Expected: Favorite Reports Widget title text font-size "18px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Manage Favorites Button + { + description: 'Validate Manage Favorite button title text, size, and color', + action: async () => { + const multipleChecks = 'Manage Favorites button'; + const element = await driver.findElement(By.linkText('Manage Favorites')); + const elementIcon = await driver.findElement(By.css('.icon-Manage-Favorites')); + const expectedHref = 'https://correlation.edgate.com/exact/add_favorite_report.php'; + + //Get text, font, size, and 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 elementBGTextColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Manage Favorites') { + console.log('Passed: Manage Favorites button text matched as expected'); + } else { + errors.push(`Expected: "Manage Favorites"; Actual: "${elementText}"`); + } + + //href + const actualHref = await element.getAttribute('href'); + if (actualHref && actualHref === expectedHref) { + console.log(`Passed: Manage Favorites href "${actualHref}" matched as expected`); + } else { + errors.push(`Expected: Manage Favorites button href to be "${expectedHref}"; but found "${actualHref}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Manage Favorites button font matched as expected'); + } else { + errors.push(`Expected: Manage Favorites button font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Manage Favorites button text font-size matched as expected'); + } else { + errors.push(`Expected: Manage Favorites button text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Manage Favorites button text color matched as expected'); + } else { + errors.push(`Expected: Manage Favorites button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //background color + if (elementBGTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Manage Favorites button background color matched as expected'); + } else { + errors.push(`Expected: Manage Favorites button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementBGTextColor}"`); + } + + //icon + if (await elementIcon.isDisplayed()) { + console.log('Passed: Manage Favorites button icon was displayed as expected'); + } else { + errors.push('Expected: Manage Favorites button icon 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')); + } + } + }, + + //Favorite Reports - Format column title + { + description: 'Validate Favorite Reports - Format column title, text, and font size', + action: async () => { + const multipleChecks = 'Favorite Reports - Format column title' + const element = await driver.findElement(By.css('.table:nth-child(1) th:nth-child(1)')); + + //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 === 'Format') { + console.log('Passed: Favorite Reports - Format column title matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - "Format" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Favorite Reports - Format column title font-family matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Format column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Favorite Reports - Format column title text font-size matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Format column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Favorite Reports - Format column title text color matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Format column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Favorite Reports - Report column title + { + description: 'Validate Favorite Reports - Report column title, text, and font size', + action: async () => { + const multipleChecks = 'Favorite Reports - Report column title' + const element = await driver.findElement(By.css('.table:nth-child(1) th: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Report') { + console.log('Passed: Favorite Reports - Report column title matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - "Report" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Favorite Reports - Report column title font-family matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Favorite Reports - Report column title text font-size matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Favorite Reports - Report column title text color matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Favorite Reports - Run column title + { + description: 'Validate Favorite Reports - Run column title, text, and font size', + action: async () => { + const multipleChecks = 'Favorite Reports - Run column title' + const element = await driver.findElement(By.css('.table:nth-child(1) th: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Run') { + console.log('Passed: Favorite Reports - Run column title matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - "Run" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Favorite Reports - Run column title font-family matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Run column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Favorite Reports - Run column title text font-size matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Run column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Favorite Reports - Run column title text color matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Run column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Favorite Reports - Download column title + { + description: 'Validate Favorite Reports - Download column title, text, and font size', + action: async () => { + const multipleChecks = 'Favorite Reports - Download column title' + const element = await driver.findElement(By.css('.table:nth-child(1) > thead .text-center')); + + //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 === 'Download') { + console.log('Passed: Favorite Reports - Download column title matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - "Download" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Favorite Reports - Download column title font-family matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Download column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Favorite Reports - Download column title text font-size matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Download column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Favorite Reports - Download column title text color matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Download column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //XLS button + { + description: 'Validate XLS button', + action: async () => { + const multipleChecks = 'XLS button'; + const element = await driver.findElement(By.css('td:nth-child(1) > .xls')); + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: XLS button was displayed as expected'); + } else { + errors.push('Expected: XLS button 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')); + } + } + }, + + //Favorite Reports - Report 1 column data + { + description: 'Validate Favorite Reports - Report column 1 data, text, and font size', + action: async () => { + const multipleChecks = 'Favorite Reports - Report column 1 data'; + const element = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(1) > 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'SoDontLook') { + console.log('Passed: Favorite Reports - Report column 1 data matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report = "SoDontLook" column 1 data; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Favorite Reports - Report column 1 data font-family matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column 1 data font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Favorite Reports - Report column 1 data font-size matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column 1 data font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Favorite Reports - Report column 1 data text color matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column 1 data text color "rgba(33, 37, 41, 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')); + } + } + }, + + //Favorite Reports - Run column 1 data + { + description: 'Validate Favorite Reports - Run column 1 data', + action: async () => { + const multipleChecks = 'Favorite Reports - Run column 1 data'; + const link = await driver.findElement(By.css('tr:nth-child(1) a.reportrun')); + const element = await link.findElement(By.css('img')); + const expectedPath = '/exact/runreport.php'; + const expectedParams = { + strReportFilename: 'ThisBeMyFile', + reportTitle: 'SoDontLook', + format: '3' + }; + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: Run icon was displayed as expected'); + } else { + errors.push('Expected: Run icon was not displayed'); + } + + //href path + const actualHref = await link.getAttribute('href'); + const url = new URL(actualHref); + if (url.pathname === expectedPath) { + console.log(`Passed: Run icon 1 href path "${url.pathname}" matched as expected`); + } else { + errors.push(`Expected: Run icon 1 href path to be "${expectedPath}"; but found "${url.pathname}"`); + } + + //href query parameters + for (const [key, expectedValue] of Object.entries(expectedParams)) { + const actualValue = url.searchParams.get(key); + if (actualValue === expectedValue) { + console.log(`Passed: Run icon 1 href param "${key}" = "${actualValue}" as expected`); + } else { + errors.push(`Expected: Run icon 1 href param "${key}" to be "${expectedValue}"; but found "${actualValue}"`); + } + } + + //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')); + } + } + }, + + //Favorite Reports - Download column 1 data + { + description: 'Validate Favorite Reports - Download column 1 data', + action: async () => { + const multipleChecks = 'Favorite Reports - Download column 1 data'; + const link = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(1) > .text-center a')); + const element = await link.findElement(By.css('img')); + const expectedHref = 'https://correlation.edgate.com/exact/reports/exact_juan/ThisBeMyFile.xls'; + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: Download icon 1 was displayed as expected'); + } else { + errors.push('Expected: Download icon 1 was not displayed'); + } + + //href + const actualHref = await link.getAttribute('href'); + if (actualHref && actualHref.endsWith(expectedHref)) { + console.log(`Passed: Download icon 1 href "${actualHref}" matched expected`); + } else { + errors.push(`Expected: Download icon 1 href to end with "${expectedHref}"; but found "${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')); + } + } + }, + + //doc button + { + description: 'Validate doc button', + action: async () => { + const multipleChecks = 'doc button'; + const element = await driver.findElement(By.css('td:nth-child(1) > .doc')); + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: doc button was displayed as expected'); + } else { + errors.push('Expected: doc button 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')); + } + } + }, + + //Favorite Reports - Report 2 column data + { + description: 'Validate Favorite Reports - Report column 2 data, text, and font size', + action: async () => { + const multipleChecks = 'Favorite Reports - Report column 2 data'; + const element = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(2) > 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Test Inc.') { + console.log('Passed: Favorite Reports - Report column 2 data matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report = "Test Inc." column 2 data; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Favorite Reports - Report column 2 data font-family matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column 2 data font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Favorite Reports - Report column 2 data font-size matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column 2 data font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Favorite Reports - Report column 2 data text color matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column 2 data text color "rgba(33, 37, 41, 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')); + } + } + }, + + //Favorite Reports - Run column 2 data + { + description: 'Validate Favorite Reports - Run column 2 data', + action: async () => { + const multipleChecks = 'Favorite Reports - Run column 2 data'; + const link = await driver.findElement(By.css('tr:nth-child(2) a.reportrun')); + const element = await link.findElement(By.css('img')); + const expectedPath = '/exact/runreport.php'; + const expectedParams = { + strReportFilename: 'WordToYa', + reportTitle: 'Test Inc.', + format: '2' + }; + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: Run icon 2 was displayed as expected'); + } else { + errors.push('Expected: Run icon 2 was not displayed'); + } + + //href path + const actualHref = await link.getAttribute('href'); + const url = new URL(actualHref); + if (url.pathname === expectedPath) { + console.log(`Passed: Run icon 2 href path "${url.pathname}" matched as expected`); + } else { + errors.push(`Expected: Run icon 2 href path to be "${expectedPath}"; but found "${url.pathname}"`); + } + + //href query parameters + for (const [key, expectedValue] of Object.entries(expectedParams)) { + const actualValue = url.searchParams.get(key); + if (actualValue === expectedValue) { + console.log(`Passed: Run icon 2 href param "${key}" = "${actualValue}" as expected`); + } else { + errors.push(`Expected: Run icon 2 href param "${key}" to be "${expectedValue}"; but found "${actualValue}"`); + } + } + + //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')); + } + } + }, + + //Favorite Reports - Download column 2 data + { + description: 'Validate Favorite Reports - Download column 2 data', + action: async () => { + const multipleChecks = 'Favorite Reports - Download column 2 data'; + const link = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(2) > .text-center a')); + const element = await link.findElement(By.css('img')); + const expectedHref = '/exact/reports/exact_juan/WordToYa.doc'; + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: Download icon 2 was displayed as expected'); + } else { + errors.push('Expected: Download icon 2 was not displayed'); + } + + //href + const actualHref = await link.getAttribute('href'); + if (actualHref && actualHref.endsWith(expectedHref)) { + console.log(`Passed: Download icon 2 href "${actualHref}" matched expected`); + } else { + errors.push(`Expected: Download icon 2 href to end with "${expectedHref}"; but found "${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')); + } + } + }, + + //pdf button + { + description: 'Validate pdf button', + action: async () => { + const multipleChecks = 'pdf button'; + const element = await driver.findElement(By.css('td:nth-child(1) > .pdf')); + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: pdf button was displayed as expected'); + } else { + errors.push('Expected: pdf button 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')); + } + } + }, + + //Favorite Reports - Report 3 column data + { + description: 'Validate Favorite Reports - Report column 3 data, text, and font size', + action: async () => { + const multipleChecks = 'Favorite Reports - Report column 3 data'; + const element = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(3) > 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'What Eves') { + console.log('Passed: Favorite Reports - Report column 3 data matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report = "What Eves" column 3 data; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Favorite Reports - Report column 3 data font-family matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column 3 data font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Favorite Reports - Report column 3 data font-size matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column 3 data font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Favorite Reports - Report column 3 data text color matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column 3 data text color "rgba(33, 37, 41, 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')); + } + } + }, + + //Favorite Reports - Run column 3 data + { + description: 'Validate Favorite Reports - Run column 3 data', + action: async () => { + const multipleChecks = 'Favorite Reports - Run column 3 data'; + const link = await driver.findElement(By.css('tr:nth-child(3 ) a.reportrun')); + const element = await link.findElement(By.css('img')); + const expectedPath = '/exact/runreport.php'; + const expectedParams = { + strReportFilename: 'IDontThinkSo', + reportTitle: 'What Eves', + format: '4' + }; + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: Run icon 3 was displayed as expected'); + } else { + errors.push('Expected: Run icon 3 was not displayed'); + } + + //href path + const actualHref = await link.getAttribute('href'); + const url = new URL(actualHref); + if (url.pathname === expectedPath) { + console.log(`Passed: Run icon 3 href path "${url.pathname}" matched as expected`); + } else { + errors.push(`Expected: Run icon 3 href path to be "${expectedPath}"; but found "${url.pathname}"`); + } + + //href query parameters + for (const [key, expectedValue] of Object.entries(expectedParams)) { + const actualValue = url.searchParams.get(key); + if (actualValue === expectedValue) { + console.log(`Passed: Run icon 3 href param "${key}" = "${actualValue}" as expected`); + } else { + errors.push(`Expected: Run icon 3 href param "${key}" to be "${expectedValue}"; but found "${actualValue}"`); + } + } + + //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')); + } + } + }, + + //Favorite Reports - Download column 3 data + { + description: 'Validate Favorite Reports - Download column 3 data', + action: async () => { + const multipleChecks = 'Favorite Reports - Download column 3 data'; + const link = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(3) > .text-center a')); + const element = await link.findElement(By.css('img')); + const expectedHref = '/exact/reports/exact_juan/IDontThinkSo.pdf'; + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: Download icon 3 was displayed as expected'); + } else { + errors.push('Expected: Download icon 3 was not displayed'); + } + + //href + const actualHref = await link.getAttribute('href'); + if (actualHref && actualHref.endsWith(expectedHref)) { + console.log(`Passed: Download icon 3 href "${actualHref}" matched expected`); + } else { + errors.push(`Expected: Download icon 3 href to end with "${expectedHref}"; but found "${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')); + } + } + }, + + //html button + { + description: 'Validate html button', + action: async () => { + const multipleChecks = 'html button'; + const element = await driver.findElement(By.css('td:nth-child(1) > .html')); + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: html button was displayed as expected'); + } else { + errors.push('Expected: html button 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')); + } + } + }, + + //Favorite Reports - Report 4 column data + { + description: 'Validate Favorite Reports - Report column 4 data, text, and font size', + action: async () => { + const multipleChecks = 'Favorite Reports - Report column 4 data'; + const element = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(4) > 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Comparing UI icons') { + console.log('Passed: Favorite Reports - Report column 4 data matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report = "Comparing UI icons" column 4 data; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Favorite Reports - Report column 4 data font-family matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column 4 data font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Favorite Reports - Report column 4 data font-size matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column 4 data font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Favorite Reports - Report column 4 data text color matched as expected'); + } else { + errors.push(`Expected: Favorite Reports - Report column 4 data text color "rgba(33, 37, 41, 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')); + } + } + }, + + //Favorite Reports - Run column 4 data + { + description: 'Validate Favorite Reports - Run column 4 data', + action: async () => { + const multipleChecks = 'Favorite Reports - Run column 4 data'; + const link = await driver.findElement(By.css('tr:nth-child(4 ) a.reportrun')); + const element = await link.findElement(By.css('img')); + const expectedPath = '/exact/runreport.php'; + const expectedParams = { + strReportFilename: 'Checking', + reportTitle: 'Comparing UI icons', + format: '1' + }; + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: Run icon 4 was displayed as expected'); + } else { + errors.push('Expected: Run icon 4 was not displayed'); + } + + //href path + const actualHref = await link.getAttribute('href'); + const url = new URL(actualHref); + if (url.pathname === expectedPath) { + console.log(`Passed: Run icon 4 href path "${url.pathname}" matched as expected`); + } else { + errors.push(`Expected: Run icon 4 href path to be "${expectedPath}"; but found "${url.pathname}"`); + } + + //href query parameters + for (const [key, expectedValue] of Object.entries(expectedParams)) { + const actualValue = url.searchParams.get(key); + if (actualValue === expectedValue) { + console.log(`Passed: Run icon 4 href param "${key}" = "${actualValue}" as expected`); + } else { + errors.push(`Expected: Run icon 4 href param "${key}" to be "${expectedValue}"; but found "${actualValue}"`); + } + } + + //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')); + } + } + }, + + //Favorite Reports - Download column 4 data + { + description: 'Validate Favorite Reports - Download column 4 data', + action: async () => { + const multipleChecks = 'Favorite Reports - Download column 4 data'; + const link = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(4) > .text-center a')); + const element = await link.findElement(By.css('img')); + const expectedHref = '/exact/reports/exact_juan/Checking.html'; + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: Download icon 4 was displayed as expected'); + } else { + errors.push('Expected: Download icon 4 was not displayed'); + } + + //href + const actualHref = await link.getAttribute('href'); + if (actualHref && actualHref.endsWith(expectedHref)) { + console.log(`Passed: Download icon 4 href "${actualHref}" matched expected`); + } else { + errors.push(`Expected: Download icon 4 href to end with "${expectedHref}"; but found "${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')); + } + } + }, + + //FOOTER + //EdGate Footer Logo + { + description: 'Validate EdGate Footer Logo', + action: async () => { + const multipleChecks = 'EdGate Footer Logo'; + const element = await driver.findElement(By.css('.pull-right img')); + const expectedSrc = 'https://correlation.edgate.com/exact/images/edgate_logo_new.png'; + + //Track all errors + const errors = []; + + //icon present + if (await element.isDisplayed()) { + console.log('Passed: EdGate logo was displayed as expected'); + } else { + errors.push('Expected: EdGate logo was not displayed'); + } + + //image src + const actualSrc = await element.getAttribute('src'); + if (actualSrc && actualSrc === expectedSrc) { + console.log(`Passed: EdGate logo src "${actualSrc}" matched expected`); + } else { + errors.push(`Expected: EdGate logo src: "${expectedSrc}"; but found "${actualSrc}"`); + } + + //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', 'dashboard'); + + const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`; + const screenshotPath = path.join(dir, screenshotFileName); + fs.writeFileSync(screenshotPath, screenshot, 'base64'); + return screenshotPath; +}; + +const clearOldResults = () => { + //Remove old screenshots + const screenshotDir = path.join('screenshots', 'dashboard'); + 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'); + } +}; + +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 { + await step.action(); + worksheet = logStep( + worksheet, + step.description, + 'Passed', + stepIndex, + timestamp, + null + ); + + } catch (error) { + 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: DASHBOARD (ExACT_dashboard); 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 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, 'dashboard.xlsx'); +} finally { + await driver.quit(); +} + })(); +} + +export default ExACT_dashboard; diff --git a/tests/ExACT_dashboardMyContent.js b/tests/ExACT_dashboardMyContent.js index 1ff9b68..ea7fd5b 100644 --- a/tests/ExACT_dashboardMyContent.js +++ b/tests/ExACT_dashboardMyContent.js @@ -1,180 +1,2676 @@ -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'; +import { brotliCompress } from 'zlib'; const ExACT_dashboardMyContent = (req, res) => { - res.send('

ExACT Automated Test Script - Dashboard - My Content Widget(ExACT_dashboardMyContent): Initiated

'); + res.send('

ExACT Automated Test Script: DASHBOARD - My Content Widget (ExACT_dashboardMyContent) | 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 -const createContentSetName = 'Automated - QA Content Set - To be deleted'; +const createContentSetName = 'Automated Algebra Content Set - TO BE DELETED'; 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('------------->| EDIT ITEM |<-------------'); + 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: 'Validate 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}"`); - } - console.log('Passed: Dashboard title matched as expected'); - } - }, + const multipleChecks = 'Dashboard title'; + const element = await driver.findElement(By.css('.e-heading')); - //Dashboard title text color -dark blue - { - description: 'Validate dashboard title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.e-heading')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Dashboard title text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Dashboard title text color matched as expected'); - } - }, + //Get text, font, size, and 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'); - //Dashboard title text font size - { - description: 'Validate dashboard title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.e-heading')).getCssValue('font-size'); - if (elementStyle !== '32px') { - throw new Error(`Expected: Dashboard title text font-size did not match; Actual: "${elementStyle}"`); + //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-family + if (elementTextFont === `"DM Serif Display", serif`) { + console.log('Passed: Dashboard title font matched as expected'); + } else { + errors.push(`Expected: Dashboard title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '32px') { + console.log('Passed: Dashboard title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard title text font-size "32px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === '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: "${elementTextColor}"`); + } + + //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 text font-size matched as expected'); } }, //MY CONTENT WIDGET + //Dashboard My Content Widget title { - description: 'Validate dashboard My Content widget title', + description: 'Validate My Content widget title text, color, and size', action: async () => { - const elementText = await driver.findElement(By.css('.h-100 h2:nth-child(2)')).getText(); - if (elementText !== 'My Content') { - throw new Error(`Expected: "My Content"; Actual: "${elementText}"`); + const multipleChecks = 'My Content widget title'; + const element = await driver.findElement(By.css('.h-100 h2:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'My Content') { + console.log('Passed: My Content widget title text matched as expected'); + } else { + errors.push(`Expected: "My Content"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: My Content widget title font matched as expected'); + } else { + errors.push(`Expected: My Content widget title font "Poppins, sans-serif", serif; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '18px') { + console.log('Passed: My Content widget title text font-size matched as expected'); + } else { + errors.push(`Expected: My Content widget title text font-size "18px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: My Content widget title text color matched as expected'); + } else { + errors.push(`Expected: My Content widget title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 - My Content Widget title matched as expected'); } }, - //Dashboard My Content Widget title text color -dark blue + //My Content total item Count (SPECIAL CASE: with button) { - description: 'Validate dashboard My Content widget title text color', + description: 'Validate My Content total item count', action: async () => { - const elementStyle = await driver.findElement(By.css('.h-100 h2:nth-child(2)')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Dashboard - My Content Widget title text color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'My Content total item count'; + const element = await driver.findElement(By.css('#badge_content_total')); + + //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 === '3415 items') { + console.log('Passed: Total item count button text matched as expected'); + } else { + errors.push(`Expected: "3415 items"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Total item count button text font matched as expected'); + } else { + errors.push(`Expected: Total item count button text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13.5px') { + console.log('Passed: Total item count button text font-size matched as expected'); + } else { + errors.push(`Expected: Total item count button text font-size "13.5px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Total item count button text color matched as expected'); + } else { + errors.push(`Expected: Total item count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Total item count button background color matched as expected'); + } else { + errors.push(`Expected: Total item count button background color: "rgba(40, 39, 90, 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')); } - console.log('Passed: Dashboard - My Content Widget title text color matched as expected'); } }, - //Dashboard My Content Widget title text font size + //NEXT ACTION + { + description: 'Click My Content Items Count button', + action: async () => { + await driver.findElement(By.css('#content_total')).click(); + console.log('----->| NEXT ACTION: Clicked Total items count button'); + await driver.sleep(2000); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.content_modal_title')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Modal did not become visible within 20 seconds'); + + console.log('Passed: DIV loaded successfully'); + } + }, + + //MY CONTENT TOTALS DIV + + //Dashboard My Content DIV { - description: 'Validate dashboard My Content widget title text font size', + description: 'Validate My Content Totals DIV title text, color, and size', action: async () => { - const elementStyle = await driver.findElement(By.css('.h-100 h2:nth-child(2)')).getCssValue('font-size'); - if (elementStyle !== '18px') { - throw new Error(`Expected: Dashboard - My Content Widget title text font-size did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'My Content Totals DIV'; + const element = await driver.findElement(By.css('.content_modal_title')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'My Content Totals') { + console.log('Passed: My Content Totals DIV title text matched as expected'); + } else { + errors.push(`Expected: DIV title: "My Content Totals"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: My Content Totals DIV title font matched as expected'); + } else { + errors.push(`Expected: My Content Totals DIV title font "Poppins, sans-serif", serif; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '18px') { + console.log('Passed: My Content Totals DIV title text font-size matched as expected'); + } else { + errors.push(`Expected: My Content Totals DIVt title text font-size "18px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: My Content Totals DIV title text color matched as expected'); + } else { + errors.push(`Expected:My Content Totals DIV title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 - My Content Widget title text font-size matched as expected'); } }, - //Dashboard My Content Item Count + //Close icon { - description: 'Validate Dashboard My Content Item Count', + description: 'Validate DIV X icon color', action: async () => { - const elementText = await driver.findElement(By.css('#badge_content_total')).getText(); - if (elementText !== '3552 items') { - throw new Error(`Expected: "3552 items"; Actual: "${elementText}"`); + const elementStyle = await driver.findElement(By.css('.ready-content span')).getCssValue('color'); + if (elementStyle === 'rgba(246, 60, 40, 1)') { + console.log('Passed: My Content Totals DIV X icon color matched as expected'); + } else { + throw new Error(`Expected: My Content Totals DIV X icon color did not match; Actual: "${elementStyle}"`); } - console.log('Passed: Dashboard - My Content Item Count matched as expected'); } }, - //Dashboard My Content Item Count button color -dark blue + //My Content Totals DIV - Total Items { - description: 'Validate Dashboard My Content Item Count button color', + description: 'Validate My Content Totals DIV - Total Items', action: async () => { - const elementStyle = await driver.findElement(By.css('#badge_content_total')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Dashboard - My Content Item Count button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'My Content Total Item count'; + const element = await driver.findElement(By.css('#total > p')); + const elementCount = await driver.findElement(By.css('#total > b')); + + //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'); + + //Count text, text font, text size, text color + const elementTotalText = await elementCount.getText(''); + const elementTotalTextFont = await elementCount.getCssValue('font-family'); + const elementTotalTextSize = await elementCount.getCssValue('font-size'); + const elementTotalTextColor = await elementCount.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Total Items') { + console.log('Passed: Total Items label matched as expected'); + } else { + errors.push(`Expected: "Total Items"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins") { + console.log('Passed: Total Items text font matched as expected'); + } else { + errors.push(`Expected: Totals Items text font "Poppins"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Total Items text font-size matched as expected'); + } else { + errors.push(`Expected: Totals Items text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Total Items label text color matched as expected'); + } else { + errors.push(`Expected: Totals Items text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(238, 238, 242, 1)') { + console.log('Passed: Total Items button background color matched as expected'); + } else { + errors.push(`Expected: Total Items button background color: "rgba(238, 238, 242, 1)"; Actual: "${elementButtonColor}"`); + } + + //Item count + //text + if (elementTotalText === '3415') { + console.log('Passed: Total Items count label matched as expected'); + } else { + errors.push(`Expected: Total Items: "3415"; Actual: "${elementTotalText}"`); + } + + //font-family + if (elementTotalTextFont === "Poppins, sans-serif") { + console.log('Passed: Total Items count text font matched as expected'); + } else { + errors.push(`Expected: Totals Items count text font "Poppins, sans-serif"; Actual: ${elementTotalTextFont}`); + } + + //font size + if (elementTotalTextSize === '36px') { + console.log('Passed: Total Items text font-size matched as expected'); + } else { + errors.push(`Expected: Totals Items count text font-size "36px"; Actual: "${elementTotalTextSize}"`); + } + + //color + if (elementTotalTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Total Items label text color matched as expected'); + } else { + errors.push(`Expected: Totals Items count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTotalTextColor}"`); + } + + //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 - My Content Item Count button color matched as expected'); } }, - - //Dashboard My Content Item Count text color -white + + //My Content Totals DIV - Unique Titles { - description: 'Validate Dashboard My Content Item Count font color', + description: 'Validate My Content Totals DIV - Unique Titles', action: async () => { - const elementStyle = await driver.findElement(By.css('#badge_content_total')).getCssValue('color'); - if (elementStyle !== 'rgba(255, 255, 255, 1)') { - throw new Error(`Expected: Dashboard - My Content Item Count font color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'My Content Unique Titles count'; + const element = await driver.findElement(By.css('#total_titles > p')); + const elementCount = await driver.findElement(By.css('#total_titles > b')); + + //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'); + + //Count text, text font, text size, text color + const elementTotalText = await elementCount.getText(''); + const elementTotalTextFont = await elementCount.getCssValue('font-family'); + const elementTotalTextSize = await elementCount.getCssValue('font-size'); + const elementTotalTextColor = await elementCount.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Unique Titles') { + console.log('Passed: Unique Titles label matched as expected'); + } else { + errors.push(`Expected: "Unique Titles"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins") { + console.log('Passed: Unique Titles label text font matched as expected'); + } else { + errors.push(`Expected: Unique Titles text font "Poppins"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Unique Titles text font-size matched as expected'); + } else { + errors.push(`Expected: Unique Titles text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Unique Titles label text color matched as expected'); + } else { + errors.push(`Expected: Unique Titles text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(238, 238, 242, 1)') { + console.log('Passed: Unique Titles button background color matched as expected'); + } else { + errors.push(`Expected: Unique Titles button background color: "rgba(238, 238, 242, 1)"; Actual: "${elementButtonColor}"`); + } + + //Item count + //text + if (elementTotalText === '3230') { + console.log('Passed: Unique Titles count label matched as expected'); + } else { + errors.push(`Expected: Unique Titles: "3230"; Actual: "${elementTotalText}"`); + } + + //font-family + if (elementTotalTextFont === "Poppins, sans-serif") { + console.log('Passed: Unique Titles count label text font matched as expected'); + } else { + errors.push(`Expected: Unique Titles count text font "Poppins, sans-serif"; Actual: ${elementTotalTextFont}`); + } + + //font size + if (elementTotalTextSize === '36px') { + console.log('Passed: Unique Titles text font-size matched as expected'); + } else { + errors.push(`Expected: Unique Titles count text font-size "36px"; Actual: "${elementTotalTextSize}"`); + } + + //color + if (elementTotalTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Unique Titles label text color matched as expected'); + } else { + errors.push(`Expected: Unique Titles count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTotalTextColor}"`); + } + + //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 - My Content Item Count font color matched as expected'); } }, - - //Dashboard My Content Item Count text font size + + //My Content Totals DIV - Unique IDs { - description: 'Validate Dashboard My Content Item count text font size', + description: 'Validate My Content Totals DIV - Unique IDs', action: async () => { - const elementStyle = await driver.findElement(By.css('#badge_content_total')).getCssValue('font-size'); - if (elementStyle !== '13.5px') { - throw new Error(`Expected: Dashboard - Dashboard My Content Item count text font-size did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'My Content Unique IDs count'; + const element = await driver.findElement(By.css('#total_pubtotalids > p')); + const elementCount = await driver.findElement(By.css('#total_pubtotalids > b')); + + //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'); + + //Count text, text font, text size, text color + const elementTotalText = await elementCount.getText(''); + const elementTotalTextFont = await elementCount.getCssValue('font-family'); + const elementTotalTextSize = await elementCount.getCssValue('font-size'); + const elementTotalTextColor = await elementCount.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Unique IDs') { + console.log('Passed: Unique IDs label matched as expected'); + } else { + errors.push(`Expected: "Unique IDs"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins") { + console.log('Passed: Unique IDs label text font matched as expected'); + } else { + errors.push(`Expected: Unique IDs text font "Poppins"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Unique IDs text font-size matched as expected'); + } else { + errors.push(`Expected: Unique IDs text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Unique IDs label text color matched as expected'); + } else { + errors.push(`Expected: Unique IDs text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(238, 238, 242, 1)') { + console.log('Passed: Unique IDs button background color matched as expected'); + } else { + errors.push(`Expected: Unique IDs button background color: "rgba(238, 238, 242, 1)"; Actual: "${elementButtonColor}"`); + } + + //Item count + //text + if (elementTotalText === '3264') { + console.log('Passed: Unique IDs count label matched as expected'); + } else { + errors.push(`Expected: Unique IDs: "3264"; Actual: "${elementTotalText}"`); + } + + //font-family + if (elementTotalTextFont === "Poppins, sans-serif") { + console.log('Passed: Unique IDs count label text font matched as expected'); + } else { + errors.push(`Expected: Unique IDs count text font "Poppins, sans-serif"; Actual: ${elementTotalTextFont}`); + } + + //font size + if (elementTotalTextSize === '36px') { + console.log('Passed: Unique IDs text font-size matched as expected'); + } else { + errors.push(`Expected: Unique IDs count text font-size "36px"; Actual: "${elementTotalTextSize}"`); + } + + //color + if (elementTotalTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Unique IDs label text color matched as expected'); + } else { + errors.push(`Expected: Unique IDs count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTotalTextColor}"`); + } + + //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 - Dashboard My Content Item count text font-size matched as expected'); } }, - //Ellipsis icon color -dark blue + //My Content Totals DIV - Content Set column header + { + description: 'Validate My Content Totals DIV - Content Set column header', + action: async () => { + const multipleChecks = 'Content Set column headers'; + const element = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set') { + console.log('Passed: Content Set column header matched as expected'); + } else { + errors.push(`Expected: Column header: "Content Set"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Content Set column header text font matched as expected'); + } else { + errors.push(`Expected: Content Set column header text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '10px') { + console.log('Passed: Content Set column header text font-size matched as expected'); + } else { + errors.push(`Expected: Content Set column header text font-size "10px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content Set column header text color matched as expected'); + } else { + errors.push(`Expected: Content Set column header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Total Items column header + { + description: 'Validate My Content Totals DIV - Total Items column header', + action: async () => { + const multipleChecks = 'Total Items column headers'; + const element = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Total Items') { + console.log('Passed: Total Items column header matched as expected'); + } else { + errors.push(`Expected: Column header: "Total Items"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Total Items column header text font matched as expected'); + } else { + errors.push(`Expected: Total Items column header text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '10px') { + console.log('Passed: Total Items column header text font-size matched as expected'); + } else { + errors.push(`Expected: Total Items column header text font-size "10px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Total Items column header text color matched as expected'); + } else { + errors.push(`Expected: Total Items column header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Unique Titles column header + { + description: 'Validate My Content Totals DIV - Unique Titles column header', + action: async () => { + const multipleChecks = 'Unique Titles column headers'; + const element = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Unique Titles') { + console.log('Passed: Unique Titles column header matched as expected'); + } else { + errors.push(`Expected: Column header: "Unique Titles"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Unique Titles column header text font matched as expected'); + } else { + errors.push(`Expected: Unique Titles column header text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '10px') { + console.log('Passed: Unique Titles column header text font-size matched as expected'); + } else { + errors.push(`Expected: Unique Titles column header text font-size "10px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Unique Titles column header text color matched as expected'); + } else { + errors.push(`Expected: Unique Titles column header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Unique IDs column header + { + description: 'Validate My Content Totals DIV - Unique IDs column header', + action: async () => { + const multipleChecks = 'Unique IDs column headers'; + const element = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(4)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Unique IDs') { + console.log('Passed: Unique IDs column header matched as expected'); + } else { + errors.push(`Expected: Column header: "Unique IDs"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Unique IDs column header text font matched as expected'); + } else { + errors.push(`Expected: Unique IDs column header text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '10px') { + console.log('Passed: Unique IDs column header text font-size matched as expected'); + } else { + errors.push(`Expected: Unique IDs column header text font-size "10px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Unique IDs column header text color matched as expected'); + } else { + errors.push(`Expected: Unique IDs column header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Biology + { + description: 'Validate My Content Totals DIV - Biology', + action: async () => { + const multipleChecks = 'Biology label'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Biology') { + console.log('Passed: Biology label text matched as expected'); + } else { + errors.push(`Expected: "Biology"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Biology label text font matched as expected'); + } else { + errors.push(`Expected: Biology label text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Biology label text font-size matched as expected'); + } else { + errors.push(`Expected: Biology label text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Biology label text color matched as expected'); + } else { + errors.push(`Expected: Biology label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Biology total items count + { + description: 'Validate My Content Totals DIV - Biology total items count', + action: async () => { + const multipleChecks = 'Biology total items count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '1493') { + console.log('Passed: Biology total items count text matched as expected'); + } else { + errors.push(`Expected: Biology total items count: "1493"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Biology total items count text font matched as expected'); + } else { + errors.push(`Expected: Biology total items count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Biology total items count text font-size matched as expected'); + } else { + errors.push(`Expected: Biology total items count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Biology total items count text color matched as expected'); + } else { + errors.push(`Expected: Biology total items count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Biology unique titles count + { + description: 'Validate My Content Totals DIV - Biology unique titles count', + action: async () => { + const multipleChecks = 'Biology unique titles count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '1482') { + console.log('Passed: Biology unique titles count text matched as expected'); + } else { + errors.push(`Expected: Biology unique titles count: "1482"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Biology unique titles count text font matched as expected'); + } else { + errors.push(`Expected: Biology unique titles count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Biology unique titles count text font-size matched as expected'); + } else { + errors.push(`Expected: Biology unique titles count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Biology unique titles count text color matched as expected'); + } else { + errors.push(`Expected: Biology unique titles count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Biology unique ids count + { + description: 'Validate My Content Totals DIV - Biology unique ids count', + action: async () => { + const multipleChecks = 'Biology unique ids count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(4)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '1493') { + console.log('Passed: Biology unique ids count text matched as expected'); + } else { + errors.push(`Expected: Biology unique ids count: "1493"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Biology unique ids count text font matched as expected'); + } else { + errors.push(`Expected: Biology unique ids count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Biology unique ids count text font-size matched as expected'); + } else { + errors.push(`Expected: Biology unique ids count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Biology unique ids count text color matched as expected'); + } else { + errors.push(`Expected: Biology unique ids count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Math Alignment Import Test + { + description: 'Validate My Content Totals DIV - Math Alignment Import Test', + action: async () => { + const multipleChecks = 'Math Alignment Import Test label'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(2) > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Math Alignment Import Test') { + console.log('Passed: Math Alignment Import Test label text matched as expected'); + } else { + errors.push(`Expected: "Math Alignment Import Test"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Math Alignment Import Test label text font matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test label text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Math Alignment Import Test label text font-size matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test label text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Math Alignment Import Test label text color matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Math Alignment Import Test total items count + { + description: 'Validate My Content Totals DIV - Math Alignment Import Test total items count', + action: async () => { + const multipleChecks = 'Math Alignment Import Test total items count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(2) > td:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '730') { + console.log('Passed: Math Alignment Import Test total items count text matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test total items count: "730"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Math Alignment Import Test total items count text font matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test total items count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Math Alignment Import Test total items count text font-size matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test total items count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Math Alignment Import Test total items count text color matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test total items count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Math Alignment Import Test unique titles count + { + description: 'Validate My Content Totals DIV - Math Alignment Import Test unique titles count', + action: async () => { + const multipleChecks = 'Math Alignment Import Test unique titles count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(2) > td:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '707') { + console.log('Passed: Math Alignment Import Test unique titles count text matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test unique titles count: "707"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Math Alignment Import Test unique titles count text font matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test unique titles count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Math Alignment Import Test unique titles count text font-size matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test unique titles count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Math Alignment Import Test unique titles count text color matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test unique titles count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Math Alignment Import Test unique ids count + { + description: 'Validate My Content Totals DIV - Math Alignment Import Test unique ids count', + action: async () => { + const multipleChecks = 'Math Alignment Import Test unique ids count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(2) > td:nth-child(4)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '728') { + console.log('Passed: Math Alignment Import Test unique ids count text matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test unique ids count: "728"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Math Alignment Import Test unique ids count text font matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test unique ids count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Math Alignment Import Test unique ids count text font-size matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test unique ids count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Math Alignment Import Test unique ids count text color matched as expected'); + } else { + errors.push(`Expected: Math Alignment Import Test unique ids count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - English I + { + description: 'Validate My Content Totals DIV - English I', + action: async () => { + const multipleChecks = 'English I label'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(3) > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'English I') { + console.log('Passed: English I label text matched as expected'); + } else { + errors.push(`Expected: "English I"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: English I label text font matched as expected'); + } else { + errors.push(`Expected: English I label text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: English I label text font-size matched as expected'); + } else { + errors.push(`Expected: English I label text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: English I label text color matched as expected'); + } else { + errors.push(`Expected: English I label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - English I total items count + { + description: 'Validate My Content Totals DIV - English I total items count', + action: async () => { + const multipleChecks = 'English I total items count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(3) > td:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '389') { + console.log('Passed: English I total items count text matched as expected'); + } else { + errors.push(`Expected: English I total items count: "389"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: English I total items count text font matched as expected'); + } else { + errors.push(`Expected: English I total items count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: English I total items count text font-size matched as expected'); + } else { + errors.push(`Expected: English I total items count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: English I total items count text color matched as expected'); + } else { + errors.push(`Expected: English I total items count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - English I unique titles count + { + description: 'Validate My Content Totals DIV - English I unique titles count', + action: async () => { + const multipleChecks = 'English I unique titles count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(3) > td:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '389') { + console.log('Passed: English I unique titles count text matched as expected'); + } else { + errors.push(`Expected: English I unique titles count: "389"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: English I unique titles count text font matched as expected'); + } else { + errors.push(`Expected: English I unique titles count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: English I unique titles count text font-size matched as expected'); + } else { + errors.push(`Expected: English I unique titles count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: English I unique titles count text color matched as expected'); + } else { + errors.push(`Expected: English I unique titles count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - English I unique ids count + { + description: 'Validate My Content Totals DIV - English I unique ids count', + action: async () => { + const multipleChecks = 'Math Alignment Import Test unique ids count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(3) > td:nth-child(4)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '389') { + console.log('Passed: English I unique ids count text matched as expected'); + } else { + errors.push(`Expected: English I unique ids count: "389"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: English I unique ids count text font matched as expected'); + } else { + errors.push(`Expected: English I unique ids count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: English I unique ids count text font-size matched as expected'); + } else { + errors.push(`Expected: English I unique ids count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: English I unique ids count text color matched as expected'); + } else { + errors.push(`Expected: English I unique ids count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Copy Move Delete Test 2 + { + description: 'Validate My Content Totals DIV - Copy Move Delete Test 2', + action: async () => { + const multipleChecks = 'Copy Move Delete Test 2 label'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(4) > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Copy Move Delete Test 2') { + console.log('Passed: Copy Move Delete Test 2 label text matched as expected'); + } else { + errors.push(`Expected: "Copy Move Delete Test 2"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Copy Move Delete Test 2 label text font matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 label text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Copy Move Delete Test 2 label text font-size matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 label text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Copy Move Delete Test 2 label text color matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Copy Move Delete Test 2 total items count + { + description: 'Validate My Content Totals DIV - Copy Move Delete Test 2 total items count', + action: async () => { + const multipleChecks = 'Copy Move Delete Test 2 total items count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(4) > td:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '327') { + console.log('Passed: Copy Move Delete Test 2 total items count text matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 total items count: "327"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Copy Move Delete Test 2 total items count text font matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 total items count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Copy Move Delete Test 2 total items count text font-size matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 total items count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Copy Move Delete Test 2 total items count text color matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 total items count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Copy Move Delete Test 2 unique titles count + { + description: 'Validate My Content Totals DIV - Copy Move Delete Test 2 unique titles count', + action: async () => { + const multipleChecks = 'Copy Move Delete Test 2 unique titles count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(4) > td:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '327') { + console.log('Passed: Copy Move Delete Test 2 unique titles count text matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 unique titles count: "327"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Copy Move Delete Test 2 unique titles count text font matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 unique titles count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Copy Move Delete Test 2 unique titles count text font-size matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 unique titles count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Copy Move Delete Test 2 unique titles count text color matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 unique titles count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Copy Move Delete Test 2 unique ids count + { + description: 'Validate My Content Totals DIV - Copy Move Delete Test 2 unique ids count', + action: async () => { + const multipleChecks = 'Copy Move Delete Test 2 unique ids count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(4) > td:nth-child(4)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '328') { + console.log('Passed: Copy Move Delete Test 2 unique ids count text matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 unique ids count: "328"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Copy Move Delete Test 2 unique ids count text font matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 unique ids count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Copy Move Delete Test 2 unique ids count text font-size matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 unique ids count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Copy Move Delete Test 2 unique ids count text color matched as expected'); + } else { + errors.push(`Expected: Copy Move Delete Test 2 unique ids count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Algebra + { + description: 'Validate My Content Totals DIV - Algebra', + action: async () => { + const multipleChecks = 'Algebra label'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(5) > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Algebra') { + console.log('Passed: Algebra label text matched as expected'); + } else { + errors.push(`Expected: "Algebra"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Algebra label text font matched as expected'); + } else { + errors.push(`Expected: Algebra label text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Algebra label text font-size matched as expected'); + } else { + errors.push(`Expected: Algebra label text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Algebra label text color matched as expected'); + } else { + errors.push(`Expected: Algebra label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Algebra total items count + { + description: 'Validate My Content Totals DIV - Algebra total items count', + action: async () => { + const multipleChecks = 'Algebra total items count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(5) > td:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '192') { + console.log('Passed: Algebra total items count text matched as expected'); + } else { + errors.push(`Expected: Algebra total items count: "192"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Algebra total items count text font matched as expected'); + } else { + errors.push(`Expected: Algebra total items count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Algebra total items count text font-size matched as expected'); + } else { + errors.push(`Expected: Algebra total items count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Algebra total items count text color matched as expected'); + } else { + errors.push(`Expected: Algebra total items count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Algebra unique titles count + { + description: 'Validate My Content Totals DIV - Algebra unique titles count', + action: async () => { + const multipleChecks = 'Algebra unique titles count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(5) > td:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '194') { + console.log('Passed: Algebra unique titles count text matched as expected'); + } else { + errors.push(`Expected: Algebra unique titles count: "194"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Algebra unique titles count text font matched as expected'); + } else { + errors.push(`Expected: Algebra unique titles count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Algebra unique titles count text font-size matched as expected'); + } else { + errors.push(`Expected: Algebra unique titles count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Algebra unique titles count text color matched as expected'); + } else { + errors.push(`Expected: Algebra unique titles count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Algebra unique ids count + { + description: 'Validate My Content Totals DIV - Algebra unique ids count', + action: async () => { + const multipleChecks = 'Algebra unique ids count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(5) > td:nth-child(4)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '189') { + console.log('Passed: Algebra unique ids count text matched as expected'); + } else { + errors.push(`Expected: Algebra unique ids count: "189"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Algebra unique ids count text font matched as expected'); + } else { + errors.push(`Expected: Algebra unique ids count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Algebra unique ids count text font-size matched as expected'); + } else { + errors.push(`Expected: Algebra unique ids count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Algebra unique ids count text color matched as expected'); + } else { + errors.push(`Expected: Algebra unique ids count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - US History III + { + description: 'Validate My Content Totals DIV - US History III', + action: async () => { + const multipleChecks = 'US History III label'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(6) > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'US History III') { + console.log('Passed: US History III label text matched as expected'); + } else { + errors.push(`Expected: "US History III"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: US History III label text font matched as expected'); + } else { + errors.push(`Expected: US History III label text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: US History III label text font-size matched as expected'); + } else { + errors.push(`Expected: US History III label text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: US History III label text color matched as expected'); + } else { + errors.push(`Expected: US History III label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - US History III total items count + { + description: 'Validate My Content Totals DIV - US History III total items count', + action: async () => { + const multipleChecks = 'US History III total items count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(6) > td:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '67') { + console.log('Passed: US History III total items count text matched as expected'); + } else { + errors.push(`Expected: US History III total items count: "67"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: US History III total items count text font matched as expected'); + } else { + errors.push(`Expected: US History III total items count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: US History III total items count text font-size matched as expected'); + } else { + errors.push(`Expected: US History III total items count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: US History III total items count text color matched as expected'); + } else { + errors.push(`Expected: US History III total items count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - US History III unique titles count + { + description: 'Validate My Content Totals DIV - US History III unique titles count', + action: async () => { + const multipleChecks = 'US History III unique titles count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(6) > td:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '67') { + console.log('Passed: US History III unique titles count text matched as expected'); + } else { + errors.push(`Expected: US History III unique titles count: "67"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: US History III unique titles count text font matched as expected'); + } else { + errors.push(`Expected: US History III unique titles count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: US History III unique titles count text font-size matched as expected'); + } else { + errors.push(`Expected: US History III unique titles count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: US History III unique titles count text color matched as expected'); + } else { + errors.push(`Expected: US History III unique titles count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - US History III unique ids count + { + description: 'Validate My Content Totals DIV - US History III unique ids count', + action: async () => { + const multipleChecks = 'US History III unique ids count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(6) > td:nth-child(4)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '66') { + console.log('Passed: US History III unique ids count text matched as expected'); + } else { + errors.push(`Expected: US History III unique ids count: "66"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: US History III unique ids count text font matched as expected'); + } else { + errors.push(`Expected: US History III unique ids count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: US History III unique ids count text font-size matched as expected'); + } else { + errors.push(`Expected: US History III unique ids count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: US History III unique ids count text color matched as expected'); + } else { + errors.push(`Expected: US History III unique ids count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Create Me + { + description: 'Validate My Content Totals DIV - Create Me', + action: async () => { + const multipleChecks = 'Create Me label'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(12) > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'create me') { + console.log('Passed: Create Me label text matched as expected'); + } else { + errors.push(`Expected: "create me"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Create Me label text font matched as expected'); + } else { + errors.push(`Expected: Create Me label text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Create Me label text font-size matched as expected'); + } else { + errors.push(`Expected: Create Me label text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Create Me label text color matched as expected'); + } else { + errors.push(`Expected: Create Me label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Create Me total items count + { + description: 'Validate My Content Totals DIV - Create Me total items count', + action: async () => { + const multipleChecks = 'Create Me total items count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(12) > td:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '6') { + console.log('Passed: Create Me total items count text matched as expected'); + } else { + errors.push(`Expected: Create Me total items count: "6"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Create Me total items count text font matched as expected'); + } else { + errors.push(`Expected: Create Me total items count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Create Me total items count text font-size matched as expected'); + } else { + errors.push(`Expected: Create Me total items count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Create Me total items count text color matched as expected'); + } else { + errors.push(`Expected: Create Me total items count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Create Me unique titles count + { + description: 'Validate My Content Totals DIV - Create Me unique titles count', + action: async () => { + const multipleChecks = 'Create Me unique titles count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(12) > td:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '6') { + console.log('Passed: Create Me unique titles count text matched as expected'); + } else { + errors.push(`Expected: Create Me unique titles count: "6"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Create Me unique titles count text font matched as expected'); + } else { + errors.push(`Expected: Create Me unique titles count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Create Me unique titles count text font-size matched as expected'); + } else { + errors.push(`Expected: Create Me unique titles count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Create Me unique titles count text color matched as expected'); + } else { + errors.push(`Expected: Create Me unique titles count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //My Content Totals DIV - Create Me unique ids count + { + description: 'Validate My Content Totals DIV - Create Me unique ids count', + action: async () => { + const multipleChecks = 'Create Me unique ids count'; + const element = await driver.findElement(By.css('#content_tbody > tr:nth-child(12) > td:nth-child(4)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '5') { + console.log('Passed: Create Me unique ids count text matched as expected'); + } else { + errors.push(`Expected: Create Me unique ids count: "5"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Create Me unique ids count text font matched as expected'); + } else { + errors.push(`Expected: Create Me unique ids count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Create Me unique ids count text font-size matched as expected'); + } else { + errors.push(`Expected: Create Me unique ids count text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Create Me unique ids count text color matched as expected'); + } else { + errors.push(`Expected: Create Me unique ids count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Close button + { + description: 'Validate Close button', + action: async () => { + const multipleChecks = 'Close button'; + const element = await driver.findElement(By.css('#all_content_modal .btn-secondary')); + + //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 elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Close') { + console.log('Passed: Close button text matched as expected'); + } else { + errors.push(`Expected: "Close"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Close button text font matched as expected'); + } else { + errors.push(`Expected: Close button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Close button text font-size matched as expected'); + } else { + errors.push(`Expected: Close button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Close button text color matched as expected'); + } else { + errors.push(`Expected: Close button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //color + if (elementColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Close button background color matched as expected'); + } else { + errors.push(`Expected: Close button background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + //Export button + { + description: 'Validate Export button', + action: async () => { + const multipleChecks = 'Export button'; + const element = await driver.findElement(By.css('#export_btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Export') { + console.log('Passed: Export button text matched as expected'); + } else { + errors.push(`Expected: "Export"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Export button text font matched as expected'); + } else { + errors.push(`Expected: Export button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Export button text font-size matched as expected'); + } else { + errors.push(`Expected: Export button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Export button text color matched as expected'); + } else { + errors.push(`Expected: Export button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //color + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Export button background color matched as expected'); + } else { + errors.push(`Expected: Export button background color: "rgba(48, 200, 172, 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 My Content Items Count Close button', + action: async () => { + await driver.findElement(By.css('.ready-content .btn-secondary')).click(); + console.log('----->| NEXT ACTION: Clicked DIV Close button'); + await driver.sleep(2000); + } + }, + + //Ellipsis icon color { description: 'Validate ellipsis icon color', action: async () => { const elementStyle = await driver.findElement(By.css('.fa-ellipsis-h')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Ellipsis icon color did not match; Actual: "${elementStyle}"`); + if (elementStyle === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Ellipsis icon color matched as expected'); + } else { + errors.push(`Expected: Ellipsis icon color did not match; Actual: "${elementStyle}"`); } - console.log('Passed: Ellipsis icon color matched as expected'); } }, - //Search icon color -dark blue + //Search icon color { description: 'Validate search icon color', action: async () => { const elementStyle = await driver.findElement(By.css('.col-12 > .fa')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Search icon color did not match; Actual: "${elementStyle}"`); + if (elementStyle === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Ellipsis search icon color matched as expected'); + } else { + errors.push(`Expected: Ellipsis search icon color did not match; Actual: "${elementStyle}"`); } - console.log('Passed: Search icon color matched as expected'); } }, @@ -182,2773 +2678,4484 @@ const steps = [ { description: 'Validate Filter placeholder text', action: async () => { - const elementValue = await driver.findElement(By.css('#content-org-filter')).getAttribute('placeholder'); - if (elementValue !== 'filter...') { - throw new Error(`Expected: "filter..."; Actual: "${elementValue}"`); + const multipleChecks = 'Filter textbox'; + const element = await driver.findElement(By.css('#content-org-filter')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'filter...') { + console.log('Passed: Filter placeholder text matched as expected'); + } else { + errors.push(`Expected: "filter..." placeholder; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Filter placeholder text font matched as expected'); + } else { + errors.push(`Expected: Filter placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13.5px') { + console.log('Passed: Filter placeholder text font-size matched as expected'); + } else { + errors.push(`Expected: Filter placeholder text font-size "13.5px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Filter placeholder text color matched as expected'); + } else { + errors.push(`Expected: Filter placeholder text color: "rgb(108, 117, 125)"; 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: Filter placeholder text matched as expected'); } }, //Sort label { - description: 'Validate sort label', + description: 'Validate My Sort label', action: async () => { - const elementText = await driver.findElement(By.css('.col-4')).getText(); - if (elementText !== 'Sort:') { - throw new Error(`Expected: "Sort:"; Actual: "${elementText}"`); + const multipleChecks = 'Sort label'; + const element = await driver.findElement(By.css('.col-4')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Sort:') { + console.log('Passed: Sort: label text matched as expected'); + } else { + errors.push(`Expected: "Sort:" label; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Sort: label text font matched as expected'); + } else { + errors.push(`Expected: Sort: label text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: Sort: label text font-size matched as expected'); + } else { + errors.push(`Expected: Sort: label text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Sort: label text color matched as expected'); + } else { + errors.push(`Expected: Sort: label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Sort label matched as expected'); } }, - //Sort Dropdown [should be: "Count", option] + //Sort dropdown values (SPECIAL CASE: validate default selection) { - description: 'Validate sort dropdown option', + description: 'Validate Sort dropdown values', action: async () => { - const elementOption = await driver.findElement(By.css('#orgsort > option:nth-child(1)')).getAttribute('value'); - if (elementOption !== 'count') { - throw new Error(`Expected: "count"; Actual: "${elementOption}"`); + const multipleChecks = 'Sort dropdown values'; + const dropdown = await driver.wait(until.elementLocated(By.css('#orgsort')), 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(); + + if (defaultText === 'Count') { + console.log('Passed: Sort: dropdown default value matched as expected'); + } else { + errors.push(`Expected: Sort dropdown default value "Count"; Actual: "${defaultText}"`); + } + + //Verify all dropdown options + const options = await selectElement.getOptions(); + const expected = [ + 'Count', + 'Name' + ]; + + 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: Sort: dropdown list matched as expected'); + } else { + errors.push(`Expected: Sort 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')); } - console.log('Passed: Sort dropdown option matched as expected'); } }, - //Biology-QA + //My Content - Biology { - description: 'Validate Biology-QA title', + description: 'Validate Biology link', action: async () => { - const elementText = await driver.findElement(By.linkText('Biology - QA')).getText(); - if (elementText !== 'Biology - QA') { - throw new Error(`Expected: "Biology - QA"; Actual: "${elementText}"`); + const multipleChecks = 'My Content - Biology link'; + const element = await driver.findElement(By.linkText('Biology')); + + //Get href, text, font, size, and color + const elementURL = await element.getAttribute('href'); + 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 = []; + + //url + if (elementURL === 'https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits') { + console.log('Passed: Biology link URL matched as expected'); + } else { + errors.push(`Expected: "https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits"; Actual: "${elementURL}"`); + } + + //text + if (elementText === 'Biology') { + console.log('Passed: Biology link text matched as expected'); + } else { + errors.push(`Expected: "Biology"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Biology link text font matched as expected'); + } else { + errors.push(`Expected: Biology link text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14.3px') { + console.log('Passed: Biology link text font-size matched as expected'); + } else { + errors.push(`Expected: Biology link text text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Biology link text color matched as expected'); + } else { + errors.push(`Expected: Biology link text color: "rgba(73, 80, 87, 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: Biology-QA title matched as expected'); } }, + //My Content - Edit Biology icon { - description: 'Validate Biology-QA edit icon color', + description: 'Validate Edit Biology icon', action: async () => { - const elementStyle = await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .fa')).getCssValue('color'); - if (elementStyle !== 'rgba(73, 80, 87, 1)') { - throw new Error(`Expected: Biology-QA edit icon color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'My Content - Edit Biology icon'; + const element = await driver.findElement(By.css('#content-org-list > li > div.orgname > a.ml-2')); + + //Get href, text, font, size, and color + const elementURL = await element.getAttribute('href'); + const elementText = await element.getAttribute('title'); + const elementColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //url + if (elementURL === 'https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821587') { + console.log('Passed: Edit Biology icon link URL matched as expected'); + } else { + errors.push(`Expected: "https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821587"; Actual: "${elementURL}"`); + } + + //text + if (elementText === 'Edit Content Set') { + console.log('Passed: Edit Biology icon title matched as expected'); + } else { + errors.push(`Expected: "Edit Content Set" ; Actual: "${elementText}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Edit Biology icon color matched as expected'); + } else { + errors.push(`Expected: Edit Biology icon color: "rgba(73, 80, 87, 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: Biology-QA edit icon color matched as expected'); } }, //Validate default sort order top6 - //Biology - QA = 1046 (1st) + + //My Content - Biology sort order 1st { - description: 'Validate default QA: Biology - QA 1046 count in 1st place', + description: 'Validate Biology sort order', action: async () => { - const elementText = await driver.findElement(By.xpath('//li/div/span')).getText(); - if (elementText !== '1046') { - throw new Error(`Expected: Dashboard default content set order: Biology - QA count "1046" not listed in 1st place; Actual: "${elementText}"`); + const multipleChecks = 'My Content - Biology sort order'; + const elementContent = await driver.findElement(By.xpath(`//a[contains(.,'Biology')]`)).getText(); + const elementURL = await driver.findElement(By.xpath('(//ul[@id="content-org-list"])[1]/li/div[@class="orgname"]/a[2]')).getAttribute('href'); + const elementCount = await driver.findElement(By.xpath('//li/div/span')).getText(); + + //Track all errors + const errors = []; + + //text + if (elementContent === 'Biology') { + console.log('Passed: Biology listed in first place as expected'); + } else { + errors.push(`Expected: First place: "Biology" ; Actual: "${elementContent}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821587') { + console.log('Passed: Biology edit icon link listed in first place as expected'); + } else { + errors.push(`Expected: First place: "https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821587"; Actual: "${elementURL}"`); + } + + //count + if (elementCount === '1493') { + console.log('Passed: Biology content count listed in first place as expected'); + } else { + errors.push(`Expected: First place: Biology content count: "1493"; Actual: "${elementCount}"`); + } + + //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 default content set order: Biology - QA count 1046 listed in 1st place'); } }, - //Biology - QA = 1046 count text font size + //My Content - Math Alignment Import Test sort order 2nd { - description: 'Validate Biology - QA = 1046 count text font size', + description: 'Validate Math Alignment Import Test sort order', action: async () => { - const elementStyle = await driver.findElement(By.xpath('//li/div/span')).getCssValue('font-size'); - if (elementStyle !== '12.87px') { - throw new Error(`Expected: Dashboard - Biology - QA = 1046 count text font-size did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'My Content - Math Alignment Import Test sort order'; + const elementContent = await driver.findElement(By.xpath(`//a[contains(.,'Math Alignment Import Test')]`)).getText(); + const elementURL = await driver.findElement(By.xpath('(//ul[@id="content-org-list"])[2]/li/div[@class="orgname"]/a[2]')).getAttribute('href'); + const elementCount = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getText(); + + //Track all errors + const errors = []; + + //text + if (elementContent === 'Math Alignment Import Test') { + console.log('Passed: Math Alignment Import Test listed in second place as expected'); + } else { + errors.push(`Expected: Second place: "Math Alignment Import Test" ; Actual: "${elementContent}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/contentset_edit_modal.php?id=1423792414') { + console.log('Passed: Math Alignment Import Test edit icon link listed in second place as expected'); + } else { + errors.push(`Expected: Second place: "https://correlation.edgate.com/exact/contentset_edit_modal.php?id=1423792414"; Actual: "${elementURL}"`); + } + + //count + if (elementCount === '730') { + console.log('Passed: Math Alignment Import Test content count listed in second place as expected'); + } else { + errors.push(`Expected: Second place: Math Alignment Import Test content count: "730"; Actual: "${elementCount}"`); + } + + //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 - Biology - QA = 1046 count text font-size matched as expected'); } }, - //Geometry - QA = 981 (2nd) + //My Content - English I sort order 3rd { - description: 'Validate default QA: Geometry - QA 981 count in 2nd place', + description: 'Validate English I sort order', action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getText(); - if (elementText !== '981') { - throw new Error(`Expected: Dashboard default content set order: Geometry - QA count "981" not listed in 2nd place; Actual: "${elementText}"`); + const multipleChecks = 'My Content - English I sort order'; + const elementContent = await driver.findElement(By.xpath(`//a[contains(.,'English I')]`)).getText(); + const elementURL = await driver.findElement(By.xpath('(//ul[@id="content-org-list"])[3]/li/div[@class="orgname"]/a[2]')).getAttribute('href'); + const elementCount = await driver.findElement(By.xpath('//ul/ul/ul/li/div/span')).getText(); + + //Track all errors + const errors = []; + + //text + if (elementContent === 'English I') { + console.log('Passed: English I listed in third place as expected'); + } else { + errors.push(`Expected: Third place: "English I" ; Actual: "${elementContent}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821585') { + console.log('Passed: English I edit icon link listed in third place as expected'); + } else { + errors.push(`Expected: Third place: "https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821585"; Actual: "${elementURL}"`); + } + + //count + if (elementCount === '389') { + console.log('Passed: English I content count listed in third place as expected'); + } else { + errors.push(`Expected: Third place: English I content count: "389"; Actual: "${elementCount}"`); + } + + //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 default content set order: Geometry - QA count 981 listed in 2nd place'); } }, - //Geometry - QA = 981 count text font size + //My Content - Copy Move Delete Test 2 sort order 4th { - description: 'Validate Geometry - QA = 981 count text font size', + description: 'Validate Copy Move Delete Test 2 sort order', action: async () => { - const elementStyle = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getCssValue('font-size'); - if (elementStyle !== '12.87px') { - throw new Error(`Expected: Dashboard - Geometry - QA = 981 count text font-size did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'My Content - Copy Move Delete Test 2 sort order'; + const elementContent = await driver.findElement(By.xpath(`//a[contains(.,'Copy Move Delete Test 2')]`)).getText(); + const elementURL = await driver.findElement(By.xpath('(//ul[@id="content-org-list"])[4]/li/div[@class="orgname"]/a[2]')).getAttribute('href'); + const elementCount = await driver.findElement(By.xpath('//ul/ul/ul/ul/li/div/span')).getText(); + + //Track all errors + const errors = []; + + //text + if (elementContent === 'Copy Move Delete Test 2') { + console.log('Passed: Copy Move Delete Test 2 in fourth place as expected'); + } else { + errors.push(`Expected: Fourth place: "Copy Move Delete Test 2" ; Actual: "${elementContent}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/contentset_edit_modal.php?id=1228574325') { + console.log('Passed: Copy Move Delete Test 2 edit icon link listed in fourth place as expected'); + } else { + errors.push(`Expected: Fourth place: "https://correlation.edgate.com/exact/contentset_edit_modal.php?id=1228574325"; Actual: "${elementURL}"`); + } + + //count + if (elementCount === '327') { + console.log('Passed: Copy Move Delete Test 2 content count listed in fourth place as expected'); + } else { + errors.push(`Expected: Fourth place: Copy Move Delete Test 2 content count: "327"; Actual: "${elementCount}"`); + } + + //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 - Geometry - QA = 981 count text font-size matched as expected'); } }, - //Math Alignment Import Test = 730 (3rd) + //My Content - Algebra sort order 5th { - description: 'Validate default QA: Math Alignment Import Test 730 count in 3rd place', + description: 'Validate Algebra sort order', action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/li/div/span')).getText(); - if (elementText !== '730') { - throw new Error(`Expected: Dashboard default content set order: Math Alignment Import Testcount "730" not listed in 3rd place; Actual: "${elementText}"`); + const multipleChecks = 'My Content - Algebra sort order'; + const elementContent = await driver.findElement(By.xpath(`//a[contains(.,'Algebra')]`)).getText(); + const elementURL = await driver.findElement(By.xpath('(//ul[@id="content-org-list"])[5]/li/div[@class="orgname"]/a[2]')).getAttribute('href'); + const elementCount = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getText(); + + //Track all errors + const errors = []; + + //text + if (elementContent === 'Algebra') { + console.log('Passed: Algebra in fifth place as expected'); + } else { + errors.push(`Expected: Fifth place: "Algebra" ; Actual: "${elementContent}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821586') { + console.log('Passed: Algebra edit icon link listed in fifth place as expected'); + } else { + errors.push(`Expected: Fifth place: "https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821586"; Actual: "${elementURL}"`); + } + + //count + if (elementCount === '192') { + console.log('Passed: Algebra content count listed in fifth place as expected'); + } else { + errors.push(`Expected: Fifth place: Algebra content count: "192"; Actual: "${elementCount}"`); + } + + //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 default content set order: Math Alignment Import Test count 730 listed in 3rd place'); } }, - //Math Alignment Import Test = 730 count text font size + //My Content - US History III sort order 6th { - description: 'Validate Math Alignment Import Test = 730 count text font size', + description: 'Validate US History III sort order', action: async () => { - const elementStyle = await driver.findElement(By.xpath('//ul/ul/ul/li/div/span')).getCssValue('font-size'); - if (elementStyle !== '12.87px') { - throw new Error(`Expected: Dashboard - Math Alignment Import Test = 7301 count text font-size did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'My Content - US History III sort order'; + const elementContent = await driver.findElement(By.xpath(`//a[contains(.,'US History III')]`)).getText(); + const elementURL = await driver.findElement(By.xpath('(//ul[@id="content-org-list"])[6]/li/div[@class="orgname"]/a[2]')).getAttribute('href'); + const elementCount = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/li/div/span')).getText(); + + //Track all errors + const errors = []; + + //text + if (elementContent === 'US History III') { + console.log('Passed: US History III in sixth place as expected'); + } else { + errors.push(`Expected: Sixth place: "US History III" ; Actual: "${elementContent}"`); + } + + //url + if (elementURL === 'https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821589') { + console.log('Passed: US History III edit icon link listed in sixth place as expected'); + } else { + errors.push(`Expected: Sxth place: "https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821589"; Actual: "${elementURL}"`); + } + + //count + if (elementCount === '67') { + console.log('Passed: US History III content count listed in sixth place as expected'); + } else { + errors.push(`Expected: Sixth place: US History III content count: "67"; Actual: "${elementCount}"`); + } + + //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 - Math Alignment Import Test = 730 count text font-size matched as expected'); } }, - //English - QA = 409 (4th) - { - description: 'Validate default QA: English - QA 409 count in 4th place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/li/div/span')).getText(); - if (elementText !== '409') { - throw new Error(`Expected: Dashboard default content set order: English - QA count "409" not listed in 4th place; Actual: "${elementText}"`); - } - console.log('Passed: Dashboard default content set order: English - QA count 409 listed in 4th place'); - } - }, - - //English - QA = 409 count text font size - { - description: 'Validate English - QA = 409 count text font size', - action: async () => { - const elementStyle = await driver.findElement(By.xpath('//ul/ul/ul/ul/li/div/span')).getCssValue('font-size'); - if (elementStyle !== '12.87px') { - throw new Error(`Expected: Dashboard - English - QA = 409 count text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Dashboard - English - QA = 409 count text font-size matched as expected'); - } - }, - - //Algebra - QA = 188 (5th) - { - description: 'Validate default QA: Algebra- QA 188 count in 5th place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getText(); - if (elementText !== '188') { - throw new Error(`Expected: Dashboard default content set order: Algebra - QA count "1882" not listed in 5th place; Actual: "${elementText}"`); - } - console.log('Passed: Dashboard default content set order: Algebra - QA count 188 listed in 5th place'); - } - }, - - //Algebra - QA = 188 count text font size - { - description: 'Validate Algebra - QA = 188 count text font size', - action: async () => { - const elementStyle = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getCssValue('font-size'); - if (elementStyle !== '12.87px') { - throw new Error(`Expected: Dashboard - Algebra - QA = 188 count text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Dashboard - Algebra - QA = 188 count text font-size matched as expected'); - } - }, - - //US History - QA = 62 (6th) - { - description: `Validate default QA: US History - QA 62 count in 6th place`, - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/li/div/span')).getText(); - if (elementText !== '62') { - throw new Error(`Expected: Dashboard default content set order: US History - QA count "62" not listed in 6th place; Actual: "${elementText}"`); - } - console.log(`Passed: Dashboard default content set order: US History - QA count 62 listed in 6th place`); - } - }, - - //US History - QA = 62 count text font size - { - description: 'Validate US History - QA = 62 count text font size', - action: async () => { - const elementStyle = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/li/div/span')).getCssValue('font-size'); - if (elementStyle !== '12.87px') { - throw new Error(`Expected: Dashboard - US History - QA = 62 count text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Dashboard - US History - QA = 62 count text font-size matched as expected'); - } - }, - - //MY CONTENT ITEM COUNT - //NEXT ACTION -Click My Content Items Count button - { description: 'Click My Content Items Count button', action: async () => await driver.findElement(By.css('#content_total')).click() }, - { description: 'Wait for My Content Totals DIV to open', action: async () => await driver.sleep(2000) }, - - //Wait for DIV + //NEXT ACTION { - description: 'Wait for DIV to open', + description: 'Click Biology edit icon', action: async () => { - return await driver.wait(until.elementLocated(By.css('.content_modal_title')), 5000).catch(() => false); - } - }, - - //My Content Totals DIV title - { - description: 'Validate My Content Totals DIV title', - action: async () => { - const elementText = await driver.findElement(By.css('.content_modal_title')).getText(); - if (elementText !== 'My Content Totals') { - throw new Error(`Expected: "My Content Totals"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV title matched as expected'); + await driver.findElement(By.css('#content-org-list > li > div.orgname > a.ml-2')).click(); + console.log('----->| NEXT ACTION: Clicked Biology edit icon'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Modal did not become visible within 20 seconds'); + + console.log('Passed: DIV loaded successfully'); } }, - //My Content Totals DIV title text color -dark blue - { - description: 'Validate My Content Totals DIV title font color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.content_modal_title')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: My Content Totals DIV title font color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV title font color matched as expected'); - } - }, - - //My Content Totals DIV title text font size - { - description: 'Validate My Content Totals DIV title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.content_modal_title')).getCssValue('font-size'); - if (elementStyle !== '18px') { - throw new Error(`Expected: My Content Totals DIV title text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV title text font-size matched as expected'); - } - }, - - //My Content Totals DIV - Total Items label - { - description: 'Validate My Content Totals DIV - Total Items label', - action: async () => { - const elementText = await driver.findElement(By.css('#total > p')).getText(); - if (elementText !== 'Total Items') { - throw new Error(`Expected: "My Content Totals"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Total Items label matched as expected'); - } - }, - - //My Content Totals DIV - Total Items label text background color -gray - { - description: 'Validate My Content Totals DIV - Total Items label text background font color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#total > p')).getCssValue('background-color'); - if (elementStyle !== 'rgba(238, 238, 242, 1)') { - throw new Error(`Expected: My Content Totals DIV - Total Items label text background font color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV - Total Items label text background font color matched as expected'); - } - }, - - //My Content Totals DIV - Total Items label text background text font size - { - description: 'Validate My Content Totals DIV - Total Items label text background text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#total > p')).getCssValue('font-size'); - if (elementStyle !== '14px') { - throw new Error(`Expected: My Content Totals DIV - Total Items label text background text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV - Total Items label text background text font-size matched as expected'); - } - }, - - //My Content Totals DIV - Total Items Count - { - description: 'Validate My Content Totals DIV - Total Items Count', - action: async () => { - const elementText = await driver.findElement(By.css('#total > b')).getText(); - if (elementText !== '3552') { - throw new Error(`Expected: "3552"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Total Items Count matched as expected'); - } - }, - - //My Content Totals DIV - Total Items Count text font size size - { - description: 'Validate My Content Totals DIV - Total Items Count text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#total > b')).getCssValue('font-size'); - if (elementStyle !== '36px') { - throw new Error(`Expected: My Content Totals DIV - Items Count text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV - Items Count text font-size matched as expected'); - } - }, - - //My Content Totals DIV - Unique Titles label - { - description: 'Validate My Content Totals DIV - Unique Titles label', - action: async () => { - const elementText = await driver.findElement(By.css('#total_titles > p')).getText(); - if (elementText !== 'Unique Titles') { - throw new Error(`Expected: "Unique Titles"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Unique Titles label matched as expected'); - } - }, - - //My Content Totals DIV - Unique Titles label text background color -gray - { - description: 'Validate My Content Totals DIV - Unique Titles label text background font color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#total_titles > p')).getCssValue('background-color'); - if (elementStyle !== 'rgba(238, 238, 242, 1)') { - throw new Error(`Expected: My Content Totals DIV - Unique Titles label text background font color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV - Unique Titles label text background font color matched as expected'); - } - }, - - //My Content Totals DIV - Unique Titles label text background text font size - { - description: 'Validate My Content Totals DIV - Unique Titles label text background text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#total_titles > p')).getCssValue('font-size'); - if (elementStyle !== '14px') { - throw new Error(`Expected: My Content Totals DIV - Unique Titles label text background text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV - Unique Titles label text background text font-size matched as expected'); - } - }, - - //My Content Totals DIV - Unique Titles Count - { - description: 'Validate My Content Totals DIV - Unique Titles Count', - action: async () => { - const elementText = await driver.findElement(By.css('#total_titles > b')).getText(); - if (elementText !== '6573') { - throw new Error(`Expected: "6573"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Unique Titles Count matched as expected'); - } - }, - - //My Content Unique Titles Count text font size - { - description: 'Validate My Content Totals DIV - Unique Titles Count text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#total_titles > b')).getCssValue('font-size'); - if (elementStyle !== '36px') { - throw new Error(`Expected: My Content Totals DIV - Unique Titles Count text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV - Unique Titles Count text font-size matched as expected'); - } - }, - - //My Content Unique IDs label - { - description: 'Validate My Content Totals DIV - Unique IDs', - action: async () => { - const elementText = await driver.findElement(By.css('#total_pubtotalids > p')).getText(); - if (elementText !== 'Unique IDs') { - throw new Error(`Expected: "Unique IDs"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Unique IDs label matched as expected'); - } - }, - - //My Content Totals DIV - Unique IDs label text background color -gray - { - description: 'Validate My Content Totals DIV - Unique IDs label text background font color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#total_titles > p')).getCssValue('background-color'); - if (elementStyle !== 'rgba(238, 238, 242, 1)') { - throw new Error(`Expected: My Content Totals DIV - Unique IDs label text background font color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV - Unique IDs label text background font color matched as expected'); - } - }, - - //My Content Totals DIV - Unique IDs label text background text font size - { - description: 'Validate My Content Totals DIV - Unique IDs label text background text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#total_titles > p')).getCssValue('font-size'); - if (elementStyle !== '14px') { - throw new Error(`Expected: My Content Totals DIV - Unique IDs label text background text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV - Unique IDs label text background text font-size matched as expected'); - } - }, - - //My Content Unique IDs Count - { - description: 'Validate My Content Totals DIV - Unique IDs Count', - action: async () => { - const elementText = await driver.findElement(By.css('#total_pubtotalids > b')).getText(); - if (elementText !== '5602') { - throw new Error(`Expected: "5602"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Unique IDs Count matched as expected'); - } - }, - - //My Content Unique IDs Count text font size - { - description: 'Validate My Content Totals DIV - Unique IDs Count text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#total_pubtotalids > b')).getCssValue('font-size'); - if (elementStyle !== '36px') { - throw new Error(`Expected: My Content Totals DIV - Unique IDs Count text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV - Unique IDs Count text font-size matched as expected'); - } - }, - - //My Content Totals DIV - Content Set column label - { - description: 'Validate My Content Totals DIV - Content Set column label', - action: async () => { - const elementText = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(1)')).getText(); - if (elementText !== 'Content Set') { - throw new Error(`Expected: My Content Totals DIV - "Content Set"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Content Set column label matched as expected'); - } - }, - - //My Content Totals DIV - Content Set column label text font size - { - description: 'Validate My Content Totals DIV - Content Set column label text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(1)')).getCssValue('font-size'); - if (elementStyle !== '10px') { - throw new Error(`Expected: My Content Totals DIV - Content Set column label text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV - Content Set column label text background text font-size matched as expected'); - } - }, - - //My Content Total Items column label - { - description: 'Validate My Content Totals DIV - Total Items column label', - action: async () => { - const elementText = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(2)')).getText(); - if (elementText !== 'Total Items') { - throw new Error(`Expected: "Total Items"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Total Items column label matched as expected'); - } - }, - - //My Content Totals DIV - Total Items column label text font size - { - description: 'Validate My Content Totals DIV - Total Items column label text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(2)')).getCssValue('font-size'); - if (elementStyle !== '10px') { - throw new Error(`Expected: My Content Totals DIV - Total Items column label text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV - Total Items column label text background text font-size matched as expected'); - } - }, - - //My Content Unique Titles column label - { - description: 'Validate My Content Totals DIV - Unique Titles column label', - action: async () => { - const elementText = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(3)')).getText(); - if (elementText !== 'Unique Titles') { - throw new Error(`Expected: "Unique Titles"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Unique Titles column label matched as expected'); - } - }, - - //My Content Totals DIV - Unique Titles column label text font size - { - description: 'Validate My Content Totals DIV - Unique Titles column label text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(3)')).getCssValue('font-size'); - if (elementStyle !== '10px') { - throw new Error(`Expected: My Content Totals DIV - Unique Titles column label text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV - Unique Titles column label text background text font-size matched as expected'); - } - }, - - //My Content Unique IDs column label - { - description: 'Validate My Content Totals DIV - Unique IDs column label', - action: async () => { - const elementText = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(4)')).getText(); - if (elementText !== 'Unique IDs') { - throw new Error(`Expected: "Unique IDs"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Unique IDs column label matched as expected'); - } - }, - - //My Content Totals DIV - Unique IDs column label text font size - { - description: 'Validate My Content Totals DIV - Unique IDs column label text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(4)')).getCssValue('font-size'); - if (elementStyle !== '10px') { - throw new Error(`Expected: My Content Totals DIV - Unique IDs column label text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: My Content Totals DIV - Unique IDs column label text background text font-size matched as expected'); - } - }, - - //My Content; Biology - QA label - { - description: 'Validate My Content Totals DIV - Biology - QA label', - action: async () => { - const elementText = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(1)')).getText(); - if (elementText !== 'Biology - QA') { - throw new Error(`Expected: "Biology - QA"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Biology - QA label matched as expected'); - } - }, - - //My Content; Biology - QA Total Items Count - { - description: 'Validate My Content Totals DIV - Biology - QA Total Items Count', - action: async () => { - const elementText = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(2)')).getText(); - if (elementText !== '1046') { - throw new Error(`Expected: "1046"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Biology - QA Total Items Count matched as expected'); - } - }, - - //My Content; Biology - QA Unique Titles Count - { - description: 'Validate My Content Totals DIV - Biology - QA Unique Titles Count', - action: async () => { - const elementText = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(3)')).getText(); - if (elementText !== '1058') { - throw new Error(`Expected: "1058"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Biology - QA Unique Titles Count matched as expected'); - } - }, - - //My Content; Biology - QA Unique IDs - { - description: 'Validate My Content Totals DIV - Biology - QA Unique IDs Count', - action: async () => { - const elementText = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(4)')).getText(); - if (elementText !== '1065') { - throw new Error(`Expected: "1065"; Actual: "${elementText}"`); - } - console.log('Passed: My Content Totals DIV - Biology - QA Unique IDs Count matched as expected'); - } - }, - - //My Content; My Content Totals DIV - Close button - { - description: 'Validate My Content Totals DIV - Close button', - action: async () => { - const elementText = await driver.findElement(By.css('#all_content_modal .btn-secondary')).getText(); - if (elementText !== 'Close') { - throw new Error(`Expected: "Close"; Actual: "${elementText}"`); - } - console.log('Passed: Close button text matched as expected'); - } - }, - - //My Content Totals DIV - Close button color-white - { - description: 'Validate My Content Totals DIV - Export button background color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#all_content_modal .btn-secondary')).getCssValue('background-color'); - if (elementStyle !== 'rgba(0, 0, 0, 0)') { - throw new Error(`Expected: Close button background color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Close button background color matched as expected'); - } - }, - - //My Content Totals DIV - Export button - { - description: 'Validate My Content Totals DIV - Export button', - action: async () => { - const elementText = await driver.findElement(By.css('#export_btn')).getText(); - if (elementText !== 'Export') { - throw new Error(`Expected: "Export"; Actual: "${elementText}"`); - } - console.log('Passed: Export button text matched as expected'); - } - }, - - //My Content Totals DIV - Export button color-green - { - description: 'Validate My Content Totals DIV - Export button background color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#export_btn')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Export button background color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Export button background color matched as expected'); - } - }, - - //NEXT ACTION -Close DIV button - { description: 'Click My Contents Count DIV Close button', action: async () => await driver.findElement(By.css('#all_content_modal .btn-secondary')).click() }, - { description: 'Wait for My Content Totals DIV to close', action: async () => await driver.sleep(2000) }, - - //NEXT ACTION -Edit Biology - QA Content Set - { description: 'Click Biology-QA edit icon', action: async () => await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .fa')).click() }, - { description: 'Wait for Edit Content DIV to open', action: async () => await driver.sleep(5000) }, - - //Wait for dashboard to load - { - description: 'Wait for DIV to open', - action: async () => { - return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 10000).catch(() => false); - } - }, - - //Edit Content Set DIV + //Edit DIV - title { description: 'Validate Edit DIV title', action: async () => { - const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText(); - if (elementText !== 'Edit Content Set') { - throw new Error(`Expected: Edit DIV title did not match; Actual: "${elementText}"`); + const multipleChecks = 'Edit DIV title'; + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Edit Content Set') { + console.log('Passed: Edit Content Set DIV title matched as expected'); + } else { + errors.push(`Expected: DIV title: "Edit Content Set"; Actual: "${elementText}"`); } - console.log('Passed: Edit DIV title matched as expected'); - } - }, - //Edit Content Set DIV title text font size - { - description: 'Validate Edit Content Set DIV title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.modal-lg .modal-title')).getCssValue('font-size'); - if (elementStyle !== '18px') { - throw new Error(`Expected: Edit Content Set DIV title text font-size did not match; Actual: "${elementStyle}"`); + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Edit Content Set DIV title font matched as expected'); + } else { + errors.push(`Expected: Edit Content Set DIV title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); } - console.log('Passed: Edit Content Set DIV title text background text font-size matched as expected'); - } - }, - //Edit Content Set DIV - Content Set Name label - { - description: 'Validate Edit Content Set DIV - Content Set Name label', - action: async () => { - const elementText = await driver.findElement(By.css('.modal-lg .form-label')).getText(); - if (elementText !== 'Content Set Name') { - throw new Error(`Expected: Edit Content Set DIV - "Content Set Name"; Actual: "${elementText}"`); + //font size + if (elementTextSize === '18px') { + console.log('Passed: Edit Content Set DIV title font-size matched as expected'); + } else { + errors.push(`Expected: Edit Content Set DIV title font-size "18px"; Actual: "${elementTextSize}"`); } - console.log('Passed: Edit Content Set DIV - Content Set Name label matched as expected'); - } - }, - //Content Set Name label text font size - { - description: 'Validate Content Set Name label text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.modal-lg .form-label')).getCssValue('font-size'); - if (elementStyle !== '15px') { - throw new Error(`Expected: Content Set Name label text font-size did not match; Actual: "${elementStyle}"`); + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Edit Content Set DIV title color matched as expected'); + } else { + errors.push(`Expected: Edit Content Set DIV title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); } - console.log('Passed: Content Set Name label text background text font-size matched as expected'); - } - }, - //Edit Content Set DIV - textbox - { - description: 'Validate Edit DIV textbox', - action: async () => { - const elementValue = await driver.findElement(By.css('#orgname')).getAttribute('value'); - if (elementValue !== 'Biology - QA') { - throw new Error(`Expected: Edit DIV textbox Expected: "Biology - QA"; Actual: "${elementValue}"`); - } - console.log('Passed: Edit DIV textbox matched as expected'); - } - }, - - //Edit Content Set DIV - Delete button - { - description: 'Validate Edit DIV delete text button', - action: async () => { - const elementText = await driver.findElement(By.css('.modal-lg #orgdelete')).getText(); - if (elementText !== 'Delete') { - throw new Error(`Expected: "Delete"; Actual: "${elementText}"`); - } - console.log('Passed: Edit DIV delete text button matched as expected'); - } - }, - - //Edit Content Set DIV - Delete button color -red - { - description: 'Validate Edit DIV delete button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.modal-lg #orgdelete')).getCssValue('background-color'); - if (elementStyle !== 'rgba(220, 53, 69, 1)') { - throw new Error(`Expected: Edit DIV delete button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Edit DIV delete button color matched as expected'); - } - }, - - //Edit Content Set DIV - Delete button disabled - { - description: 'Validate Edit DIV delete button is disabled', - action: async () => { - const elementStyle = await driver.findElement(By.css('.modal-lg #orgdelete')).getAttribute('disabled'); - if (elementStyle !== 'true') { - throw new Error(`Expected: Edit DIV delete button should be disabled; Actual: "${elementStyle}"`); - } - console.log('Passed: Edit DIV delete button disabled as expected'); - } - }, - - //Edit Content Set DIV - Delete button tool-tip - { - description: 'Validate Edit DIV delete button tool-tip', - action: async () => { - const elementStyle = await driver.findElement(By.css('.modal-lg #orgdelete')).getAttribute('title'); - if (elementStyle !== 'You cannot delete a Content Set that has content items') { - throw new Error(`Expected: "You cannot delete a Content Set that has content items"; Actual: "${elementStyle}"`); - } - console.log('Passed: Edit DIV delete button tool-tip matched as expected'); - } - }, - - //Edit Content Set DIV - Save button - { - description: 'Validate Edit DIV save text button', - action: async () => { - const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value'); - if (elementText !== 'Save') { - throw new Error(`Expected: "Save"; Actual: "${elementText}"`); - } - console.log('Passed: Edit DIV save text button matched as expected'); - } - }, - - //Edit Content Set DIV - Save button color -green - { - description: 'Validate Edit DIV save button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#modalop')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Edit DIV save button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Edit DIV save button color matched as expected'); - } - }, - - //Edit Content Set DIV - Close button - { - description: 'Validate Edit DIV close text button', - action: async () => { - const elementText = await driver.findElement(By.css('#modalclose')).getText(); - if (elementText !== 'Close') { - throw new Error(`Expected: "Close"; Actual: "${elementText}"`); - } - console.log('Passed: Edit DIV close text button matched as expected'); - } - }, - - //Edit Content Set DIV - Close button color -white - { - description: 'Validate Edit DIV close button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color'); - if (elementStyle !== 'rgba(0, 0, 0, 0)') { - throw new Error(`Expected: Edit DIV close button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Edit DIV close button color matched as expected'); - } - }, - - //NEXT ACTION -Close edit DIV - { description: 'Click X icon', action: async () => await driver.findElement(By.css('.modal-lg .modal-header span')).click() }, - { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, - - /*Biology - QA Item Count Check {ECS-2972} - //NEXT ACTION -Verify Biology - QA item Count - { description: 'Click Biology-QA item Count link', action: async () => await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .badge')).click() }, - { description: 'Wait for My Content Totals DIV to open', action: async () => await driver.sleep(5000) }, - - //Wait for dashboard to load - { - description: 'Wait for DIV to open', - action: async () => { - return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 10000).catch(() => false); - } - }, - - //Biology - QA Totals DIV title - { - description: 'Validate Biology - QA Totals DIV title', - action: async () => { - const elementText = await driver.findElement(By.css('.content_modal_title')).getText(); - if (elementText !== 'Biology - QA Totals') { - throw new Error(`Expected: "Biology - QA Totals"; Actual: "${elementText}"`); - } - console.log('Passed: Biology - QA Totals DIV title matched as expected'); - } - }, - - //Biology - QA Totals DIV title text color -dark blue - { - description: 'Validate Biology - QA Totals DIV title font color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.content_modal_title')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: My Content Totals DIV title font color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Biology - QA Totals DIV title font color matched as expected'); - } - }, - - //Biology - QA Totals DIV title text font size - { - description: 'Validate Biology - QA Totals DIV title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.content_modal_title')).getCssValue('font-size'); - if (elementStyle !== '18px') { - throw new Error(`Expected: Biology - QA Totals DIV title text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Biology - QA Totals DIV title background text font-size matched as expected'); - } - }, - - //Biology - QA Total Items Count "1046" - { - description: 'Validate Biology - QA Totals DIV - Total Items Count', - action: async () => { - const elementText = await driver.findElement(By.css('#total > b')).getText(); - if (elementText !== '1046') { - throw new Error(`Expected: "1046"; Actual: "${elementText}"`); - } - console.log('Passed: 1046 - Total Items Count matched as expected'); - } - }, - - //Biology - QA Total Items Count text font size - { - description: 'Validate Biology - QA Totals DIV - Total Items Count text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#total > b')).getCssValue('font-size'); - if (elementStyle !== '36px') { - throw new Error(`Expected: Biology - QA Totals DIV - Items Count text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Biology - QA Totals DIV - Items Count text font-size matched as expected'); - } - }, - - //Biology - QA Total Items label - { - description: 'Validate Biology - QA Totals DIV - Total Items label', - action: async () => { - try { - const element = await driver.findElement(By.css('#total')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'Total Items'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); + //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`); } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging - } - } - }, - - //Biology - QA Unique Titles Count - { - description: 'Validate Biology - QA Totals DIV - Unique Titles Count', - action: async () => { - const elementText = await driver.findElement(By.css('#total_titles > b')).getText(); - if (elementText !== '1058') { - throw new Error(`Expected: "1058"; Actual: "${elementText}"`); - } - console.log('Passed: Biology - QA Totals DIV - Unique Titles Count matched as expected'); - } - }, - - //Biology - QA Unique Titles Count text font size - { - description: 'Validate Biology - QA Totals DIV - Unique Titles Count text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#total_titles > b')).getCssValue('font-size'); - if (elementStyle !== '36px') { - throw new Error(`Expected: Biology - QA Total DIV - Unique Titles Count text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Biology - QA Totals DIV - Unique Titles Count text font-size matched as expected'); - } - }, - - //Biology - QA Unique Titles label - { - description: 'Validate Biology - QA Totals DIV - Unique Titles label', - action: async () => { - try { - const element = await driver.findElement(By.css('#total_titles')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'Unique Titles'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); - } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging - } - } - }, - - //Biology - QA Unique IDs Count - { - description: 'Validate Biology - QA Totals DIV - Unique Titles Count', - action: async () => { - const elementText = await driver.findElement(By.css('#total_pubtotalids > b')).getText(); - if (elementText !== '1065') { - throw new Error(`Expected: "1065"; Actual: "${elementText}"`); - } - console.log('Passed: Biology - QA Totals DIV - Unique IDs Count matched as expected'); - } - }, - - //Biology - QA Unique IDs Count text font size - { - description: 'Validate Biology - QA Totals DIV - Unique IDs Count text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#total_pubtotalids > b')).getCssValue('font-size'); - if (elementStyle !== '36px') { - throw new Error(`Expected: Biology - QA Totals DIV - Unique IDs Count text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Biology - QA Totals DIV - Count text font-size matched as expected'); - } - }, - - //Biology - QA Unique IDs label - { - description: 'Validate Biology - QA Totals DIV - Unique IDs', - action: async () => { - try { - const element = await driver.findElement(By.css('#total_pubtotalids')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'Unique IDs'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); - } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging - } - } - }, - - //My Content; My Content Totals DIV - Close button - { - description: 'Validate My Content Totals DIV - Close button', - action: async () => { - const elementText = await driver.findElement(By.css('#all_content_modal .btn-secondary')).getText(); - if (elementText !== 'Close') { - throw new Error(`Expected: "Close"; Actual: "${elementText}"`); - } - console.log('Passed: Close button text matched as expected'); - } - }, - - //My Content Totals DIV - Close button color-white - { - description: 'Validate My Content Totals DIV - Export button background color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#all_content_modal .btn-secondary')).getCssValue('background-color'); - if (elementStyle !== 'rgba(0, 0, 0, 0)') { - throw new Error(`Expected: Close button background color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Close button background color matched as expected'); - } - }, - - //My Content Totals DIV - Export button - { - description: 'Validate My Content Totals DIV - Export button', - action: async () => { - const elementText = await driver.findElement(By.css('#export_btn')).getText(); - if (elementText !== 'Export') { - throw new Error(`Expected: "Export"; Actual: "${elementText}"`); - } - console.log('Passed: Export button text matched as expected'); - } - }, - - //My Content Totals DIV - Export button color-green - { - description: 'Validate My Content Totals DIV - Export button background color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#export_btn')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Export button background color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Export button background color matched as expected'); - } - }, - - //NEXT ACTION -Click Close DIV button - { description: 'Click My Contents Count DIV Close button', action: async () => await driver.findElement(By.css('#all_content_modal .btn-secondary')).click() }, - { description: 'Wait for My Content Totals DIV to close', action: async () => await driver.sleep(2000) },*/ - - //NEXT ACTION -Click My Content ellipsis icon - { description: 'Click Ellipsis icon', action: async () => await driver.findElement(By.css('.fa-ellipsis-h')).click() }, - { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, - - //Create Content Set icon color -dark blue - { - description: 'Validate create content set icon color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.fa-plus')).getCssValue('color'); - if (elementStyle !== 'rgba(33, 37, 41, 1)') { - throw new Error(`Expected: Create Content Set icon color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Create Content Set icon color matched as expected'); - } - }, - - //Create Content Set link text - { - description: 'Validate create content set link text', - action: async () => { - const elementText = await driver.findElement(By.linkText('Create Content Set')).getText(); - if (elementText !== 'Create Content Set') { - throw new Error(`Expected: "Create Content Set"; Actual: "${elementText}"`); - } - console.log('Passed: Create Content Set link text matched as expected'); - } - }, - - //Create Content Set link text color -dark blue - { - description: 'Validate create content set link text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Create Content Set')).getCssValue('color'); - if (elementStyle !== 'rgba(33, 37, 41, 1)') { - throw new Error(`Expected: Create Content Set link text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Create Content Set link text color matched as expected'); - } - }, - - //Export Content Set icon color -dark blue - { - description: 'Validate export content set icon color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.fa-download')).getCssValue('color'); - if (elementStyle !== 'rgba(33, 37, 41, 1)') { - throw new Error(`Expected: Export Content icon color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Export Content icon color matched as expected'); - } - }, - - //Export Content Set link text - { - description: 'Validate export content set link text', - action: async () => { - const elementText = await driver.findElement(By.linkText('Export Content Set')).getText(); - if (elementText !== 'Export Content Set') { - throw new Error(`Expected: "Export Content Set"; Actual: "${elementText}"`); - } - console.log('Passed: Export Content Set link text matched as expected'); - } - }, - - //Export Content Set link text color -dark blue - { - description: 'Validate export content set link text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Export Content Set')).getCssValue('color'); - if (elementStyle !== 'rgba(33, 37, 41, 1)') { - throw new Error(`Expected: Export Content Set icon color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Export Content Set icon color matched as expected'); - } - }, - - //NEXT ACTION -Create Content Set - { description: 'Click Create Content Set link', action: async () => await driver.findElement(By.linkText('Create Content Set')).click() }, - { description: 'Driver sleep', action: async () => await driver.sleep(5000) }, - - //Wait for DIV to open - { - description: 'Wait for DIV to open', - action: async () => { - return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 10000).catch(() => false); - } - }, - - //Create Content Set DIV - { - description: 'Validate create content set DIV title', - action: async () => { - const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText(); - if (elementText !== 'Create Content Set') { - throw new Error(`Expected: Content set DIV title did not match; Actual: "${elementText}"`); - } - console.log('Passed: Create Content Set DIV title matched as expected'); - } - }, - - //Create Content Set DIV title text font size - { - description: 'Validate Create Content Set DIV title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.modal-lg .modal-title')).getCssValue('font-size'); - if (elementStyle !== '18px') { - throw new Error(`Expected: Create Content Set DIV title text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Create Content Set DIV title text background text font-size matched as expected'); - } - }, - - //Create Content Set DIV - Content Set Name label - { - description: 'Validate create DIV label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-row:nth-child(2) .form-label')).getText(); - if (elementText !== 'Content Set Name') { - throw new Error(`Expected: "Content Set Name"; Actual: "${elementText}"`); - } - console.log('Passed: Create DIV label matched as expected'); - } - }, - - //Create Content Set DIV - Content Set Name label text font size - { - description: 'Validate Create Content Set DIV - Content Set Name label text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.form-row:nth-child(2) .form-label')).getCssValue('font-size'); - if (elementStyle !== '15px') { - throw new Error(`Expected: Create Content Set DIV - Content Set Name label text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Create Content Set DIV - Content Set Name label text background text font-size matched as expected'); - } - }, - - //Create Content Set DIV - Create button text - { - description: 'Validate create DIV - Create button text', - action: async () => { - const elementText = await driver.findElement(By.css('.modal-lg #modalop')).getAttribute('value'); - if (elementText !== 'Create') { - throw new Error(`Expected: "Create"; Actual: "${elementText}"`); - } - console.log('Passed: Create button text matched as expected'); - } - }, - - //Create Content Set DIV - Create button color -green - { - description: 'Validate create DIV - Create button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.modal-lg #modalop')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Create button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Create button color matched as expected'); - } - }, - - //Create Content Set DIV - Close button text - { - description: 'Validate create DIV - Close button text', - action: async () => { - const elementText = await driver.findElement(By.css('#modalclose')).getText(); - if (elementText !== 'Close') { - throw new Error(`Expected: "Close"; Actual: "${elementText}"`); - } - console.log('Passed: Close DIV label matched as expected'); - } - }, - - //Create Content Set DIV - Close button color -white - { - description: 'Validate create DIV - Close button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color'); - if (elementStyle !== 'rgba(0, 0, 0, 0)') { - throw new Error(`Expected: Close button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Close button color matched as expected'); - } - }, - - //NEXT ACTION -Validation: Create Content Set - No Name - { description: 'Click create button without content set name', action: async () => await driver.findElement(By.css('.modal-lg #modalop')).click() }, - { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, - - //Validation - { - description: 'Validate text', - action: async () => { - const elementText = await driver.findElement(By.css('#metawarn > b')).getText(); - if (elementText !== 'You must enter a Content Set name.') { - throw new Error(`Expected: "You must enter a Content Set name."; Actual: "${elementText}"`); - } - console.log('Passed: Create DIV label matched as expected'); - } - }, - - //Validation text color -red - { - description: 'Validate Create Content Set validation text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#metawarn > b')).getCssValue('color'); - if (elementStyle !== 'rgba(220, 53, 69, 1)') { - throw new Error(`Expected: Create Content Set validation text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Create Content Set validation text color matched as expected'); - } - }, - - //NEXT ACTION -Validation: Create Content Set - Existing Name - { description: 'Enter existing content set name', action: async () => await driver.findElement(By.css('#orgname')).sendKeys('Biology - QA') }, - { description: 'Click create button', action: async () => await driver.findElement(By.css('.modal-lg #modalop')).click() }, - { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, - - //Validation - { - description: 'Validate text', - action: async () => { - const elementText = await driver.findElement(By.css('#namewarn')).getText(); - if (elementText !== 'That name is already in use. Please enter a different name.') { - throw new Error(`Expected: "That name is already in use. Please enter a different name."; Actual: "${elementText}"`); - } - console.log('Passed: Create DIV label matched as expected'); - } - }, - - //Validation text color -red - { - description: 'Validate Create Content Set validation text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#namewarn')).getCssValue('color'); - if (elementStyle !== 'rgba(220, 53, 69, 1)') { - throw new Error(`Expected: Create Content Set validation text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Create Content Set validation text color matched as expected'); - } - }, - - //NEXT ACTION -Enter Content Set name: "Automated Content Set - To be deleted" - { description: 'Clear content set name', action: async () => await driver.findElement(By.css('.form-row:nth-child(2) #orgname')).clear() }, - { description: 'Driver sleep', action: async () => await driver.sleep(1000) }, - { description: 'Enter content set name', action: async () => await driver.findElement(By.css('.form-row:nth-child(2) #orgname')).sendKeys(createContentSetName) }, - { description: 'Click create button', action: async () => await driver.findElement(By.css('.modal-lg #modalop')).click() }, - { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, - - //Validate confirmation message - { - description: 'Validate confirmation message', - action: async () => { - const elementText = await driver.findElement(By.css('strong')).getText(); - if (elementText !== 'The content set was successfuly created') { - throw new Error(`Expected: Alert banner created confirmation message did not match; Actual: "${elementText}"`); - } - console.log('Passed: Alert banner created confirmation message displayed as expected'); - } - }, - - //Validate confirmation message background color -green - { - description: 'Validate confirmation message background color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#statalert')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 167, 69, 1)') { - throw new Error(`Expected: Alert banner background color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Alert banner background color matched as expected'); - } - }, - - //Wait for dashboard to load - { - description: 'Wait for dashboard load to completely', - action: async () => { - return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false); - } - }, - - //Validate created content item count - { - description: 'Validate created content count', - action: async () => { - const elementText = await driver.findElement(By.css('#content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list .badge')).getText(); - if (elementText !== '0') { - throw new Error(`Expected: created content item count did not match; Actual: "${elementText}"`); - } - console.log('Passed: Created content item count matched as expected'); - } - }, - - //ITEMS PAGE - //NEXT ACTION -Click created content set link - { description: 'Click created content set title link', action: async () => await driver.findElement(By.linkText(createContentSetName)).click() }, - - //Wait for DIV - { - description: 'Wait for contente page to load', - action: async () => { - return await driver.wait(until.elementLocated(By.css('b:nth-child(2)')), 5000).catch(() => false); - } - }, - - //Validate content item page - Filter Results label - { - description: 'Validate Filter Results label', - action: async () => { - const elementText = await driver.findElement(By.css('.well > b')).getText(); - if (elementText !== 'Filter Results') { - throw new Error(`Expected: Filter Results label did not match; Actual: "${elementText}"`); - } - console.log('Passed: Filter Results label matched as expected'); - } - }, - - //Validate content item page - Filter Results label text font size - { - description: 'Validate Validate content item page - Filter Results label text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.well > b')).getCssValue('font-size'); - if (elementStyle !== '13px') { - throw new Error(`Expected: Content item page - Filter Results label text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Content item page - Filter Results label text background text font-size matched as expected'); - } - }, - - //Validate content item page - Grade label - { - description: 'Validate filter - Grade label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(1) > b')).getText(); - if (elementText !== 'Grade') { - throw new Error(`Expected: Filter - Grade label did not match; Actual: "${elementText}"`); - } - console.log('Passed: Filter - Grade label matched as expected'); - } - }, - - //Validate content item page - Grade label text font size - { - description: 'Validate Validate content item page - Grade label text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.form-group:nth-child(1) > b')).getCssValue('font-size'); - if (elementStyle !== '13px') { - throw new Error(`Expected: Content item page - Grade label text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Content item page - Grade label text background text font-size matched as expected'); - } - }, - - //Validate content item page - Subject label - { - description: 'Validate filter - Subject label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(3) > b')).getText(); - if (elementText !== 'Subject') { - throw new Error(`Expected: Filter - Subject label did not match; Actual: "${elementText}"`); - } - console.log('Passed: Filter - Subject label matched as expected'); - } - }, - - //Validate content item page - Subject label text font size - { - description: 'Validate Validate content item page - Subject label text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.form-group:nth-child(3) > b')).getCssValue('font-size'); - if (elementStyle !== '13px') { - throw new Error(`Expected: Content item page - Subject label text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Content item page - Subject label text background text font-size matched as expected'); - } - }, - - //Validate content item page - Reset All link - { - description: 'Validate filter - Reset All link', - action: async () => { - const elementText = await driver.findElement(By.linkText('Reset All')).getText(); - if (elementText !== 'Reset All') { - throw new Error(`Expected: Filter - Reset All link did not match; Actual: "${elementText}"`); - } - console.log('Passed: Filter - Reset All link matched as expected'); - } - }, - - //Validate content item page - Search Results text - { - description: 'Validate Item - Search Results text', - action: async () => { - const elementText = await driver.findElement(By.css('b:nth-child(2)')).getText(); - if (elementText !== 'There are no items that match your search criteria.') { - throw new Error(`Expected: "There are no items that match your search criteria." text did not match; Actual: "${elementText}"`); - } - console.log('Passed: Item - Search Results text matched as expected'); - } - }, - - //Validate content item page - Search Results text font size - { - description: 'Validate content item page - Search Results text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('b:nth-child(2)')).getCssValue('font-size'); - if (elementStyle !== '13px') { - throw new Error(`Expected: Content item page - Search Results text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Content item page - Search Results text background text font-size matched as expected'); - } - }, - - //NEXT ACTION -Navigate Back To Dashboard - { description: 'Click Dashboard navigation link', action: async () => await driver.findElement(By.linkText('Dashboard')).click() }, - { description: 'Browser sleep', action: async () => await driver.sleep(10000) }, - - //Wait for dashboard to load - Correlation Coverages View Details button - { - description: 'Wait for dashboard load to completely', - action: async () => { - return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false); - } - }, - - //NEXT ACTION -Export Content - { description: 'Click Ellipsis icon', action: async () => await driver.findElement(By.css('.fa-ellipsis-h')).click() }, - { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, - - //Create Content Set icon color -dark blue - { - description: 'Validate create content set icon color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.fa-plus')).getCssValue('color'); - if (elementStyle !== 'rgba(33, 37, 41, 1)') { - throw new Error(`Expected: Create Content Set icon color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Create Content Set icon color matched as expected'); - } - }, - - //Create Content Set link text - { - description: 'Validate create content set link text', - action: async () => { - const elementText = await driver.findElement(By.linkText('Create Content Set')).getText(); - if (elementText !== 'Create Content Set') { - throw new Error(`Expected: "Create Content Set"; Actual: "${elementText}"`); - } - console.log('Passed: Create Content Set link text matched as expected'); - } - }, - - //Create Content Set link text color -dark blue - { - description: 'Validate create content set link text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Create Content Set')).getCssValue('color'); - if (elementStyle !== 'rgba(33, 37, 41, 1)') { - throw new Error(`Expected: Create Content Set link text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Create Content Set link text color matched as expected'); - } - }, - - //Export Content Set icon color -dark blue - { - description: 'Validate export content set icon color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.fa-download')).getCssValue('color'); - if (elementStyle !== 'rgba(33, 37, 41, 1)') { - throw new Error(`Expected: Export Content icon color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Export Content icon color matched as expected'); - } - }, - - //Export Content Set link text - { - description: 'Validate export content set link text', - action: async () => { - const elementText = await driver.findElement(By.linkText('Export Content Set')).getText(); - if (elementText !== 'Export Content Set') { - throw new Error(`Expected: "Export Content Set"; Actual: "${elementText}"`); - } - console.log('Passed: Export Content Set link text matched as expected'); - } - }, - - //Export Content Set link text color -dark blue - { - description: 'Validate export content set link text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Export Content Set')).getCssValue('color'); - if (elementStyle !== 'rgba(33, 37, 41, 1)') { - throw new Error(`Expected: Export Content Set icon color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Export Content Set icon color matched as expected'); - } - }, - - //NEXT ACTION -Click Export Content Set link - { description: 'Click Export Content Set link', action: async () => await driver.findElement(By.linkText('Export Content Set')).click() }, - { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, - - //Wait for dashboard to load - { - description: 'Wait for DIV to open', - action: async () => { - return await driver.wait(until.elementLocated(By.css('.modal-header:nth-child(5) > .modal-title')), 10000).catch(() => false); - } - }, - - //Export Content Set DIV - { - description: 'Validate export content set DIV title', - action: async () => { - const elementText = await driver.findElement(By.css('.modal-header:nth-child(5) > .modal-title')).getText(); - if (elementText !== 'Export Content') { - throw new Error(`Expected: Export set DIV title did not match; Actual: "${elementText}"`); - } - console.log('Passed: Export Content DIV title matched as expected'); - } - }, - - //Export Content Set DIV Title text font size - { - description: 'Validate Export Content Set DIV Title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.modal-header:nth-child(5) > .modal-title')).getCssValue('font-size'); - if (elementStyle !== '18px') { - throw new Error(`Expected: Export Content Set DIV Title text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Export Content Set DIV Title text background text font-size matched as expected'); - } - }, - - //Export Content Set DIV - label - { - description: 'Validate export DIV label text', - action: async () => { - const elementText = await driver.findElement(By.css('#content-export-container > h5')).getText(); - if (elementText !== 'Please select one or more content sets to export:') { - throw new Error(`Expected: "Please select one or more content sets to export:" label; Actual: "${elementText}"`); - } - console.log('Passed: Export Content DIV label matched as expected'); - } - }, - - //Export Content Set DIV - label text font size - { - description: 'Validate export DIV label text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#content-export-container > h5')).getCssValue('font-size'); - if (elementStyle !== '20px') { - throw new Error(`Expected: Export Content label text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Export Content label text font-size matched as expected'); - } - }, - - //Export Content Set DIV - label - { - description: 'Validate export DIV label', - action: async () => { - const elementText = await driver.findElement(By.css('#content_export .form-label')).getText(); - if (elementText !== 'Content Set') { - throw new Error(`Expected: "Content Set"; Actual: "${elementText}"`); - } - console.log('Passed: Export Content DIV label matched as expected'); - } - }, - - //Export Content Set Dropdown - { - description: 'Validate export content set dropdown option', - action: async () => { - const elementOption = await driver.findElement(By.css('.form-group:nth-child(1) .multiselect-selected-text')).getText(); - if (elementOption !== 'Please select a Content Set') { - throw new Error(`Expected: "Please select a Content Set"; Actual: "${elementOption}"`); - } - console.log('Passed: Export Content Set dropdown option matched as expected'); - } - }, - - //Export Content Set DIV - Export button text - { - description: 'Validate export DIV - Export button text', - action: async () => { - const elementText = await driver.findElement(By.css('.modal-footer:nth-child(6) > .btn-primary')).getAttribute('value'); - if (elementText !== 'Export') { - throw new Error(`Expected: "Export"; Actual: "${elementText}"`); - } - console.log('Passed: Export button text matched as expected'); - } - }, - - //Export Content Set DIV - Export button color -green - { - description: 'Validate export DIV - Export button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.modal-footer:nth-child(6) > .btn-primary')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Export button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Export button color matched as expected'); - } - }, - - //Export Content Set DIV - Close button text - { - description: 'Validate export DIV - Close button text', - action: async () => { - const elementText = await driver.findElement(By.css('.btn:nth-child(3)')).getText(); - if (elementText !== 'Close') { - throw new Error(`Expected: "Close"; Actual: "${elementText}"`); - } - console.log('Passed: Close DIV label matched as expected'); - } - }, - - //Export Content Set DIV - Close button color -white - { - description: 'Validate export DIV - Close button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.btn:nth-child(3)')).getCssValue('background-color'); - if (elementStyle !== 'rgba(0, 0, 0, 0)') { - throw new Error(`Expected: Close button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Close button color matched as expected'); - } - }, - - //NEXT ACTION -Click dropdown - { description: 'Click Export Content dropdown', action: async () => await driver.findElement(By.css('.form-group:nth-child(1) .multiselect-selected-text')).click() }, - { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, - - //Export search icon - { - description: 'Verify export search icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show .input-group-prepend img')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Export search icon not found'); - } - console.log('Passed: Export search icon present'); - } - }, - - //Export Content set dropdown placeholder - { - description: 'Validate dropdown placeholder text', - action: async () => { - const elementValue = await driver.findElement(By.css('.show > .multiselect-item .form-control')).getAttribute('placeholder'); - if (elementValue !== 'Search') { - throw new Error(`Expected: "Search"; Actual: "${elementValue}"`); - } - console.log('Passed: Export dropdown placeholder text matched as expected'); - } - }, - - //Export X icon - { - description: 'Verify export search X icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.form-group:nth-child(1) .input-group-append img')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Export search X icon not found'); - } - console.log('Passed: Export search X icon present'); - } - }, - - //SEARCH OPTIONS - //Select All checkbox - { - description: 'Verify Select all checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show .multiselect-all input')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Export selectd all checkbox icon not found'); - } - console.log('Passed: Export select all checkbox icon present'); - } - }, - - //Select all search text - { - description: 'Validate export Select all text', - action: async () => { - const elementText = await driver.findElement(By.css('.show > .multiselect-item .checkbox')).getText(); - if (elementText !== 'Select all') { - throw new Error(`Expected: "Select all"; Actual: "${elementText}"`); - } - console.log('Passed: Select all matched as expected'); - } - }, - - //Select all search text font size - { - description: 'Validate Select all search text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.show > .multiselect-item .checkbox')).getCssValue('font-size'); - if (elementStyle !== '13.2px') { - throw new Error(`Expected: Select all search text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Select all search text font-size matched as expected'); - } - }, - - //NEXT ACTION -Filter content list by QA - { description: 'Filter Content Set Search list by QA', action: async () => await driver.findElement(By.css('.show > .multiselect-item .form-control')).sendKeys('QA') }, - { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, - - //FILTERED RESULTS - //Select All checkbox - { - description: 'Verify Select all checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show .multiselect-all input')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Export selectd all checkbox icon not found'); - } - console.log('Passed: Export select all checkbox icon present'); - } - }, - - //Select all search handle text - { - description: 'Validate export Select all handle text', - action: async () => { - const elementText = await driver.findElement(By.css('.show > .multiselect-item .checkbox')).getText(); - if (elementText !== 'Select all') { - throw new Error(`Expected: "Select all"; Actual: "${elementText}"`); - } - console.log('Passed: Select all handle text matched as expected'); - } - }, - - //Algebra - QA checkbox - { - description: 'Verify Algebra checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(8) input')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Export Algebra - QA checkbox icon not found'); - } - console.log('Passed: Export Algebra - QA checkbox icon present'); - } - }, - - //Algebra - QA search handle text - { - description: 'Validate export Algebra handle text', - action: async () => { - const elementText = await driver.findElement(By.css('.show > li:nth-child(8) .checkbox')).getText(); - if (elementText !== 'Algebra - QA') { - throw new Error(`Expected: "Algebra - QA"; Actual: "${elementText}"`); - } - console.log('Passed: Algebra - QA handle text matched as expected'); - } - }, - - //Biology - QA checkbox - { - description: 'Verify Biology checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(9) input')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Export Biology - QA checkbox icon not found'); - } - console.log('Passed: Export Biology - QA checkbox icon present'); - } - }, - - //Biology - QA search handle text - { - description: 'Validate export Biology handle text', - action: async () => { - const elementText = await driver.findElement(By.css('.show > li:nth-child(9) .checkbox')).getText(); - if (elementText !== 'Biology - QA') { - throw new Error(`Expected: "Biology - QA"; Actual: "${elementText}"`); - } - console.log('Passed: Biology - QA handle text matched as expected'); - } - }, - - //English II - QA checkbox - { - description: 'Verify English II checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(10) input')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Export English II - QA checkbox icon not found'); - } - console.log('Passed: Export English II - QA checkbox icon present'); - } - }, - - //English II - QA search handle text - { - description: 'Validate export English II handle text', - action: async () => { - const elementText = await driver.findElement(By.css('.show > li:nth-child(10) .checkbox')).getText(); - if (elementText !== 'English II - QA') { - throw new Error(`Expected: "English II - QA"; Actual: "${elementText}"`); - } - console.log('Passed: English II - QA handle text matched as expected'); - } - }, - - //Geometry - QA checkbox - { - description: 'Verify Geometry checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(11) input')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Export Geometry - QA checkbox icon not found'); - } - console.log('Passed: Export Geometry - QA checkbox icon present'); - } - }, - - //Geometry - QA search handle text - { - description: 'Validate export Geometry handle text', - action: async () => { - const elementText = await driver.findElement(By.css('.show > li:nth-child(11) .checkbox')).getText(); - if (elementText !== 'Geometry - QA') { - throw new Error(`Expected: "Geometry - QA"; Actual: "${elementText}"`); - } - console.log('Passed: Geometry - QA handle text matched as expected'); - } - }, - - //US History - QA checkbox - { - description: 'Verify US History checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(12) input')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Export US History - QA checkbox icon not found'); - } - console.log('Passed: Export US History - QA checkbox icon present'); - } - }, - - //US History - QA search handle text - { - description: 'Validate export US History handle text', - action: async () => { - const elementText = await driver.findElement(By.css('.show > li:nth-child(12) .checkbox')).getText(); - if (elementText !== 'US History - QA') { - throw new Error(`Expected: "US History - QA"; Actual: "${elementText}"`); - } - console.log('Passed: US History - QA handle text matched as expected'); - } - }, - - //Created Content Set Name checkbox - { - description: `Verify ${createContentSetName} checkbox icon is present`, - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(20) input')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error(`Expected: Export "${createContentSetName}" checkbox icon not found`); - } - console.log(`Passed: Export "${createContentSetName}" checkbox icon present`); - } - }, - - //Created Content Set Name search handle text - { - description: `Validate export ${createContentSetName} handle text`, - action: async () => { - const elementText = await driver.findElement(By.css('.show > li:nth-child(20) .checkbox')).getText(); - if (elementText !== createContentSetName) { - throw new Error(`Expected: "${createContentSetName}"; Actual: "${elementText}"`); - } - console.log(`Passed: "${createContentSetName}" handle text matched as expected`); - } - }, - - //NEXT ACTION -Select created content set to export - { description: 'Click Automated QA checkbox', action: async () => await driver.findElement(By.css('.show > li:nth-child(20) input')).click() }, - { description: 'Browser sleep', action: async () => await driver.sleep(2000) }, - { description: 'Click Export button', action: async () => await driver.findElement(By.css('.modal-footer:nth-child(6) > .btn-primary')).click() }, - { description: 'Wait for export page to load', action: async () => await driver.sleep(5000) }, - - //Export page title - { - description: 'Validate Export page title', - action: async () => { - const elementText = await driver.findElement(By.css('h2')).getText(); - if (elementText !== 'Export') { - throw new Error(`Expected: "Export"; Actual: "${elementText}"`); - } - console.log('Passed: Export page title matched as expected'); - } - }, - - //Export page title text color -dark blue - { - description: 'Validate Export page title text font color', - action: async () => { - const elementStyle = await driver.findElement(By.css('h2')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Export page title text font color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Export page title text font color matched as expected'); - } - }, - - //Export page title text font size - { - description: 'Validate Export page title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('h2')).getCssValue('font-size'); - if (elementStyle !== '32px') { - throw new Error(`Expected: Export page title text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Export page title text font-size matched as expected'); - } - }, - - //Export complete label - { - description: 'Validate Export complete label', - action: async () => { - const elementText = await driver.findElement(By.css('b')).getText(); - if (elementText !== 'Export complete!') { - throw new Error(`Expected: "Export complete!"; Actual: "${elementText}"`); - } - console.log('Passed: Export complete! label matched as expected'); - } - }, - - //Export complete label text font size - { - description: 'Validate Export complete label text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('b')).getCssValue('font-size'); - if (elementStyle !== '13px') { - throw new Error(`Expected:Export complete label text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Export complete label text font-size matched as expected'); - } - }, - - //Download Export button icon - { - description: 'Verify Download Export button icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-download')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Expected: Download Export button icon not found'); - } - console.log('Passed: Download Export button icon present'); - } - }, - - //Download Export button text - { - description: 'Validate Download Export button text', - action: async () => { - const elementText = await driver.findElement(By.linkText('Download Export')).getText(); - if (elementText !== 'Download Export') { - throw new Error(`Expected: "Download Export"; Actual: "${elementText}"`); - } - console.log('Passed: Download Export button text matched as expected'); - } - }, - - //Download Export button color -dark blue - { - description: 'Validate Download Export button color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Download Export')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Download Export button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Download Export button color matched as expected'); - } - }, - - //NEXT ACTION -Navigate Back To Dashboard - { description: 'Click Dashboard navigation link', action: async () => await driver.findElement(By.linkText('Dashboard')).click() }, - { description: 'Browser sleep', action: async () => await driver.sleep(10000) }, - - //Wait for dashboard to load - Correlation Coverages View Details button - { - description: 'Wait for dashboard load to completely', - action: async () => { - return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false); - } - }, - - //NEXT ACTION -Filter content list by - QA - { description: 'Enter content set name', action: async () => await driver.findElement(By.css('#content-org-filter')).sendKeys('QA') }, - { description: 'Wait for content list to filter', action: async () => await driver.sleep(2000) }, - - //Validate sort order by applying filter QA - //Biology - QA (1st) - { - description: 'Validate by filter QA: Biology - QA label in 1st place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'Biology - QA')]`)).getText(); - if (elementText !== 'Biology - QA') { - throw new Error(`Expected: Filtered by QA: Biology - QA label not sorted in 1st place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: Biology - QA label sorted in 1st place'); - } - }, - - //Biology - QA = 1046 (1st) - { - description: 'Validate by filter QA: Biology - QA 1046 count in 1st place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//li/div/span')).getText(); - if (elementText !== '1046') { - throw new Error(`Expected: Filtered by QA: Biology - QA count "1046" not sorted in 1st place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: Biology - QA count 1046 sorted in 1st place'); - } - }, - - //Geometry - QA (2nd) - { - description: 'Validate by filter QA: Geometry - QA label in 2nd place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'Geometry - QA')]`)).getText(); - if (elementText !== 'Geometry - QA') { - throw new Error(`Expected: Filtered by QA: Geometry - QA label not sorted in 2nd place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: Geometry - QA label sorted in 2nd place'); - } - }, - - //Geometry - QA = 981 (2nd) - { - description: 'Validate by filter QA: Geometry - QA 981 count in 2nd place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getText(); - if (elementText !== '981') { - throw new Error(`Expected: Filtered by QA: Geometry - QA count "981" not sorted in 2nd place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: Geometry - QA count 981 sorted in 2nd place'); - } - }, - - //English II - QA (3rd) - { - description: 'Validate by filter QA: English II - QA label in 3rd place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'English II - QA')]`)).getText(); - if (elementText !== 'English II - QA') { - throw new Error(`Expected: Filtered by QA: English II - QA label not sorted in 3rd place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: English II - QA label sorted in 3rd place'); - } - }, - - //English II - QA = 409 (3rd) - { - description: 'Validate by filter QA: English II - QA 409 count in 3rd place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/li/div/span')).getText(); - if (elementText !== '409') { - throw new Error(`Expected: Filtered by QA: English II - QA count "409" not sorted in 3rd place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: English II - QA count 409 sorted in 3rd place'); - } - }, - - //Algebra - QA (4th) - { - description: 'Validate by filter QA: Algebra - QA label in 4th place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'Algebra - QA')]`)).getText(); - if (elementText !== 'Algebra - QA') { - throw new Error(`Expected: Filtered by QA: Algebra - QA label not sorted in 4th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: Algebra - QA label sorted in 4th place'); - } - }, - - //Algebra - QA = 188 (4th) - { - description: 'Validate by filter QA: Algebra - QA 188 count in 4th place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getText(); - if (elementText !== '188') { - throw new Error(`Expected: Filtered by QA: Algebra - QA count "188" not sorted in 4th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: Algebra - QA count 188 sorted in 4th place'); - } - }, - - //US History - QA (5th) - { - description: 'Validate by filter QA: US History - QA label in 5th place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'US History - QA')]`)).getText(); - if (elementText !== 'US History - QA') { - throw new Error(`Expected: Filtered by QA: Biology - QA label not sorted in 5th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: US History - QA label sorted in 5th place'); - } - }, - - //US History - QA = 62 (5th) - { - description: 'Validate by filter QA: US History - QA 162 count in 5th place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/li/div/span')).getText(); - if (elementText !== '62') { - throw new Error(`Expected: Filtered by QA: US History - QA count "62" not sorted in 5th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: US History - QA count 62 sorted in 5th place'); - } - }, - - //Created Content Set (6th) - { - description: `Validate by filter QA: ${createContentSetName} label in 6th place`, - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'Automated - QA Content Set - To be deleted')]`)).getText(); - if (elementText !== 'Automated - QA Content Set - To be deleted') { - throw new Error(`Expected: Filtered by QA: ${createContentSetName} label not sorted in 6th place; Actual: "${elementText}"`); - } - console.log(`Passed: Filtered by QA: ${createContentSetName} label sorted in 6th place`); - } - }, - - //Created Content Set = 0 (6th) - { - description: `Validate by filter QA: ${createContentSetName} 0 count in 6th place`, - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/li/div/span')).getText(); - if (elementText !== '0') { - throw new Error(`Expected: Filtered by QA: ${createContentSetName} count "0" not sorted in 6th place; Actual: "${elementText}"`); - } - console.log(`Passed: Filtered by QA: ${createContentSetName} count 0 sorted in 6th place`); - } - }, - - //NEXT ACTION -Sort content set list by applying sort by Name - { description: 'Select filter sort order by Name', action: async () => await driver.findElement(By.css('#orgsort > option:nth-child(2)')).click() }, - { description: 'Wait for content list to filter', action: async () => await driver.sleep(2000) }, - - //Algebra - QA (1st) - { - description: 'Validate by filter name: Algebra - QA label in 1st place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'Algebra - QA')]`)).getText(); - if (elementText !== 'Algebra - QA') { - throw new Error(`Expected: Filtered by name: Algebra - QA label not sorted in 1st place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by name: Algebra - QA label sorted in 1st place'); - } - }, - - //Algebra - QA = 188 (1st) - { - description: 'Validate by filter name: Algebra - QA 188 count in 1st place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//li/div/span')).getText(); - if (elementText !== '188') { - throw new Error(`Expected: Filtered by name: Algebra - QA count "188" not sorted in 1st place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by name: Algebra - QA count 188 sorted in 1st place'); - } - }, - - //Created Content Set (2nd) - { - description: `Validate by filter name: ${createContentSetName} label in 2nd place`, - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'Automated - QA Content Set - To be deleted')]`)).getText(); - if (elementText !== 'Automated - QA Content Set - To be deleted') { - throw new Error(`Expected: Filtered by name: ${createContentSetName} label not sorted in 2nd place; Actual: "${elementText}"`); - } - console.log(`Passed: Filtered by name: ${createContentSetName} label sorted in 2nd place`); - } - }, - - //Created Content Set = 0 (2nd) - { - description: `Validate by filter name: ${createContentSetName} 0 count in 2nd place`, - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getText(); - if (elementText !== '0') { - throw new Error(`Expected: Filtered by name: ${createContentSetName} count "0" not sorted in 2nd place; Actual: "${elementText}"`); - } - console.log(`Passed: Filtered by name: ${createContentSetName} count 0 sorted in 2nd place`); - } - }, - - //Biology - QA (3rd) - { - description: 'Validate by filter name: Biology - QA label in 3rd place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'Biology - QA')]`)).getText(); - if (elementText !== 'Biology - QA') { - throw new Error(`Expected: Filtered by name: Biology - QA label not sorted in 3rd place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by name: Biology - QA label sorted in 3rd place'); - } - }, - - //Biology - QA = 1046 (3rd) - { - description: 'Validate by filter name: Biology - QA 1046 count in 3rd place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/li/div/span')).getText(); - if (elementText !== '1046') { - throw new Error(`Expected: Filtered by name: Biology - QA count "1046" not sorted in 3rd place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by name: Biology - QA count 1046 sorted in 3rd place'); - } - }, - - //Demo - User Submitted Content (4th) - { - description: 'Validate by filter name: Demo - User Submitted Content label in 4th place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'Demo - User Submitted Content')]`)).getText(); - if (elementText !== 'Demo - User Submitted Content') { - throw new Error(`Expected: Filtered by name: Biology - QA label not sorted in 4th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by name: Biology - QA label sorted in 4th place'); - } - }, - - //Demo - User Submitted Content = 17 (4th) - { - description: 'Validate by filter name: Demo - User Submitted Content 17 count in 4th place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/li/div/span')).getText(); - if (elementText !== '17') { - throw new Error(`Expected: Filtered by name: Demo - User Submitted ContentA count "17" not sorted in 4th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by name: Demo - User Submitted Content count 17 sorted in 4th place'); - } - }, - - //ECS-2952 Test = 25 (5th) - { - description: 'Validate by filter name: ECS-2952 Test label in 4th place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'ECS-2952 Test')]`)).getText(); - if (elementText !== 'ECS-2952 Test') { - throw new Error(`Expected: Filtered by name: ECS-2952 Test label not sorted in 4th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by name:ECS-2952 Test label sorted in 4th place'); - } - }, - - //ECS-2952 Test = 25 (5th) - { - description: `Validate by filter name: ECS-2952 Test 25 count in 5th place`, - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getText(); - if (elementText !== '25') { - throw new Error(`Expected: Filtered by name: ECS-2952 Test count "25" not sorted in 5th place; Actual: "${elementText}"`); - } - console.log(`Passed: Filtered by name: ECS-2952 Test count 25 sorted in 5th place`); - } - }, - - //English II - QA (6th) - { - description: 'Validate by filter QA: English II - QA label in 6th place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'English II - QA')]`)).getText(); - if (elementText !== 'English II - QA') { - throw new Error(`Expected: Filtered by QA: English II - QA label not sorted in 6th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: English II - QA label sorted in 6th place'); - } - }, - - //English II - QA = 409 (6th) - { - description: 'Validate by filter name: English II - QA 409 count in 6th place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/li/div/span')).getText(); - if (elementText !== '409') { - throw new Error(`Expected: Filtered by name: English II - QA count "409" not sorted in 6th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by name: English II - QA 409 count 409 sorted in 6th place'); - } - }, - - //NEXT ACTION -Filter content list by - QA by applying sort by Name and filtered by QA - { description: 'Enter content set name', action: async () => await driver.findElement(By.css('#content-org-filter')).sendKeys('QA') }, - { description: 'Wait for content list to filter', action: async () => await driver.sleep(2000) }, - - //Algebra - QA (1st) - { - description: 'Validate by filter name: Algebra - QA label in 1st place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'Algebra - QA')]`)).getText(); - if (elementText !== 'Algebra - QA') { - throw new Error(`Expected: Filtered by name: Algebra - QA label not sorted in 1st place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by name: Algebra - QA label sorted in 1st place'); - } - }, - - //Algebra - QA = 188 (1st) - { - description: 'Validate by filter QA and sorted by name: Algebra - QA 188 count in 1st place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//li/div/span')).getText(); - if (elementText !== '188') { - throw new Error(`Expected: Filtered by QA and sorted by name: Algebra - QA count "188" not sorted in 1st place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA and sorted by name: Algebra - QA count 188 sorted in 1st place'); - } - }, - - //Created Content Set (2nd) - { - description: `Validate by filter name: ${createContentSetName} label in 2nd place`, - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'Automated - QA Content Set - To be deleted')]`)).getText(); - if (elementText !== 'Automated - QA Content Set - To be deleted') { - throw new Error(`Expected: Filtered by name: ${createContentSetName} label not sorted in 2nd place; Actual: "${elementText}"`); - } - console.log(`Passed: Filtered by name: ${createContentSetName} label sorted in 2nd place`); - } - }, - - //Created Content Set = 0 (2nd) - { - description: `Validate by filter QA and sorted by name: ${createContentSetName} 0 count in 2nd place`, - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getText(); - if (elementText !== '0') { - throw new Error(`Expected: Filtered by QA and sorted by name: ${createContentSetName} count "0" not sorted in 2nd place; Actual: "${elementText}"`); - } - console.log(`Passed: Filtered by QA and sorted by name: ${createContentSetName} count 0 sorted in 2nd place`); - } - }, - - //Biology - QA (3rd) - { - description: 'Validate by filter name: Biology - QA label in 3rd place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'Biology - QA')]`)).getText(); - if (elementText !== 'Biology - QA') { - throw new Error(`Expected: Filtered by name: Biology - QA label not sorted in 3rd place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by name: Biology - QA label sorted in 3rd place'); - } - }, - - //Biology - QA = 1046 (3rd) - { - description: 'Validate by filter QA and sorted by name: Biology - QA 1046 count in 3rd place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/li/div/span')).getText(); - if (elementText !== '1046') { - throw new Error(`Expected: Filtered by QA and sorted by name: Biology - QA count "1046" not sorted in 3rd place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA and sorted by name: Biology - QA count 1046 sorted in 3rd place'); - } - }, - - //English II - QA (4th) - { - description: 'Validate by filter QA: English II - QA label in 4th place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'English II - QA')]`)).getText(); - if (elementText !== 'English II - QA') { - throw new Error(`Expected: Filtered by QA: English II - QA label not sorted in 4th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: English II - QA label sorted in 4th place'); - } - }, - - //English II - QA = 409 (4th) - { - description: 'Validate by filter QA and sorted by name: English II - QA 409 count in 4th place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/li/div/span')).getText(); - if (elementText !== '409') { - throw new Error(`Expected: Filtered by QA and sorted by name: English II - QA count "409" not sorted in 4th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA and sorted by name: English II - QA 409 count 409 sorted in 4th place'); - } - }, - - //Geometry - QA (5th) - { - description: 'Validate by filter QA: Geometry - QA label in 5th place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'Geometry - QA')]`)).getText(); - if (elementText !== 'Geometry - QA') { - throw new Error(`Expected: Filtered by QA: Geometry - QA label not sorted in 5th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: Geometry - QA label sorted in 5th place'); - } - }, - - //Geometry - QA = 981 (5th) - { - description: 'Validate by filter QA and sorted by name: Geometry - QA 981 count in 5th place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/li/div/span')).getText(); - if (elementText !== '981') { - throw new Error(`Expected: Filtered by QA and sorted by name: Geometry - QA count "981" not sorted in 5th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA and sorted by name: Geometry - QA count 981 sorted in 5th place'); - } - }, - - //US History - QA (6th) - { - description: 'Validate by filter QA: US History - QA label in 6th place', - action: async () => { - const elementText = await driver.findElement(By.xpath(`//a[contains(.,'US History - QA')]`)).getText(); - if (elementText !== 'US History - QA') { - throw new Error(`Expected: Filtered by QA: Biology - QA label not sorted in 6th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA: US History - QA label sorted in 6th place'); - } - }, - - //US History - QA = 62 (6th) - { - description: 'Validate by filter QA and sorted by name: US History - QA 162 count in 6th place', - action: async () => { - const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/li/div/span')).getText(); - if (elementText !== '62') { - throw new Error(`Expected: Filtered by QA and sorted by name: US History - QA count "62" not sorted in 6th place; Actual: "${elementText}"`); - } - console.log('Passed: Filtered by QA and sorted by name: US History - QA count 62 sorted in 6th place'); - } - }, - - //NEXT ACTION -DELETE CREATED CONTENT SET - { description: `Click ${createContentSetName} edit icon`, action: async () => await driver.findElement(By.css('#mycontentlist > #content-org-list > #content-org-list > .content-org .fa')).click() }, - { description: 'Wait for Edit Content DIV to open', action: async () => await driver.sleep(5000) }, - - //Wait for dashboard to load - { - description: 'Wait for DIV to open', - action: async () => { - return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 10000).catch(() => false); - } - }, - - //Edit Content Set DIV - { - description: 'Validate Edit DIV title', - action: async () => { - const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText(); - if (elementText !== 'Edit Content Set') { - throw new Error(`Expected: Edit DIV title did not match; Actual: "${elementText}"`); - } - console.log('Passed: Edit DIV title matched as expected'); - } - }, - //Edit Content Set DIV title text font size - { - description: 'Validate Edit Content Set DIV title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.modal-lg .modal-title')).getCssValue('font-size'); - if (elementStyle !== '18px') { - throw new Error(`Expected: Edit Content Set DIV title text font-size did not match; Actual: "${elementStyle}"`); + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Edit Content Set DIV title text background text font-size matched as expected'); } }, - //Edit Content Set DIV - Content Set Name label + //Edit DIV - label { description: 'Validate Edit DIV - Content Set Name label', action: async () => { - const elementText = await driver.findElement(By.css('.modal-lg .form-label')).getText(); - if (elementText !== 'Content Set Name') { - throw new Error(`Expected: "Content Set Name" label; Actual: "${elementText}"`); + const multipleChecks = 'Edit DIV label'; + const element = await driver.findElement(By.css('.modal-lg .form-label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set Name') { + console.log('Passed: Content Set Name DIV label matched as expected'); + } else { + errors.push(`Expected: "Content Set Name"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Content Set Name label font matched as expected'); + } else { + errors.push(`Expected: Content Set Name label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: Content Set Name label font-size matched as expected'); + } else { + errors.push(`Expected: Content Set Name label font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content Set Name label color matched as expected'); + } else { + errors.push(`Expected: Content Set Name label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Content Set Name label matched as expected'); } }, - //Edit Content Set DIV - Content Set Name label text font size - { - description: 'Validate Edit Content Set DIV - Content Set Name label text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('.modal-lg .form-label')).getCssValue('font-size'); - if (elementStyle !== '15px') { - throw new Error(`Expected: Edit Content Set DIV - Content Set Name label text font-size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Edit Content Set DIV - Content Set Name label text background text font-size matched as expected'); - } - }, - - //Edit Content Set DIV - textbox + //Edit DIV - textbox { description: 'Validate Edit DIV textbox', action: async () => { - const elementValue = await driver.findElement(By.css('#orgname')).getAttribute('value'); - if (elementValue !== createContentSetName) { - throw new Error(`Expected: Edit DIV textbox Expected: "${createContentSetName}"; Actual: "${elementValue}"`); + const multipleChecks = 'Edit DIV texbox'; + const element = await driver.findElement(By.css('#orgname')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Biology') { + console.log('Passed: Biology textbox text matched as expected'); + } else { + errors.push(`Expected: "Biology"; Actual: "${elementText}"`); } - console.log('Passed: Edit DIV textbox matched as expected'); - } - }, - //Edit Content Set DIV - Delete button - { - description: 'Validate Edit DIV delete text button', - action: async () => { - const elementText = await driver.findElement(By.css('.modal-lg #orgdelete')).getText(); - if (elementText !== 'Delete') { - throw new Error(`Expected: "Delete"; Actual: "${elementText}"`); + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Biology textbox font matched as expected'); + } else { + errors.push(`Expected: Biology textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); } - console.log('Passed: Edit DIV delete text button matched as expected'); - } - }, - //Edit Content Set DIV - Delete button color -red - { - description: 'Validate Edit DIV delete button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.modal-lg #orgdelete')).getCssValue('background-color'); - if (elementStyle !== 'rgba(220, 53, 69, 1)') { - throw new Error(`Expected: Edit DIV delete button color did not match; Actual: "${elementStyle}"`); + //font size + if (elementTextSize === '14px') { + console.log('Passed: Biology textbox font-size matched as expected'); + } else { + errors.push(`Expected: Biology textbox font-size "14px"; Actual: "${elementTextSize}"`); } - console.log('Passed: Edit DIV delete button color matched as expected'); - } - }, - //Edit Content Set DIV - Save button - { - description: 'Validate Edit DIV save text button', - action: async () => { - const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value'); - if (elementText !== 'Save') { - throw new Error(`Expected: "Save"; Actual: "${elementText}"`); + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Biology textbox color matched as expected'); + } else { + errors.push(`Expected: Biology textbox color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); } - console.log('Passed: Edit DIV save text button matched as expected'); - } - }, - //Edit Content Set DIV - Save button color -green - { - description: 'Validate Edit DIV save button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#modalop')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Edit DIV save button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Edit DIV save button color matched as expected'); - } - }, - - //Edit Content Set DIV - Close button - { - description: 'Validate Edit DIV close text button', - action: async () => { - const elementText = await driver.findElement(By.css('#modalclose')).getText(); - if (elementText !== 'Close') { - throw new Error(`Expected: "Close"; Actual: "${elementText}"`); - } - console.log('Passed: Edit DIV close text button matched as expected'); - } - }, - - //Edit Content Set DIV - Close button color -white - { - description: 'Validate Edit DIV close button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color'); - if (elementStyle !== 'rgba(0, 0, 0, 0)') { - throw new Error(`Expected: Edit DIV close button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Edit DIV close button color matched as expected'); - } - }, - - //NEXT ACTION -Delete created content set - { - description: 'Delete created content and validate assert message', - action: async () => { - await driver.wait( - until.elementLocated(By.css('#myModal')), - 5000 - ); - await driver.sleep(2000); - - const deleteButton = await driver.wait( - until.elementLocated(By.css('#orgdelete')), - 5000 - ); - await deleteButton.click(); - await driver.sleep(2000); - - const alert = await driver.wait( - until.alertIsPresent(), - 5000 - ); - - const alertText = await alert.getText(); - - try { - if (alertText !== `Are you sure you want to delete ${createContentSetName}? This operation cannot be undone or recovered.`) { - throw new Error(`Expected: "Are you sure you want to delete ${createContentSetName}? This operation cannot be undone or recovered."; Actual: "${alertText}"`); + //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`); } - console.log('Passed: Delete Alert DIV text matched as expected'); - console.log('Passed: Delete Alert DIV, OK/Cancel button text matched as expected'); - } catch (error) { - console.error('FAILED: Delete Alert DIV, unable to validate text; Error Message: ', error.message); - await alert.dismiss(); - throw error; + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - - await alert.accept(); - await driver.sleep(2000); } }, - //Validate confirmation message + //Delete button { - description: 'Validate confirmation message', + description: 'Validate Delete button', action: async () => { - const elementText = await driver.findElement(By.css('strong')).getText(); - if (elementText !== 'The content set was successfuly deleted') { - throw new Error(`Expected: Alert banner deleted confirmation message did not match; Actual: "${elementText}"`); + const multipleChecks = 'Delete button'; + const element = await driver.findElement(By.css('.modal-lg #orgdelete')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementStyle = await element.getAttribute('disabled'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Delete') { + console.log('Passed: Delete button text matched as expected'); + } else { + errors.push(`Expected: "Delete"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "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: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Delete button text font-size matched as expected'); + } else { + errors.push(`Expected: Delete button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text 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}"`); + } + + //disabled + if (elementStyle === 'true') { + console.log('Passed: Delete button disabled as expected'); + } else { + errors.push(`Expected: Delete button style: "disabled"; Actual: "${elementStyle}"`); + } + + //tooltip + if (elementTooltip === 'You cannot delete a Content Set that has content items') { + console.log('Passed: Delete button tool-tip matched as expected'); + } else { + errors.push(`Expected: Delete button tool-tip: "You cannot delete a Content Set that has content items"; Actual: "${elementTooltip}"`); + } + + //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: Alert banner deleted confirmation message displayed as expected'); } }, - //Validate confirmation message background color -green + //Save button { - description: 'Validate confirmation message background color', + description: 'Validate Save button', action: async () => { - const elementStyle = await driver.findElement(By.css('#statalert')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 167, 69, 1)') { - throw new Error(`Expected: Alert banner background color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Save button'; + const element = await driver.findElement(By.css('#modalop')); + + //Get text, font, color, and size + const elementText = await element.getAttribute('value'); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Save') { + console.log('Passed: Save button text matched as expected'); + } else { + errors.push(`Expected: "Save"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Save button text font matched as expected'); + } else { + errors.push(`Expected: Save button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Save button text font-size matched as expected'); + } else { + errors.push(`Expected: Save button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Save button text color matched as expected'); + } else { + errors.push(`Expected: Save button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //color + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Save button background color matched as expected'); + } else { + errors.push(`Expected: Save button background color: "rgba(48, 200, 172, 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: Alert banner background color matched as expected'); } }, - //Wait for dashboard to load + //Close button + { + description: 'Validate Close button', + action: async () => { + const multipleChecks = 'Close button'; + const element = await driver.findElement(By.css('#modalclose')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Close') { + console.log('Passed: Close button text matched as expected'); + } else { + errors.push(`Expected: "Close"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Close button text font matched as expected'); + } else { + errors.push(`Expected: Close button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Close button text font-size matched as expected'); + } else { + errors.push(`Expected: Close button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Close button text color matched as expected'); + } else { + errors.push(`Expected: Close button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //color + if (elementColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Close button background color matched as expected'); + } else { + errors.push(`Expected: Close button background color: "rgba(0, 0, 0, 0)"; 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: 'Wait for dashboard load to completely', + description: 'Click X icon', action: async () => { - return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false); - } + await driver.findElement(By.css('.modal-lg .modal-header span')).click(); + console.log('----->| NEXT ACTION: Clicked X icon, to close window'); + await driver.sleep(2000); + } + }, + + //NEXT ACTION + { + description: 'Click Biology content count', + action: async () => { + await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .badge')).click(); + console.log('----->| NEXT ACTION: Clicked Biology 1493 content link'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.content_modal_title')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Modal did not become visible within 20 seconds'); + + console.log('Passed: DIV loaded successfully'); + } + }, + + //Biology Totals DIV - title + { + description: 'Validate Biology Totals DIV title', + action: async () => { + const multipleChecks = 'Biology Totals DIV title'; + const element = await driver.findElement(By.css('.content_modal_title')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Biology Totals') { + console.log('Passed: Biology Totals DIV title matched as expected'); + } else { + errors.push(`Expected: DIV title: "Biology Totals"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Biology Totals DIV title font matched as expected'); + } else { + errors.push(`Expected: Biology Totals DIV title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '18px') { + console.log('Passed: Biology Totals DIV title font-size matched as expected'); + } else { + errors.push(`Expected: Biology Totals DIV title font-size "18px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Biology Totals DIV title color matched as expected'); + } else { + errors.push(`Expected: Biology Totals DIV title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Biology Total Items count 1493 + { + description: 'Validate Biology DIV - Total Items count', + action: async () => { + const multipleChecks = 'Biology DIV Total Items count'; + const element = await driver.findElement(By.css('#total > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '1493') { + console.log('Passed: Biology Total Items: 1493 count text matched as expected'); + } else { + errors.push(`Expected: Biology Total Items: "1493"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Biology Total Items: 1493 count text font matched as expected'); + } else { + errors.push(`Expected: Biology Total Items: 1493 count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '36px') { + console.log('Passed: Biology Total Items: 1493 count text ont-size matched as expected'); + } else { + errors.push(`Expected: Biology Total Items: 1493 count text font-size "36px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Biology Total Items: 1493 count text color matched as expected'); + } else { + errors.push(`Expected: Biology Total Items: 1493 count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Biology Total Items (SPECIAL CASE: css path with trimmed text) + { + description: 'Validate Biology DIV - Total Items', + action: async () => { + const multipleChecks = 'Biology DIV Total Items'; + const element = await driver.findElement(By.css('#total')); + + //Extract the bare text node (everything that's not a tag) + const elementTrimmedText = await driver.executeScript(` + const el = arguments[0]; + for (const node of el.childNodes) { + if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) { + return node.textContent.trim(); + } + } + return null; + `, element); + + //Get font, size, and color + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementTrimmedText === 'Total Items') { + console.log('Passed: Total Items text found and matched as expected'); + } else { + errors.push(`Expected: Text to contain: "Total Items"; Actual: "${elementTrimmedText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Total Items text font matched as expected'); + } else { + errors.push(`Expected: Total Items text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Total Items text font-size matched as expected'); + } else { + errors.push(`Expected: Total Items text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Total Items text color matched as expected'); + } else { + errors.push(`Expected: Total Items text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Biology Unique Titles count 3230 + { + description: 'Validate Biology DIV - Unique Titles count', + action: async () => { + const multipleChecks = 'Biology DIV Unique Titles count'; + const element = await driver.findElement(By.css('#total_titles > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '3230') { + console.log('Passed: Biology Unique Titles: 3230 count text matched as expected'); + } else { + errors.push(`Expected: Biology Unique Titles: "3230"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Biology Unique Titles: 3230 count text font matched as expected'); + } else { + errors.push(`Expected: Biology Unique Titles: 3230 count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '36px') { + console.log('Passed: Biology Unique Titles: 3230 count text ont-size matched as expected'); + } else { + errors.push(`Expected: Biology Unique Titles: 3230 count text font-size "36px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Biology Unique Titles: 3230 count text color matched as expected'); + } else { + errors.push(`Expected: Biology Unique Titles: 3230 count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Biology Unique Titles (SPECIAL CASE: css path with trimmed text) + { + description: 'Validate Biology DIV - Unique Titles', + action: async () => { + const multipleChecks = 'Biology DIV Unique Titles'; + const element = await driver.findElement(By.css('#total_titles')); + + //Extract the bare text node (everything that's not a tag) + const elementTrimmedText = await driver.executeScript(` + const el = arguments[0]; + for (const node of el.childNodes) { + if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) { + return node.textContent.trim(); + } + } + return null; + `, element); + + //Get font, size, and color + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementTrimmedText === 'Unique Titles') { + console.log('Passed: Unique Titles text found and matched as expected'); + } else { + errors.push(`Expected: Text to contain: "Unique Titles"; Actual: "${elementTrimmedText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Unique Titles text font matched as expected'); + } else { + errors.push(`Expected: v text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Unique Titles text font-size matched as expected'); + } else { + errors.push(`Expected: Unique Titles text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Unique Titles text color matched as expected'); + } else { + errors.push(`Expected: Unique Titles text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Biology Unique IDs count 3264 + { + description: 'Validate Biology DIV - Unique IDs count', + action: async () => { + const multipleChecks = 'Biology DIV Unique IDs count'; + const element = await driver.findElement(By.css('#total_pubtotalids > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '3264') { + console.log('Passed: Biology Unique IDs: 3264 count text matched as expected'); + } else { + errors.push(`Expected: Biology Unique IDs: "3264"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Biology Unique IDs: 3264 count text font matched as expected'); + } else { + errors.push(`Expected: Biology Unique IDs: 3264 count text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '36px') { + console.log('Passed: Biology Unique IDs: 3264 count text ont-size matched as expected'); + } else { + errors.push(`Expected: Biology Unique IDs: 3264 count text font-size "36px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Biology Unique IDs: 3264 count text color matched as expected'); + } else { + errors.push(`Expected: Biology Unique IDs: 3264 count text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Biology Unique IDs (SPECIAL CASE: css path with trimmed text) + { + description: 'Validate Biology DIV - Unique IDs', + action: async () => { + const multipleChecks = 'Biology DIV Unique IDs'; + const element = await driver.findElement(By.css('#total_pubtotalids')); + + //Extract the bare text node (everything that's not a tag) + const elementTrimmedText = await driver.executeScript(` + const el = arguments[0]; + for (const node of el.childNodes) { + if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) { + return node.textContent.trim(); + } + } + return null; + `, element); + + //Get font, size, and color + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementTrimmedText === 'Unique IDs') { + console.log('Passed: Unique IDss text found and matched as expected'); + } else { + errors.push(`Expected: Text to contain: "Unique IDs"; Actual: "${elementTrimmedText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Unique IDs text font matched as expected'); + } else { + errors.push(`Expected: v text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Unique IDs text font-size matched as expected'); + } else { + errors.push(`Expected: Unique IDs text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Unique IDs text color matched as expected'); + } else { + errors.push(`Expected: Unique IDs text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Close button + { + description: 'Validate Close button', + action: async () => { + const multipleChecks = 'Close button'; + const element = await driver.findElement(By.css('#all_content_modal .btn-secondary')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Close') { + console.log('Passed: Close button text matched as expected'); + } else { + errors.push(`Expected: "Close"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Close button text font matched as expected'); + } else { + errors.push(`Expected: Close button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Close button text font-size matched as expected'); + } else { + errors.push(`Expected: Close button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Close button text color matched as expected'); + } else { + errors.push(`Expected: Close button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //color + if (elementColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Close button background color matched as expected'); + } else { + errors.push(`Expected: Close button background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + //Export button + { + description: 'Validate Export button', + action: async () => { + const multipleChecks = 'Export button'; + const element = await driver.findElement(By.css('#export_btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Export') { + console.log('Passed: Export button text matched as expected'); + } else { + errors.push(`Expected: "Export"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Export button text font matched as expected'); + } else { + errors.push(`Expected: Export button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Export button text font-size matched as expected'); + } else { + errors.push(`Expected: Export button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Export button text color matched as expected'); + } else { + errors.push(`Expected: Export button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //color + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Export button background color matched as expected'); + } else { + errors.push(`Expected: Export button background color: "rgba(48, 200, 172, 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 Close button', + action: async () => { + await driver.findElement(By.css('#all_content_modal .btn-secondary')).click(); + console.log('----->| NEXT ACTION: Clicked Close button'); + await driver.sleep(2000); + } + }, + + //NEXT ACTION + { + description: 'Click My Content ellipsis icon', + action: async () => { + await driver.findElement(By.css('.fa-ellipsis-h')).click(); + console.log('----->| NEXT ACTION: Clicked My Content ellipsis icon'); + + //Wait until the element exists in the DOM + const elementVisible = await driver.wait( + until.elementLocated(By.css('.fa-plus')), + 20000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(elementVisible), + 20000 + ); + } + }, + + //Create Content Set + { + description: 'Validate Add Create Content Set', + action: async () => { + const multipleChecks = 'Add Create Content Set'; + const elementIcon = await driver.findElement(By.css('.fa-plus')).getCssValue('color'); + const element = await driver.findElement(By.linkText('Create Content Set')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Create Content Set add icon color matched as expected'); + } else { + errors.push(`Expected: Create Content Set add icon color: "rgba(33, 37, 41, 1)"; Actual: "${elementIcon}"`); + } + + //text + if (elementText === 'Create Content Set') { + console.log('Passed: Create Content Set text matched as expected'); + } else { + errors.push(`Expected: "Create Content Set"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Create Content Set text font matched as expected'); + } else { + errors.push(`Expected: Create Content Set text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Create Content Set text font-size matched as expected'); + } else { + errors.push(`Expected: Create Content Set text font-size "12px"; Actual: "${elementSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Create Content Set text color matched as expected'); + } else { + errors.push(`Expected: Create Content Set text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Export Content Set + { + description: 'Validate Export Content Set', + action: async () => { + const multipleChecks = 'Export Content Set'; + const elementIcon = await driver.findElement(By.css('.fa-download')).getCssValue('color'); + const element = await driver.findElement(By.linkText('Export Content Set')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Export Content Set download icon color matched as expected'); + } else { + errors.push(`Expected: Export Content Set download icon color: "rgba(33, 37, 41, 1)"; Actual: "${elementIcon}"`); + } + + //text + if (elementText === 'Export Content Set') { + console.log('Passed: Export Content Set text matched as expected'); + } else { + errors.push(`Expected: "Export Content Set"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Export Content Set text font matched as expected'); + } else { + errors.push(`Expected: Export Content Set text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Export Content Set text font-size matched as expected'); + } else { + errors.push(`Expected: Export Content Set text font-size "12px"; Actual: "${elementSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Export Content Set Set text color matched as expected'); + } else { + errors.push(`Expected: Export Content Set text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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 Create Content Set link', + action: async () => { + await driver.findElement(By.linkText('Create Content Set')).click(); + console.log('----->| NEXT ACTION: Clicked Create Content Set link'); + await driver.sleep(5000); //INCONSISTENT ATTEMPTING TO READ DIV TITLE + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 30000, 'Modal did not become visible within 30 seconds'); + + console.log('Passed: DIV loaded successfully'); + } + }, + + //Create Content Set DIV - title + { + description: 'Validate Create Content Set DIV title', + action: async () => { + const multipleChecks = 'Create Content Set DIV title'; + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Create Content Set') { + console.log('Passed: Create Content Set DIV title matched as expected'); + } else { + errors.push(`Expected: DIV title: "Create Content Set"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Create Content Set DIV title font matched as expected'); + } else { + errors.push(`Expected: Create Content Set DIV title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '18px') { + console.log('Passed: Create Content Set DIV title font-size matched as expected'); + } else { + errors.push(`Expected: Create Content Set DIV title font-size "18px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Create Content Set DIV title color matched as expected'); + } else { + errors.push(`Expected: Create Content Set DIV title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 Name label + { + description: 'Validate Content Set Name label', + action: async () => { + const multipleChecks = 'Content Set Name label'; + const element = await driver.findElement(By.css('.form-row:nth-child(2) .form-label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set Name') { + console.log('Passed: Content Set Name label matched as expected'); + } else { + errors.push(`Expected: Label: "Content Set Name"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Content Set Name label font matched as expected'); + } else { + errors.push(`Expected: Content Set Name label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: Content Set Name label font-size matched as expected'); + } else { + errors.push(`Expected: Content Set Name label font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content Set Name label color matched as expected'); + } else { + errors.push(`Expected: Content Set Name label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Create button + { + description: 'Validate Create button', + action: async () => { + const multipleChecks = 'Create button'; + const element = await driver.findElement(By.css('.modal-lg #modalop')); + + //Get text, font, color, and size + const elementText = await element.getAttribute('value'); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Create') { + console.log('Passed: Create button text matched as expected'); + } else { + errors.push(`Expected: "Create"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Create button text font matched as expected'); + } else { + errors.push(`Expected: Create button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Create button text font-size matched as expected'); + } else { + errors.push(`Expected: Create button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Create button text color matched as expected'); + } else { + errors.push(`Expected: Create button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //color + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Create button background color matched as expected'); + } else { + errors.push(`Expected: Create button background color: "rgba(48, 200, 172, 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')); + } + } + }, + + //Close button + { + description: 'Validate Close button', + action: async () => { + const multipleChecks = 'Close button'; + const element = await driver.findElement(By.css('#modalclose')); + + //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 elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Close') { + console.log('Passed: Close button text matched as expected'); + } else { + errors.push(`Expected: "Close"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Close button text font matched as expected'); + } else { + errors.push(`Expected: Close button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Close button text font-size matched as expected'); + } else { + errors.push(`Expected: Close button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Close button text color matched as expected'); + } else { + errors.push(`Expected: Close button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //color + if (elementColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Close button background color matched as expected'); + } else { + errors.push(`Expected: Close button background color: "rgba(0, 0, 0, 0)"; 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 Create button', + action: async () => { + await driver.findElement(By.css('.modal-lg #modalop')).click(); + console.log('----->| NEXT ACTION: Clicked Create button without Content Set name'); + + //Wait until the element exists in the DOM + const elementVisible = await driver.wait( + until.elementLocated(By.css('#metawarn > b')), + 20000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(elementVisible), + 20000 + ); + } + }, + + //Validation + { + description: 'Validate empty Content Set name validation message', + action: async () => { + const multipleChecks = 'Empty Content Set Name validation'; + const element = await driver.findElement(By.css('#metawarn > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'You must enter a Content Set name.') { + console.log('Passed: Validation text matched as expected'); + } else { + errors.push(`Expected: Validation: "You must enter a Content Set name."; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Validation text font matched as expected'); + } else { + errors.push(`Expected: Validation text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Validation text font-size matched as expected'); + } else { + errors.push(`Expected: Validation text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(220, 53, 69, 1)') { + console.log('Passed: Validation text color matched as expected'); + } else { + errors.push(`Expected: Validation text color: "rgba(220, 53, 69, 1)"; Actual: "${elementTextColor}"`); + } + + //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 Create button', + action: async () => { + await driver.findElement(By.css('#orgname')).sendKeys('Biology'); + console.log('----->| NEXT ACTION: Entered duplicate Content Set name'); + + await driver.findElement(By.css('.modal-lg #modalop')).click(); + console.log('----->| NEXT ACTION: Clicked Create button'); + + //Wait until the element exists in the DOM + const elementVisible = await driver.wait( + until.elementLocated(By.css('#namewarn')), + 20000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(elementVisible), + 20000 + ); + } + }, + + //Validation + { + description: 'Validate duplicate Content Set name validation message', + action: async () => { + const multipleChecks = 'Duplicate Content Set Name validation'; + const element = await driver.findElement(By.css('#namewarn')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'That name is already in use. Please enter a different name.') { + console.log('Passed: Validation text matched as expected'); + } else { + errors.push(`Expected: Validation: "That name is already in use. Please enter a different name."; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Validation text font matched as expected'); + } else { + errors.push(`Expected: Validation text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Validation text font-size matched as expected'); + } else { + errors.push(`Expected: Validation text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(220, 53, 69, 1)') { + console.log('Passed: Validation text color matched as expected'); + } else { + errors.push(`Expected: Validation text color: "rgba(220, 53, 69, 1)"; Actual: "${elementTextColor}"`); + } + + //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 Create button', + action: async () => { + await driver.findElement(By.css('.form-row:nth-child(2) #orgname')).clear(); + console.log('----->| NEXT ACTION: Cleared Content Set name'); + await driver.sleep(2000); + + await driver.findElement(By.css('.form-row:nth-child(2) #orgname')).sendKeys(createContentSetName); + console.log('----->| NEXT ACTION: Entered new Content Set name'); + + await driver.findElement(By.css('.modal-lg #modalop')).click(); + console.log('----->| NEXT ACTION: Clicked Create button'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('#statalert')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Modal did not become visible within 20 seconds'); + + console.log('Passed: DIV loaded successfully'); + } + }, + + //Alert banner + { + description: 'Validate alert banner', + action: async () => { + const multipleChecks = 'Alert banner'; + const element = await driver.findElement(By.css('strong')); + const elementBanner = await driver.findElement(By.css('#statalert')); + + //Get text, font, size, and 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 elementBannerColor = await elementBanner.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'The content set was successfuly created') { + console.log('Passed: Confirmation text matched as expected'); + } else { + errors.push(`Expected: Confirmation: "The content set was successfuly created"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Confirmation text font matched as expected'); + } else { + errors.push(`Expected: Confirmation text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Confirmation text font-size matched as expected'); + } else { + errors.push(`Expected: Confirmation text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Confirmation text color matched as expected'); + } else { + errors.push(`Expected: Confirmation text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //banner color + if (elementBannerColor === 'rgba(40, 167, 69, 1)') { + console.log('Passed: Confirmation banner color matched as expected'); + } else { + errors.push(`Expected: Confirmation banner color: "rgba(40, 167, 69, 1)"; Actual: "${elementBannerColor}"`); + } + + //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')); + } + + //Wait until the element exists in the DOM + const biologyLink = await driver.wait( + until.elementLocated(By.linkText('Biology')), + 20000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(biologyLink), + 20000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 20000, 'ExACT Dashboard did not fully load within 30 seconds'); + console.log('Passed: ExACT Dashboard loaded successfully'); + } + }, + + //My Content - Biology + { + description: 'Validate Biology link', + action: async () => { + const multipleChecks = 'My Content - Biology link'; + const element = await driver.findElement(By.linkText('Biology')); + + //Get href, text, font, size, and color + const elementURL = await element.getAttribute('href'); + 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 = []; + + //url + if (elementURL === 'https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits') { + console.log('Passed: Biology link URL matched as expected'); + } else { + errors.push(`Expected: "https://correlation.edgate.com/exact/?iPublisherId=585821587&function=listUnits"; Actual: "${elementURL}"`); + } + + //text + if (elementText === 'Biology') { + console.log('Passed: Biology link text matched as expected'); + } else { + errors.push(`Expected: "Biology"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Biology link text font matched as expected'); + } else { + errors.push(`Expected: Biology link text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14.3px') { + console.log('Passed: Biology link text font-size matched as expected'); + } else { + errors.push(`Expected: Biology link text text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Biology link text color matched as expected'); + } else { + errors.push(`Expected: Biology link text color: "rgba(73, 80, 87, 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')); + } + } + }, + + //My Content - Edit Biology icon + { + description: 'Validate Edit Biology icon', + action: async () => { + const multipleChecks = 'My Content - Edit Biology icon'; + const element = await driver.findElement(By.css('#content-org-list > li > div.orgname > a.ml-2')); + + //Get href, text, font, size, and color + const elementURL = await element.getAttribute('href'); + const elementText = await element.getAttribute('title'); + const elementColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //url + if (elementURL === 'https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821587') { + console.log('Passed: Edit Biology icon link URL matched as expected'); + } else { + errors.push(`Expected: "https://correlation.edgate.com/exact/contentset_edit_modal.php?id=585821587"; Actual: "${elementURL}"`); + } + + //text + if (elementText === 'Edit Content Set') { + console.log('Passed: Edit Biology icon title matched as expected'); + } else { + errors.push(`Expected: "Edit Content Set" ; Actual: "${elementText}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Edit Biology icon color matched as expected'); + } else { + errors.push(`Expected: Edit Biology icon color: "rgba(73, 80, 87, 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')); + } + } + }, + + //My Content - Newly created content + { + description: 'Validate Newly created Content Set sort order', + action: async () => { + const multipleChecks = `${createContentSetName} sort order`; + const elementContent = await driver.findElement(By.linkText(`${createContentSetName}`)).getText(); + const elementEditIcon = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/li/div[2]/a[2]/i')); + const elementCount = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/li/div/span')).getText(); + + //Track all errors + const errors = []; + + //text + if (elementContent === `${createContentSetName}`) { + console.log(`Passed: ${createContentSetName} listed in last place as expected`); + } else { + errors.push(`Expected: Last place: "${createContentSetName}" ; Actual: "${elementContent}"`); + } + + //icon present + if (elementEditIcon) { + console.log(`Passed: ${createContentSetName} edit icon listed in last place as expected`); + } else { + errors.push(`Expected: ${createContentSetName} edit icon not found in last place`); + } + + //count + if (elementCount === '0') { + console.log(`Passed: ${createContentSetName} content count listed in last place as expected`); + } else { + errors.push(`Expected: Last place: ${createContentSetName} content count: "0"; Actual: "${elementCount}"`); + } + + //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 newly created Content Set link', + action: async () => { + await driver.findElement(By.linkText(`${createContentSetName}`)).click(); + console.log(`----->| NEXT ACTION: Clicked ${createContentSetName} link`); + + //Wait until the element exists in the DOM + const elementVisible = await driver.wait( + until.elementLocated(By.css('.well > b')), + 20000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(elementVisible), + 20000 + ); + } + }, + + //Filter Results label + { + description: 'Validate Filter Results label', + action: async () => { + const multipleChecks = 'Filter Results label'; + const element = await driver.findElement(By.css('.well > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Filter Results') { + console.log('Passed: Filter Results label matched as expected'); + } else { + errors.push(`Expected: Label: "Filter Results"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Filter Results label font matched as expected'); + } else { + errors.push(`Expected: Filter Results label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Filter Results label font-size matched as expected'); + } else { + errors.push(`Expected: Filter Results label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Filter Results label color matched as expected'); + } else { + errors.push(`Expected: Filter Results label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Grade label + { + description: 'Validate Grade label', + action: async () => { + const multipleChecks = 'Grade label'; + const element = await driver.findElement(By.css('.form-group:nth-child(1) > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Grade') { + console.log('Passed: Grade label matched as expected'); + } else { + errors.push(`Expected: Label: "Grade"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade label font matched as expected'); + } else { + errors.push(`Expected: Grade label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade label font-size matched as expected'); + } else { + errors.push(`Expected: Grade label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade label color matched as expected'); + } else { + errors.push(`Expected: Grade label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Subject label + { + description: 'Validate Subject label', + action: async () => { + const multipleChecks = 'Subject label'; + const element = await driver.findElement(By.css('.form-group:nth-child(3) > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Subject') { + console.log('Passed: Subject label matched as expected'); + } else { + errors.push(`Expected: Label: "Subject"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Subject label font matched as expected'); + } else { + errors.push(`Expected: Subject label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Subject label font-size matched as expected'); + } else { + errors.push(`Expected: Subject label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Subject label color matched as expected'); + } else { + errors.push(`Expected: Subject label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Reset All link + { + description: 'Validate Reset All link', + action: async () => { + const multipleChecks = 'Reset All link'; + const element = await driver.findElement(By.linkText('Reset All')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Reset All') { + console.log('Passed: Reset All link matched as expected'); + } else { + errors.push(`Expected: Link: "Reset All"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Reset All link font matched as expected'); + } else { + errors.push(`Expected: Reset All link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Reset All link font-size matched as expected'); + } else { + errors.push(`Expected: Reset All link font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Reset All link color matched as expected'); + } else { + errors.push(`Expected: Reset All link color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Home link + { + description: 'Validate Home link', + action: async () => { + const multipleChecks = 'Home link'; + const element = await driver.findElement(By.linkText('Home')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Home') { + console.log('Passed: Home link matched as expected'); + } else { + errors.push(`Expected: Link: "Home"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Home link font matched as expected'); + } else { + errors.push(`Expected: Home link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Home link font-size matched as expected'); + } else { + errors.push(`Expected: Home link font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Home link color matched as expected'); + } else { + errors.push(`Expected: Home link color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //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 link + { + description: 'Validate Content link', + action: async () => { + const multipleChecks = 'Content link'; + const element = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content') { + console.log('Passed: Content link matched as expected'); + } else { + errors.push(`Expected: Link: "Content"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Content link font matched as expected'); + } else { + errors.push(`Expected: Content link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Content link font-size matched as expected'); + } else { + errors.push(`Expected: Content link font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content link color matched as expected'); + } else { + errors.push(`Expected: Content link color: "rgba(48, 200, 172, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Results text + { + description: 'Validate Results text', + action: async () => { + const multipleChecks = 'Reset All link'; + const element = await driver.findElement(By.css('b:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'There are no items that match your search criteria.') { + console.log('Passed: Results text matched as expected'); + } else { + errors.push(`Expected: "There are no items that match your search criteria."; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Results text link font matched as expected'); + } else { + errors.push(`Expected: Results text link font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Results text link font-size matched as expected'); + } else { + errors.push(`Expected: Results text link font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Results text link color matched as expected'); + } else { + errors.push(`Expected: Results text link color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 Dashboard navigation link', + action: async () => { + await driver.findElement(By.linkText('Dashboard')).click(); + console.log(`----->| NEXT ACTION: Clicked Dashboard navigation link`); + + //Wait until the element exists in the DOM + const correlationCoveragesImage = await driver.wait( + until.elementLocated(By.css('.gap-idle-wrap > img')), + 20000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(correlationCoveragesImage), + 20000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 20000, 'ExACT Dashboard did not fully load within 30 seconds'); + console.log('Passed: ExACT Dashboard loaded successfully'); + } + }, + + //NEXT ACTION + { + description: 'Click My Content ellipsis icon', + action: async () => { + await driver.findElement(By.css('.fa-ellipsis-h')).click(); + await driver.sleep(2000); + await driver.findElement(By.linkText('Export Content Set')).click(); + console.log('----->| NEXT ACTION: Clicked My Content ellipsis icon and Export Content Set link'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Modal did not become visible within 20 seconds'); + + console.log('Passed: DIV loaded successfully'); + } + }, + + //Export Content DIV + { + description: 'Validate Export Content DIV', + action: async () => { + const multipleChecks = 'Export Content DIV'; + const element = await driver.findElement(By.css('.modal-header:nth-child(4) > .modal-title'));//.modal-lg .modal-title')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Export Content') { + console.log('Passed: Export Content DIV title matched as expected'); + } else { + errors.push(`Expected: DIV title: "Export Content"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Export Content DIV title font matched as expected'); + } else { + errors.push(`Expected: Export Content DIV title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '18px') { + console.log('Passed: Export Content DIV title font-size matched as expected'); + } else { + errors.push(`Expected: Export Content DIV title font-size "18px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Export Content DIV title color matched as expected'); + } else { + errors.push(`Expected: Export Content DIV title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Export Content DIV label + { + description: 'Validate Export Content label', + action: async () => { + const multipleChecks = 'Export Content label'; + const element = await driver.findElement(By.css('#content-export-container > h5')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Please select one or more content sets to export:') { + console.log('Passed: Export Content DIV label matched as expected'); + } else { + errors.push(`Expected: DIV label: "Please select one or more content sets to export:"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Export Content DIV label font matched as expected'); + } else { + errors.push(`Expected: Results text label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '20px') { + console.log('Passed: Export Content DIV label font-size matched as expected'); + } else { + errors.push(`Expected: Export Content DIV label font-size "20px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Export Content DIV label color matched as expected'); + } else { + errors.push(`Expected: Export Content DIV label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: 'Validate Content Set label', + action: async () => { + const multipleChecks = 'Content Set label'; + const element = await driver.findElement(By.css('#content_export .form-label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set') { + console.log('Passed: Content Set label matched as expected'); + } else { + errors.push(`Expected: Label: "Content Set"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Content Set label font matched as expected'); + } else { + errors.push(`Expected: Content Set label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Content Set label font-size matched as expected'); + } else { + errors.push(`Expected: Content Set label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content Set label color matched as expected'); + } else { + errors.push(`Expected: Content Set label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Export - Search textbox placeholder + { + description: 'Validate Export Search placeholder text', + action: async () => { + const multipleChecks = 'Export Search textbox'; + + //Click to expand dropdown list + await driver.findElement(By.css('#content_export > div > div > button > span')).click(); + console.log('----->| NEXT ACTION: Clicked Content Set dropdown'); + await driver.sleep(2000); + + const elementIcon = await driver.findElement(By.css('.show .input-group-prepend img')).getCssValue('color'); + const element = await driver.findElement(By.css('.show > .multiselect-item .form-control')); + const elementClearIcon = await driver.findElement(By.css('.form-group:nth-child(1) .input-group-append img')).getCssValue('color'); + + //Get placeholder text, size, and color + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + + //Track all errors + const errors = []; + + //Search icon color + if (elementIcon === 'rgba(169, 169, 189, 1)') { + console.log('Passed: Search icon color matched as expected'); + } else { + errors.push(`Expected: Search icon color: "rgba(169, 169, 189, 1)"; Actual: "${elementIcon}"`); + } + + //text + if (elementText === 'Search') { + console.log('Passed: Search placeholder text matched as expected'); + } else { + errors.push(`Expected: "Search" placeholder; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Search placeholder text font matched as expected'); + } else { + errors.push(`Expected: Search placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '10.8px') { + console.log('Passed: Search placeholder text font-size matched as expected'); + } else { + errors.push(`Expected: Search placeholder text font-size "10.8px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Search placeholder text color matched as expected'); + } else { + errors.push(`Expected: Search placeholder text color: "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //Clear icon color + if (elementClearIcon === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Search clear icon color matched as expected'); + } else { + errors.push(`Expected: Search clear icon color: "rgba(33, 37, 41, 1)"; Actual: "${elementClearIcon}"`); + } + + //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')); + } + } + }, + + //Sort dropdown values (SPECIAL CASE: multi-selection) + { + description: 'Validate Export multiselect dropdown list', + action: async () => { + const multipleChecks = 'Export multiselect dropdown list'; + + //Track all errors// + const errors = []; + + /* await driver.sleep(2000); + + //If the select has a unique id or name + await driver.executeScript(` + document.querySelector('button.multiselect[title="Please select a Content Set"]').click(); + `); */ + + //Target the correct dropdown directly by its unique id + const dropdown = await driver.wait(until.elementLocated(By.css('#selectOrg')), 5000); + const selectElement = new Select(dropdown); + + //Get all options + const options = await selectElement.getOptions(); + //console.log('----->| Total options found:', options.length); + + const expected = [ + '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', + 'Automated Algebra Content Set - TO BE DELETED' + ]; + + const actual = []; + for (const opt of options) { + const text = await driver.executeScript(` + return arguments[0].textContent.trim(); + `, opt); + if (text !== '') { + actual.push(text); + //console.log(`----->| Option: "${text}"`); + } + } + + //console.log('----->| DEBUG actual:', JSON.stringify(actual)); + + //Validate list matches expected + if (JSON.stringify(actual) === JSON.stringify(expected)) { + console.log('Passed: Export Content multi-select dropdown list', options.length + ' matched as expected'); + } else { + errors.push(`Expected: ${JSON.stringify(expected)}\nActual: ${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')); + } + } + }, + + //Export button + { + description: 'Validate Export button', + action: async () => { + const multipleChecks = 'Export button'; + const element = await driver.findElement(By.css('.modal-footer:nth-child(6) > .btn-primary')); + + //Get text, font, color, and size + const elementText = await element.getAttribute('value'); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Export') { + console.log('Passed: Export button text matched as expected'); + } else { + errors.push(`Expected: "Export"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Export button text font matched as expected'); + } else { + errors.push(`Expected: Export button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Export button text font-size matched as expected'); + } else { + errors.push(`Expected: Export button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Export button text color matched as expected'); + } else { + errors.push(`Expected: Export button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //color + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Export button background color matched as expected'); + } else { + errors.push(`Expected: Export button background color: "rgba(48, 200, 172, 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')); + } + } + }, + + //Close button + { + description: 'Validate Close button', + action: async () => { + const multipleChecks = 'Close button'; + const element = await driver.findElement(By.css('.btn:nth-child(3)')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Close') { + console.log('Passed: Close button text matched as expected'); + } else { + errors.push(`Expected: "Close"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Close button text font matched as expected'); + } else { + errors.push(`Expected: Close button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Close button text font-size matched as expected'); + } else { + errors.push(`Expected: Close button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Close button text color matched as expected'); + } else { + errors.push(`Expected: Close button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //color + if (elementColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Close button background color matched as expected'); + } else { + errors.push(`Expected: Close button background color: "rgba(0, 0, 0, 0)"; 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 filter Content Set list and select newly created Content Set', + action: async () => { + await driver.findElement(By.css('.show > .multiselect-item .form-control')).sendKeys('Auto'); + console.log('----->| NEXT ACTION: Entered search term - Auto'); + + await driver.findElement(By.css('.show > li:nth-child(15) input')).click(); + console.log(`----->| NEXT ACTION: Clicked checkbox for: ${createContentSetName}`); + await driver.sleep(2000); + + await driver.findElement(By.css('.modal-footer:nth-child(6) > .btn-primary')).click(); + console.log('----->| NEXT ACTION: Clicked Export button'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('h2')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Modal did not become visible within 20 seconds'); + + console.log('Passed: DIV loaded successfully'); + } + }, + + //Export page + { + description: 'Validate Export page title', + action: async () => { + const multipleChecks = 'Export page title'; + const element = await driver.findElement(By.css('h2')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Export') { + console.log('Passed: Export title matched as expected'); + } else { + errors.push(`Expected: DIV title: "Export"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === `"DM Serif Display", serif`) { + console.log('Passed: Export title font matched as expected'); + } else { + errors.push(`Expected: Export title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '32px') { + console.log('Passed: Export title font-size matched as expected'); + } else { + errors.push(`Expected: Export title font-size "32px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Export title color matched as expected'); + } else { + errors.push(`Expected: Export title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Export page label + { + description: 'Validate Export page label', + action: async () => { + const multipleChecks = 'Export page label'; + const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Export complete!') { + console.log('Passed: Export label matched as expected'); + } else { + errors.push(`Expected: DIV label: "Export complete!"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Export label font matched as expected'); + } else { + errors.push(`Expected: Export label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Export label font-size matched as expected'); + } else { + errors.push(`Expected: Export label font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Export label color matched as expected'); + } else { + errors.push(`Expected: Export label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Download Export button + { + description: 'Validate Download Export button', + action: async () => { + const multipleChecks = 'Download Export button'; + const elementIcon = await driver.wait(until.elementLocated(By.css('.fa-download')), 5000).catch(() => false); + const element = await driver.findElement(By.linkText('Download Export')); + + //Get icon, text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Download Export button icon present'); + } else { + errors.push('Download Export button icon not found'); + } + + //text + if (elementText === 'Download Export') { + console.log('Passed: Download Export button text matched as expected'); + } else { + errors.push(`Expected: "Download Export"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Download Export button text font matched as expected'); + } else { + errors.push(`Expected: Download Export button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Download Export button text color matched as expected'); + } else { + errors.push(`Expected: Download Export button text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '20px') { + console.log('Passed: Download Export button text font-size matched as expected'); + } else { + errors.push(`Expected: Download Export button text text font-size "20px"; Actual: "${elementSize}"`); + } + + //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 Dashboard navigation link', + action: async () => { + await driver.findElement(By.linkText('Dashboard')).click(); + console.log(`----->| NEXT ACTION: Clicked Dashboard navigation link`); + + //Wait until the element exists in the DOM + const correlationCoveragesImage = await driver.wait( + until.elementLocated(By.css('.gap-idle-wrap > img')), + 20000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(correlationCoveragesImage), + 20000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 20000, 'ExACT Dashboard did not fully load within 30 seconds'); + console.log('Passed: ExACT Dashboard loaded successfully'); + } + }, + + //Sort by Count (default) + { + description: 'Validate sort order by Count', + action: async () => { + const multipleChecks = 'My Content - Sort order by Count'; + const errors = []; + + const rows = await driver.executeScript(` + const results = []; + const items = document.querySelectorAll('#mycontentlist .orgname'); + items.forEach((item, index) => { + const nameLink = item.querySelector('a:first-child'); + const name = nameLink ? nameLink.textContent.trim() : ''; + const editLink = item.querySelector('a.ml-2'); + const href = editLink ? editLink.getAttribute('href') : ''; + const countSpan = item.closest('li').querySelector('.badge.contnet_set_count'); + const count = countSpan ? countSpan.textContent.trim() : ''; + results.push({ position: index + 1, name, href, count }); + }); + return results; + `); + + const expected = [ + { position: 1, name: 'Biology', count: '1493', href: '/exact/contentset_edit_modal.php?id=585821587' }, + { position: 2, name: 'Math Alignment Import Test', count: '730', href: '/exact/contentset_edit_modal.php?id=1423792414' }, + { position: 3, name: 'English I', count: '389', href: '/exact/contentset_edit_modal.php?id=585821585' }, + { position: 4, name: 'Copy Move Delete Test 2', count: '327', href: '/exact/contentset_edit_modal.php?id=1228574325' }, + { position: 5, name: 'Algebra', count: '192', href: '/exact/contentset_edit_modal.php?id=585821586' }, + { position: 6, name: 'US History III', count: '67', href: '/exact/contentset_edit_modal.php?id=585821589' }, + { position: 7, name: 'Import Align - Concept Based 1', count: '44', href: '/exact/contentset_edit_modal.php?id=1323320445' }, + { position: 8, name: 'Import Align - Concept Based 2', count: '44', href: '/exact/contentset_edit_modal.php?id=1323322624' }, + { position: 9, name: 'Import Align - Direct Align 1', count: '44', href: '/exact/contentset_edit_modal.php?id=1323322921' }, + { position: 10, name: 'Import Align - Direct Align 2', count: '44', href: '/exact/contentset_edit_modal.php?id=1323322923' }, + { position: 11, name: 'Copy Move Delete Test 1', count: '35', href: '/exact/contentset_edit_modal.php?id=1228574323' }, + { position: 12, name: 'create me', count: '6', href: '/exact/contentset_edit_modal.php?id=1427607301' }, + { position: 13, name: 'Automated Algebra Content Set - TO BE DELETED', count: '0', hrefContains: '/exact/contentset_edit_modal.php?id=' } + ]; + + for (const exp of expected) { + const actual = rows[exp.position - 1]; + if (!actual) { + errors.push(`Position ${exp.position}: row not found`); + continue; + } + + const nameMatch = actual.name === exp.name; + const countMatch = actual.count === exp.count; + //Use includes() for href if exp.hrefContains is defined, otherwise exact match + const hrefMatch = exp.hrefContains + ? actual.href.includes(exp.hrefContains) + : actual.href === exp.href; + + if (nameMatch && countMatch && hrefMatch) { + console.log(`Passed: Sort Order ${exp.position} - ${exp.name} | Count: ${exp.count} | href | All matched as expected`); + } else { + if (!nameMatch) errors.push(`Sort Order ${exp.position} name - Expected: "${exp.name}"; Actual: "${actual.name}"`); + if (!countMatch) errors.push(`Sort Order ${exp.position} count - Expected: "${exp.count}"; Actual: "${actual.count}"`); + if (!hrefMatch) errors.push(`Sort Order ${exp.position} href - Expected: "${exp.href}"; Actual: "${actual.href}"`); + } + } + + //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')); + } + } + }, + + //NEXT ACTION + { + description: 'Filter My Content list', + action: async () => { + const filterInput = await driver.findElement(By.css('#content-org-filter')); + await filterInput.click(); + await driver.sleep(500); + + for (const char of 'algebra') { + await filterInput.sendKeys(char); + await driver.executeScript(`$(document.querySelector('#content-org-filter')).trigger('keyup');`); + await driver.sleep(300); + } + console.log('----->| NEXT ACTION: Filtered My Content list by - algebra'); + await driver.sleep(2000); + + //Wait for visible items to reduce + await driver.wait(async () => { + try { + const visibleCount = await driver.executeScript(` + const all = document.querySelectorAll('#mycontentlist .orgname'); + return Array.from(all).filter(el => { + const style = window.getComputedStyle(el.closest('li')); + return style.display !== 'none' && style.visibility !== 'hidden'; + }).length; + `); + return visibleCount < 13; + } catch (e) { + return false; + } + }, 10000, 'List did not filter within 10 seconds'); + + console.log('Passed: Filter "algebra" applied successfully'); + } + }, + + //Validate sort order by filter algebra + { + description: 'Validate sort order by filter algebra', + action: async () => { + const multipleChecks = 'My Content - Sort order by filter algebra'; + const errors = []; + + const rows = await driver.executeScript(` + const results = []; + const items = document.querySelectorAll('#mycontentlist .orgname'); + Array.from(items).forEach((item) => { + //Only include visible items + const li = item.closest('li'); + const style = window.getComputedStyle(li); + if (style.display === 'none' || style.visibility === 'hidden') return; + + const nameLink = item.querySelector('a:first-child'); + const name = nameLink ? nameLink.textContent.trim() : ''; + const editLink = item.querySelector('a.ml-2'); + const href = editLink ? editLink.getAttribute('href') : ''; + const countSpan = li.querySelector('.badge.contnet_set_count'); + const count = countSpan ? countSpan.textContent.trim() : ''; + results.push({ position: results.length + 1, name, href, count }); + }); + return results; + `); + + //Positions are now 1 and 2 since we only have 2 visible items + const expected = [ + { position: 1, name: 'Algebra', count: '192', href: '/exact/contentset_edit_modal.php?id=585821586' }, + { position: 2, name: 'Automated Algebra Content Set - TO BE DELETED', count: '0', hrefContains: '/exact/contentset_edit_modal.php?id=' } + ]; + + for (const exp of expected) { + const actual = rows[exp.position - 1]; + if (!actual) { + errors.push(`Position ${exp.position}: row not found`); + continue; + } + const nameMatch = actual.name === exp.name; + const countMatch = actual.count === exp.count; + //Use includes() for href if exp.hrefContains is defined, otherwise exact match + const hrefMatch = exp.hrefContains + ? actual.href.includes(exp.hrefContains) + : actual.href === exp.href; + + if (nameMatch && countMatch && hrefMatch) { + console.log(`Passed: Sort Order ${exp.position} - ${exp.name} | Count: ${exp.count} | href | All matched as expected`); + } else { + if (!nameMatch) errors.push(`Sort Order ${exp.position} name - Expected: "${exp.name}"; Actual: "${actual.name}"`); + if (!countMatch) errors.push(`Sort Order ${exp.position} count - Expected: "${exp.count}"; Actual: "${actual.count}"`); + if (!hrefMatch) errors.push(`Sort Order ${exp.position} href - Expected: "${exp.href}"; Actual: "${actual.href}"`); + } + } + + //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')); + } + } + }, + + //NEXT ACTION orgsort (SPECIAL CASE: visible in DOM) + { + description: 'Click Name sort by option', + action: async () => { + //Use Select class for reliable dropdown interaction + const sortDropdown = await driver.wait(until.elementLocated(By.css('#orgsort')), 5000); + const selectElement = new Select(sortDropdown); + await selectElement.selectByVisibleText('Name'); + console.log('----->| NEXT ACTION: Selected Sort: "Name" option'); + + //Wait specifically for the list to re-render with Algebra first + await driver.wait(async () => { + try { + const firstItem = await driver.executeScript(` + const first = document.querySelector('#mycontentlist .orgname a:first-child'); + return first ? first.textContent.trim() : ''; + `); + return firstItem === 'Algebra'; + } catch (e) { + return false; + } + }, 10000, 'List did not re-sort by Name within 10 seconds'); + + console.log('Passed: Sort by Name applied successfully'); + } + }, + + //Sort by Name + { + description: 'Validate sort order by Name', + action: async () => { + const multipleChecks = 'My Content - Sort order by Name'; + const errors = []; + + const rows = await driver.executeScript(` + const results = []; + const items = document.querySelectorAll('#mycontentlist .orgname'); + items.forEach((item, index) => { + const nameLink = item.querySelector('a:first-child'); + const name = nameLink ? nameLink.textContent.trim() : ''; + const editLink = item.querySelector('a.ml-2'); + const href = editLink ? editLink.getAttribute('href') : ''; + const countSpan = item.closest('li').querySelector('.badge.contnet_set_count'); + const count = countSpan ? countSpan.textContent.trim() : ''; + results.push({ position: index + 1, name, href, count }); + }); + return results; + `); + + const expected = [ + { position: 1, name: 'Algebra', count: '192', href: '/exact/contentset_edit_modal.php?id=585821586' }, + { position: 2, name: 'Automated Algebra Content Set - TO BE DELETED', count: '0', hrefContains: '/exact/contentset_edit_modal.php?id=' }, + { position: 3, name: 'Biology', count: '1493', href: '/exact/contentset_edit_modal.php?id=585821587' }, + { position: 4, name: 'Copy Move Delete Test 1', count: '35', href: '/exact/contentset_edit_modal.php?id=1228574323' }, + { position: 5, name: 'Copy Move Delete Test 2', count: '327', href: '/exact/contentset_edit_modal.php?id=1228574325' }, + { position: 6, name: 'create me', count: '6', href: '/exact/contentset_edit_modal.php?id=1427607301' }, + { position: 7, name: 'English I', count: '389', href: '/exact/contentset_edit_modal.php?id=585821585' }, + { position: 8, name: 'Import Align - Concept Based 1', count: '44', href: '/exact/contentset_edit_modal.php?id=1323320445' }, + { position: 9, name: 'Import Align - Concept Based 2', count: '44', href: '/exact/contentset_edit_modal.php?id=1323322624' }, + { position: 10, name: 'Import Align - Direct Align 1', count: '44', href: '/exact/contentset_edit_modal.php?id=1323322921' }, + { position: 11, name: 'Import Align - Direct Align 2', count: '44', href: '/exact/contentset_edit_modal.php?id=1323322923' }, + { position: 12, name: 'Math Alignment Import Test', count: '730', href: '/exact/contentset_edit_modal.php?id=1423792414' }, + { position: 13, name: 'US History III', count: '67', href: '/exact/contentset_edit_modal.php?id=585821589' } + ]; + + for (const exp of expected) { + const actual = rows[exp.position - 1]; + if (!actual) { + errors.push(`Position ${exp.position}: row not found`); + continue; + } + + const nameMatch = actual.name === exp.name; + const countMatch = actual.count === exp.count; + //Use includes() for href if exp.hrefContains is defined, otherwise exact match + const hrefMatch = exp.hrefContains + ? actual.href.includes(exp.hrefContains) + : actual.href === exp.href; + + if (nameMatch && countMatch && hrefMatch) { + console.log(`Passed: Sort Order ${exp.position} - ${exp.name} | Count: ${exp.count} | href | All matched as expected`); + } else { + if (!nameMatch) errors.push(`Sort Order ${exp.position} name - Expected: "${exp.name}"; Actual: "${actual.name}"`); + if (!countMatch) errors.push(`Sort Order ${exp.position} count - Expected: "${exp.count}"; Actual: "${actual.count}"`); + if (!hrefMatch) errors.push(`Sort Order ${exp.position} href - Expected: "${exp.href}"; Actual: "${actual.href}"`); + } + } + + //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')); + } + } + }, + + //NEXT ACTION + { + description: 'Click newly created Content Set edit icon', + action: async () => { + await driver.findElement(By.css('#mycontentlist > #content-org-list > #content-org-list > .content-org .fa')).click(); + console.log(`----->| NEXT ACTION: Clicked ${createContentSetName} edit icon`); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Modal did not become visible within 20 seconds'); + + console.log('Passed: DIV loaded successfully'); + } + }, + + //Edit DIV - title + { + description: 'Validate Edit DIV title', + action: async () => { + const multipleChecks = 'Edit DIV title'; + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Edit Content Set') { + console.log('Passed: Edit Content Set DIV title matched as expected'); + } else { + errors.push(`Expected: DIV title: "Edit Content Set"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Edit Content Set DIV title font matched as expected'); + } else { + errors.push(`Expected: Edit Content Set DIV title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '18px') { + console.log('Passed: Edit Content Set DIV title font-size matched as expected'); + } else { + errors.push(`Expected: Edit Content Set DIV title font-size "18px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Edit Content Set DIV title color matched as expected'); + } else { + errors.push(`Expected: Edit Content Set DIV title color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Edit DIV - label + { + description: 'Validate Edit DIV - Content Set Name label', + action: async () => { + const multipleChecks = 'Edit DIV label'; + const element = await driver.findElement(By.css('#divname > .form-label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set Name') { + console.log('Passed: Content Set Name DIV label matched as expected'); + } else { + errors.push(`Expected: "Content Set Name"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Content Set Name label font matched as expected'); + } else { + errors.push(`Expected: Content Set Name label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: Content Set Name label font-size matched as expected'); + } else { + errors.push(`Expected: Content Set Name label font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content Set Name label color matched as expected'); + } else { + errors.push(`Expected: Content Set Name label color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Edit DIV - textbox + { + description: 'Validate Edit DIV textbox', + action: async () => { + const multipleChecks = 'Edit DIV texbox'; + const element = await driver.findElement(By.css('#orgname')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === `${createContentSetName}`) { + console.log(`Passed: ${createContentSetName} textbox text matched as expected`); + } else { + errors.push(`Expected: "${createContentSetName}"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log(`Passed: ${createContentSetName} textbox font matched as expected`); + } else { + errors.push(`Expected: ${createContentSetName} textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log(`Passed: ${createContentSetName} textbox font-size matched as expected`); + } else { + errors.push(`Expected: ${createContentSetName} textbox font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log(`Passed: ${createContentSetName} textbox color matched as expected`); + } else { + errors.push(`Expected: ${createContentSetName} textbox color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: 'Validate Delete button', + action: async () => { + const multipleChecks = 'Delete button'; + const element = await driver.findElement(By.css('#orgdelete')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Delete') { + console.log('Passed: Delete button text matched as expected'); + } else { + errors.push(`Expected: "Delete"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "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: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Delete button text font-size matched as expected'); + } else { + errors.push(`Expected: Delete button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text 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}"`); + } + + //tooltip + if (elementTooltip === '') { + console.log('Passed: Delete button tool-tip disabled as expected'); + } else { + errors.push(`Expected: Delete button tool-tip: "no tool-tip"; Actual: "${elementTooltip}"`); + } + + //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')); + } + } + }, + + //Save button + { + description: 'Validate Save button', + action: async () => { + const multipleChecks = 'Save button'; + const element = await driver.findElement(By.css('#modalop')); + + //Get text, font, color, and size + const elementText = await element.getAttribute('value'); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Save') { + console.log('Passed: Save button text matched as expected'); + } else { + errors.push(`Expected: "Save"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Save button text font matched as expected'); + } else { + errors.push(`Expected: Save button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Save button text font-size matched as expected'); + } else { + errors.push(`Expected: Save button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Save button text color matched as expected'); + } else { + errors.push(`Expected: Save button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //color + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Save button background color matched as expected'); + } else { + errors.push(`Expected: Save button background color: "rgba(48, 200, 172, 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')); + } + } + }, + + //Close button + { + description: 'Validate Close button', + action: async () => { + const multipleChecks = 'Close button'; + const element = await driver.findElement(By.css('#modalclose')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Close') { + console.log('Passed: Close button text matched as expected'); + } else { + errors.push(`Expected: "Close"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Close button text font matched as expected'); + } else { + errors.push(`Expected: Close button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Close button text font-size matched as expected'); + } else { + errors.push(`Expected: Close button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Close button text color matched as expected'); + } else { + errors.push(`Expected: Close button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //color + if (elementColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Close button background color matched as expected'); + } else { + errors.push(`Expected: Close button background color: "rgba(0, 0, 0, 0)"; 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: 'Delete created content and validate alert message', + action: async () => { + const multipleChecks = 'Delete content alert'; + const errors = []; + + //Wait for modal to be ready + await driver.wait(until.elementLocated(By.css('#myModal')), 5000); + await driver.sleep(1000); + + //Click delete button + const deleteButton = await driver.wait(until.elementLocated(By.css('#orgdelete')), 5000); + await deleteButton.click(); + await driver.sleep(5000); + console.log('----->| NEXT ACTION: Clicked Delete button'); + + //Wait for confirm dialog to appear + const alert = await driver.wait(until.alertIsPresent(), 5000); + console.log('----->| NEXT ACTION: Alert dialog appeared'); + + //Get alert text + const alertText = await alert.getText(); + + //Validate alert message text + const expectedText = `Are you sure you want to delete ${createContentSetName}? This operation cannot be undone or recovered.`; + if (alertText === expectedText) { + console.log('Passed: Delete alert message text matched as expected'); + } else { + errors.push(`Expected: "${expectedText}"; Actual: "${alertText}"`); + } + + //Throw summary before dismissing if errors found + if (errors.length > 0) { + await alert.dismiss(); //Cancel the delete if validation failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + + //Accept the alert (click OK) to proceed with deletion + await alert.accept(); + console.log('----->| NEXT ACTION: Clicked OK to confirm alert DIV Content Set deletion'); + await driver.sleep(2000); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('#statalert')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Alert banner did not become visible within 20 seconds'); + } + }, + + //Alert banner + { + description: 'Validate alert banner', + action: async () => { + const multipleChecks = 'Alert banner'; + const element = await driver.findElement(By.css('strong')); + const elementBanner = await driver.findElement(By.css('#statalert')); + + //Get text, font, size, and 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 elementBannerColor = await elementBanner.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'The content set was successfuly deleted') { + console.log('Passed: Confirmation text matched as expected'); + } else { + errors.push(`Expected: Confirmation: "The content set was successfuly deleted"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Confirmation text font matched as expected'); + } else { + errors.push(`Expected: Confirmation text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Confirmation text font-size matched as expected'); + } else { + errors.push(`Expected: Confirmation text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Confirmation text color matched as expected'); + } else { + errors.push(`Expected: Confirmation text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //banner color + if (elementBannerColor === 'rgba(40, 167, 69, 1)') { + console.log('Passed: Confirmation banner color matched as expected'); + } else { + errors.push(`Expected: Confirmation banner color: "rgba(40, 167, 69, 1)"; Actual: "${elementBannerColor}"`); + } + + //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')); + } + + //Wait until the element exists in the DOM + const correlationCoveragesImage = await driver.wait( + until.elementLocated(By.css('.gap-idle-wrap > img')), + 20000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(correlationCoveragesImage), + 20000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 20000, 'ExACT Dashboard did not fully load within 30 seconds'); + console.log('Passed: ExACT Dashboard loaded successfully'); + } }, //Verify content was deleted { - description: 'Verify content set deletion', + description: 'Verify Content Set deletion', action: async () => { - const filterSearch = await driver.wait( - until.elementLocated(By.css('#content-org-filter')), - 5000 - ); - await filterSearch.clear(); - await filterSearch.sendKeys('QA'); - await driver.sleep(2000); + //Clear filter and search for the deleted Content Set by name + const filterInput = await driver.wait(until.elementLocated(By.css('#content-org-filter')), 5000); + await filterInput.clear(); - const createdContentSet = await driver.findElements( - By.linkText(createContentSetName) - ); - - if (createdContentSet.length > 0) { - throw new Error('Content set was not deleted successfully'); + //Trigger keyup after clear to reset the list + await driver.executeScript(`$(document.querySelector('#content-org-filter')).trigger('keyup');`); + await driver.sleep(500); + + //Type the deleted Content Set name to filter for it specifically + for (const char of 'Automated Algebra') { + await filterInput.sendKeys(char); + await driver.executeScript(`$(document.querySelector('#content-org-filter')).trigger('keyup');`); + await driver.sleep(300); + } + console.log('----->| NEXT ACTION: Filtered list by "Automated Algebra"'); + await driver.sleep(1000); + + //Check visible items only + const visibleNames = await driver.executeScript(` + const items = document.querySelectorAll('#mycontentlist .orgname'); + return Array.from(items) + .filter(el => { + const style = window.getComputedStyle(el.closest('li')); + return style.display !== 'none' && style.visibility !== 'hidden'; + }) + .map(el => el.querySelector('a:first-child').textContent.trim()); + `); + //console.log('----->| DEBUG visible items after filter:', JSON.stringify(visibleNames)); + + //Verify deleted Content Set is NOT in the visible list + if (visibleNames.includes(createContentSetName)) { + throw new Error(`Expected: "${createContentSetName}" to be deleted; Actual: Still visible in list`); + } else { + console.log(`Passed: ${createContentSetName} successfully deleted and no longer visible`); } } }, - //LOG OUT - //NEXT ACTION - Log out - { description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, - { description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, - - //Wait for login screen to load + //NEXT ACTION { - description: 'Wait for log out process to complete', + description: 'Log Out', action: async () => { - return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false); + 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')); + } } }, ]; @@ -3000,26 +7207,24 @@ try { 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 + try { await step.action(); - - //Log a successful step with no screenshot worksheet = logStep( worksheet, step.description, 'Passed', stepIndex, timestamp, - null //No screenshot for passed steps + null ); } catch (error) { - //Only take screenshot if the step fails const screenshotPath = await takeScreenshot( driver, stepIndex, @@ -3036,19 +7241,21 @@ try { ); console.error(`Step ${stepIndex} FAILED: ${error.message}`); + failedSteps.push(`Step ${stepIndex}: ${step.description} - ${error.message}`); //Track failed step testStatus = 'Failed'; allStepsPassed = false; } } - //Check if log out was successful - const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); - - if (loginButton && allStepsPassed) { - console.log('PASSED: EDM-2972 | My Content widget(ExACT_dashboardMyContent); All test steps completed successfully'); + if (allStepsPassed) { + console.log('------------->| THE END |<-------------'); + console.log('PASSED: DASHBOARD - My Content widget (ExACT_dashboardMyContent); All test steps completed successfully'); testStatus = 'Passed'; } else { - console.log('FAILED: EDM-2972 | My Content widget(ExACT_dashboardMyContent); One or more test steps failed'); + console.log('------------->| THE END |<-------------'); + console.log('FAILED: DASHBOARD - My Content widget (ExACT_dashboardMyContent); One or more test steps failed'); + console.log('FAILED STEPS:'); + failedSteps.forEach(step => console.error(` ✗ ${step}`)); testStatus = 'Failed'; } @@ -3062,7 +7269,7 @@ try { } finally { await driver.quit(); } -})(); + })(); } export default ExACT_dashboardMyContent; diff --git a/tests/ExACT_dashboardMyStandards.js b/tests/ExACT_dashboardMyStandards.js index 75426cb..c12a2a0 100644 --- a/tests/ExACT_dashboardMyStandards.js +++ b/tests/ExACT_dashboardMyStandards.js @@ -1,97 +1,158 @@ -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'; +import { brotliCompress } from 'zlib'; +import { myStandardsSearch_AlignedContent } from './myStandardsSearchAlignedContent.js'; -const ExACT_dashboardMyStandards = (req, res) => { - res.send('

ExACT Automated Test Script - Dashboard - My Standards Widget(ExACT_dashboardMyStandards): Initiated

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

ExACT Automated Test Script: DASHBOARD - My Standards Widget (dashboardMyStandards) | 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(); const steps = [ - { description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://stage.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 + //Login { - description: 'Login with valid credentials', + description: 'Login', action: async () => { - - console.log('---------------->| BEGIN |<----------------'); - console.log('---------->| MY STANDARDS WIDGET|<---------'); + const multipleChecks = 'Log In'; + console.log('------------->| MY STANDARDS WIDGET |<-------------'); + 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 until the element exists in the DOM - const appliedFiltersLabel = await driver.wait( - until.elementLocated(By.css('.applied-filter-sec > label')), - 30000 - ); - - //Wait until it becomes visible - await driver.wait( - until.elementIsVisible(appliedFiltersLabel), - 30000 - ); - - //Wait for page to load completely + //Wait for page readyState await driver.wait(async () => { const readyState = await driver.executeScript('return document.readyState'); return readyState === 'complete'; - }, 30000, 'Dashboard - Correlation Dashboard Page did not fully load within 30 seconds'); - console.log('Passed: Dashboard - Correlation Dashboard Page loaded successfully'); + }, 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 - Page title, text, and font size + //Dashboard title { - description: 'Validate Dashboard - National Standards page title text, color, and size', + description: 'Validate dashboard title text, size, and color', action: async () => { + const multipleChecks = 'Dashboard title'; const element = await driver.findElement(By.css('.e-heading')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; - //Validate text = + //text if (elementText === 'Correlation Dashboard') { - console.log("Passed: Dashboard - Correlation Dashboard page title matched as expected"); + console.log('Passed: Dashboard title text matched as expected'); } else { - const message = `Expected: Dashboard - "Correlation Dashboard" page title; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: Dashboard - Page title text color matched as expected'); + //font + if (elementFont === `"DM Serif Display", serif`) { + console.log('Passed: Dashboard title font-family matched as expected'); } else { - const message = `Expected: Dashboard - Page title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard title font-family "DM Serif Display, serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '32px') { - console.log('Passed: Dashboard - Page title text font-size matched as expected'); + console.log('Passed: Dashboard title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - Page title text font-size "32px"; Actual: "${elementSize}"`; - errors.push(message); + 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -103,47 +164,53 @@ const steps = [ //MY STANDARDS WIDGET //Dashboard - My Standards Widget title (active) { - description: 'Validate Dashboard Semantic Standards Comparison Widget title text, color, and size', + description: 'Validate Dashboard My Standards Widget title text, color, and size', action: async () => { + const multipleChecks = 'My Standards Widget title (active)'; const element = await driver.findElement(By.css('#mystd-tab')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; - //Validate text + //text if (elementText === 'My Standards') { - console.log('Passed: Dashboard - Semantic Standards Comparison Widget title matched as expected'); + console.log('Passed: Dashboard - My Standards Widget title matched as expected'); } else { - const message = `Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Dashboard - "My Standards"; Actual: "${elementText}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected'); + //font + if (elementFont === `Poppins, sans-serif`) { + console.log('Passed: Dashboard - My Standards Widget font-family matched as expected'); } else { - const message = `Expected: Dashboard - Semantic Standards Comparison Widget title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards Widget font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '15px') { - console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-size matched as expected'); + console.log('Passed: Dashboard - My Standards Widget title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards Widget title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - My Standards Widget title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Widget 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -152,49 +219,55 @@ const steps = [ } }, - //Dashboard - Other Available Stndards tab title, text, and font size (dimmed) + //Dashboard - Other Available Stndards tab title { description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size', action: async () => { + const multipleChecks = 'Other Available Stndards tab title'; const element = await driver.findElement(By.css('#availstd-tab')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; - //Validate text + //text if (elementText === 'Other Available Standards') { console.log('Passed: Dashboard - Other Available Standards tab title matched as expected'); } else { - const message = `Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`); } - //Validate color -gray (dimmed) - if (elementColor === 'rgba(182, 186, 181, 1)') { - console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected'); + //font + if (elementFont === `Poppins, sans-serif`) { + console.log('Passed: Dashboard - Other Available Standards tab title font-family matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards tab title text color "rgba(182, 186, 181, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Other Available Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '15px') { console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab title text color "rgba(182, 186, 181, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -207,51 +280,81 @@ const steps = [ { description: 'Validate Dashboard - My Standards dropdown list and value', action: async () => { - const dropdown = await driver.findElement(By.css('#stdparent')); - const dropdownValue = await dropdown.getAttribute('value'); - const options = await dropdown.findElements(By.css('option')); - const expectedList = [ - 'Adding a New Org to test with', - 'Archived Standards', - 'Australia Standards', - 'Canada Standards', - 'Common Core Standards', - 'Demo Standards', - 'ECS-2732 Testing Frame II', - 'Future Standards', - 'Org To Delete', - 'QA Client Test Frameworks', - 'United States Standards' - ]; - const actual = []; + const multipleChecks = 'My Standards dropdown list'; + const elementDropdown = await driver.findElement(By.css('#stdparent')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); + //Track all errors const errors = []; - if (dropdownValue === '154828031') { - console.log("Passed: Dashboard - My Standards dropdown value matched as expected"); + //text + if (elementText === 'United States Standards') { + console.log('Passed: Dashboard - My Standards dropdown text matched as expected'); } else { - const message = `Expected: Dashboard - My Standards dropdown value - "United States Standards"; Actual: "${dropdownValue}"`; - errors.push(message); + throw new Error(`Expected: Dashboard - My Standards: "United States Standards"; Actual: "${elementText}"`); } + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards dropdown font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Dashboard - My Standards dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards dropdown font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - My Standards dropdown color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const expected = [ + 'ACTFL', + 'Australia', + 'California', + 'Canada', + 'Common Core Standards', + 'Creating Org', + 'Demo Client Standards', + 'Demo Standards', + 'New Folder', + 'QA Client Test Frameworks', + 'United States Standards', + 'WIDA' + ]; + + const actual = []; + for (const opt of options) { const text = (await opt.getText()).trim(); actual.push(text); } - if (JSON.stringify(actual) === JSON.stringify(expectedList)) { + if (JSON.stringify(actual) === JSON.stringify(expected)) { console.log('Passed: Dashboard - My Standards Dropdown list matched as expected'); } else { - const message = `Expected: Dashboard My Standards Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`; - errors.push(message); + throw new Error(`Expected: Dashboard - My Standards Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -260,49 +363,55 @@ const steps = [ } }, - //Dashboard - My Standards Organization column title, text, and font size + //Dashboard - My Standards Organization column title { description: 'Validate Dashboard - My Standards Organization column title, text, and font size', action: async () => { + const multipleChecks = 'My Standards Organization column title' const element = await driver.findElement(By.css('.table:nth-child(2) th:nth-child(1)')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; - //Validate text + //text if (elementText === 'Organization') { console.log('Passed: Dashboard - My Standards Organization column title matched as expected'); } else { - const message = `Expected: Dashboard - My Standards "Organization" column title; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards "Organization" column title; Actual: "${elementText}"`); } - //Validate color -dark gray - if (elementColor === 'rgba(94, 105, 116, 1)') { - console.log('Passed: Dashboard - My Standards Organization column title text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Organization column title font-family matched as expected'); } else { - const message = `Expected: Dashboard - My Standards Organization column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards Organization column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '14px') { console.log('Passed: Dashboard - My Standards Organization column title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - My Standards Organization column title text font-size "14px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards Organization column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards Organization column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Organization column title text color "rgba(94, 105, 116, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -311,49 +420,55 @@ const steps = [ } }, - //Dashboard - My Standards Export column title, text, and font size + //Dashboard - My Standards Export column title { description: 'Validate Dashboard - My Standards Export column title, text, and font size', action: async () => { + const multipleChecks = 'My Standards Export column title'; const element = await driver.findElement(By.css('.table:nth-child(2) > thead .text-center:nth-child(2)')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; - //Validate text + //text if (elementText === 'Export') { console.log('Passed: Dashboard - My Standards Export column title matched as expected'); } else { - const message = `Expected: Dashboard - My Standards "Export" column title; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards "Export" column title; Actual: "${elementText}"`); } - //Validate color -dark gray - if (elementColor === 'rgba(94, 105, 116, 1)') { - console.log('Passed: Dashboard - My Standards Export column title text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Export column title font-family matched as expected'); } else { - const message = `Expected: Dashboard - My Standards Export column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards Export column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '14px') { console.log('Passed: Dashboard - My Standards Export column title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - My Standards Export column title text font-size "14px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards Export column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards Export column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Export column title text color "rgba(94, 105, 116, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -362,49 +477,55 @@ const steps = [ } }, - //Dashboard - My Standards Manage column title, text, and font size + //Dashboard - My Standards Manage column title { description: 'Validate Dashboard - My Standards Manage column title, text, and font size', action: async () => { + const multipleChecks = 'My Standards Manage column title'; const element = await driver.findElement(By.css('.text-center:nth-child(3)')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; - //Validate text + //text if (elementText === 'Manage') { console.log('Passed: Dashboard - My Standards Manage column title matched as expected'); } else { - const message = `Expected: Dashboard - My Standards "Manage" column title; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards "Manage" column title; Actual: "${elementText}"`); } - //Validate color -dark gray - if (elementColor === 'rgba(94, 105, 116, 1)') { - console.log('Passed: Dashboard - My Standards Manage column title text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Manage column title font-family matched as expected'); } else { - const message = `Expected: Dashboard - My Standards Manage column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards Manage column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '14px') { console.log('Passed: Dashboard - My Standards Manage column title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - My Standards Manage column title text font-size "14px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards Manage column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards Manage column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Manage column title text color "rgba(94, 105, 116, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -413,49 +534,55 @@ const steps = [ } }, - //Dashboard - My Standards More Info column title, text, and font size + //Dashboard - My Standards More Info column title { description: 'Validate Dashboard - My Standards More Info column title, text, and font size', action: async () => { + const multipleChecks = 'My Standards More Info column title'; const element = await driver.findElement(By.css('.table-sm > thead .text-center:nth-child(4)')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; - //Validate text + //text if (elementText === 'More Info') { console.log('Passed: Dashboard - My Standards More Info column title matched as expected'); } else { - const message = `Expected: Dashboard - My Standards "More Info" column title; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards "More Info" column title; Actual: "${elementText}"`); } - //Validate color -dark gray - if (elementColor === 'rgba(94, 105, 116, 1)') { - console.log('Passed: Dashboard - My Standards More Info column title text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards More Info column title font-family matched as expected'); } else { - const message = `Expected: Dashboard - My Standards More Info column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards More Info column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '14px') { console.log('Passed: Dashboard - My Standards More Info column title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - My Standards More Info column title text font-size "14px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards More Info column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards More Info column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards More Info column title text color "rgba(94, 105, 116, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -464,49 +591,55 @@ const steps = [ } }, - //Dashboard - My Standards View column title, text, and font size + //Dashboard - My Standards View column title { description: 'Validate Dashboard - My Standards View column title, text, and font size', action: async () => { + const multipleChecks = 'My Standards View column title'; const element = await driver.findElement(By.css('thead .text-center:nth-child(5)')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; - //Validate text + //text if (elementText === 'View') { console.log('Passed: Dashboard - My Standards View column title matched as expected'); } else { - const message = `Expected: Dashboard - My Standards "View" column title; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards "View" column title; Actual: "${elementText}"`); } - //Validate color -dark gray - if (elementColor === 'rgba(94, 105, 116, 1)') { - console.log('Passed: Dashboard - My Standards View column title text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards View column title font-family matched as expected'); } else { - const message = `Expected: Dashboard - My Standards View column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards View column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '14px') { console.log('Passed: Dashboard - My Standards View column title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - My Standards View column title text font-size "14px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Dashboard - My Standards View column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards View column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards View column title text color "rgba(94, 105, 116, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -515,63 +648,80 @@ const steps = [ } }, - //Dashboard - My Standards Organization = Alabama Standards text + //Dashboard - My Standards = Alabama { description: 'Validate Dashboard - My Standards Organization = Alabama Standards text', action: async () => { - const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(1)')).getText(); + const multipleChecks = 'My Standards Organization - Alabama'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(1)')); + + //Get text, font, color, and size + 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'); - if (elementText === 'Alabama Standards') { - console.log("Passed: Dashboard - My Standards Alabama Standadrds text matched as expected"); - } else { - throw new Error(`Expected: Dashboard - My Standards Alabama Standadrds text "Alabama Standards"; Actual: "${elementText}"`); - } - } - }, - - //Dashboard - My Standards Alabama - Export icon - { - description: 'Verify Dashboard - My Standards Alabama - Export icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards Alabama - Export icon not found'); - } - console.log('Passed: Dashboard - My Standards Alabama - Export icon is present'); - } - }, - - //Dashboard - My Standards Alabama - More Info icon and title text - { - description: 'Verify Dashboard - My Standards Alabama - More Info icon and title text is present', - action: async () => { - const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(1) > td:nth-child(4) > a')), 5000).catch(() => false); - - //Get title text - const elementTitleText = await element.getAttribute('title'); + const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img')); //Track all errors const errors = []; - if (!element) { - throw new Error('Expected: Dashboard - My Standards Alabama - More Info icon not found'); - } - console.log('Passed: Dashboard - My Standards Alabama - More Info icon is present'); - - //Validate title text - if (elementTitleText === 'View Detail Information') { - console.log('Passed: Dashboard - My Standards Alabama - text title matched as expected'); + //text + if (elementText === 'Alabama') { + console.log("Passed: Dashboard - My Standards Alabama text matched as expected"); } else { - const message = `Expected: Dashboard - My Standards Alabama - "View Detail Information" text title; Actual: "${elementTitleText}"`; - errors.push(message); + throw new Error(`Expected: Dashboard - My Standards text: "Alabama"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Alabama text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Alabama text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Alabama text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Alabama text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Alabama text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Alabama text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Alabama - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Alabama - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Alabama icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Alabama: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Alabama - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Alabama - View icon not found'); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -580,76 +730,80 @@ const steps = [ } }, - //Dashboard - My Standards Alabama - View icon - { - description: 'Verify Dashboard - My Standards Alabama - View icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) > .text-center:nth-child(5) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards Alabama - View icon not found'); - } - console.log('Passed: Dashboard - My Standards Alabama - View icon is present'); - } - }, - - //Dashboard - My Standards Organization = Arizona Standards text + //Dashboard - My Standards = Arizona { description: 'Validate Dashboard - My Standards Organization = Arizona Standards text', action: async () => { - const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(1)')).getText(); + const multipleChecks = 'My Standards Organization - Arizona'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(1)')); + + //Get text, font, color, and size + 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'); - if (elementText === 'Arizona Standards') { - console.log("Passed: Dashboard - My Standards Arizona Standadrds text matched as expected"); - } else { - throw new Error(`Expected: Dashboard - My Standards Arizona Standadrds text "Arizona Standards"; Actual: "${elementText}"`); - } - } - }, - - //Dashboard - My Standards Arizona - Export icon - { - description: 'Verify Dashboard - My Standards Arizona - Export icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(2) > .text-center:nth-child(2) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards Arizona - Export icon not found'); - } - console.log('Passed: Dashboard - My Standards Arizona - Export icon is present'); - } - }, - - //Dashboard - My Standards Arizona - More Info icon and title text - { - description: 'Verify Dashboard - My Standards Arizona - More Info icon and title text is present', - action: async () => { - const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(2) > td:nth-child(4) > a')), 5000).catch(() => false); - - //Get title text - const elementTitleText = await element.getAttribute('title'); + const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(2) > .text-center:nth-child(5) img')); //Track all errors const errors = []; - if (!element) { - throw new Error('Expected: Dashboard - My Standards Arizona - More Info icon not found'); - } - console.log('Passed: Dashboard - My Standards Arizona - More Info icon is present'); - - //Validate title text - if (elementTitleText === 'View Detail Information') { - console.log('Passed: Dashboard - My Standards Arizona - text title matched as expected'); + //text + if (elementText === 'Arizona') { + console.log("Passed: Dashboard - My Standards Arizona text matched as expected"); } else { - const message = `Expected: Dashboard - My Standards Arizona - "View Detail Information" text title; Actual: "${elementTitleText}"`; - errors.push(message); + throw new Error(`Expected: Dashboard - My Standards text: "Arizona"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Arizona text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Arizona text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Arizona text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Arizona text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Arizona text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Arizona text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Arizona - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Arizona - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Arizona icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Arizona: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Arizona - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Arizona - View icon not found'); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -658,76 +812,80 @@ const steps = [ } }, - //Dashboard - My Standards Arizona - View icon - { - description: 'Verify Dashboard - My Standards Arizona - View icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) > .text-center:nth-child(5) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards Arizona - View icon not found'); - } - console.log('Passed: Dashboard - My Standards Arizona - View icon is present'); - } - }, - - //Dashboard - My Standards Organization = California Standards text + //Dashboard - My Standards = California { description: 'Validate Dashboard - My Standards Organization = California Standards text', action: async () => { - const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(1)')).getText(); + const multipleChecks = 'My Standards Organization - California'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(1)')); + + //Get text, font, color, and size + 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'); - if (elementText === 'California Standards') { - console.log("Passed: Dashboard - My Standards California Standadrds text matched as expected"); - } else { - throw new Error(`Expected: Dashboard - My Standards California Standadrds text "California Standards"; Actual: "${elementText}"`); - } - } - }, - - //Dashboard - My Standards California - Export icon - { - description: 'Verify Dashboard - My Standards California - Export icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(3) > .text-center:nth-child(2) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards California - Export icon not found'); - } - console.log('Passed: Dashboard - My Standards California - Export icon is present'); - } - }, - - //Dashboard - My Standards California - More Info icon and title text - { - description: 'Verify Dashboard - My Standards California - More Info icon and title text is present', - action: async () => { - const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(3) > td:nth-child(4) > a')), 5000).catch(() => false); - - //Get title text - const elementTitleText = await element.getAttribute('title'); + const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(3) > .text-center:nth-child(5) img')); //Track all errors const errors = []; - if (!element) { - throw new Error('Expected: Dashboard - My Standards California - More Info icon not found'); - } - console.log('Passed: Dashboard - My Standards California - More Info icon is present'); - - //Validate title text - if (elementTitleText === 'View Detail Information') { - console.log('Passed: Dashboard - My Standards California - text title matched as expected'); + //text + if (elementText === 'California') { + console.log("Passed: Dashboard - My Standards California text matched as expected"); } else { - const message = `Expected: Dashboard - My Standards California - "View Detail Information" text title; Actual: "${elementTitleText}"`; - errors.push(message); + throw new Error(`Expected: Dashboard - My Standards text: "California"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards California text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards California text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards California text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards California text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards California text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards California text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards California - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards California - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards California icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards California: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards California - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards California - View icon not found'); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -736,76 +894,80 @@ const steps = [ } }, - //Dashboard - My Standards California - View icon - { - description: 'Verify Dashboard - My Standards California - View icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) > .text-center:nth-child(5) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards California - View icon not found'); - } - console.log('Passed: Dashboard - My Standards California - View icon is present'); - } - }, - - //Dashboard - My Standards Organization = Florida Standards text + //Dashboard - My Standards = Florida { description: 'Validate Dashboard - My Standards Organization = Florida Standards text', action: async () => { - const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(1)')).getText(); + const multipleChecks = 'My Standards Organization - Florida'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(1)')); + + //Get text, font, color, and size + 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'); - if (elementText === 'Florida Standards') { - console.log("Passed: Dashboard - My Standards Florida Standadrds text matched as expected"); - } else { - throw new Error(`Expected: Dashboard - My Standards Florida Standadrds text "Florida Standards"; Actual: "${elementText}"`); - } - } - }, - - //Dashboard - My Standards Florida - Export icon - { - description: 'Verify Dashboard - My Standards Florida - Export icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(4) > .text-center:nth-child(2) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards Florida - Export icon not found'); - } - console.log('Passed: Dashboard - My Standards Florida - Export icon is present'); - } - }, - - //Dashboard - My Standards Florida - More Info icon and title text - { - description: 'Verify Dashboard - My Standards Florida - More Info icon and title text is present', - action: async () => { - const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(4) > td:nth-child(4) > a')), 5000).catch(() => false); - - //Get title text - const elementTitleText = await element.getAttribute('title'); + const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(4) > .text-center:nth-child(5) img')); //Track all errors const errors = []; - if (!element) { - throw new Error('Expected: Dashboard - My Standards Florida - More Info icon not found'); - } - console.log('Passed: Dashboard - My Standards Florida - More Info icon is present'); - - //Validate title text - if (elementTitleText === 'View Detail Information') { - console.log('Passed: Dashboard - My Standards Florida - text title matched as expected'); + //text + if (elementText === 'Florida') { + console.log("Passed: Dashboard - My Standards Florida text matched as expected"); } else { - const message = `Expected: Dashboard - My Standards Florida - "View Detail Information" text title; Actual: "${elementTitleText}"`; - errors.push(message); + throw new Error(`Expected: Dashboard - My Standards text: "Florida"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Florida text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Florida text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Florida text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Florida text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Florida text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Florida text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Florida - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Florida - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Florida icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Florida: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Florida - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Florida - View icon not found'); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -814,76 +976,244 @@ const steps = [ } }, - //Dashboard - My Standards Florida - View icon + //Dashboard - My Standards = Georgia { - description: 'Verify Dashboard - My Standards Florida - View icon is present', + description: 'Validate Dashboard - My Standards Organization = Georgia Standards text', action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) > .text-center:nth-child(5) img')), 5000).catch(() => false); + const multipleChecks = 'My Standards Organization - Georgia'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > td:nth-child(1)')); + + //Get text, font, color, and size + 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'); - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards Florida - View icon not found'); + const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(5) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Georgia') { + console.log("Passed: Dashboard - My Standards Georgia text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Georgia"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Georgia text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Georgia text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Georgia text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Georgia text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Georgia text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Georgia text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Georgia - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Georgia - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Georgia icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Georgia: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Georgia - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Georgia - View icon not found'); + } + + //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 - My Standards Florida - View icon is present'); } }, - //Dashboard - My Standards Organization = New York Standards text + //Dashboard - My Standards = Illinois + { + description: 'Validate Dashboard - My Standards Organization = Illinois Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Illinois'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(6) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Illinois') { + console.log("Passed: Dashboard - My Standards Illinois text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Illinois"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Illinois text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Illinois text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Illinois text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Illinois text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Illinois text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Illinois text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Illinois - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Illinois - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Illinois icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Illinois: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Illinois - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Illinois - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = New York { description: 'Validate Dashboard - My Standards Organization = New York Standards text', action: async () => { - const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > td:nth-child(1)')).getText(); + const multipleChecks = 'My Standards Organization - New York'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > td:nth-child(1)')); + + //Get text, font, color, and size + 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'); - if (elementText === 'New York Standards') { - console.log("Passed: Dashboard - My Standards New York Standadrds text matched as expected"); - } else { - throw new Error(`Expected: Dashboard - My Standards "New York Standards"; Actual: "${elementText}"`); - } - } - }, - - //Dashboard - My Standards New York - Export icon - { - description: 'Verify Dashboard - My Standards New York - Export icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(5) > .text-center:nth-child(2) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards New York - Export icon not found'); - } - console.log('Passed: Dashboard - My Standards New York - Export icon is present'); - } - }, - - //Dashboard - My Standards New York - More Info icon and title text - { - description: 'Verify Dashboard - My Standards New York - More Info icon and title text is present', - action: async () => { - const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(5) > td:nth-child(4) > a')), 5000).catch(() => false); - - //Get title text - const elementTitleText = await element.getAttribute('title'); + const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(7) > .text-center:nth-child(5) img')); //Track all errors const errors = []; - if (!element) { - throw new Error('Expected: Dashboard - My Standards New York - More Info icon not found'); - } - console.log('Passed: Dashboard - My Standards New York - More Info icon is present'); - - //Validate title text - if (elementTitleText === 'View Detail Information') { - console.log('Passed: Dashboard - My Standards New York - text title matched as expected'); + //text + if (elementText === 'New York') { + console.log("Passed: Dashboard - My Standards New York text matched as expected"); } else { - const message = `Expected: Dashboard - My Standards New York - "View Detail Information" text title; Actual: "${elementTitleText}"`; - errors.push(message); + throw new Error(`Expected: Dashboard - My Standards text: "New York"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards New York text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards New York text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards New York text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards New York text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards New York text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards New York text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards New York - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards New York - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards New York icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards New York: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards New York - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards New York - View icon not found'); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -892,76 +1222,80 @@ const steps = [ } }, - //Dashboard - My Standards New York - View icon + //Dashboard - My Standards = Texas { - description: 'Verify Dashboard - My Standards New York - View icon is present', + description: 'Validate Dashboard - My Standards Organization = Texas Standards text', action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(5) > .text-center:nth-child(5) img')), 5000).catch(() => false); + const multipleChecks = 'My Standards Organization - Texas'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > td:nth-child(1)')); + + //Get text, font, color, and size + 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'); - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards New York - View icon not found'); - } - console.log('Passed: Dashboard - My Standards New York - View icon is present'); - } - }, - - //Dashboard - My Standards Organization = North Carolina Standards text - { - description: 'Validate Dashboard - My Standards Organization = North Carolina Standards text', - action: async () => { - const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > td:nth-child(1)')).getText(); - - if (elementText === 'North Carolina Standards') { - console.log("Passed: Dashboard - My Standards North Carolina Standadrds text matched as expected"); - } else { - throw new Error(`Expected: Dashboard - My Standards "North Carolina Standards"; Actual: "${elementText}"`); - } - } - }, - - //Dashboard - My Standards North Carolina - Export icon - { - description: 'Verify Dashboard - My Standards North Carolina - Export icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(6) > .text-center:nth-child(2) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards North Carolina - Export icon not found'); - } - console.log('Passed: Dashboard - My Standards North Carolina - Export icon is present'); - } - }, - - //Dashboard - My Standards North Carolina - More Info icon and title text - { - description: 'Verify Dashboard - My Standards North Carolina - More Info icon and title text is present', - action: async () => { - const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(6) > td:nth-child(4) > a')), 5000).catch(() => false); - - //Get title text - const elementTitleText = await element.getAttribute('title'); + const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(8) > .text-center:nth-child(5) img')); //Track all errors const errors = []; - if (!element) { - throw new Error('Expected: Dashboard - My Standards North Carolina - More Info icon not found'); - } - console.log('Passed: Dashboard - My Standards North Carolina - More Info icon is present'); - - //Validate title text - if (elementTitleText === 'View Detail Information') { - console.log('Passed: Dashboard - My Standards North Carolina - text title matched as expected'); + //text + if (elementText === 'Texas') { + console.log("Passed: Dashboard - My Standards Texas text matched as expected"); } else { - const message = `Expected: Dashboard - My Standards North Carolina - "View Detail Information" text title; Actual: "${elementTitleText}"`; - errors.push(message); + throw new Error(`Expected: Dashboard - My Standards text: "Texas"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Texas text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Texas text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Texas text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Texas text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Texas text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Texas text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Texas - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Texas - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Texas icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Texas: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Texas - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Texas - View icon not found'); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -969,233 +1303,81 @@ const steps = [ } } }, - - //Dashboard - My Standards North Carolina - View icon - { - description: 'Verify Dashboard - My Standards North Carolina - View icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(6) > .text-center:nth-child(5) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards North Carolina - View icon not found'); - } - console.log('Passed: Dashboard - My Standards North Carolina - View icon is present'); - } - }, - - //Dashboard - My Standards Organization = South Carolina Standards text - { - description: 'Validate Dashboard - My Standards Organization = South Carolina Standards text', - action: async () => { - const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > td:nth-child(1)')).getText(); - - if (elementText === 'South Carolina Standards') { - console.log("Passed: Dashboard - My Standards South Carolina Standadrds text matched as expected"); - } else { - throw new Error(`Expected: Dashboard - My Standards "South Carolina Standards"; Actual: "${elementText}"`); - } - } - }, - - //Dashboard - My Standards South Carolina - Export icon - { - description: 'Verify Dashboard - My Standards South Carolina - Export icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(7) > .text-center:nth-child(2) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards South Carolina - Export icon not found'); - } - console.log('Passed: Dashboard - My Standards South Carolina - Export icon is present'); - } - }, - - //Dashboard - My Standards South Carolina - More Info icon and title text - { - description: 'Verify Dashboard - My Standards South Carolina - More Info icon and title text is present', - action: async () => { - const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(7) > td:nth-child(4) > a')), 5000).catch(() => false); - - //Get title text - const elementTitleText = await element.getAttribute('title'); - - //Track all errors - const errors = []; - - if (!element) { - throw new Error('Expected: Dashboard - My Standards South Carolina - More Info icon not found'); - } - console.log('Passed: Dashboard - My Standards South Carolina - More Info icon is present'); - - //Validate title text - if (elementTitleText === 'View Detail Information') { - console.log('Passed: Dashboard - My Standards South Carolina - text title matched as expected'); - } else { - const message = `Expected: Dashboard - My Standards South Carolina - "View Detail Information" text title; Actual: "${elementTitleText}"`; - errors.push(message); - } - - //Throw summary if any validation failed - if (errors.length > 0) { - //Add summary line only when multiple checks failed - if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); - } - - //Throw collected messages — catch() will prefix with "FAILED:" - throw new Error(errors.join('\n')); - } - } - }, - - //Dashboard - My Standards South Carolina - View icon - { - description: 'Verify Dashboard - My Standards South Carolina - View icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(7) > .text-center:nth-child(5) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards South Carolina - View icon not found'); - } - console.log('Passed: Dashboard - My Standards South Carolina - View icon is present'); - } - }, - - //Dashboard - My Standards Organization = Texas TEKS Standards text - { - description: 'Validate Dashboard - My Standards Organization = Texas TEKS Standards text', - action: async () => { - const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > td:nth-child(1)')).getText(); - - if (elementText === 'Texas TEKS Standards') { - console.log("Passed: Dashboard - My Standards Texas TEKS Standadrds text matched as expected"); - } else { - throw new Error(`Expected: Dashboard - My Standards "Texas TEKS Standards"; Actual: "${elementText}"`); - } - } - }, - - //Dashboard - My Standards Texas TEKS - Export icon - { - description: 'Verify Dashboard - My Standards Texas TEKS - Export icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(8) > .text-center:nth-child(2) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards Texas TEKS - Export icon not found'); - } - console.log('Passed: Dashboard - My Standards Texas TEKS - Export icon is present'); - } - }, - - //Dashboard - My Standards Texas TEKS - More Info icon and title text - { - description: 'Verify Dashboard - My Standards Texas TEKS - More Info icon and title text is present', - action: async () => { - const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(8) > td:nth-child(4) > a')), 5000).catch(() => false); - - //Get title text - const elementTitleText = await element.getAttribute('title'); - - //Track all errors - const errors = []; - - if (!element) { - throw new Error('Expected: Dashboard - My Standards Texas TEKS - More Info icon not found'); - } - console.log('Passed: Dashboard - My Standards Texas TEKS - More Info icon is present'); - - //Validate title text - if (elementTitleText === 'View Detail Information') { - console.log('Passed: Dashboard - My Standards Texas TEKS - text title matched as expected'); - } else { - const message = `Expected: Dashboard - My Standards Texas TEKS - "View Detail Information" text title; Actual: "${elementTitleText}"`; - errors.push(message); - } - - //Throw summary if any validation failed - if (errors.length > 0) { - //Add summary line only when multiple checks failed - if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); - } - - //Throw collected messages — catch() will prefix with "FAILED:" - throw new Error(errors.join('\n')); - } - } - }, - - //Dashboard - My Standards Texas TEKS - View icon - { - description: 'Verify Dashboard - My Standards Texas TEKS - View icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(8) > .text-center:nth-child(5) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards Texas TEKS - View icon not found'); - } - console.log('Passed: Dashboard - My Standards Texas TEKS - View icon is present'); - } - }, - - //Dashboard - My Standards Organization = Washington Standards text + + //Dashboard - My Standards = Washington { description: 'Validate Dashboard - My Standards Organization = Washington Standards text', action: async () => { - const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > td:nth-child(1)')).getText(); + const multipleChecks = 'My Standards Organization - Washington'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > td:nth-child(1)')); + + //Get text, font, color, and size + 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'); - if (elementText === 'Washington Standards') { - console.log("Passed: Dashboard - My Standards Washington Standadrds text matched as expected"); - } else { - throw new Error(`Expected: Dashboard - My Standards "Washington Standards"; Actual: "${elementText}"`); - } - } - }, - - //Dashboard - My Standards Washington - Export icon - { - description: 'Verify Dashboard - My Standards Washington - Export icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(9) > .text-center:nth-child(2) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards Washington - Export icon not found'); - } - console.log('Passed: Dashboard - My Standards Washington - Export icon is present'); - } - }, - - //Dashboard - My Standards Washington - More Info icon and title text - { - description: 'Verify Dashboard - My Standards Washington - More Info icon and title text is present', - action: async () => { - const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(9) > td:nth-child(4) > a')), 5000).catch(() => false); - - //Get title text - const elementTitleText = await element.getAttribute('title'); + const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(9) > .text-center:nth-child(5) img')); //Track all errors const errors = []; - if (!element) { - throw new Error('Expected: Dashboard - My Standards Washington - More Info icon not found'); - } - console.log('Passed: Dashboard - My Standards Washington - More Info icon is present'); - - //Validate title text - if (elementTitleText === 'View Detail Information') { - console.log('Passed: Dashboard - My Standards Washington - text title matched as expected'); + //text + if (elementText === 'Washington') { + console.log("Passed: Dashboard - My Standards Washington text matched as expected"); } else { - const message = `Expected: Dashboard - My Standards Washington - "View Detail Information" text title; Actual: "${elementTitleText}"`; - errors.push(message); + throw new Error(`Expected: Dashboard - My Standards text: "Washington"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Washington text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Washington text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Washington text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Washington text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Washington text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Washington text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Washington - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Washington - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Washington icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Washington: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Washington - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Washington - View icon not found'); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -1204,72 +1386,76 @@ const steps = [ } }, - //Dashboard - My Standards Washington - View icon - { - description: 'Verify Dashboard - My Standards Washington - View icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(9) > .text-center:nth-child(5) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - My Standards Washington - View icon not found'); - } - console.log('Passed: Dashboard - My Standards Washington - View icon is present'); - } - }, - - /*NEXT ACTION - Click Other Available Standards tab + //NEXT ACTION { description: 'Dashboard - Click Other Available Standards tab', action: async () => { - console.log('----->| NEXT ACTION: Clicked Other Available Standards tab'); await driver.findElement(By.css('#availstd-tab')).click(); - await driver.sleep(2000); + console.log('----->| NEXT ACTION: Clicked Other Available Standards tab'); + + //Wait until the element exists in the DOM + const instructionText = await driver.wait( + until.elementLocated(By.css('p:nth-child(1)')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(instructionText), + 30000 + ); } }, - //Dashboard - My Standards Widget title (dimmed) + //Dashboard - My Standards Widget title { description: 'Validate Dashboard Semantic Standards Comparison Widget title text, color, and size', action: async () => { + const multipleChecks = 'Dashboard Semantic Standards Comparison Widget title'; const element = await driver.findElement(By.css('#mystd-tab')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //Get text, font, color, and size + 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 = []; - //Validate text + //text if (elementText === 'My Standards') { console.log('Passed: Dashboard - Semantic Standards Comparison Widget title matched as expected'); } else { - const message = `Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`); } - //Validate color -gray (dimmed) - if (elementColor === 'rgba(182, 186, 181, 1)') { - console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-family matched as expected'); } else { - const message = `Expected: Dashboard - Semantic Standards Comparison Widget title text color "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '15px') { console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title text color "rgba(182, 186, 181, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -1278,49 +1464,55 @@ const steps = [ } }, - //Dashboard - Other Available Stndards tab title, text, and font size (active) + //Dashboard - Other Available Stndards tab title (active) { description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size', action: async () => { + const multipleChecks = 'Other Available Stndards tab title'; const element = await driver.findElement(By.css('#availstd-tab')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //Get text, font, color, and size + 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 = []; - //Validate text + //text if (elementText === 'Other Available Standards') { console.log('Passed: Dashboard - Other Available Standards tab title matched as expected'); } else { - const message = `Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards tab title text font-family matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards tab title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Other Available Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '15px') { console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -1329,16 +1521,59 @@ const steps = [ } }, - //Dashboard - Other Available Standards description text + //Dashboard - Other Available Stndards tab title { - description: 'Validate Dashboard - Other Available Standards description text', + description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size', action: async () => { - const elementText = await driver.findElement(By.css('p:nth-child(1)')).getText(); + const multipleChecks = 'Other Available Stndards tab title'; + const element = await driver.findElement(By.css('p:nth-child(1)')); + //Get text, font, color, and size + 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 === 'The following standards are also available to clients. If you would like access to any of these standards sets, please Contact Us.') { - console.log("Passed: Dashboard - Other Available Standards description text matched as expected"); + console.log('Passed: Dashboard - Other Available Standards description text matched as expected'); } else { - throw new Error(`Expected: Dashboard - Other Available Standards description text "The following standards are also available to clients. If you would like access to any of these standards sets, please Contact Us."; Actual: "${elementText}"`); + errors.push(`Expected: Dashboard - "The following standards are also available to clients. If you would like access to any of these standards sets, please Contact Us."; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards description text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards description text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab title text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab 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')); } } }, @@ -1347,47 +1582,97 @@ const steps = [ { description: 'Validate Dashboard - Other Available Standards dropdown list and value', action: async () => { - const dropdown = await driver.findElement(By.css('#defstdparent')); - const dropdownValue = await dropdown.getAttribute('value'); - const options = await dropdown.findElements(By.css('option')); - const expectedList = [ - 'Additional U.S. Standards', - 'Australia Standards', - 'Canada Standards', - 'England Standards', - 'National Standards', - 'Supplemental Standards', - 'United States Standards' - ]; - const actual = []; + const multipleChecks = 'Other Available Standards'; + const elementDropdown = await driver.findElement(By.css('#defstdparent')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); + //Track all errors const errors = []; - if (dropdownValue === '154828031') { - console.log("Passed: Dashboard - Other Available Standards dropdown value matched as expected"); + //text + if (elementText === 'United States Standards') { + console.log('Passed: Dashboard - Other Available Standards dropdown value matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards dropdown value - "United States Standards"; Actual: "${dropdownValue}"`; - errors.push(message); + throw new Error(`Expected: Dashboard - Other Available Standards dropdown value - "United States Standards"; Actual: "${elementText}"`); } + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards dropdown value font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards dropdown value font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Dashboard - Other Available Standards dropdown value font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards dropdown value font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - Other Available Standards dropdown value color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards dropdown value color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const expected = [ + 'ACT', + 'ACTFL', + 'AQA', + 'Australia', + 'Brazil', + 'Cambridge IGCSE', + 'Cambridge International AS & A Level', + 'Cambridge Secondary', + 'Canada', + 'Common Core Standards', + 'Edexcel', + 'England', + 'Finland', + 'India', + 'India NCERT (Archived)', + 'International Standards', + 'Ireland (Archived)', + 'Mexico', + 'National Standards', + 'New Zealand', + 'OCR', + 'Puerto Rico 2014', + 'Saudi Arabia', + 'Supplemental Standards', + 'Taiwan (Additional)', + 'Thailand (Additional)', + 'United Arab Emirates', + 'United States Standards' + ]; + + const actual = []; + for (const opt of options) { const text = (await opt.getText()).trim(); actual.push(text); } - if (JSON.stringify(actual) === JSON.stringify(expectedList)) { - console.log('Passed: Dashboard - Other Available Standards Dropdown list matched as expected'); + if (JSON.stringify(actual) === JSON.stringify(expected)) { + console.log('Passed: Dashboard - Other Available Standards dropdown list matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`; - errors.push(message); + throw new Error(`Expected: Dashboard - Other Available Standards dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -1396,49 +1681,55 @@ const steps = [ } }, - //Dashboard - Other Available Standards Organization column title, text, and font size + //Dashboard - Other Available Standards Organization column title { description: 'Validate Dashboard - Other Available Standards Organization column title, text, and font size', action: async () => { + const multiple = 'Other Available Standards Organization column title'; const element = await driver.findElement(By.css('.table:nth-child(3) th:nth-child(1)')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //Get text, font, color, and size + 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 = []; - //Validate text + //text if (elementText === 'Organization') { console.log('Passed: Dashboard - Other Available Standards Organization column title matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards "Organization" column title; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Other Available Standards "Organization" column title; Actual: "${elementText}"`); } - //Validate color -dark gray - if (elementColor === 'rgba(94, 105, 116, 1)') { - console.log('Passed: Dashboard - Other Available Standards Organization column title text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards Organization column title font-family matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards Organization column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Other Available Standards Organization column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '14px') { console.log('Passed: Dashboard - Other Available Standards Organization column title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards Organization column title text font-size "14px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Other Available Standards Organization column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - Other Available Standards Organization column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Organization column title text color "rgba(94, 105, 116, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -1447,49 +1738,55 @@ const steps = [ } }, - //Dashboard - Other Available Organization column title, text, and font size + //Dashboard - Other Available Organization column title { description: 'Validate Dashboard - Other Available Standards More Info column title, text, and font size', action: async () => { + const multipleChecks = 'Other Available Organization column title'; const element = await driver.findElement(By.css('.table:nth-child(3) > thead .text-center')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //Get text, font, color, and size + 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 = []; - //Validate text + //text if (elementText === 'More Info') { console.log('Passed: Dashboard - Other Available Standards More Info column title matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards "More Info" column title; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Other Available Standards "More Info" column title; Actual: "${elementText}"`); } - //Validate color -dark gray - if (elementColor === 'rgba(94, 105, 116, 1)') { - console.log('Passed: Dashboard - Other Available Standards More Info column title text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards More Info column title font-family matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards More Info column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Other Available Standards More Info column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '14px') { console.log('Passed: Dashboard - Other Available Standards More Info column title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards More Info column title text font-size "14px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Other Available Standards More Info column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - Other Available Standards More Info column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards More Info column title text color "rgba(94, 105, 116, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -1498,148 +1795,354 @@ const steps = [ } }, - //Dashboard - Other Available Standards - Alaska Standards text + //Dashboard - Other Available Standards - Alaska { - description: 'Validate Dashboard - Other Available Standards - Alaska Standards text', + description: 'Validate Dashboard - Other Available Standards - Alaska', action: async () => { - const elementText = await driver.findElement(By.css('#defstdbody > tr:nth-child(1) > td:nth-child(1)')).getText(); + const multipleChecks = 'Other Available Standards - Alaska'; + const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(1) > td:nth-child(1)')); - if (elementText === 'Alaska Standards') { - console.log("Passed: Dashboard - Other Available Standards - Alaska Standards text matched as expected"); + //Get text, font, color, and size + 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 elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(1) > td.text-center > a')).getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Alaska') { + console.log('Passed: Dashboard - Other Available Standards Alaska column title matched as expected'); } else { - throw new Error(`Expected: Dashboard - Other Available Standards - "Alaska Standards"; Actual: "${elementText}"`); + errors.push(`Expected: Dashboard - Other Available Standards "Alaska" column title; Actual: "${elementText}"`); } - } - }, - //Dashboard - Other Available Standards - Alaska Standards More Info icon - { - description: 'Verify Dashboard - Other Available Standards - Alaska Standards icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#defstdbody > tr:nth-child(1) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - Other Available Standards - Alaska Standards More Info icon not found'); - } - console.log('Passed: Dashboard - Other Available Standards - Alaska Standards More Info icon is present'); - } - }, - - //Dashboard - Other Available Standards - Arkansas Standards text - { - description: 'Validate Dashboard - Other Available Standards - Arkansas Standards text', - action: async () => { - const elementText = await driver.findElement(By.css('#defstdbody > tr:nth-child(2) > td:nth-child(1)')).getText(); - - if (elementText === 'Arkansas Standards') { - console.log("Passed: Dashboard - Other Available Standards - Arkansas Standards text matched as expected"); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards Alaska column title font-family matched as expected'); } else { - throw new Error(`Expected: Dashboard - Other Available Standards - "Arkansas Standards"; Actual: "${elementText}"`); + errors.push(`Expected: Dashboard - Other Available Standards Alaska column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - } - }, - //Dashboard - Other Available Standards - Arkansas Standards More Info icon - { - description: 'Verify Dashboard - Other Available Standards - Arkansas Standards icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#defstdbody > tr:nth-child(2) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - Other Available Standards - Arkansas Standards More Info icon not found'); - } - console.log('Passed: Dashboard - Other Available Standards - Arkansas Standards More Info icon is present'); - } - }, - - //Dashboard - Other Available Standards - Colorado Standards text - { - description: 'Validate Dashboard - Other Available Standards - Colorado Standards text', - action: async () => { - const elementText = await driver.findElement(By.css('#defstdbody > tr:nth-child(3) > td:nth-child(1)')).getText(); - - if (elementText === 'Colorado Standards') { - console.log("Passed: Dashboard - Other Available Standards - Colorado Standards text matched as expected"); + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - Other Available Standards Alaska column title text font-size matched as expected'); } else { - throw new Error(`Expected: Dashboard - Other Available Standards - "Colorado Standards"; Actual: "${elementText}"`); + errors.push(`Expected: Dashboard - Other Available Standards Alaska column title text font-size "14.3px"; Actual: "${elementSize}"`); } - } - }, - //Dashboard - Other Available Standards - Colorado Standards More Info icon - { - description: 'Verify Dashboard - Other Available Standards - Colorado Standards icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#defstdbody > tr:nth-child(3) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - Other Available Standards - Colorado Standards More Info icon not found'); - } - console.log('Passed: Dashboard - Other Available Standards - Colorado Standards More Info icon is present'); - } - }, - - //Dashboard - Other Available Standards - Connecticut Standards text - { - description: 'Validate Dashboard - Other Available Standards - Connecticut Standards text', - action: async () => { - const elementText = await driver.findElement(By.css('#defstdbody > tr:nth-child(4) > td:nth-child(1)')).getText(); - - if (elementText === 'Connecticut Standards') { - console.log("Passed: Dashboard - Other Available Standards - Connecticut Standards text matched as expected"); + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - Other Available Standards Alaska column title text color matched as expected'); } else { - throw new Error(`Expected: Dashboard - Other Available Standards - "Connecticut Standards"; Actual: "${elementText}"`); + errors.push(`Expected: Dashboard - Other Available Standards Alaska column title text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`); } - } - }, - //Dashboard - Other Available Standards - Connecticut Standards More Info icon - { - description: 'Verify Dashboard - Other Available Standards - Connecticut Standards icon is present', - action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#defstdbody > tr:nth-child(4) img')), 5000).catch(() => false); - - if (!expectedIcon) { - throw new Error('Expected: Dashboard - Other Available Standards - Connecticut Standards More Info icon not found'); - } - console.log('Passed: Dashboard - Other Available Standards - Connecticut Standards More Info icon is present'); - } - }, - - //Dashboard - Other Available Standards - Delaware Standards text - { - description: 'Validate Dashboard - Other Available Standards - Delaware Standards text', - action: async () => { - const elementText = await driver.findElement(By.css('#defstdbody > tr:nth-child(5) > td:nth-child(1)')).getText(); - - if (elementText === 'Delaware Standards') { - console.log("Passed: Dashboard - Other Available Standards - Delaware Standards text matched as expected"); + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - Other Available Standards Alaska icon tool-tip text matched as expected'); } else { - throw new Error(`Expected: Dashboard - Other Available Standards - "Delaware Standards"; Actual: "${elementText}"`); + errors.push(`Expected: Dashboard - Other Available Standards Alaska: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //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')); } } }, - //Dashboard - Other Available Standards - Delaware Standards More Info icon + //Dashboard - Other Available Standards - Arkansas { - description: 'Verify Dashboard - Other Available Standards - Delaware Standards icon is present', + description: 'Validate Dashboard - Other Available Standards - Arkansas', action: async () => { - const expectedIcon = await driver.wait(until.elementLocated(By.css('#defstdbody > tr:nth-child(5) img')), 5000).catch(() => false); + const multipleChecks = 'Other Available Standards - Arkansas'; + const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(2) > td:nth-child(1)')); - if (!expectedIcon) { - throw new Error('Expected: Dashboard - Other Available Standards - Delaware Standards More Info icon not found'); + //Get text, font, color, and size + 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 elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(2) > td.text-center > a')).getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Arkansas') { + console.log('Passed: Dashboard - Other Available Standards Arkansas column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards "Arkansas" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards Arkansas column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Arkansas column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - Other Available Standards Arkansas column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Arkansas column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - Other Available Standards Arkansas column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Arkansas column title text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - Other Available Standards Arkansas icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Arkansas: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //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 - Other Available Standards - Delaware Standards More Info icon is present'); } }, - //NEXT ACTION - Click MyStandards tab + //Dashboard - Other Available Standards - Colorado + { + description: 'Validate Dashboard - Other Available Standards - Colorado', + action: async () => { + const multipleChecks = 'Other Available Standards - Colorado'; + const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(3) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(3) > td.text-center > a')).getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Colorado') { + console.log('Passed: Dashboard - Other Available Standards Colorado column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards "Colorado" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards Colorado column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Colorado column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - Other Available Standards Colorado column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Colorado column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - Other Available Standards Colorado column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Colorado column title text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - Other Available Standards Colorado icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Colorado: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //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')); + } + } + }, + + //Dashboard - Other Available Standards - Connecticut + { + description: 'Validate Dashboard - Other Available Standards - Connecticut', + action: async () => { + const multipleChecks = 'Other Available Standards - Connecticut'; + const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(4) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(4) > td.text-center > a')).getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Connecticut') { + console.log('Passed: Dashboard - Other Available Standards Connecticut column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards "Connecticut" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards Connecticut column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Connecticut column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - Other Available Standards Connecticut column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Connecticut column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - Other Available Standards Connecticut column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Connecticut column title text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - Other Available Standards Connecticut icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Connecticut: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //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')); + } + } + }, + + //Dashboard - Other Available Standards - Delaware + { + description: 'Validate Dashboard - Other Available Standards - Delaware', + action: async () => { + const multipleChecks = 'Other Available Standards - Delaware'; + const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(5) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(5) > td.text-center > a')).getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Delaware') { + console.log('Passed: Dashboard - Other Available Standards Delaware column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards "Delaware" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards Delaware column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Delaware column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - Other Available Standards Delaware column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Delaware column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - Other Available Standards Delaware icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Delaware: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - Other Available Standards Delaware column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Delaware column title text color "rgba(33, 37, 41, 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: 'Dashboard - Click My Standards tab', action: async () => { - console.log('----->| NEXT ACTION: Clicked My Standards tab'); await driver.findElement(By.css('#mystd-tab')).click(); - await driver.sleep(2000); + console.log('----->| NEXT ACTION: Clicked My Standards tab'); + + //Wait until the element exists in the DOM + const myStandardsDropdown = await driver.wait( + until.elementLocated(By.css('#stdparent')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(myStandardsDropdown), + 30000 + ); } }, @@ -1647,45 +2150,51 @@ const steps = [ { description: 'Validate Dashboard Semantic Standards Comparison Widget title text, color, and size', action: async () => { + const multipleChecks = 'My Standards Widget title (active)'; const element = await driver.findElement(By.css('#mystd-tab')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //Get text, font, color, and size + 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 = []; - //Validate text + //text if (elementText === 'My Standards') { console.log('Passed: Dashboard - Semantic Standards Comparison Widget title matched as expected'); } else { - const message = `Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title font-family matched as expected'); } else { - const message = `Expected: Dashboard - Semantic Standards Comparison Widget title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '15px') { console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -1694,49 +2203,55 @@ const steps = [ } }, - //Dashboard - Other Available Stndards tab title, text, and font size (dimmed) + //Dashboard - Other Available Stndards tab title { description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size', action: async () => { + const multipleChecks = 'Other Available Stndards tab title'; const element = await driver.findElement(By.css('#availstd-tab')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //Get text, font, color, and size + 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 = []; - //Validate text + //text if (elementText === 'Other Available Standards') { console.log('Passed: Dashboard - Other Available Standards tab title matched as expected'); } else { - const message = `Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`); } - //Validate color -gray (dimmed) - if (elementColor === 'rgba(182, 186, 181, 1)') { - console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards tab title font-family matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards tab title text color "rgba(182, 186, 181, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Other Available Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '15px') { console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab title text color "rgba(182, 186, 181, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -1745,78 +2260,777 @@ const steps = [ } }, - //NEXT ACTION - Click Alabama Export icon + //Dashboard - My Standards dropdown + { + description: 'Validate Dashboard - My Standards dropdown list and value', + action: async () => { + const multipleChecks = 'My Standards dropdown list'; + const elementDropdown = await driver.findElement(By.css('#stdparent')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); + + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'United States Standards') { + console.log('Passed: Dashboard - My Standards dropdown text matched as expected'); + } else { + throw new Error(`Expected: Dashboard - My Standards: "United States Standards"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards dropdown font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Dashboard - My Standards dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards dropdown font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - My Standards dropdown color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const expected = [ + 'ACTFL', + 'Australia', + 'California', + 'Canada', + 'Common Core Standards', + 'Creating Org', + 'Demo Client Standards', + 'Demo Standards', + 'New Folder', + 'QA Client Test Frameworks', + 'United States Standards', + 'WIDA' + ]; + + 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: Dashboard - My Standards Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Dashboard - My Standards Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //Dashboard - My Standards Organization column title + { + description: 'Validate Dashboard - My Standards Organization column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards Organization column title' + const element = await driver.findElement(By.css('.table:nth-child(2) th:nth-child(1)')); + + //Get text, font, color, and size + 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 === 'Organization') { + console.log('Passed: Dashboard - My Standards Organization column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "Organization" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Organization column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Organization column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards Organization column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Organization column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards Organization column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Organization column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards Export column title + { + description: 'Validate Dashboard - My Standards Export column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards Export column title'; + const element = await driver.findElement(By.css('.table:nth-child(2) > thead .text-center:nth-child(2)')); + + //Get text, font, color, and size + 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 === 'Export') { + console.log('Passed: Dashboard - My Standards Export column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "Export" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Export column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Export column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards Export column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Export column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards Export column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Export column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards Manage column title + { + description: 'Validate Dashboard - My Standards Manage column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards Manage column title'; + const element = await driver.findElement(By.css('.text-center:nth-child(3)')); + + //Get text, font, color, and size + 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 === 'Manage') { + console.log('Passed: Dashboard - My Standards Manage column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "Manage" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Manage column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Manage column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards Manage column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Manage column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards Manage column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Manage column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards More Info column title, + { + description: 'Validate Dashboard - My Standards More Info column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards More Info column title'; + const element = await driver.findElement(By.css('.table-sm > thead .text-center:nth-child(4)')); + + //Get text, font, color, and size + 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 === 'More Info') { + console.log('Passed: Dashboard - My Standards More Info column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "More Info" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards More Info column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards More Info column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards More Info column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards More Info column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards More Info column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards More Info column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards View column title + { + description: 'Validate Dashboard - My Standards View column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards View column title'; + const element = await driver.findElement(By.css('thead .text-center:nth-child(5)')); + + //Get text, font, color, and size + 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 === 'View') { + console.log('Passed: Dashboard - My Standards View column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "View" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards View column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards View column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards View column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards View column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards View column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards View column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards = Alabama + { + description: 'Validate Dashboard - My Standards Organization = Alabama Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Alabama'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Alabama') { + console.log("Passed: Dashboard - My Standards Alabama text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Alabama"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Alabama text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Alabama text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Alabama text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Alabama text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Alabama text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Alabama text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Alabama - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Alabama - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Alabama icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards Alabama: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Alabama - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Alabama - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = Arizona + { + description: 'Validate Dashboard - My Standards Organization = Arizona Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Arizona'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(2) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Arizona') { + console.log("Passed: Dashboard - My Standards Arizona text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Arizona"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Arizona text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Arizona text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Arizona text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Arizona text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Arizona text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Arizona text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Arizona - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Arizona - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Arizona icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards Arizona: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Arizona - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Arizona - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = California + { + description: 'Validate Dashboard - My Standards Organization = California Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - California'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(3) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'California') { + console.log("Passed: Dashboard - My Standards California text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "California"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards California text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards California text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards California text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards California text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards California text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards California text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards California - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards California - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards California icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards California: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards California - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards California - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = Florida + { + description: 'Validate Dashboard - My Standards Organization = Florida Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Florida'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(4) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Florida') { + console.log("Passed: Dashboard - My Standards Florida text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Florida"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Florida text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Florida text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Florida text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Florida text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Florida text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Florida text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Florida - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Florida - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Florida icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards Florida: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Florida - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Florida - View icon not found'); + } + + //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: 'Dashboard - Click Alabama Export icon', action: async () => { - console.log('----->| NEXT ACTION: Clicked Alabama Export icon'); await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img')).click(); + console.log('----->| NEXT ACTION: Clicked Alabama Export icon'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Modal did not become visible within 20 seconds'); + + console.log('Passed: DIV - Loaded successfully'); } }, - //Wait for element - { - description: 'Wait for DIV to be visible', - action: async () => { - - //Wait until the element exists in the DOM - const elementVisible = await driver.wait( - until.elementLocated(By.css('.modal-lg .modal-title')), - 20000 - ); - - //Wait until it becomes visible - await driver.wait( - until.elementIsVisible(elementVisible), - 20000 - ); - await driver.sleep(2000); - } - }, - - //DIV - Export Standards title, text, and font size + //EXPORT STANDARD DIV + //DIV - Export Standards title { description: 'Validate DIV - Export Standards title text, color, and size', action: async () => { + const multipleChecks = 'DIV - Export Standards title'; const element = await driver.findElement(By.css('.modal-lg .modal-title')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //Get text, font, color, and size + 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 = []; - //Validate text + //text if (elementText === 'Export Standards') { console.log('Passed: DIV - Export Standards title matched as expected'); } else { - const message = `Expected: DIV - "Export Standards"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - "Export Standards"; Actual: "${elementText}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: DIV - Export Standards title text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Export Standards title text font-family matched as expected'); } else { - const message = `Expected: DIV - Export Standards title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: DIV - Export Standards title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '18px') { console.log('Passed: DIV - Export Standards title text font-size matched as expected'); } else { - const message = `Expected: DIV - Export Standards title text font-size "18px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: DIV - Export Standards title text font-size "18px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Export Standards title text color matched as expected'); + } else { + errors.push(`Expected: DIV - Export Standards 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -1825,49 +3039,55 @@ const steps = [ } }, - //DIV - Alabama Standards sub-title, text, and font size + //DIV - Alabama sub-title { - description: 'Validate DIV - Alabama Standards sub-title text, color, and size', + description: 'Validate DIV - Alabama sub-title text, color, and size', action: async () => { + const multipleChecks = 'DIV - Alabama sub-title'; const element = await driver.findElement(By.css('p > b')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //Get text, font, color, and size + 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 = []; - //Validate text - if (elementText === 'Alabama Standards') { - console.log('Passed: DIV - Alabama Standards sub-title matched as expected'); + //text + if (elementText === 'Alabama') { + console.log('Passed: DIV - Alabama sub-title matched as expected'); } else { - const message = `Expected: DIV - sub-title "Alabama Standards"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - sub-title "Alabama"; Actual: "${elementText}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: DIV - Alabama Standards sub-title text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Alabama sub-title text font-family matched as expected'); } else { - const message = `Expected: DIV - Alabama Standards sub-title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: DIV - Alabama sub-title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '13px') { - console.log('Passed: DIV - Alabama Standards sub-title text font-size matched as expected'); + console.log('Passed: DIV - Alabama sub-title text font-size matched as expected'); } else { - const message = `Expected: DIV - Alabama Standards sub-title text font-size "13px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: DIV - Alabama sub-title text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Alabama sub-title text color matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama sub-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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -1876,49 +3096,55 @@ const steps = [ } }, - //DIV - Alabama Standards Subject label, text, and font size + //DIV - Alabama Standards Subject label { description: 'Validate DIV - Alabama Standards Subject label text, color, and size', action: async () => { + const multipleChecks = 'DIV - Alabama Standards Subject label'; const element = await driver.findElement(By.css('.form-row:nth-child(2) > .form-group:nth-child(1) > label')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //Get text, font, color, and size + 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 = []; - //Validate text + //text if (elementText === 'Subject') { console.log('Passed: DIV - Alabama Standards Subject label matched as expected'); } else { - const message = `Expected: DIV - "Subject" label; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - "Subject" label; Actual: "${elementText}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: DIV - Alabama Standards Subject label text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Alabama Standards Subject label text font-family matched as expected'); } else { - const message = `Expected: DIV - Alabama Standards Subject label text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: DIV - Alabama Standards Subject label text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '15px') { console.log('Passed: DIV - Alabama Standards Subject label text font-size matched as expected'); } else { - const message = `Expected: DIV - Alabama Standards Subject label text font-size "15px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: DIV - Alabama Standards Subject label text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Alabama Standards Subject label text color matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Standards Subject 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -1931,31 +3157,59 @@ const steps = [ { description: 'Validate DIV - Subject dropdown list and value', action: async () => { - const select = await driver.findElement(By.css('#exsubject')); + const multipleChecks = 'DIV - Subject dropdown'; + const elementDropdown = await driver.findElement(By.css('#exsubject')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); - // Get the selected option text - const selectedOption = await select.findElement(By.css('option:checked')); - const selectedText = await selectedOption.getText(); + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); - if (selectedText === 'Choose a subject') { - console.log('Passed: DIV - Subject Choose a subject default value matched as expected'); + const options = await elementDropdown.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Choose a subject') { + console.log('Passed: DIV - Subject dropdown text matched as expected'); } else { - throw new Error(`Expected DIV - Subject "Choose a subject"; Actual: "${selectedText}"`); + throw new Error(`Expected: DIV - Subject: "Choose a subject"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Subject dropdown font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Subject dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: DIV - Subject dropdown font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Subject dropdown font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Subject dropdown color matched as expected'); + } else { + errors.push(`Expected: DIV - Subject dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); } - const options = await select.findElements(By.css('option')); const expectedList = [ 'Choose a subject', + 'Health and PE', 'Language Arts', 'Mathematics', 'Science', 'Social Studies', - 'World Languages' + 'Technology Education' ]; - const actual = []; - //Track all errors - const errors = []; + const actual = []; for (const opt of options) { const text = (await opt.getText()).trim(); @@ -1965,15 +3219,14 @@ const steps = [ if (JSON.stringify(actual) === JSON.stringify(expectedList)) { console.log('Passed: DIV - Subject Dropdown list matched as expected'); } else { - const message = `Expected: DIV - Subject Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`; - errors.push(message); + errors.push(`Expected: DIV - Subject Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -1982,49 +3235,55 @@ const steps = [ } }, - //DIV - Alabama Standards Format label, text, and font size + //DIV - Alabama Standards Format label { description: 'Validate DIV - Alabama Standards Format label text, color, and size', action: async () => { + const multipleChecks = 'DIV - Alabama Standards Format label'; const element = await driver.findElement(By.css('.form-row:nth-child(2) > .form-group:nth-child(2) > label')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //Get text, font, color, and size + 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 = []; - //Validate text + //text if (elementText === 'Format') { console.log('Passed: DIV - Alabama Standards Format label matched as expected'); } else { - const message = `Expected: DIV - "Format" label; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - "Format" label; Actual: "${elementText}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: DIV - Alabama Standards Format label text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Alabama Standards Format label font-family matched as expected'); } else { - const message = `Expected: DIV - Alabama Standards Format label text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: DIV - Alabama Standards Format label font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '15px') { console.log('Passed: DIV - Alabama Standards Format label text font-size matched as expected'); } else { - const message = `Expected: DIV - Alabama Standards Format label text font-size "15px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: DIV - Alabama Standards Format label text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Alabama Standards Format label text color matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Standards Format 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -2037,25 +3296,55 @@ const steps = [ { description: 'Validate DIV - Format dropdown list and value', action: async () => { - const dropdown = await driver.findElement(By.css('#exformat')); - const dropdownValue = await dropdown.getAttribute('value'); - const options = await dropdown.findElements(By.css('option')); - const expectedList = [ - 'CSV', - 'JSON' - ]; - const actual = []; + const multipleChecks = 'DIV - Format dropdown'; + const elementDropdown = await driver.findElement(By.css('#exformat')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); + + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); //Track all errors const errors = []; - if (dropdownValue === 'csv') { - console.log("Passed: DIV - Format dropdown value matched as expected"); + //text + if (elementText === 'CSV') { + console.log('Passed: DIV - Format dropdown text matched as expected'); } else { - const message = `Expected: DIV - Format dropdown value - "CSV"; Actual: "${dropdownValue}"`; - errors.push(message); + throw new Error(`Expected: DIV - Format: "CSV"; Actual: "${elementText}"`); } + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Format dropdown font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Format dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: DIV - Format dropdown font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Format dropdown font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Format dropdown color matched as expected'); + } else { + errors.push(`Expected: DIV - Format dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const expectedList = [ + 'CSV', + 'JSON' + ]; + + const actual = []; + for (const opt of options) { const text = (await opt.getText()).trim(); actual.push(text); @@ -2064,15 +3353,14 @@ const steps = [ if (JSON.stringify(actual) === JSON.stringify(expectedList)) { console.log('Passed: DIV - Format Dropdown list matched as expected'); } else { - const message = `Expected: DIV - Format Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`; - errors.push(message); + errors.push(`Expected: DIV - Format Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -2081,49 +3369,55 @@ const steps = [ } }, - //DIV - Alabama Standards Grades label, text, and font size + //DIV - Grades label { - description: 'Validate DIV - Alabama Standards Grades label text, color, and size', + description: 'Validate DIV - Grades label text, color, and size', action: async () => { + const multipleChecks = 'DIV - Grades label'; const element = await driver.findElement(By.css('.col-md-12:nth-child(1) > label')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //Get text, font, color, and size + 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 = []; - //Validate text + //text if (elementText === 'Grades') { - console.log('Passed: DIV - Alabama Standards Grades label matched as expected'); + console.log('Passed: DIV - Grades label matched as expected'); } else { - const message = `Expected: DIV - "Grades" label; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - "Grades" label; Actual: "${elementText}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: DIV - Alabama Standards Grades label text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Grades label font-family matched as expected'); } else { - const message = `Expected: DIV - Alabama Standards Grades label text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: DIV - Grades label font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '15px') { - console.log('Passed: DIV - Alabama Standards Grades label text font-size matched as expected'); + console.log('Passed: DIV - Grades label text font-size matched as expected'); } else { - const message = `Expected: DIV - Alabama Standards Grades label text font-size "15px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: DIV - Grades label text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Grades label text color matched as expected'); + } else { + errors.push(`Expected: DIV - Grades 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -2136,24 +3430,53 @@ const steps = [ { description: 'Validate DIV - Grades dropdown list and value', action: async () => { - const dropdown = await driver.findElement(By.css('#exgrades')); - const dropdownValue = await dropdown.getText(); - const options = await dropdown.findElements(By.css('option')); - const expectedList = [ - 'Please select a subject first' - ]; - const actual = []; + const multipleChecks = 'DIV - Grades dropdown'; + const elementDropdown = await driver.findElement(By.css('#exgrades')); + + const elementText = await elementDropdown.getText(); + const elementFont = await elementDropdown.getCssValue('font-family'); + const elementSize = await elementDropdown.getCssValue('font-size'); + const elementColor = await elementDropdown.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); //Track all errors const errors = []; - if (dropdownValue === 'Please select a subject first') { - console.log("Passed: DIV - Grades dropdown value matched as expected"); + //text + if (elementText === 'Please select a subject first') { + console.log('Passed: DIV - Grades dropdown text matched as expected'); } else { - const message = `Expected: DIV - Grades dropdown value - "Please select a subject first"; Actual: "${dropdownValue}"`; - errors.push(message); + throw new Error(`Expected: DIV - Grades: "Please select a subject first"; Actual: "${elementText}"`); } + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Grades dropdown font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Grades dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: DIV - Grades dropdown font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Grades dropdown font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Grades dropdown color matched as expected'); + } else { + errors.push(`Expected: DIV - Grades dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const expectedList = [ + 'Please select a subject first' + ]; + + const actual = []; + for (const opt of options) { const text = (await opt.getText()).trim(); actual.push(text); @@ -2162,15 +3485,14 @@ const steps = [ if (JSON.stringify(actual) === JSON.stringify(expectedList)) { console.log('Passed: DIV - Grades Dropdown list matched as expected'); } else { - const message = `Expected: DIV - Grades Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`; - errors.push(message); + errors.push(`Expected: DIV - Grades Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -2179,49 +3501,71 @@ const steps = [ } }, - //DIV - Download button validation + //DIV - Download button { description: 'Validate DIV - Download button icon, text, and color', action: async () => { - const icon = await driver.findElement(By.css('#exsubmit > .fa')); + const multipleChecks = 'DIV - Download button'; + const elementIcon = await driver.findElement(By.css('#exsubmit > .fa')); const element = await driver.findElement(By.css('#exsubmit')); - //Get text, color, and icon - const elementText = await element.getText(); - const elementColor = await element.getCssValue('background-color'); + //Get text, font, color, and size + 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 elementButtonColor = await element.getCssValue('background-color'); //Track all errors const errors = []; - - //Validate button icon is present - if (icon) { + + //icon + if (elementIcon) { console.log('Passed: DIV - Download button icon is present'); } else { - const message = 'Expected: DIV - Download button icon not found'; - errors.push(message); + errors.push('DIV - Download button icon was not found'); } - //Validate text + //text if (elementText === 'Download') { - console.log('Passed: DIV - Get Download button text matched as expected'); + console.log('Passed: DIV - Download button text matched as expected'); } else { - const message = `Expected: DIV - "Download" button text; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - Button text: "Download"; Actual: "${elementText}"`); } - //Validate color -green - if (elementColor === 'rgba(48, 200, 172, 1)') { - console.log('Passed: DIV - Download button color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Download button text font-family matched as expected'); } else { - const message = `Expected: DIV - Download button color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: DIV - Download button text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '16px') { + console.log('Passed: DIV - Download button text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Download button text font-size "16px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: DIV - Download button text color matched as expected'); + } else { + errors.push(`Expected: DIV - Download button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: DIV - Download button background color matched as expected'); + } else { + errors.push(`Expected: DIV - Download 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -2230,40 +3574,63 @@ const steps = [ } }, - //DIV - Close button validation + //DIV - Close button { - description: 'Validate DIV - Close button icon, text, and color', + description: 'Validate DIV - Close button text, style, font, and color', action: async () => { + const multipleChecks = 'DIV - Close button'; const element = await driver.findElement(By.css('#modalclose')); - //Get text, color, and icon - const elementText = await element.getText(); - const elementColor = await element.getCssValue('background-color'); + //Get text, font, color, and size + 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 elementButtonColor = await element.getCssValue('background-color'); //Track all errors const errors = []; - //Validate text + //text if (elementText === 'Close') { console.log('Passed: DIV - Close button text matched as expected'); } else { - const message = `Expected: DIV - "Close" button text; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - Button text: "Close"; Actual: "${elementText}"`); } - //Validate color -white - if (elementColor === 'rgba(0, 0, 0, 0)') { - console.log('Passed: DIV - Close button color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Close button text font-family matched as expected'); } else { - const message = `Expected: DIV - Close button color "rgba(0, 0, 0, 0)"; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: DIV - Close button text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '16px') { + console.log('Passed: DIV - Close button text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Close button text font-size "16px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Close button text color matched as expected'); + } else { + errors.push(`Expected: DIV - Close button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: DIV - Close button background color matched as expected'); + } else { + errors.push(`Expected: DIV - Close button background color: "rgba(0, 0, 0, 0)"; 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -2272,52 +3639,68 @@ const steps = [ } }, - //NEXT ACTION - Click Download button (validation) + //NEXT ACTION { - description: 'DIV - Click DIV Download button', + description: 'DIV - Click Export button', action: async () => { - console.log('----->| NEXT ACTION: Clicked DIV Download button (validation)'); - await driver.findElement(By.css('#exsubmit > .fa')).click(); - await driver.sleep(2000); + await driver.findElement(By.css('#exsubmit')).click(); + console.log('----->| NEXT ACTION: Clicked Export button'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('#metawarn > b')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Validation text not visible within 20 seconds'); + + console.log('Passed: DIV - Validation message appeared'); } }, - //DIV - Validation, text, color, and size + //DIV - Validation { description: 'Validate DIV - Validation text, color, and size', action: async () => { const element = await driver.findElement(By.css('#metawarn > b')); //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('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 = []; - //Validate text + //text if (elementText === 'A subject and at least one grade must be selected.') { console.log('Passed: DIV - Validation text matched as expected'); } else { - const message = `Expected: DIV - validation text "A subject and at least one grade must be selected."; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - Validation text: "A subject and at least one grade must be selected."; Actual: "${elementText}"`); } - //Validate color -red - if (elementColor === 'rgba(220, 53, 69, 1)') { - console.log('Passed: DIV - Validation text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Validation text font-family matched as expected'); } else { - const message = `Expected: DIV - Validation text color "rgba(220, 53, 69, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: DIV - Validation text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '13px') { console.log('Passed: DIV - Validation text font-size matched as expected'); } else { - const message = `Expected: DIV - Validation text font-size "13px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: DIV - Validation text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(220, 53, 69, 1)') { + console.log('Passed: DIV - Validation text color matched as expected'); + } else { + errors.push(`Expected: DIV - Validation text color: "rgba(220, 53, 69, 1)"; Actual: "${elementColor}"`); } //Throw summary if any validation failed @@ -2333,15 +3716,15 @@ const steps = [ } }, - //NEXT ACTION - Export Standards DIV - Select subject and grade + //NEXT ACTION { - description: 'Validate Export Standards DIV - Select subject and grade', + description: 'Select subject and grade', action: async () => { //Select "Mathematics" from dropdown - console.log('----->| NEXT ACTION: Selected Subject = Mathematics'); await driver.findElement(By.css('#exsubject')).click(); await driver.sleep(2000); - await driver.findElement(By.css('#exsubject > option:nth-child(3)')).click(); + await driver.findElement(By.css('#exsubject > option:nth-child(4)')).click(); + console.log('----->| NEXT ACTION: Selected Subject - Mathematics'); //Wait for the X clear icon (Select2 uses this class) const clearGradesIcon = await driver.wait( @@ -2356,117 +3739,70 @@ const steps = [ ); //Click to clear grades - console.log('----->| NEXT ACTION: Clicked X clear icon'); await clearGradesIcon.click(); - await driver.sleep(2000); + await driver.sleep(1000); + console.log('----->| NEXT ACTION: Clicked Grades X clear icon'); - console.log('----->| NEXT ACTION: Selected grades: 9, 10, 11, and 12'); await driver.findElement(By.xpath("//li[contains(text(), '9')]")).click(); - await driver.sleep(2000); + await driver.sleep(1000); await driver.findElement(By.xpath("//li[contains(text(), '10')]")).click(); - await driver.sleep(2000); + await driver.sleep(1000); await driver.findElement(By.xpath("//li[contains(text(), '11')]")).click(); - await driver.sleep(2000); + await driver.sleep(1000); await driver.findElement(By.xpath("//li[contains(text(), '12')]")).click(); - await driver.sleep(2000); + await driver.sleep(1000); //Click away from dropdown list await driver.findElement(By.css('#exform > div:nth-child(3) > div > span')).click(); - await driver.sleep(2000); + await driver.sleep(1000); - /*Click Download button - console.log('----->| NEXT ACTION: Clicked Download button'); - await driver.findElement(By.css('#exsubmit')).click(); - await driver.sleep(5000);*/ - /*}, + console.log('----->| NEXT ACTION: Selected grades: 9, 10, 11, and 12'); + }, }, - //NEXT ACTION - Click Close button + //DIV - Grade 9 { - description: 'DIV - Click DIV Close button', + description: 'Validate DIV - Grade 9', action: async () => { - console.log('----->| NEXT ACTION: Clicked DIV Close button'); - await driver.findElement(By.css('#modalclose')).click(); - await driver.sleep(2000); - } - }, + const multipleChecks = 'DIV - Grade 9'; + const elementIconToolTip = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(1) > button')).getAttribute('title'); + const element = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(1)')); - //NEXT ACTION - Click Arizona More Info icon - { - description: 'DIV - Click Arizona More Info icon', - action: async () => { - console.log('----->| NEXT ACTION: Clicked Arizona More Info icon'); - await driver.findElement(By.css('#stdbody > tr:nth-child(2) > .text-center:nth-child(4) img')).click(); - await driver.sleep(2000); - } - }, - - //Wait for element - { - description: 'Wait for DIV to be visible', - action: async () => { - - //Wait until the element exists in the DOM - const elementVisible = await driver.wait( - until.elementLocated(By.css('.modal-lg .modal-title')), - 20000 - ); - - //Wait until it becomes visible - await driver.wait( - until.elementIsVisible(elementVisible), - 20000 - ); - await driver.sleep(2000); - } - }, - - //DIV - More Info title, text, and font size - { - description: 'Validate DIV - More Info title text, color, and size', - action: async () => { - const element = await driver.findElement(By.css('.modal-lg .modal-title')); - - //Get text, color, and size const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); - const elementSize = await element.getCssValue('font-size'); + const elementToolTip = await element.getAttribute('title'); //Track all errors const errors = []; - //Validate text - if (elementText === `Arizona's College and Career Ready Standards`) { - console.log(`Passed: DIV - Arizona's College and Career Ready Standards title matched as expected`); + //icon tool-tip + if (elementIconToolTip === 'Remove item') { + console.log('Passed: DIV - Grade 9 icon tool-tip text matched as expected'); } else { - const message = `Expected: DIV - "Arizona's College and Career Ready Standards"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - Grade 9 icon tool-tip text: "Remove item"; Actual: "${elementIconToolTip}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log(`Passed: DIV - Arizona's College and Career Ready Standards title text color matched as expected`); + //text + if (elementText.includes('9')) { + console.log('Passed: DIV - Grades selection included "9" text matched as expected'); } else { - const message = `Expected: DIV - Arizona's College and Career Ready Standards title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + throw new Error(`Expected: DIV - Grades selection: "9"; Actual: "${elementText}"`); } - //Validate font size - if (elementSize === '18px') { - console.log(`Passed: DIV - Arizona's College and Career Ready Standards title text font-size matched as expected`); + //tool-tip + if (elementToolTip === '9') { + console.log('Passed: DIV - Grade 9 tool-tip text matched as expected'); } else { - const message = `Expected: DIV - Arizona's College and Career Ready Standards title text font-size "18px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: DIV - Grade 9 tool-tip text: "9"; Actual: "${elementToolTip}"`); } - //Throw summary if any validation failed + //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -2475,49 +3811,389 @@ const steps = [ } }, - //DIV - More Info Arizona sub-text, and font size + //DIV - Grade 10 { - description: 'Validate DIV - More Info Arizona sub-text, color, and size', + description: 'Validate DIV - Grade 10', action: async () => { - const element = await driver.findElement(By.css('.modal-body > .notenabled')); + const multipleChecks = 'DIV - Grade 10'; + const elementIconToolTip = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(2) > button')).getAttribute('title'); + const element = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(2)')); - //Get text, color, and size const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); - const elementSize = await element.getCssValue('font-size'); + const elementToolTip = await element.getAttribute('title'); //Track all errors const errors = []; - //Validate text + //icon tool-tip + if (elementIconToolTip === 'Remove item') { + console.log('Passed: DIV - Grade 10 icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 10 icon tool-tip text: "Remove item"; Actual: "${elementIconToolTip}"`); + } + + //text + if (elementText.includes('10')) { + console.log('Passed: DIV - Grades selection included "10" text matched as expected'); + } else { + throw new Error(`Expected: DIV - Grades selection: "10"; Actual: "${elementText}"`); + } + + //tool-tip + if (elementToolTip === '10') { + console.log('Passed: DIV - Grade 10 tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 10 tool-tip text: "9"; Actual: "${elementToolTip}"`); + } + + //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')); + } + } + }, + + //DIV - Grade 11 + { + description: 'Validate DIV - Grade 11', + action: async () => { + const multipleChecks = 'DIV - Grade 11'; + const elementIconToolTip = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(3) > button')).getAttribute('title'); + const element = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(3)')); + + const elementText = await element.getText(); + const elementToolTip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon tool-tip + if (elementIconToolTip === 'Remove item') { + console.log('Passed: DIV - Grade 11 icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 11 icon tool-tip text: "Remove item"; Actual: "${elementIconToolTip}"`); + } + + //text + if (elementText.includes('11')) { + console.log('Passed: DIV - Grades selection included "11" text matched as expected'); + } else { + throw new Error(`Expected: DIV - Grades selection: "11"; Actual: "${elementText}"`); + } + + //tool-tip + if (elementToolTip === '11') { + console.log('Passed: DIV - Grade 11 tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 11 tool-tip text: "9"; Actual: "${elementToolTip}"`); + } + + //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')); + } + } + }, + + //DIV - Grade 12 + { + description: 'Validate DIV - Grade 12', + action: async () => { + const multipleChecks = 'DIV - Grade 12'; + const elementIconToolTip = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(4) > button')).getAttribute('title'); + const element = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(4)')); + + const elementText = await element.getText(); + const elementToolTip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon tool-tip + if (elementIconToolTip === 'Remove item') { + console.log('Passed: DIV - Grade 12 icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 12 icon tool-tip text: "Remove item"; Actual: "${elementIconToolTip}"`); + } + + //text + if (elementText.includes('12')) { + console.log('Passed: DIV - Grades selection included "12" text matched as expected'); + } else { + throw new Error(`Expected: DIV - Grades selection: "12"; Actual: "${elementText}"`); + } + + //tool-tip + if (elementToolTip === '12') { + console.log('Passed: DIV - Grade 12 tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 12 tool-tip text: "9"; Actual: "${elementToolTip}"`); + } + + //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: 'DIV - Click Export button then Close DIV', + action: async () => { + const multipleChecks = 'DIV - Processing status'; + + const errors = []; + + //Capture styles immediately via executeScript BEFORE clicking + //This sets up a MutationObserver to catch the spinner the moment it appears + await driver.executeScript(` + window._spinnerStyles = null; + const observer = new MutationObserver(() => { + const el = document.querySelector('#modalspin strong'); + if (el) { + const style = window.getComputedStyle(el); + const spinDiv = document.querySelector('#modalspin'); + const spinStyle = window.getComputedStyle(spinDiv); + if (spinStyle.display !== 'none') { + window._spinnerStyles = { + text: el.textContent.trim(), + fontFamily: style.getPropertyValue('font-family'), + fontSize: style.getPropertyValue('font-size'), + color: style.getPropertyValue('color') + }; + observer.disconnect(); + } + } + }); + observer.observe(document.querySelector('#modalspin'), { + attributes: true, + attributeFilter: ['style'] + }); + `); + + //Now click Export + await driver.findElement(By.css('#exsubmit')).click(); + console.log('----->| NEXT ACTION: Clicked Export button'); + + //Wait for MutationObserver to capture the styles + await driver.wait(async () => { + const captured = await driver.executeScript(`return window._spinnerStyles !== null;`); + return captured; + }, 15000, 'Processing spinner styles were not captured within 15 seconds'); + + //Get the captured styles + const styles = await driver.executeScript(`return window._spinnerStyles;`); + //console.log('----->| DEBUG captured styles:', JSON.stringify(styles)); + + //text + if (styles.text === 'Processing...') { + console.log('Passed: DIV - Status text matched as expected'); + } else { + errors.push(`Expected: DIV - Status text: "Processing..."; Actual: "${styles.text}"`); + } + + //font + if (styles.fontFamily === 'Poppins, sans-serif') { + console.log('Passed: DIV - Processing... status text font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Processing... status text font-family "Poppins, sans-serif"; Actual: "${styles.fontFamily}"`); + } + + //size + if (styles.fontSize === '23.4px') { + console.log('Passed: DIV - Processing... status text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Processing... status text font-size "23.4px"; Actual: "${styles.fontSize}"`); + } + + //color + if (styles.color === 'rgb(40, 39, 90)') { + console.log('Passed: DIV - Processing... status text color matched as expected'); + } else { + errors.push(`Expected: DIV - Processing... status text color "rgb(40, 39, 90)"; Actual: "${styles.color}"`); + } + + //Wait until processing is complete + await driver.wait(async () => { + try { + const spinDiv = await driver.findElement(By.css('#modalspin')); + return !(await spinDiv.isDisplayed()); + } catch (e) { + return true; + } + }, 30000, 'Processing... Status did not disappear within 30 seconds'); + console.log('Passed: Processing... Status is no longer visible as expected'); + + await driver.findElement(By.css('#modalclose')).click(); + console.log('----->| NEXT ACTION: Clicked Close button'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 20000, 'ExACT Dashboard did not fully load within 60 seconds'); + console.log('Passed: ExACT Dashboard 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')); + } + } + }, + + //NEXT ACTION + { + description: 'Dashboard - Click Alabama More Info icon', + action: async () => { + await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(4) img')).click(); + console.log('----->| NEXT ACTION: Clicked Alabama More Info icon'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Modal did not become visible within 20 seconds'); + + console.log('Passed: DIV - Loaded successfully'); + } + }, + + //Alabama Courses of Study DIV + //DIV - Alabama Courses of Study title + { + description: 'Validate DIV - Alabama Courses of Study title text, color, and size', + action: async () => { + const multipleChecks = 'DIV - Alabama Courses of Study title'; + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + + //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 === 'Alabama Courses of Study') { + console.log('Passed: DIV - Alabama Courses of Study title matched as expected'); + } else { + errors.push(`Expected: DIV - "Alabama Courses of Study"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Alabama Courses of Study title font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Courses of Study title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '18px') { + console.log('Passed: DIV - Alabama Courses of Study title text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Courses of Study title text font-size "18px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Alabama Courses of Study title text color matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Courses of Study 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')); + } + } + }, + + //DIV - More Info Alabama sub-text + { + description: 'Validate DIV - More Info Alabma sub-text, color, and size', + action: async () => { + const multipleChecks = 'DIV - Alabama sut-text'; + const element = await driver.findElement(By.css('.modal-body > .notenabled')); + + //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 === '*Not enabled in Profile. If you would like access to any of these standards sets, please Contact Us.') { console.log('Passed: DIV - More Info Arizona sub-text matched as expected'); } else { - const message = `Expected: DIV - sub-text "*Not enabled in Profile. If you would like access to any of these standards sets, please Contact Us."; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - sub-text "*Not enabled in Profile. If you would like access to any of these standards sets, please Contact Us."; Actual: "${elementText}"`); } - //Validate color -gray - if (elementColor === 'rgba(119, 119, 119, 1)') { - console.log('Passed: DIV - More Info Arizona sub-text color matched as expected'); + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - More Info Arizona sub-text font-family matched as expected'); } else { - const message = `Expected: DIV - More Info Arizona sub-text text color "rgba(119, 119, 119, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: DIV - More Info Arizona sub-text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '11.7px') { console.log('Passed: DIV - More Info Arizona sub-text text font-size matched as expected'); } else { - const message = `Expected: DIV - More Info Arizona sub-text text font-size "11.7px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: DIV - More Info Arizona sub-text text font-size "11.7px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(119, 119, 119, 1)') { + console.log('Passed: DIV - More Info Arizona sub-text color matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona sub-text text color "rgba(119, 119, 119, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -2526,49 +4202,63 @@ const steps = [ } }, - //DIV - More Info Arizona Contact Us link text, and font size + //DIV - More Info Alabama Contact Us link { - description: 'Validate DIV - More Info Arizona Contact Us link text, color, and size', + description: 'Validate DIV - More Info Alabama Contact Us link text, color, and size', action: async () => { + const multipleChecks = 'DIV - Alabama Courses of Study Contact Us link'; const element = await driver.findElement(By.linkText('Contact Us')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //Get text, font, size, color, url + 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 elementURL = await element.getAttribute('href'); //Track all errors const errors = []; - //Validate text + //text if (elementText === 'Contact Us') { - console.log('Passed: DIV - More Info Arizona sub-text matched as expected'); + console.log('Passed: DIV - More Info Alabama sub-text matched as expected'); } else { - const message = `Expected: DIV - More Info Arizona sub-text "Contact Us"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - More Info Alabama sub-text "Contact Us"; Actual: "${elementText}"`); } - //Validate color -light green - if (elementColor === 'rgba(48, 200, 172, 1)') { - console.log('Passed: DIV - More Info Arizona Contact Us link text color matched as expected'); + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: DIV - More Info Alabama sub-text font-family matched as expected'); } else { - const message = `Expected: DIV - More Info Arizona Contact Us link text color "rgba(48, 200, 172, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: DIV - More Info Alabama sub-text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '11.7px') { - console.log('Passed: DIV - More Info Arizona Contact Us link text font-size matched as expected'); + console.log('Passed: DIV - More Info Alabama Contact Us link text font-size matched as expected'); } else { - const message = `Expected: DIV - More Info Arizona Contact Us link text font-size "11.7px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: DIV - More Info Alabama Contact Us link text font-size "11.7px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: DIV - More Info Alabama Contact Us link text color matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Alabama Contact Us link text color "rgba(48, 200, 172, 1)"'; Actual: "${elementColor}"`); + } + + //url + if (elementURL === 'https://edgate.com/contact-us') { + console.log('Passed: DIV - More Info Alabama Contact Us URL link matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Alabama Contact Us URL: "https://edgate.com/contact-us"; Actual: "${elementURL}"`); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -2577,49 +4267,55 @@ const steps = [ } }, - //DIV - More Info Arizona Subject column title text, and font size + //DIV - More Info Alabama Subject column title { - description: 'Validate DIV - More Info Arizona Subject column title text, color, and size', + description: 'Validate DIV - More Info Alabama Subject column title text, color, and size', action: async () => { + const multipleChecks = 'DIV - Alabama Courses of Study column title'; const element = await driver.findElement(By.css('#myModal > div > div > div.modal-body > table > thead > tr > th:nth-child(1)')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //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 = []; - //Validate text + //text if (elementText === 'Subject') { console.log('Passed: DIV - More Info Arizona Subject column title text matched as expected'); } else { - const message = `Expected: DIV - Arizona column title "Subject"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - Arizona column title "Subject"; Actual: "${elementText}"`); } - //Validate color -gray - if (elementColor === 'rgba(94, 105, 116, 1)') { - console.log('Passed: DIV - More Info Arizona Subject column title text color matched as expected'); + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: DIV - More Info Arizona Subject column title font-family matched as expected'); } else { - const message = `Expected: DIV - More Info Arizona Subject column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: DIV - More Info Arizona Subject column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '14px') { console.log('Passed: DIV - More Info Arizona Subject column title text font-size matched as expected'); } else { - const message = `Expected: DIV - More Info Arizona Subject column title text font-size "14px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: DIV - More Info Arizona Subject column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: DIV - More Info Arizona Subject column title text color matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona Subject column title text color "rgba(94, 105, 116, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -2628,49 +4324,55 @@ const steps = [ } }, - //DIV - More Info Arizona Adopted column title text, and font size + //DIV - More Info Alabama Adopted column title { - description: 'Validate DIV - More Info Arizona Adopted column title text, color, and size', + description: 'Validate DIV - More Info Alabama Adopted column title text, color, and size', action: async () => { + const multipleChecks = 'DIV - Alabama Courses of Study Adopted column title'; const element = await driver.findElement(By.css('#myModal > div > div > div.modal-body > table > thead > tr > th:nth-child(2)')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //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 = []; - //Validate text + //text if (elementText === 'Adopted') { console.log('Passed: DIV - More Info Arizona Adopted column title text matched as expected'); } else { - const message = `Expected: DIV - Arizona column title "Adopted"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - Arizona column title "Adopted"; Actual: "${elementText}"`); } - //Validate color -gray - if (elementColor === 'rgba(94, 105, 116, 1)') { - console.log('Passed: DIV - More Info Arizona Adopted column title text color matched as expected'); + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: DIV - More Info Arizona Adopted column title font-family matched as expected'); } else { - const message = `Expected: DIV - More Info Arizona Adopted column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: DIV - More Info Arizona Adopted column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '14px') { console.log('Passed: DIV - More Info Arizona Adopted column title text font-size matched as expected'); } else { - const message = `Expected: DIV - More Info Arizona Adopted column title text font-size "14px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: DIV - More Info Arizona Adopted column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: DIV - More Info Arizona Adopted column title text color matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona Adopted column title text color "rgba(94, 105, 116, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -2679,49 +4381,55 @@ const steps = [ } }, - //DIV - More Info Arizona Grades column title text, and font size + //DIV - More Info Alabama Grades column title { - description: 'Validate DIV - More Info Arizona Grades column title text, color, and size', + description: 'Validate DIV - More Info Alabama Grades column title text, color, and size', action: async () => { + const multipleChecks = 'DIV - Alabama Courses of Study Grades column title'; const element = await driver.findElement(By.css('#myModal > div > div > div.modal-body > table > thead > tr > th:nth-child(3)')); - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + //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 = []; - //Validate text + //text if (elementText === 'Grades') { console.log('Passed: DIV - More Info Arizona Grades column title text matched as expected'); } else { - const message = `Expected: DIV - Arizona column title "Grades"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: DIV - Arizona column title "Grades"; Actual: "${elementText}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(94, 105, 116, 1)') { - console.log('Passed: DIV - More Info Arizona Grades column title text color matched as expected'); + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: DIV - More Info Arizona Grades column title font-family matched as expected'); } else { - const message = `Expected: DIV - More Info Arizona Grades column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: DIV - More Info Arizona Grades column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '14px') { console.log('Passed: DIV - More Info Arizona Grades column title text font-size matched as expected'); } else { - const message = `Expected: DIV - More Info Arizona Grades column title text font-size "14px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: DIV - More Info Arizona Grades column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: DIV - More Info Arizona Grades column title text color matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona Grades column title text color "rgba(94, 105, 116, 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('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -2730,49 +4438,44 @@ const steps = [ } }, - //DIV - More Info Arizona Row 1 label text, color, and font size + //DIV - More Info Alabama Row 1 label { - description: 'Validate DIV - More Info Arizona Row 1 label text, color, and font size', + description: 'Validate DIV - More Info Alabama Row 1 label text, font, color, and size', action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 1 label'; const checks = [ //Subject { selector: '.text-success:nth-child(1) > td:nth-child(1)', - label: 'Language Arts', + label: 'Health and PE', expected: { - text: 'Language Arts', + text: 'Health and PE', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } }, + //Adopted { selector: '.text-success:nth-child(1) > td:nth-child(2)', - label: '2010, Reading 2003 / Writing 2004', + label: '2019', expected: { - text: '2010, Reading 2003 / Writing 2004', + text: '2019', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } }, - //Grades - //Pre K* (special color) - { - selector: '.text-success:nth-child(1) .notenabled', - label: 'Pre K*', - expected: { - text: 'Pre K*', - color: 'rgba(119, 119, 119, 1)', - size: '12.87px' - } - }, + //All Grades list { selector: '.text-success:nth-child(1) > td:nth-child(3)', label: 'Grades List', expected: { - text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } @@ -2785,30 +4488,38 @@ const steps = [ const element = await driver.findElement(By.css(selector)); const actualText = await element.getText(); - const actualColor = await element.getCssValue('color'); + const actualFont = await element.getCssValue('font-family'); const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); const errors = []; - //Text + //text if (actualText === expected.text) { - console.log(`Passed: DIV - More Info Arizona Row 1 ${label} label text matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 1 ${label} label text matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 1 "${expected.text}"; Actual: "${actualText}"`); + errors.push(`Expected: DIV - More Info Alabama Row 1 "${expected.text}"; Actual: "${actualText}"`); } - //Color - if (actualColor === expected.color) { - console.log(`Passed: DIV - More Info Arizona Row 1 ${label} label text color matched as expected`); + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 1 ${label} label text font-family matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 1 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + errors.push(`Expected: DIV - More Info Alabama Row 1 "${expected.font}"; Actual: "${actualFont}"`); } - //Font-size + //size if (actualSize === expected.size) { - console.log(`Passed: DIV - More Info Arizona Row 1 ${label} label text font-size matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 1 ${label} label text font-size matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 1 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + errors.push(`Expected: DIV - More Info Alabama Row 1 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 1 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 1 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); } return errors; @@ -2820,55 +4531,50 @@ const steps = [ } if (allErrors.length > 0) { - if (allErrors.length > 1) allErrors.unshift('Multiple validation checks did not pass'); + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); throw new Error(allErrors.join('\n')); } } }, - //DIV - More Info Arizona Row 2 label text, color, and font size + //DIV - More Info Alabama Row 2 label { - description: 'Validate DIV - More Info Arizona Row 2 label text, color, and font size', + description: 'Validate DIV - More Info Alabama Row 2 label text, font, color, and size', action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 2 label'; const checks = [ //Subject { selector: '.text-success:nth-child(2) > td:nth-child(1)', - label: 'Mathematics', + label: 'Language Arts', expected: { - text: 'Mathematics', + text: 'Language Arts', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } }, + //Adopted { selector: '.text-success:nth-child(2) > td:nth-child(2)', - label: '2008, 2010', + label: '2021/Effective 2022', expected: { - text: '2008, 2010', + text: '2021/Effective 2022', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } }, - //Grades - //Pre K* (special color) - { - selector: '.text-success:nth-child(2) .notenabled', - label: 'Pre K*', - expected: { - text: 'Pre K*', - color: 'rgba(119, 119, 119, 1)', - size: '12.87px' - } - }, + //All Grades list { selector: '.text-success:nth-child(2) > td:nth-child(3)', label: 'Grades List', expected: { - text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } @@ -2881,30 +4587,38 @@ const steps = [ const element = await driver.findElement(By.css(selector)); const actualText = await element.getText(); - const actualColor = await element.getCssValue('color'); + const actualFont = await element.getCssValue('font-family'); const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); const errors = []; - //Text + //text if (actualText === expected.text) { - console.log(`Passed: DIV - More Info Arizona Row 2 ${label} label text matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 2 ${label} label text matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 2 "${expected.text}"; Actual: "${actualText}"`); + errors.push(`Expected: DIV - More Info Alabama Row 2 "${expected.text}"; Actual: "${actualText}"`); } - //Color - if (actualColor === expected.color) { - console.log(`Passed: DIV - More Info Arizona Row 2 ${label} label text color matched as expected`); + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 2 ${label} label text font matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 2 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + errors.push(`Expected: DIV - More Info Alabama Row 2 "${expected.font}"; Actual: "${actualFont}"`); } - //Font-size + //size if (actualSize === expected.size) { - console.log(`Passed: DIV - More Info Arizona Row 2 ${label} label text font-size matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 2 ${label} label text font-size matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 2 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + errors.push(`Expected: DIV - More Info Alabama Row 2 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 2 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 2 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); } return errors; @@ -2916,55 +4630,50 @@ const steps = [ } if (allErrors.length > 0) { - if (allErrors.length > 1) allErrors.unshift('Multiple validation checks did not pass'); + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); throw new Error(allErrors.join('\n')); } } }, - //DIV - More Info Arizona Row 3 label text, color, and font size + //DIV - More Info Alabama Row 3 label { - description: 'Validate DIV - More Info Arizona Row 3 label text, color, and font size', + description: 'Validate DIV - More Info Alabama Row 3 label text, color, and font size', action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 3 label'; const checks = [ //Subject { selector: '.text-success:nth-child(3) > td:nth-child(1)', - label: 'Science', + label: 'Mathematics', expected: { - text: 'Science', + text: 'Mathematics', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } }, + //Adopted { selector: '.text-success:nth-child(3) > td:nth-child(2)', - label: '2004 / Updated 2005', + label: '2019/Impl. 2020', expected: { - text: '2004 / Updated 2005', + text: '2019/Impl. 2020', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } }, - //Grades - //Pre K* (special color) - { - selector: '.text-success:nth-child(3) .notenabled', - label: 'Pre K*', - expected: { - text: 'Pre K*', - color: 'rgba(119, 119, 119, 1)', - size: '12.87px' - } - }, + //All Grades list { selector: '.text-success:nth-child(3) > td:nth-child(3)', label: 'Grades List', expected: { - text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } @@ -2977,30 +4686,38 @@ const steps = [ const element = await driver.findElement(By.css(selector)); const actualText = await element.getText(); - const actualColor = await element.getCssValue('color'); + const actualFont = await element.getCssValue('font-family'); const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); const errors = []; - //Text + //text if (actualText === expected.text) { - console.log(`Passed: DIV - More Info Arizona Row 3 ${label} label text matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 3 ${label} label text matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 3 "${expected.text}"; Actual: "${actualText}"`); + errors.push(`Expected: DIV - More Info Alabama Row 3 "${expected.text}"; Actual: "${actualText}"`); } - //Color - if (actualColor === expected.color) { - console.log(`Passed: DIV - More Info Arizona Row 3 ${label} label text color matched as expected`); + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 3 ${label} label text font matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 3 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + errors.push(`Expected: DIV - More Info Alabama Row 3 "${expected.font}"; Actual: "${actualFont}"`); } - //Font-size + //size if (actualSize === expected.size) { - console.log(`Passed: DIV - More Info Arizona Row 3 ${label} label text font-size matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 3 ${label} label text font-size matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 3 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + errors.push(`Expected: DIV - More Info Alabama Row 3 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 3 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 3 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); } return errors; @@ -3012,55 +4729,50 @@ const steps = [ } if (allErrors.length > 0) { - if (allErrors.length > 1) allErrors.unshift('Multiple validation checks did not pass'); + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); throw new Error(allErrors.join('\n')); } } }, - //DIV - More Info Arizona Row 4 label text, color, and font size + //DIV - More Info Alabama Row 4 label { - description: 'Validate DIV - More Info Arizona Row 4 label text, color, and font size', + description: 'Validate DIV - More Info Alabama Row 4 label text, color, and font size', action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 4 label'; const checks = [ //Subject { selector: '.text-success:nth-child(4) > td:nth-child(1)', - label: 'Social Studies', + label: 'Science', expected: { - text: 'Social Studies', + text: 'Science', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } }, + //Adopted { selector: '.text-success:nth-child(4) > td:nth-child(2)', - label: '2005 / Updated 2006', + label: '2023', expected: { - text: '2005 / Updated 2006', + text: '2023', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } }, - //Grades - //Pre K* (special color) - { - selector: '.text-success:nth-child(4) .notenabled', - label: 'Pre K*', - expected: { - text: 'Pre K*', - color: 'rgba(119, 119, 119, 1)', - size: '12.87px' - } - }, + //All Grades list { selector: '.text-success:nth-child(4) > td:nth-child(3)', label: 'Grades List', expected: { - text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } @@ -3073,30 +4785,38 @@ const steps = [ const element = await driver.findElement(By.css(selector)); const actualText = await element.getText(); - const actualColor = await element.getCssValue('color'); + const actualFont = await element.getCssValue('font-family'); const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); const errors = []; - //Text + //text if (actualText === expected.text) { - console.log(`Passed: DIV - More Info Arizona Row 4 ${label} label text matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 4 ${label} label text matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 4 "${expected.text}"; Actual: "${actualText}"`); + errors.push(`Expected: DIV - More Info Alabama Row 4 "${expected.text}"; Actual: "${actualText}"`); } - //Color - if (actualColor === expected.color) { - console.log(`Passed: DIV - More Info Arizona Row 4 ${label} label text color matched as expected`); + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 4 ${label} label text font matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 4 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + errors.push(`Expected: DIV - More Info Alabama Row 4 "${expected.font}"; Actual: "${actualFont}"`); } - //Font-size + //size if (actualSize === expected.size) { - console.log(`Passed: DIV - More Info Arizona Row 4 ${label} label text font-size matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 4 ${label} label text font-size matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 4 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + errors.push(`Expected: DIV - More Info Alabama Row 4 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 4 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 4 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); } return errors; @@ -3108,55 +4828,50 @@ const steps = [ } if (allErrors.length > 0) { - if (allErrors.length > 1) allErrors.unshift('Multiple validation checks did not pass'); + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); throw new Error(allErrors.join('\n')); } } }, - //DIV - More Info Arizona Row 5 label text, color, and font size + //DIV - More Info Alabama Row 5 label { - description: 'Validate DIV - More Info Arizona Row 5 label text, color, and font size', + description: 'Validate DIV - More Info Alabama Row 5 label text, color, and font size', action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 5 label'; const checks = [ //Subject { selector: '.text-success:nth-child(5) > td:nth-child(1)', - label: 'World Languages', + label: 'Social Studies', expected: { - text: 'World Languages', + text: 'Social Studies', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } }, + //Adopted { selector: '.text-success:nth-child(5) > td:nth-child(2)', - label: '1997', + label: '2024', expected: { - text: '1997', + text: '2024', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } }, - //Grades - //Pre K* (special color) - { - selector: '.text-success:nth-child(5) .notenabled', - label: 'Pre K*', - expected: { - text: 'Pre K*', - color: 'rgba(119, 119, 119, 1)', - size: '12.87px' - } - }, + //All Grades list { selector: '.text-success:nth-child(5) > td:nth-child(3)', label: 'Grades List', expected: { - text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', color: 'rgba(40, 167, 69, 1)', size: '14.3px' } @@ -3169,30 +4884,38 @@ const steps = [ const element = await driver.findElement(By.css(selector)); const actualText = await element.getText(); - const actualColor = await element.getCssValue('color'); + const actualFont = await element.getCssValue('font-family'); const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); const errors = []; - //Text + //text if (actualText === expected.text) { - console.log(`Passed: DIV - More Info Arizona Row 5 ${label} label text matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 5 ${label} label text matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 5 "${expected.text}"; Actual: "${actualText}"`); + errors.push(`Expected: DIV - More Info Alabama Row 5 "${expected.text}"; Actual: "${actualText}"`); } - //Color - if (actualColor === expected.color) { - console.log(`Passed: DIV - More Info Arizona Row 5 ${label} label text color matched as expected`); + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 5 ${label} label text font matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 5 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + errors.push(`Expected: DIV - More Info Alabama Row 5 "${expected.font}"; Actual: "${actualFont}"`); } - //Font-size + //size if (actualSize === expected.size) { - console.log(`Passed: DIV - More Info Arizona Row 5 ${label} label text font-size matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 5 ${label} label text font-size matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 5 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + errors.push(`Expected: DIV - More Info Alabama Row 5 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 5 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 5 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); } return errors; @@ -3204,57 +4927,52 @@ const steps = [ } if (allErrors.length > 0) { - if (allErrors.length > 1) allErrors.unshift('Multiple validation checks did not pass'); + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); throw new Error(allErrors.join('\n')); } } }, - //DIV - More Info Arizona Row 6 label text, color, and font size + //DIV - More Info Alabama Row 6 label { - description: 'Validate DIV - More Info Arizona Row 6 label text, color, and font size', + description: 'Validate DIV - More Info Alabama Row 6 label text, color, and font size', action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 6 label'; const checks = [ //Subject { - selector: '.notenabled:nth-child(6) > td:nth-child(1)', - label: 'Arts Education*', + selector: '.text-success:nth-child(6) > td:nth-child(1)', + label: 'Technology Education', expected: { - text: 'Arts Education*', - color: 'rgba(119, 119, 119, 1)', - size: '12.87px' + text: 'Technology Education', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' } }, + //Adopted { - selector: '.notenabled:nth-child(6) > td:nth-child(2)', - label: '2006', + selector: '.text-success:nth-child(6) > td:nth-child(2)', + label: '2025', expected: { - text: '2006', - color: 'rgba(119, 119, 119, 1)', - size: '12.87px' - } - }, - //Grades - //Pre K* - { - selector: '.notenabled:nth-child(6) .notenabled', - label: 'Pre K*', - expected: { - text: 'Pre K*', - color: 'rgba(119, 119, 119, 1)', - size: '11.583px' + text: '2025', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' } }, + //All Grades list { - selector: '.notenabled:nth-child(6) > td:nth-child(3)', + selector: '.text-success:nth-child(6) > td:nth-child(3)', label: 'Grades List', expected: { - text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', - color: 'rgba(119, 119, 119, 1)', - size: '12.87px' + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' } } ]; @@ -3265,30 +4983,38 @@ const steps = [ const element = await driver.findElement(By.css(selector)); const actualText = await element.getText(); - const actualColor = await element.getCssValue('color'); + const actualFont = await element.getCssValue('font-family'); const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); const errors = []; - //Text + //text if (actualText === expected.text) { - console.log(`Passed: DIV - More Info Arizona Row 6 ${label} label text matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 6 ${label} label text matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 6 "${expected.text}"; Actual: "${actualText}"`); + errors.push(`Expected: DIV - More Info Alabama Row 6 "${expected.text}"; Actual: "${actualText}"`); } - //Color - if (actualColor === expected.color) { - console.log(`Passed: DIV - More Info Arizona Row 6 ${label} label text color matched as expected`); + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 6 ${label} label text font matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 6 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + errors.push(`Expected: DIV - More Info Alabama Row 6 "${expected.font}"; Actual: "${actualFont}"`); } - //Font-size + //size if (actualSize === expected.size) { - console.log(`Passed: DIV - More Info Arizona Row 6 ${label} label text font-size matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 6 ${label} label text font-size matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 6 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + errors.push(`Expected: DIV - More Info Alabama Row 6 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 6 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 6 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); } return errors; @@ -3300,46 +5026,52 @@ const steps = [ } if (allErrors.length > 0) { - if (allErrors.length > 1) allErrors.unshift('Multiple validation checks did not pass'); + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); throw new Error(allErrors.join('\n')); } } }, - //DIV - More Info Arizona Row 7 label text, color, and font size + //DIV - More Info Alabama Row 7 label { - description: 'Validate DIV - More Info Arizona Row 7 label text, color, and font size', + description: 'Validate DIV - More Info Alabama Row 7 label text, color, and font size', action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 7 label'; const checks = [ //Subject { selector: '.notenabled:nth-child(7) > td:nth-child(1)', - label: 'Early Childhood Education*', + label: 'Arts Education*', expected: { - text: 'Early Childhood Education*', + text: 'Arts Education*', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '12.87px' } }, + //Adopted { selector: '.notenabled:nth-child(7) > td:nth-child(2)', - label: '2005', + label: '2017', expected: { - text: '2005', + text: '2017', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '12.87px' } }, + //Grades { - selector: '.notenabled:nth-child(7) .notenabled', - label: 'Ages 3-5*', + selector: '.notenabled:nth-child(7) > td:nth-child(3)', + label: 'Grades List', expected: { - text: 'Ages 3-5*', + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', - size: '11.583px' + size: '12.87px' } } ]; @@ -3350,30 +5082,38 @@ const steps = [ const element = await driver.findElement(By.css(selector)); const actualText = await element.getText(); - const actualColor = await element.getCssValue('color'); + const actualFont = await element.getCssValue('font-family'); const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); const errors = []; - //Text + //text if (actualText === expected.text) { - console.log(`Passed: DIV - More Info Arizona Row 7 ${label} label text matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 7 ${label} label text matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 7 "${expected.text}"; Actual: "${actualText}"`); + errors.push(`Expected: DIV - More Info Alabama Row 7 "${expected.text}"; Actual: "${actualText}"`); } - //Color - if (actualColor === expected.color) { - console.log(`Passed: DIV - More Info Arizona Row 7 ${label} label text color matched as expected`); + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 7 ${label} label text font matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 7 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + errors.push(`Expected: DIV - More Info Alabama Row 7 "${expected.font}"; Actual: "${actualFont}"`); } - //Font-size + //size if (actualSize === expected.size) { - console.log(`Passed: DIV - More Info Arizona Row 7 ${label} label text font-size matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 7 ${label} label text font-size matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 7 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + errors.push(`Expected: DIV - More Info Alabama Row 7 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 7 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 7 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); } return errors; @@ -3385,55 +5125,50 @@ const steps = [ } if (allErrors.length > 0) { - if (allErrors.length > 1) allErrors.unshift('Multiple validation checks did not pass'); + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); throw new Error(allErrors.join('\n')); } } }, - //DIV - More Info Arizona Row 8 label text, color, and font size + //DIV - More Info Alabama Row 8 label { - description: 'Validate DIV - More Info Arizona Row 8 label text, color, and font size', + description: 'Validate DIV - More Info Alabama Row 8 label text, color, and font size', action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 8 label'; const checks = [ //Subject { selector: '.notenabled:nth-child(8) > td:nth-child(1)', - label: 'English Language Learners*', + label: 'Career Development*', expected: { - text: 'English Language Learners*', + text: 'Career Development*', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '12.87px' } }, + //Adopted { selector: '.notenabled:nth-child(8) > td:nth-child(2)', - label: '2004', + label: '2016', expected: { - text: '2004', + text: '2016', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '12.87px' } }, - //Grades - //Pre K* - { - selector: '.notenabled:nth-child(8) .notenabled', - label: 'Pre K*', - expected: { - text: 'Pre K*', - color: 'rgba(119, 119, 119, 1)', - size: '11.583px' - } - }, + //All Grades list { selector: '.notenabled:nth-child(8) > td:nth-child(3)', label: 'Grades List', expected: { - text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + text: '9, 10, 11, 12', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '12.87px' } @@ -3446,30 +5181,38 @@ const steps = [ const element = await driver.findElement(By.css(selector)); const actualText = await element.getText(); - const actualColor = await element.getCssValue('color'); + const actualFont = await element.getCssValue('font-family'); const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); const errors = []; - //Text + //text if (actualText === expected.text) { - console.log(`Passed: DIV - More Info Arizona Row 8 ${label} label text matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 8 ${label} label text matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 8 "${expected.text}"; Actual: "${actualText}"`); + errors.push(`Expected: DIV - More Info Alabama Row 8 "${expected.text}"; Actual: "${actualText}"`); } - //Color - if (actualColor === expected.color) { - console.log(`Passed: DIV - More Info Arizona Row 8 ${label} label text color matched as expected`); + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 8 ${label} label text font matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 8 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + errors.push(`Expected: DIV - More Info Alabama Row 8 "${expected.font}"; Actual: "${actualFont}"`); } - //Font-size + //size if (actualSize === expected.size) { - console.log(`Passed: DIV - More Info Arizona Row 8 ${label} label text font-size matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 8 ${label} label text font-size matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 8 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + errors.push(`Expected: DIV - More Info Alabama Row 8 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 8 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 8 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); } return errors; @@ -3481,57 +5224,88 @@ const steps = [ } if (allErrors.length > 0) { - if (allErrors.length > 1) allErrors.unshift('Multiple validation checks did not pass'); + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); throw new Error(allErrors.join('\n')); } } }, - //DIV - More Info Arizona Row 9 label text, color, and font size + //DIV - More Info Alabama Row 9 label text { - description: 'Validate DIV - More Info Arizona Row 9 label text, color, and font size', + description: 'Validate DIV - More Info Alabama Row 9 label text, color, and font size', action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 9 label'; const checks = [ //Subject { selector: '.notenabled:nth-child(9) > td:nth-child(1)', - label: 'Health and PE*', + label: 'Early Childhood Education*', expected: { - text: 'Health and PE*', + text: 'Early Childhood Education*', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '12.87px' } }, + //Adopted { selector: '.notenabled:nth-child(9) > td:nth-child(2)', - label: '2009', + label: '2023', expected: { - text: '2009', + text: '2023', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '12.87px' } }, - //Grades - //Pre K* + + //Ages 3-5* { selector: '.notenabled:nth-child(9) .notenabled', - label: 'Pre K*', + label: 'Ages 3-5*', expected: { - text: 'Pre K*', + text: 'Ages 3-5*', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '11.583px' } }, - //All Grades list + + //All Grades list 1 { - selector: '.notenabled:nth-child(9) > td:nth-child(3)', - label: 'Grades List', + selector: '.notenabled:nth-child(2)', + label: 'Ages Birth to 12 months*', expected: { - text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + text: 'Ages Birth to 12 months*', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', - size: '12.87px' + size: '11.583px' + } + }, + + //All Grades list 2 + { + selector: '.notenabled:nth-child(3)', + label: 'Ages 13 to 24 months*', + expected: { + text: 'Ages 13 to 24 months*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '11.583px' + } + }, + + //All Grades list 3 + { + selector: '.notenabled:nth-child(4)', + label: 'Ages 25 to 36 months*', + expected: { + text: 'Ages 25 to 36 months*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '11.583px' } } ]; @@ -3542,30 +5316,38 @@ const steps = [ const element = await driver.findElement(By.css(selector)); const actualText = await element.getText(); - const actualColor = await element.getCssValue('color'); + const actualFont = await element.getCssValue('font-family'); const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); const errors = []; - //Text + //text if (actualText === expected.text) { - console.log(`Passed: DIV - More Info Arizona Row 9 ${label} label text matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 9 ${label} label text matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 9 "${expected.text}"; Actual: "${actualText}"`); + errors.push(`Expected: DIV - More Info Alabama Row 9 "${expected.text}"; Actual: "${actualText}"`); } - //Color - if (actualColor === expected.color) { - console.log(`Passed: DIV - More Info Arizona Row 9 ${label} label text color matched as expected`); + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 9 ${label} label text font matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 9 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + errors.push(`Expected: DIV - More Info Alabama Row 9 "${expected.font}"; Actual: "${actualFont}"`); } - //Font-size + //size if (actualSize === expected.size) { - console.log(`Passed: DIV - More Info Arizona Row 9 ${label} label text font-size matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 9 ${label} label text font-size matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 9 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + errors.push(`Expected: DIV - More Info Alabama Row 9 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 9 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 9 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); } return errors; @@ -3577,45 +5359,50 @@ const steps = [ } if (allErrors.length > 0) { - if (allErrors.length > 1) allErrors.unshift('Multiple validation checks did not pass'); + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); throw new Error(allErrors.join('\n')); } } }, - //DIV - More Info Arizona Row 10 label text, color, and font size + //DIV - More Info Alabama Row 10 label text { - description: 'Validate DIV - More Info Arizona Row 10 label text, color, and font size', + description: 'Validate DIV - More Info Alabama Row 10 label text, color, and font size', action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 10 label'; const checks = [ //Subject { selector: '.notenabled:nth-child(10) > td:nth-child(1)', - label: 'Library Media*', + label: 'English Language Learners*', expected: { - text: 'Library Media*', + text: 'English Language Learners*', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '12.87px' } }, - //Grades - //Pre K* + + //Adopted { - selector: '.notenabled:nth-child(10) .notenabled', - label: 'Pre K*', + selector: '.notenabled:nth-child(10) > td:nth-child(2)', + label: '2020', expected: { - text: 'Pre K*', + text: '2020', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', - size: '11.583px' + size: '12.87px' } }, + //All Grades list { selector: '.notenabled:nth-child(10) > td:nth-child(3)', label: 'Grades List', expected: { - text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '12.87px' } @@ -3628,30 +5415,38 @@ const steps = [ const element = await driver.findElement(By.css(selector)); const actualText = await element.getText(); - const actualColor = await element.getCssValue('color'); + const actualFont = await element.getCssValue('font-family'); const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); const errors = []; - //Text + //text if (actualText === expected.text) { - console.log(`Passed: DIV - More Info Arizona Row 10 ${label} label text matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 10 "${expected.text}"; Actual: "${actualText}"`); + errors.push(`Expected: DIV - More Info Alabama Row 10 "${expected.text}"; Actual: "${actualText}"`); } - //Color - if (actualColor === expected.color) { - console.log(`Passed: DIV - More Info Arizona Row 10 ${label} label text color matched as expected`); + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text font matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 10 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + errors.push(`Expected: DIV - More Info Alabama Row 10 "${expected.font}"; Actual: "${actualFont}"`); } - //Font-size + //size if (actualSize === expected.size) { - console.log(`Passed: DIV - More Info Arizona Row 10 ${label} label text font-size matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text font-size matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 10 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + errors.push(`Expected: DIV - More Info Alabama Row 10 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 10 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); } return errors; @@ -3663,55 +5458,149 @@ const steps = [ } if (allErrors.length > 0) { - if (allErrors.length > 1) allErrors.unshift('Multiple validation checks did not pass'); + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); throw new Error(allErrors.join('\n')); } } }, - //DIV - More Info Arizona Row 11 label text, color, and font size + //DIV - More Info Alabama Row 11 label { - description: 'Validate DIV - More Info Arizona Row 11 label text, color, and font size', + description: 'Validate DIV - More Info Alabama Row 11 label text, color, and font size', action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 11 label'; const checks = [ //Subject { selector: '.notenabled:nth-child(11) > td:nth-child(1)', - label: 'Technology Education*', + label: 'Social and Emotional Learning*', expected: { - text: 'Technology Education*', + text: 'Social and Emotional Learning*', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '12.87px' } }, + //Adopted { selector: '.notenabled:nth-child(11) > td:nth-child(2)', - label: '2009', + label: '2013', expected: { - text: '2009', + text: '2013', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '12.87px' } }, - //Grades + //Pre K* { selector: '.notenabled:nth-child(11) .notenabled', label: 'Pre K*', expected: { text: 'Pre K*', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '11.583px' } + } + ]; + + const allErrors = []; + + async function validateCell({ selector, label, expected }) { + const element = await driver.findElement(By.css(selector)); + + const actualText = await element.getText(); + const actualFont = await element.getCssValue('font-family'); + const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); + + const errors = []; + + //text + if (actualText === expected.text) { + console.log(`Passed: DIV - More Info Alabama Row 11 ${label} label text matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 11 "${expected.text}"; Actual: "${actualText}"`); + } + + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 11 ${label} label text font matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 11 "${expected.font}"; Actual: "${actualFont}"`); + } + + //size + if (actualSize === expected.size) { + console.log(`Passed: DIV - More Info Alabama Row 11 ${label} label text font-size matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 11 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 11 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 11 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + } + + return errors; + } + + for (const check of checks) { + const errs = await validateCell(check); + allErrors.push(...errs); + } + + if (allErrors.length > 0) { + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + throw new Error(allErrors.join('\n')); + } + } + }, + + //DIV - More Info Alabama Row 12 label text + { + description: 'Validate DIV - More Info Alabama Row 12 label text, color, and font size', + action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 12 label'; + + const checks = [ + //Subject + { + selector: '.notenabled:nth-child(12) > td:nth-child(1)', + label: 'World Languages*', + expected: { + text: 'World Languages*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } }, + + //Adopted + { + selector: '.notenabled:nth-child(12) > td:nth-child(2)', + label: '2017', + expected: { + text: '2017', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + }, + //All Grades list { - selector: '.notenabled:nth-child(11) > td:nth-child(3)', + selector: '.notenabled:nth-child(12) > td:nth-child(3)', label: 'Grades List', expected: { - text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', color: 'rgba(119, 119, 119, 1)', size: '12.87px' } @@ -3724,30 +5613,38 @@ const steps = [ const element = await driver.findElement(By.css(selector)); const actualText = await element.getText(); - const actualColor = await element.getCssValue('color'); + const actualFont = await element.getCssValue('font-family'); const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); const errors = []; - //Text + //text if (actualText === expected.text) { - console.log(`Passed: DIV - More Info Arizona Row 11 ${label} label text matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 11 "${expected.text}"; Actual: "${actualText}"`); + errors.push(`Expected: DIV - More Info Alabama Row 10 "${expected.text}"; Actual: "${actualText}"`); } - //Color - if (actualColor === expected.color) { - console.log(`Passed: DIV - More Info Arizona Row 11 ${label} label text color matched as expected`); + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text font matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 11 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + errors.push(`Expected: DIV - More Info Alabama Row 10 "${expected.font}"; Actual: "${actualFont}"`); } - //Font-size + //size if (actualSize === expected.size) { - console.log(`Passed: DIV - More Info Arizona Row 11 ${label} label text font-size matched as expected`); + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text font-size matched as expected`); } else { - errors.push(`Expected: DIV - More Info Arizona Row 11 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + errors.push(`Expected: DIV - More Info Alabama Row 10 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 10 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); } return errors; @@ -3759,290 +5656,360 @@ const steps = [ } if (allErrors.length > 0) { - if (allErrors.length > 1) allErrors.unshift('Multiple validation checks did not pass'); + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); throw new Error(allErrors.join('\n')); } } }, - //NEXT ACTION - Click DIV X icon + //NEXT ACTION { - description: 'DIV - Click DIV X icon', + description: 'Dashboard - Click DIV X icon', action: async () => { - console.log('----->| NEXT ACTION: Clicked DIV X icon'); await driver.findElement(By.css('.modal-lg .modal-header span')).click(); - await driver.sleep(2000); - } - },*/ - - //NEXT ACTION - Click View icon - { - description: 'DIV - Click California View icon', - action: async () => { - console.log('----->| NEXT ACTION: Clicked California View icon'); - await driver.findElement(By.css('tr:nth-child(3) > .text-center:nth-child(5) img')).click(); - await driver.sleep(2000); - } - }, - - //Wait until the element exists in the DOM - { - description: 'Wait for page to load', - action: async () => { - const pageTitle = await driver.wait( - until.elementLocated(By.css('h2')), - 30000 - ); - - //Wait until it becomes visible - await driver.wait( - until.elementIsVisible(pageTitle), - 30000 - ); + console.log('----->| NEXT ACTION: Clicked DIV X icon'); //Wait for page to load completely await driver.wait(async () => { const readyState = await driver.executeScript('return document.readyState'); return readyState === 'complete'; - }, 30000, 'Browse Page did not fully load within 30 seconds'); - console.log('Passed: Browse Page loaded successfully'); + }, 20000, 'ExACT Dashboard did not fully load within 60 seconds'); + console.log('Passed: ExACT Dashboard loaded successfully'); } }, - //Browse - Page title, text, and font size + //NEXT ACTION { - description: 'Validate Browse page title text, color, and size', + description: 'Dashboard - Click Alabama View icon', action: async () => { - const element = await driver.findElement(By.css('h2')); + await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img')).click(); + console.log('----->| NEXT ACTION: Clicked Alabama View icon'); - //Get text, color, and size + //Wait for page readyState + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Browse standards page did not fully load within 30 seconds'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.linkText('Content')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Content tab did not become visible within 20 seconds'); + + console.log('Passed: Content tab loaded successfully'); + } + }, + + //Content tab title + { + description: 'Validate Content tab title text, size, and color', + action: async () => { + const multipleChecks = 'Content tab title'; + const element = await driver.findElement(By.linkText('Content')); + + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); - const elementSize = await element.getCssValue('font-size'); + 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 = []; - //Validate text = - if (elementText === 'Browse') { - console.log("Passed: Browse page title matched as expected"); - } else { - const message = `Expected: "Browse" page title; Actual: "${elementText}"`; - errors.push(message); - } - - //Validate color -navy blue - if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: Browse Page title text color matched as expected'); - } else { - const message = `Expected: Browse Page title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; - errors.push(message); - } - - //Validate font size - if (elementSize === '32px') { - console.log('Passed: Browse Page title text font-size matched as expected'); - } else { - const message = `Expected: Browse Page title text font-size "32px"; Actual: "${elementSize}"`; - errors.push(message); - } - - //Throw once at the end (no additional console logs here) - if (errors.length > 0) { - throw new Error(errors.join('\n')); - } - } - }, - - //Browse - Content tab title, text, and font size (dimmed) - { - description: 'Validate Browse - Content tab title text, color, and size', - action: async () => { - const element = await driver.findElement(By.css('#content-tab')); - - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('background-color'); - const elementSize = await element.getCssValue('font-size'); - - //Track all errors - const errors = []; - - //Validate text = + //text if (elementText === 'Content') { - console.log("Passed: Browse page - Content tab title matched as expected"); + console.log('Passed: Content tab title text matched as expected'); } else { - const message = `Expected: "Content" tab title; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: "Content"; Actual: "${elementText}"`); } - //Validate color -clear - if (elementColor === 'rgba(0, 0, 0, 0)') { - console.log('Passed: Browse page - Content tab title text color matched as expected'); + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Content tab title font-family matched as expected'); } else { - const message = `Expected: Browse page - Content tab title text color "rgba(0, 0, 0, 0)"; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Content tab title font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); } - //Validate font size - if (elementSize === '15px') { - console.log('Passed: Browse page - Content tab title text font-size matched as expected'); + //size + if (elementTextSize === '15px') { + console.log('Passed: Content tab title text font-size matched as expected'); } else { - const message = `Expected: Browse page - Content tab title text font-size "15px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Content tab title text font-size "15px"; Actual: "${elementTextSize}"`); } - //Throw once at the end (no additional console logs here) + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Content tab title text color matched as expected'); + } else { + errors.push(`Expected: Content tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Content tab background color matched as expected'); + } else { + errors.push(`Expected: Content tab background color: "rgba(0, 0, 0, 0)"; 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')); } } }, - - //Browse - Standards tab title, text, and font size (active) + + //Standards tab tab title (active) { - description: 'Validate Browse - Standards tab title text, color, and size', + description: 'Validate Standards tab title text, size, and color', action: async () => { - const element = await driver.findElement(By.css('#std-tab')); + const multipleChecks = 'By Standard tab title'; + const element = await driver.findElement(By.linkText('Standards')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('background-color'); - const elementSize = await element.getCssValue('font-size'); + 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 = []; - //Validate text = + //text if (elementText === 'Standards') { - console.log("Passed: Browse page - Standards tab title matched as expected"); + console.log('Passed: Standards tab title text matched as expected'); } else { - const message = `Expected: "Standards" tab title; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: "Standards"; Actual: "${elementText}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: Browse page - Standards tab title text color matched as expected'); + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standards tab title font-family matched as expected'); } else { - const message = `Expected: Browse page - Standards tab title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); } - //Validate font size - if (elementSize === '15px') { - console.log('Passed: Browse page - Standards tab title text font-size matched as expected'); + //size + if (elementTextSize === '15px') { + console.log('Passed: Standards tab title text font-size matched as expected'); } else { - const message = `Expected: Browse page - Standards tab title text font-size "15px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Standards tab title text font-size "15px"; Actual: "${elementTextSize}"`); } - //Throw once at the end (no additional console logs here) + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standards tab title text color matched as expected'); + } else { + errors.push(`Expected: Standards tab title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standards tab background color matched as expected'); + } else { + errors.push(`Expected: Standards tab background color: "rgba(40, 39, 90, 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')); } } }, - //Browse - Concepts tab title, text, and font size (dimmed) + //AutoAlign tab title { - description: 'Validate Browse - Conceptss tab title text, color, and size', + description: 'Validate AutoAlign tab title text, size, and color', action: async () => { - const element = await driver.findElement(By.css('#concept-tab')); + const multipleChecks = 'AutoAlign tab title'; + const element = await driver.findElement(By.linkText('AutoAlign')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('background-color'); - const elementSize = await element.getCssValue('font-size'); + 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 = []; - //Validate text = - if (elementText === 'Concepts') { - console.log("Passed: Browse page - Concepts tab title matched as expected"); + //text + if (elementText === 'AutoAlign') { + console.log('Passed: AutoAlign tab title text matched as expected'); } else { - const message = `Expected: "Concepts" tab title; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: "AutoAlign"; Actual: "${elementText}"`); } - //Validate color -clear - if (elementColor === 'rgba(0, 0, 0, 0)') { - console.log('Passed: Browse page - Concepts tab title text color matched as expected'); + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: AutoAlign tab title font-family matched as expected'); } else { - const message = `Expected: Browse page - Concepts tab title text color "rgba(0, 0, 0, 0)"; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: AutoAlign tab title font-family "DM Serif Display, serif"; Actual: ${elementTextFont}`); } - //Validate font size - if (elementSize === '15px') { - console.log('Passed: Browse page - Concepts tab title text font-size matched as expected'); + //size + if (elementTextSize === '15px') { + console.log('Passed: AutoAlign tab title text font-size matched as expected'); } else { - const message = `Expected: Browse page - Concepts tab title text font-size "15px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: AutoAlign tab title text font-size "15px"; Actual: "${elementTextSize}"`); } - //Throw once at the end (no additional console logs here) + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: AutoAlign tab title text color matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: AutoAlign tab background color matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab background color: "rgba(0, 0, 0, 0)"; 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')); } } }, - //Browse - Browse standards sub-title, text, and font size + //Browse - Browse standards sub-title { - description: 'Validate Browse - Browse standards sub-title text, color, and size', + description: 'Validate Browse - Browse standards sub-title text, color, and size', action: async () => { - const element = await driver.findElement(By.css('#std p')); + const multipleChecks = 'Browse sub-title'; + const element = await driver.findElement(By.css('#std .fom-title')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('background-color'); + 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 = []; - //Validate text = + //text if (elementText === 'Browse standards') { console.log("Passed: Browse page - Browse standards sub-title matched as expected"); } else { - const message = `Expected: "Browse standards" sub-title; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: "Browse standards" sub-title; Actual: "${elementText}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(0, 0, 0, 0)') { - console.log('Passed: Browse page - Browse standards sub-title text color matched as expected'); + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Browse page - Browse standards sub-title font-family matched as expected'); } else { - const message = `Expected: Browse page - Browse standards sub-title text color "rgba(0, 0, 0, 0)"; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Browse page - Browse standards sub-title font-family "DM Serif Display, serif"; Actual: ${elementFont}`); } - //Validate font size + //size if (elementSize === '13px') { console.log('Passed: Browse page - Browse standards sub-title text font-size matched as expected'); } else { - const message = `Expected: Browse page - Browse standards sub-title text font-size "13px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Browse page - Browse standards sub-title text font-size "13px"; Actual: "${elementSize}"`); } - //Throw once at the end (no additional console logs here) + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Browse page - Browse standards sub-title text color matched as expected'); + } else { + errors.push(`Expected: Browse page - Browse standards sub-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')); } } }, - //Standards label text + //Standards label { - description: 'Validate Standards label text', + description: 'Validate Standards label text, font, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(4) > .col-sm-2')).getText(); + const multipleChecks = 'Standards label'; + const element = await driver.findElement(By.css('#browse-standards > .form-group:nth-child(1) > .col-sm-12')); + + //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 === 'Standards') { - console.log('Passed: Standards label text matched as expected'); + console.log("Passed: Standards label matched as expected"); } else { - throw new Error(`Expected: "Standards" label text; Actual: "${elementText}"`); + errors.push(`Expected: "Standards" label; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standards label font-family matched as expected'); + } else { + errors.push(`Expected: Standards label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standards label text font-size matched as expected'); + } else { + errors.push(`Expected: Standards label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standards label text color matched as expected'); + } else { + errors.push(`Expected: Standards 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')); } } }, @@ -4051,43 +6018,74 @@ const steps = [ { description: 'Validate Standards dropdown list and value', action: async () => { + const multipleChecks = 'Standards Dropdown List'; const select = await driver.findElement(By.css('#stdselect')); - // Get the selected option text + //Get text, font, size, and color const selectedOption = await select.findElement(By.css('option:checked')); - const selectedText = await selectedOption.getText(); + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); - if (selectedText === 'California Standards') { - console.log('Passed: California Standards default value matched as expected'); + //text + if (elementText === 'Alabama') { + console.log("Passed: Alabama default option matched as expected"); } else { - throw new Error(`Expected "California Standards"; Actual: "${selectedText}"`); + errors.push(`Expected option: "Alabama"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Alabama default text font-family matched as expected'); + } else { + errors.push(`Expected: Alabama default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Alabama default text font-size matched as expected'); + } else { + errors.push(`Expected: Alabama default text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Alabama default text color matched as expected'); + } else { + errors.push(`Expected: Alabama default text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); } const options = await select.findElements(By.css('option')); const expectedList = [ 'Select standards', - 'Alabama Standards', - 'Arizona Standards', - 'California Standards', - 'Florida Standards', - 'New York Standards', - 'North Carolina Standards', - 'South Carolina Standards', - 'Texas TEKS Standards', - 'Washington Standards', + 'Alabama', + 'Arizona', + 'California', + 'Florida', + 'Georgia', + 'Illinois', + 'New York', + 'Texas', + 'Washington', 'Common Core State Standards', 'Alberta Standards', - 'Ontario Standards', - 'Australian Curriculum (ACARA) Standards', + 'Ontario Curriculum', + 'Australian Curriculum (ACARA) v8', + 'New South Wales', + 'NCSSFL-ACTFL CAN-DO STATEMENTS', + 'WIDA Consortium (2020)', '5th Grade Import ECS-2732', - 'Stats Test Framework', + 'Imported Framework Updated', + 'ECS-2933 Testing On Prod', + //'Stats Test Framework', 'Widget Test', - 'Still Testing ECS-273', - 'New Framework to New Org 2735', - 'New York Language Arts (2011)', - 'New York Language Arts (2017)', - 'Make Sure To Delete', - 'Inquiry Skills' + 'California Mathematics 1997', + 'Georgia Archived Language Arts QA', + 'Georgia Current Language Arts QA', + 'Georgia Future Language Arts QA', + 'create group test', + 'IMport Test' ]; const actual = []; @@ -4102,15 +6100,14 @@ const steps = [ if (JSON.stringify(actual) === JSON.stringify(expectedList)) { console.log('Passed: Standards Dropdown list matched as expected'); } else { - const message = `Expected: Standards Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`; - errors.push(message); + errors.push(`Expected: Standards Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -4119,106 +6116,311 @@ const steps = [ } }, - //Standards Display label text + //Standards Display label { - description: 'Validate Standards Display label text', + description: 'Validate Standards Display label text, font, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(5) > .col-sm-2')).getText(); + const multipleChecks = 'Standards Display label'; + const element = await driver.findElement(By.css('.form-group:nth-child(2) > .col-sm-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'); + + //Track all errors + const errors = []; + + //text if (elementText === 'Standards Display') { - console.log('Passed: Standards Display label text matched as expected'); + console.log("Passed: Standards Display label text matched as expected"); } else { - throw new Error(`Expected: "Standards Display" label text; Actual: "${elementText}"`); + errors.push(`Expected: ""Standards Display" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standards Display label font-family matched as expected'); + } else { + errors.push(`Expected: Standards Display label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standards Display label text font-size matched as expected'); + } else { + errors.push(`Expected: Standards Display label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standards Display label text color matched as expected'); + } else { + errors.push(`Expected: Standards Display 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')); } } }, - //All radio option checkbox -active + //All radio option { - description: 'Validate All radio option enabled', + description: 'Validate All radio option text, font, size, and color', action: async () => { + const multipleChecks = 'All radio option'; const elementOption = await driver.findElement(By.css('#gap1')).getAttribute('checked'); + const element = await driver.findElement(By.css('.form-check:nth-child(1) > .form-check-label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //icon if (elementOption === 'true') { - console.log('Passed: All radio option value matched as expected'); + console.log('Passed: All radio option selected as expected'); } else { throw new Error(`All radio option value was not selected; Actual: "${elementOption}"`); } - } - }, - //All radio handle text - { - description: 'Validate All radio handle text', - action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(1) > .form-check-label')).getText(); + //text if (elementText === 'All') { - console.log('Passed: All radio handle text matched as expected'); + console.log('Passed: All radio label text matched as expected'); } else { - throw new Error(`Expected: "All" radio handle text; Actual: "${elementText}"`); + errors.push(`Expected: "All" radio label text; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: All radio label font matched as expected'); + } else { + errors.push(`Expected: All radio label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: All radio label text font-size matched as expected'); + } else { + errors.push(`Expected: All radio label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: All radio label text color matched as expected'); + } else { + errors.push(`Expected: All radio label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); } } }, - //Correlated Only radio option checkbox + //Correlated Only radio option { - description: 'Validate Correlated Only radio option enabled', + description: 'Validate Correlated Only radio option text, font, size, and color', action: async () => { - const elementOption = await driver.findElement(By.css('#gap2')).getAttribute('type'); - if (elementOption === 'radio') { - console.log('Passed: Correlated Only radio type matched as expected'); - } else { - throw new Error(`Correlated Only radio type did not match; Actual: "${elementOption}"`); - } - } - }, + const multipleChecks = 'Correlated Only radio option'; + const elementOption = await driver.findElement(By.css('#gap2')); + const element = await driver.findElement(By.css('.form-check:nth-child(2) > .form-check-label')); - //Correlated Only radio handle text - { - description: 'Validate Correlated Only radio handle text', - action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(2) > .form-check-label')).getText(); + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //icon + if (elementOption) { + console.log('Passed: Correlated Only radio option is present'); + } else { + throw new Error(`Correlated Only radio option was not found; Actual: "${elementOption}"`); + } + + //text if (elementText === 'Correlated Only') { - console.log('Passed: Correlated Only radio handle text matched as expected'); + console.log('Passed: Correlated Only radio label text matched as expected'); } else { - throw new Error(`Expected: "Correlated Only" radio handle text; Actual: "${elementText}"`); + errors.push(`Expected: "Correlated Only" radio label text; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Correlated Only radio label font matched as expected'); + } else { + errors.push(`Expected: Correlated Only radio label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Correlated Only radio label text font-size matched as expected'); + } else { + errors.push(`Expected: Correlated Only radio label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Correlated Only radio label text color matched as expected'); + } else { + errors.push(`Expected: Correlated Only radio label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); } } }, - //Uncorrelated Only radio option checkbox + //Uncorrelated Only radio option { - description: 'Validate Uncorrelated Only radio option enabled', + description: 'Validate Uncorrelated Only radio option text, font, size, and color', action: async () => { - const elementOption = await driver.findElement(By.css('#gap3')).getAttribute('type'); - if (elementOption === 'radio') { - console.log('Passed: Uncorrelated Only radio type matched as expected'); - } else { - throw new Error(`Uncorrelated Only radio type did not match; Actual: "${elementOption}"`); - } - } - }, + const multipleChecks = 'Uncorrelated Only radio option'; + const elementOption = await driver.findElement(By.css('#gap3')); + const element = await driver.findElement(By.css('.form-check:nth-child(3) > .form-check-label')); - //Uncorrelated Only radio handle text - { - description: 'Validate Uncorrelated Only radio handle text', - action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(3) > .form-check-label')).getText(); + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //icon + if (elementOption) { + console.log('Passed: Uncorrelated Only radio option is present'); + } else { + throw new Error(`Uncorrelated Only radio option was not found; Actual: "${elementOption}"`); + } + + //text if (elementText === 'Uncorrelated Only') { - console.log('Passed: Uncorrelated Only radio handle text matched as expected'); + console.log('Passed: Uncorrelated Only radio label text matched as expected'); } else { - throw new Error(`Expected: "Uncorrelated Only" radio handle text; Actual: "${elementText}"`); + errors.push(`Expected: "Uncorrelated Only" radio label text; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Uncorrelated Only radio label font matched as expected'); + } else { + errors.push(`Expected: Uncorrelated Only radio label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Uncorrelated Only radio label text font-size matched as expected'); + } else { + errors.push(`Expected: Uncorrelated Only radio label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Uncorrelated Only radio label text color matched as expected'); + } else { + errors.push(`Expected: Uncorrelated Only radio label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); } } }, - //Subject label text + //Subject label { - description: 'Validate Subject Display label text', + description: 'Validate Subject label text, font, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.hideSubject > .col-sm-2')).getText(); + const multipleChecks = 'Subject label'; + const element = await driver.findElement(By.css('.hideSubject > .col-form-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 === 'Subject') { - console.log('Passed: Subject label text matched as expected'); + console.log("Passed: Subject label text matched as expected"); } else { - throw new Error(`Expected: "Subject" label text; Actual: "${elementText}"`); + errors.push(`Expected: "Subject" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Subject label font-family matched as expected'); + } else { + errors.push(`Expected: Subject label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Subject label text font-size matched as expected'); + } else { + errors.push(`Expected: Subject label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Subject label text color matched as expected'); + } else { + errors.push(`Expected: Subject 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')); } } }, @@ -4227,26 +6429,53 @@ const steps = [ { description: 'Validate Subject dropdown list and value', action: async () => { + const multipleChecks = 'Subject Dropdown List'; const select = await driver.findElement(By.css('#selectSubjects')); - // Get the selected option text + //Get text, font, size, and color const selectedOption = await select.findElement(By.css('option:checked')); - const selectedText = await selectedOption.getText(); + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); - if (selectedText === 'Select a subject') { - console.log('Passed: Select a subject default value matched as expected'); + //text + if (elementText === 'Select a subject') { + console.log("Passed: Select a subject default option matched as expected"); } else { - throw new Error(`Expected Select a subject "Select a subject"; Actual: "${selectedText}"`); + errors.push(`Expected option: "Select a subject"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Select a subject default text font-family matched as expected'); + } else { + errors.push(`Expected: Select a subject default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Select a subject default text font-size matched as expected'); + } else { + errors.push(`Expected: Select a subject default text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Select a subject default text color matched as expected'); + } else { + errors.push(`Expected: Select a subject default text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); } const options = await select.findElements(By.css('option')); const expectedList = [ 'Select a subject', + 'Health and PE', 'Language Arts', - 'Mathematics', - 'Science', - 'Social Studies', - 'World Languages' + "Mathematics", + "Science", + "Social Studies", + "Technology Education" ]; const actual = []; @@ -4261,15 +6490,14 @@ const steps = [ if (JSON.stringify(actual) === JSON.stringify(expectedList)) { console.log('Passed: Subject Dropdown list matched as expected'); } else { - const message = `Expected: Subject Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`; - errors.push(message); + errors.push(`Expected: Subject Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); } //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -4278,43 +6506,703 @@ const steps = [ } }, - //Show Correlations From label text + //Grade label and dropdown { - description: 'Validate Show Correlations From label text', + description: 'Validate Grade label and dropdown are hidden', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(8) > .col-sm-2')).getText(); - if (elementText === 'Show Correlations From') { - console.log('Passed: Show Correlations From label text matched as expected'); + const multipleChecks = 'Grade label and dropdown are hidden'; + const errors = []; + + const visibility = await driver.executeScript(` + const hideGradeDiv = document.querySelector('.hideGrade'); + if (!hideGradeDiv) return { found: false }; + const style = window.getComputedStyle(hideGradeDiv); + return { + found: true, + hidden: style.display === 'none', + display: style.display + }; + `); + //console.log('----->| DEBUG hideGrade visibility:', JSON.stringify(visibility)); + + //Both label and dropdown are inside the same hideGrade div + //so we only need to check the parent container once + if (visibility.found && visibility.hidden) { + console.log('Passed: Grade label is hidden as expected'); + console.log('Passed: Grade dropdown is hidden as expected'); } else { - throw new Error(`Expected: "Show Correlations From" label text; Actual: "${elementText}"`); + errors.push(`Expected: Grade label and dropdown to be hidden; Actual: display="${visibility.display}"`); + } + + //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')); } } }, - //Show Correlations From dropdown + //Show Correlations From label { - description: 'Validate Show Correlations From dropdown list and value', + description: 'Validate Show Correlations From label text, font, size, and color', action: async () => { + const multipleChecks = 'Show Correlations From label'; + const element = await driver.findElement(By.css('.form-group:nth-child(3) > .col-form-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 === 'Show Correlations From') { + console.log("Passed: Show Correlations From label text matched as expected"); + } else { + errors.push(`Expected: "Show Correlations From" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Show Correlations From label font-family matched as expected'); + } else { + errors.push(`Expected: Show Correlations From label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Show Correlations From label text font-size matched as expected'); + } else { + errors.push(`Expected: Show Correlations From label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Show Correlations From label text color matched as expected'); + } else { + errors.push(`Expected: Show Correlations From 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')); + } + } + }, + + //Show Correlations From dropdown value + { + description: 'Validate Show Correlations From dropdown value', + action: async () => { + const multipleChecks = 'Show Correlations From dropdown value'; //Locate and validate selected (collapsed) value const dropdownButton = await driver.findElement( By.css('button.multiselect.dropdown-toggle') ); - const selectedText = (await dropdownButton.getAttribute('title')).trim(); + const selectedOption = await driver.findElement(By.css('#browse-standards > div:nth-child(3) > div > div > div:nth-child(3) > div > div > button > span')); - if (selectedText === 'None selected') { - console.log('Passed: Show Correlations From default value matched as expected'); + //Get text, font, size, and color + const elementText = await selectedOption.getText(''); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'All Content Sets') { + console.log("Passed: All Content Sets default option matched as expected"); } else { - throw new Error( - `Expected default value "All Content Sets"; Actual: "${selectedText}"` - ); + errors.push(`Expected option: "All Content Sets"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: All Content Sets default text font-family matched as expected'); + } else { + errors.push(`Expected: All Content Sets default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '16px') { + console.log('Passed: All Content Sets default text font-size matched as expected'); + } else { + errors.push(`Expected: All Content Sets default text font-size "16px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: All Content Sets default text color matched as expected'); + } else { + errors.push(`Expected: All Content Sets default text color "rgba(33, 37, 41, 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')); + } + } + }, + + //Term Search label + { + description: 'Validate Term Search label text, font, size, and color', + action: async () => { + const multipleChecks = 'Term Search label'; + const element = await driver.findElement(By.css('.form-group:nth-child(7) > .col-sm-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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Term Search') { + console.log("Passed: Term Search label text matched as expected"); + } else { + errors.push(`Expected: "Term Search" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Term Search label font-family matched as expected'); + } else { + errors.push(`Expected: Term Search label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Term Search label text font-size matched as expected'); + } else { + errors.push(`Expected: Term Search label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Term Search label text color matched as expected'); + } else { + errors.push(`Expected: Term Search 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')); + } + } + }, + + //Term Search placeholder + { + description: 'Validate Term Search placeholder', + action: async () => { + const elementPlaceholder = await driver.findElement(By.css('#searchTerm')).getAttribute('placeholder'); + + if (elementPlaceholder === '') { + console.log('Passed: Term Search "blank" placeholder text matched as expected'); + } else { + throw new Error(`Expected: Term Search "blank" placeholder text; Actual: "${elementPlaceholder}"`); + } + } + }, + + //Include Related Standards checkbox + { + description: 'Validate Include Related Standards checkbox', + action: async () => { + const elementType = await driver.findElement(By.css('#doRel')).getAttribute('type'); + + if (elementType === 'checkbox') { + console.log('Passed: Include Related Standards checkbox type matched as expected'); + } else { + throw new Error(`Include Related Standards checkbox type did not match; Actual: "${elementType}"`); + } + } + }, + + //Include Related Standards label + { + description: 'Validate Include Related Standards label text, font, size, and color', + action: async () => { + const multipleChecks = 'Include Related Standards label'; + const element = await driver.findElement(By.css('.col-sm-offset-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 === 'Include Related Standards') { + console.log("Passed: Include Related Standards label text matched as expected"); + } else { + errors.push(`Expected: "Include Related Standards" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Include Related Standards label font-family matched as expected'); + } else { + errors.push(`Expected: Include Related Standards label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Include Related Standards label text font-size matched as expected'); + } else { + errors.push(`Expected: Include Related Standards label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Include Related Standards label text color matched as expected'); + } else { + errors.push(`Expected: Include Related Standards 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')); + } + } + }, + + //Search button + { + description: 'Validate Search button text, size, and color', + action: async () => { + const multipleChecks = 'Search button'; + const element = await driver.findElement(By.css('#stdsubmit')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + 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 === 'Search') { + console.log('Passed: Search button text matched as expected'); + } else { + errors.push(`Expected: "Search"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Search button text font-family matched as expected'); + } else { + errors.push(`Expected: Search button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '16px') { + console.log('Passed: Search button text font-size matched as expected'); + } else { + errors.push(`Expected: Search button text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Search button text color matched as expected'); + } else { + errors.push(`Expected: Search button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Search button background color matched as expected'); + } else { + errors.push(`Expected: Search 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')); + } + } + }, + + //NEXT ACTION + { + description: 'Validate alert message', + action: async () => { + const multipleChecks = 'Validate alert message'; + const errors = []; + + //Click delete button + const element = await driver.findElement(By.css('#stdsubmit')).click(); + await driver.sleep(5000); + console.log('----->| NEXT ACTION: Clicked Search button'); + + //Wait for confirm dialog to appear + const alert = await driver.wait(until.alertIsPresent(), 5000); + console.log('----->| NEXT ACTION: Alert dialog appeared as expected'); + + //Get alert text + const alertText = await alert.getText(); + + //Validate alert message text + const expectedText = 'You must select a subject'; + if (alertText === expectedText) { + console.log('Passed: Alert dialog text matched as expected'); + } else { + errors.push(`Expected: "${expectedText}"; Actual: "${alertText}"`); + } + + //Throw summary before dismissing if errors found + if (errors.length > 0) { + await alert.dismiss(); //Cancel the delete if validation failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + + //Accept the alert (click OK) to proceed with deletion + await alert.accept(); + console.log('----->| NEXT ACTION: Clicked alert message OK button'); + await driver.sleep(2000); + } + }, + + //NEXT ACTION + { + description: 'Click Subject dropdown', + action: async () => { + //Select "Mathematics" from dropdown + const subjectDropdown = await driver.findElement(By.css('#selectSubjects')); + const mathematicsOption = await driver.findElement(By.css('#selectSubjects > option:nth-child(4)')); + + await subjectDropdown.click(); + await driver.sleep(2000); + + await mathematicsOption.click(); + await driver.sleep(2000); + console.log('----->| NEXT ACTION: Selected Subject - Mathematics'); + + //Click away to close dropdown + await driver.findElement(By.css('#browse-standards > .form-group:nth-child(1)')).click(); + + //Wait for the dashboard container to exist in DOM + await driver.wait( + until.elementLocated(By.css('#selectGrade')), + 30000, + 'Grade dropdown did not appear within 30 seconds' + ); + + //Wait for it to be visible + await driver.wait(async () => { + try { + const gradeDropdown = await driver.findElement(By.css('#selectGrade')); + return await gradeDropdown.isDisplayed(); + } catch (e) { + return false; + } + }, 30000, 'Grade dropdown did not become visible within 30 seconds'); + }, + }, + + //Grade label + { + description: 'Validate Grade label text, font, size, and color', + action: async () => { + const multipleChecks = 'Grade label'; + const element = await driver.findElement(By.css('.hideGrade > .col-form-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 === 'Grade') { + console.log("Passed: Grade label text matched as expected"); + } else { + errors.push(`Expected: "Grade" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Grade label font-family matched as expected'); + } else { + errors.push(`Expected: Grade label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Grade label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade label text color matched as expected'); + } else { + errors.push(`Expected: Grade 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')); + } + } + }, + + //Grade dropdown + { + description: 'Validate Grade dropdown list and value', + action: async () => { + const multipleChecks = 'Grade Dropdown List'; + const select = await driver.findElement(By.css('#selectGrade')); + + //Get text, font, size, and color + const selectedOption = await select.findElement(By.css('option:checked')); + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + //text + if (elementText === 'Select a grade') { + console.log("Passed: Select a grade default option matched as expected"); + } else { + errors.push(`Expected option: "Select a grade"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Select a grade default text font-family matched as expected'); + } else { + errors.push(`Expected: Select a grade default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Select a grade default text font-size matched as expected'); + } else { + errors.push(`Expected: Select a grade default text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Select a grade default text color matched as expected'); + } else { + errors.push(`Expected: Select a grade default text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const options = await select.findElements(By.css('option')); + const expectedList = [ + 'Select a grade', + 'K', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + '10', + '11', + '12' + ]; + const actual = []; + + //Track all errors + const errors = []; + + for (const opt of options) { + const text = (await opt.getText()).trim(); + actual.push(text); + } + + if (JSON.stringify(actual) === JSON.stringify(expectedList)) { + console.log('Passed: Grade Dropdown list matched as expected'); + } else { + errors.push(`Expected: Grade Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); + } + + //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: 'Validate alert message', + action: async () => { + const multipleChecks = 'Validate alert message'; + const errors = []; + + //Click delete button + const element = await driver.findElement(By.css('#stdsubmit')).click(); + await driver.sleep(5000); + console.log('----->| NEXT ACTION: Clicked Search button'); + + //Wait for confirm dialog to appear + const alert = await driver.wait(until.alertIsPresent(), 5000); + console.log('----->| NEXT ACTION: Alert dialog appeared as expected'); + + //Get alert text + const alertText = await alert.getText(); + + //Validate alert message text + const expectedText = 'You must select a grade'; + if (alertText === expectedText) { + console.log('Passed: Alert dialog text matched as expected'); + } else { + errors.push(`Expected: "${expectedText}"; Actual: "${alertText}"`); + } + + //Throw summary before dismissing if errors found + if (errors.length > 0) { + await alert.dismiss(); //Cancel the delete if validation failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + + //Accept the alert (click OK) to proceed with deletion + await alert.accept(); + console.log('----->| NEXT ACTION: Clicked alert message OK button'); + await driver.sleep(2000); + } + }, + + //NEXT ACTION + { + description: 'Select grade', + action: async () => { + //Select "9" from dropdown + await driver.findElement(By.css('#selectGrade')).click(); + await driver.sleep(2000); + await driver.findElement(By.css('#selectGrade > option:nth-child(11)')).click(); + + console.log('----->| NEXT ACTION: Selected grade: 9'); + }, + }, + + //Show Correlations From dropdown + { + description: 'Validate Show Correlations From dropdown list and value', + action: async () => { + const multipleChecks = 'Show Correlations From dropdown list'; + + //Locate and validate selected (collapsed) value + const dropdownButton = await driver.findElement( + By.css('button.multiselect.dropdown-toggle') + ); + + const selectedOption = await driver.findElement(By.css('#browse-standards > div:nth-child(3) > div > div > div:nth-child(3) > div > div > button > span')); + + //Get text, font, size, and color + const elementText = await selectedOption.getText(''); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + //text + if (elementText === 'All Content Sets') { + console.log("Passed: All Content Sets default option matched as expected"); + } else { + errors.push(`Expected option: "All Content Sets"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: All Content Sets default text font-family matched as expected'); + } else { + errors.push(`Expected: All Content Sets default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '16px') { + console.log('Passed: All Content Sets default text font-size matched as expected'); + } else { + errors.push(`Expected: All Content Sets default text font-size "16px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: All Content Sets default text color matched as expected'); + } else { + errors.push(`Expected: All Content Sets default text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); } //Open dropdown - console.log('----->| NEXT ACTION: Clicked All Content Sets dropdown'); - await driver.findElement(By.css('.col-sm-10 .multiselect-selected-text')).click(); + await driver.findElement(By.css('.col-sm-12 .multiselect-selected-text')).click(); await driver.sleep(2000); + console.log('----->| NEXT ACTION: Clicked Show Correlations From dropdown'); //Wait for dropdown list to become visible const dropdownMenu = await driver.wait( @@ -4343,25 +7231,29 @@ const steps = [ const expectedOptions = [ 'Select all', - 'Demo - User Submitted Content', - 'Upload Demo', - 'Exploring - Access', - 'Exploring - PowerPoint', - 'Exploring - Word', - 'Algebra - QA', - 'Biology - QA', - 'English II - QA', - 'Geometry - QA', - 'US History - QA', - 'Import Align - Concept Based', - 'Import Align - Direct Align', - 'Im Creating Content', + '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', - 'Import testing 3', - 'New Frame Delete Test', - 'ECS-2952 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', + 'Post NIght July26' ]; + //Track all errors const errors = []; //Length validation @@ -4380,103 +7272,25 @@ const steps = [ } }); - //Fail once, list everything - if (errors.length > 0) { - throw new Error(errors.join('\n')); - } + //Select "Algebra" from dropdown + //Runs even if validation above already failed — errors are thrown after this, + //so log order does not reflect when the failing check actually ran + await driver.findElement(By.css('.show > li:nth-child(5) input')).click(); + await driver.sleep(2000); - //Click away to close list - await driver.findElement(By.css('.mt-2 > .col-sm-10')).click(); - console.log('Passed: Show Correlations From dropdown list matched as expected'); - } - }, + console.log('----->| NEXT ACTION: Selected correlation: Algebra'); - //Term Search From label text - { - description: 'Validate Term Search From label text', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(12) > .col-sm-2')).getText(); - if (elementText === 'Term Search') { - console.log('Passed: Term Search label text matched as expected'); - } else { - throw new Error(`Expected: "Term Search" label text; Actual: "${elementText}"`); - } - } - }, - - //Term Search placeholder - { - description: 'Validate Term Search placeholder', - action: async () => { - const elementValue = await driver.findElement(By.css('#searchTerm')).getAttribute('placeholder'); - if (elementValue === '') { - console.log('Passed: Term Search "blank" placeholder text, matched as expected'); - } else { - throw new Error(`Expected: Term Search "blank" placeholder text; Actual: "${elementValue}"`); - } - } - }, - - //Include Related Standards checkbox - { - description: 'Validate Include Related Standards checkbox', - action: async () => { - const elementOption = await driver.findElement(By.css('#doRel')).getAttribute('type'); - if (elementOption === 'checkbox') { - console.log('Passed: Include Related Standards checkbox type matched as expected'); - } else { - throw new Error(`Include Related Standards checkbox type did not match; Actual: "${elementOption}"`); - } - } - }, - - //Include Related Standards label text - { - description: 'Validate Include Related Standards label text', - action: async () => { - const elementText = await driver.findElement(By.css('.col-sm-offset-2 > label')).getText(); - if (elementText === 'Include Related Standards') { - console.log('Passed: Include Related Standards label text matched as expected'); - } else { - throw new Error(`Expected: "Include Related Standards" label text; Actual: "${elementText}"`); - } - } - }, - - //Search button - { - description: 'Validate Search button icon, text, and color', - action: async () => { - const element = await driver.findElement(By.css('#stdsubmit')); - - //Get text, color, and icon - const elementText = await element.getAttribute('value'); - const elementColor = await element.getCssValue('background-color'); - - //Track all errors - const errors = []; - - //Validate text - if (elementText === 'Search') { - console.log('Passed: Search button text matched as expected'); - } else { - const message = `Expected: Button text "Search"; Actual: "${elementText}"`; - errors.push(message); - } - - //Validate color -green - if (elementColor === 'rgba(48, 200, 172, 1)') { - console.log('Passed: Search button color matched as expected'); - } else { - const message = `Expected: Search button color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`; - errors.push(message); - } + //Click away to close dropdown using executeScript to bypass interception + await driver.executeScript(` + document.querySelector('.col-sm-12 .multiselect-selected-text').click(); + `); + await driver.sleep(2000); //Throw summary if any validation failed if (errors.length > 0) { //Add summary line only when multiple checks failed if (errors.length > 1) { - errors.unshift('Multiple validation checks did not pass'); + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); } //Throw collected messages — catch() will prefix with "FAILED:" @@ -4485,254 +7299,612 @@ const steps = [ } }, - //NEXT ACTION - Alert DIV -Validation + //Related Standards options { - description: 'Click search button without selecting any values and validate assert message', + description: 'Validate Include Related Standards options are hidden', action: async () => { - const searchButton = await driver.wait( - until.elementLocated(By.css('#stdsubmit')), - 5000 - ); - - await searchButton.click(); - console.log('----->| NEXT ACTION: Clicked Search button'); - - const expected = 'You must select a grade'; - let alertText; - - try { - const alert = await driver.wait(until.alertIsPresent(), 5000); - alertText = (await alert.getText()).trim(); - - //close alert before leaving try block - await alert.accept(); - console.log('----->| NEXT ACTION: Clicked alert OK option'); - } catch (err) { - throw new Error(`Failed while handling alert: ${err.message}`); - } - - if (alertText === expected) { - console.log('Passed: Alert text matched as expected'); - } else { - throw new Error( - `Alert text did not match: \n Expected: "${expected}"\n Actual: "${alertText}"` - ); - } - } - }, - - //NEXT ACTION - Click Include Related Standards checkbox - { - description: 'Dashboard - Click Include Related Standards checkbox', - action: async () => { - console.log('----->| NEXT ACTION: Clicked Inclued Related Standards checkbox'); - await driver.findElement(By.css('#doRel')).click(); - } - }, - - //Wait for element - { - description: 'Wait for DIV to be visible', - action: async () => { - - //Wait until the element exists in the DOM - const elementVisible = await driver.wait( - until.elementLocated(By.css('.col-auto .multiselect-selected-text')), - 20000 - ); - - //Wait until it becomes visible - await driver.wait( - until.elementIsVisible(elementVisible), - 20000 - ); - await driver.sleep(2000); - } - }, - - //None Selected dropdown - - //based on label text - { - description: 'Validate based on label text', - action: async () => { - const elementText = await driver.findElement(By.css('.col-auto:nth-child(2)')).getText(); - if (elementText === 'based on') { - console.log('Passed: based on label text matched as expected'); - } else { - throw new Error(`Expected: "based on" label text; Actual: "${elementText}"`); - } - } - }, - - //best match dropdown - - //Question icon - - //Asterisk text, family font, and font size - { - description: 'Validate Asterisk text, family font, and size', - action: async () => { - const element = await driver.findElement(By.css('em')); - - //Get text, color, and size - const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); - const elementSize = await element.getCssValue('font-size'); - - //Track all errors + const multipleChecks = 'Include Related Standards labels and dropdowns are hidden'; const errors = []; - //Validate text = - if (elementText === '** note - including related standards may cause increased page load times') { - console.log("Passed: *Note text matched as expected"); + const visibility = await driver.executeScript(` + const elementRelStdnt = document.querySelector('#relsel'); + if (!elementRelStdnt) return { found: false }; + const style = window.getComputedStyle(elementRelStdnt); + return { + found: true, + hidden: style.display === 'none', + display: style.display + }; + `); + //console.log('----->| DEBUG RelStdnt visibility:', JSON.stringify(visibility)); + + //Both label and dropdown are inside the same hideGrade div + //so we only need to check the parent container once + if (visibility.found && visibility.hidden) { + console.log('Passed: Related Standards dropdown is hidden as expected'); + console.log('Passed: Best Match dropdown is hidden as expected'); } else { - const message = `Expected: "** note - including related standards may cause increased page load times"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: Related Standards and Best Match dropdowns to be hidden; Actual: display="${visibility.display}"`); } - //Validate color -navy blue - if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: Browse page - Browse standards sub-title text color matched as expected'); - } else { - const message = `Expected: Browse page - Browse standards sub-title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; - errors.push(message); - } - - //Validate font size - if (elementSize === '10.4px') { - console.log('Passed: Browse page - Browse standards sub-title text font-size matched as expected'); - } else { - const message = `Expected: Browse page - Browse standards sub-title text font-size "10.4px"; Actual: "${elementSize}"`; - errors.push(message); - } - - //Throw once at the end (no additional console logs here) + //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')); } } }, - //Alert DIV -Validation + //NEXT ACTION { - description: 'Click search button without selecting any values and validate assert message', + description: 'Select Include Related Standards checkbox', action: async () => { - const searchButton = await driver.wait( - until.elementLocated(By.css('#stdsubmit')), - 5000 - ); + await driver.findElement(By.css('#doRel')).click(); + await driver.sleep(2000); + console.log('----->| NEXT ACTION: Clicked Include Related Standards checkbox'); - await searchButton.click(); + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.col-auto .multiselect-selected-text')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Related Standards dropdown did not become visible within 20 seconds'); + + console.log('Passed: Related Standards dropdown loaded successfully'); + } + }, + + //NEXT ACTION + { + description: 'Validate alert message', + action: async () => { + const multipleChecks = 'Validate alert message'; + const errors = []; + + //Click delete button + const element = await driver.findElement(By.css('#stdsubmit')).click(); + await driver.sleep(5000); console.log('----->| NEXT ACTION: Clicked Search button'); - const expected = 'You must select at least one set of related standards'; - let alertText; + //Wait for confirm dialog to appear + const alert = await driver.wait(until.alertIsPresent(), 5000); + console.log('----->| NEXT ACTION: Alert dialog appeared as expected'); - try { - const alert = await driver.wait(until.alertIsPresent(), 5000); - alertText = (await alert.getText()).trim(); + //Get alert text + const alertText = await alert.getText(); - //close alert before leaving try block - await alert.accept(); - console.log('----->| NEXT ACTION: Clicked alert OK option'); - } catch (err) { - throw new Error(`Failed while handling alert: ${err.message}`); + //Validate alert message text + const expectedText = 'You must select at least one set of related standards'; + if (alertText === expectedText) { + console.log('Passed: Alert dialog text matched as expected'); + } else { + errors.push(`Expected: "${expectedText}"; Actual: "${alertText}"`); } - if (alertText === expected) { - console.log('Passed: Alert text matched as expected'); + //Throw summary before dismissing if errors found + if (errors.length > 0) { + await alert.dismiss(); //Cancel the delete if validation failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + + //Accept the alert (click OK) to proceed with deletion + await alert.accept(); + console.log('----->| NEXT ACTION: Clicked alert message OK button'); + await driver.sleep(2000); + } + }, + + //Related Standards dropdown + { + description: 'Validate Related Standards dropdown list and value', + action: async () => { + const multipleChecks = 'Related Standards dropdown list'; + + //Locate and validate selected (collapsed) value + const dropdownButton = await driver.findElement( + By.css('.col-auto .multiselect-selected-text') + ); + + //Open dropdown - use the element directly, not findElement again + await dropdownButton.click(); + await driver.sleep(2000); + console.log('----->| NEXT ACTION: Clicked Related Standards dropdown'); + + //Track all errors + const errors = []; + + //Get text, font, size, and color + const elementText = await dropdownButton.getText(); + const elementFont = await dropdownButton.getCssValue('font-family'); + const elementSize = await dropdownButton.getCssValue('font-size'); + const elementColor = await dropdownButton.getCssValue('color'); + + //text + if (elementText === 'None Selected') { + console.log("Passed: None Selected default option matched as expected"); } else { - throw new Error( - `Alert text did not match: \n Expected: "${expected}"\n Actual: "${alertText}"` + errors.push(`Expected option: "None Selected"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: None Selected default text font-family matched as expected'); + } else { + errors.push(`Expected: None Selected default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '16px') { + console.log('Passed: None Selected default text font-size matched as expected'); + } else { + errors.push(`Expected: None Selected default text font-size "16px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: None Selected default text color matched as expected'); + } else { + errors.push(`Expected: None Selected default text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //Wait for dropdown list to become visible + const dropdownMenu = await driver.wait( + until.elementLocated(By.css('ul.multiselect-container.dropdown-menu.show')), + 10000 + ); + + await driver.wait( + until.elementIsVisible(dropdownMenu), + 10000 + ); + + //Now safely get option labels + const optionLabels = await dropdownMenu.findElements( + By.css('li label.checkbox') + ); + + //Extract list values + const actualOptions = []; + for (const label of optionLabels) { + const text = (await label.getText()).trim(); + if (text) { + actualOptions.push(text); + } + } + + const expectedOptions = [ + 'Select all', + 'Alabama', + 'Arizona', + 'California', + 'Florida', + 'Georgia', + 'Illinois', + 'New York', + 'Texas', + 'Washington', + 'Common Core State Standards', + 'Alberta Standards', + 'Ontario Curriculum', + 'Australian Curriculum (ACARA) v8', + 'New South Wales', + 'NCSSFL-ACTFL CAN-DO STATEMENTS', + 'WIDA Consortium (2020)', + '5th Grade Import ECS-2732', + 'Imported Framework Updated', + 'ECS-2933 Testing On Prod', + 'Widget Test', + 'California Mathematics 1997', + 'Georgia Archived Language Arts QA', + 'Georgia Current Language Arts QA', + 'Georgia Future Language Arts QA', + 'create group test', + 'IMport Test' + ]; + + //Length validation + if (actualOptions.length !== expectedOptions.length) { + errors.push( + `Expected option count ${expectedOptions.length}; Actual ${actualOptions.length}` ); } + + //Value-by-value validation + expectedOptions.forEach((expected, i) => { + if (actualOptions[i] !== expected) { + errors.push( + `Index ${i}: Expected "${expected}", Actual "${actualOptions[i]}"` + ); + } + }); + + //Select "Washington" from dropdown + await driver.findElement(By.css('.show > li:nth-child(12) input')).click(); + await driver.sleep(2000); + + //Select "Common Core State Standards" from dropdown + await driver.findElement(By.css('.show > li:nth-child(14) input')).click(); + await driver.sleep(2000); + + //Select "California Mathematics 1997" from dropdown + await driver.findElement(By.css('.show > li:nth-child(32) input')).click(); + await driver.sleep(2000); + + console.log('----->| NEXT ACTION: Selected Related Standards: Washington, Common Core State Standards, California Mathematics 1997'); + + //Click away to close dropdown using executeScript to bypass interception + await driver.executeScript(` + document.querySelector('.col-auto .multiselect-selected-text').click(); + `); + await driver.sleep(2000); + + //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')); + } } }, - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //LOG OUT - //NEXT ACTION - Log out + //Selected Related Standards dropdown value { - description: 'Log out of EXACT', + description: 'Validate Show Correlations From dropdown value', action: async () => { - //Profile link - await driver.findElement(By.css('#navbarDropdown > span')).click(); - await driver.sleep(1000); - //Log Out - await driver.findElement(By.linkText('Log Out')).click(); - console.log('----->| NEXT ACTION: Clicked User Profile and Logged out'); - await driver.sleep(1000); + const multipleChecks = 'Show Correlations From dropdown value'; + const selectedOption = await driver.findElement(By.css('.col-auto .multiselect-selected-text')); + + //Get text, font, size, and color + const elementText = await selectedOption.getText(''); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Washington , Common Core State Standards , California Mathematics 1997') { + console.log("Passed: Selected Content Sets dropdown options matched as expected"); + } else { + errors.push(`Expected option: "Washington , Common Core State Standards , California Mathematics 1997"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Selected Content Sets dropdown text font-family matched as expected'); + } else { + errors.push(`Expected: Selected Content Sets dropdown text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '16px') { + console.log('Passed: Selected Content Sets dropdown text font-size matched as expected'); + } else { + errors.push(`Expected: Selected Content Sets dropdown text font-size "16px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Selected Content Sets dropdown text color matched as expected'); + } else { + errors.push(`Expected: Selected Content Sets dropdown text color "rgba(33, 37, 41, 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')); + } } }, - //Wait for page to load + //based on { - description: 'Wait for page to fully load', + description: 'Validate based on label text, font, size, and color', action: async () => { + const multipleChecks = 'based on label'; + const element = await driver.findElement(By.css('.col-auto:nth-child(2)')); - //Wait until the element exists in the DOM - const loginButton = await driver.wait( - until.elementLocated(By.css('.login')), - 20000 - ); + //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'); - //Wait until it becomes visible - await driver.wait( - until.elementIsVisible(loginButton), - 20000 - ); + //Track all errors + const errors = []; + //text + if (elementText === 'based on') { + console.log("Passed: based on label text matched as expected"); + } else { + errors.push(`Expected: "based on" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: based on label font-family matched as expected'); + } else { + errors.push(`Expected: based on label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: based on label text font-size matched as expected'); + } else { + errors.push(`Expected: based on label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: based on label text color matched as expected'); + } else { + errors.push(`Expected: based on 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')); + } + } + }, + + //best match dropdown + { + description: 'Validate best match dropdown list and value', + action: async () => { + const multipleChecks = 'best match Dropdown List'; + const select = await driver.findElement(By.css('.custom-select')); + + //Get text, font, size, and color + const selectedOption = await select.findElement(By.css('option:checked')); + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + //text + if (elementText === 'best match') { + console.log("Passed: best match default option matched as expected"); + } else { + errors.push(`Expected option: "best match"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: best match default text font-family matched as expected'); + } else { + errors.push(`Expected: best match default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: best match default text font-size matched as expected'); + } else { + errors.push(`Expected: best match default text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: best match default text color matched as expected'); + } else { + errors.push(`Expected: best match default text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const options = await select.findElements(By.css('option')); + const expectedList = [ + 'best match', + 'similar text', + 'like concepts' + ]; + const actual = []; + + //Track all errors + const errors = []; + + for (const opt of options) { + const text = (await opt.getText()).trim(); + actual.push(text); + } + + if (JSON.stringify(actual) === JSON.stringify(expectedList)) { + console.log('Passed: best match Dropdown list matched as expected'); + } else { + errors.push(`Expected: best match Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //Include Related Standards info icon | SPECIAL CASE {title data-original-title} + { + description: 'Validate info icon', + action: async () => { + const multipleChecks = 'info icon'; + const errors = []; + + //Get both text and styles in one executeScript call + const result = await driver.executeScript(` + const el = document.querySelector('[data-toggle="tooltip"][data-placement="right"]'); + if (!el) return null; + const style = window.getComputedStyle(el); + return { + tooltipText: el.getAttribute('data-original-title'), + fontFamily: style.getPropertyValue('font-family'), + fontSize: style.getPropertyValue('font-size'), + color: style.getPropertyValue('color'), + backgroundColor: style.getPropertyValue('background-color') + }; + `); + //console.log('----->| DEBUG result:', JSON.stringify(result)); + + //text + if (result.tooltipText === '"best match" uses a combination of similar text and like concepts') { + console.log('Passed: Tooltip text matched as expected'); + } else { + errors.push(`Expected: Tooltip text: '"best match" uses a combination of similar text and like concepts'; Actual: "${result.tooltipText}"`); + } + + //font + if (result.fontFamily === 'Poppins, sans-serif') { + console.log('Passed: Info icon text font-family matched as expected'); + } else { + errors.push(`Expected: Info icon font-family "Poppins, sans-serif"; Actual: "${result.fontFamily}"`); + } + + //size + if (result.fontSize === '13px') { + console.log('Passed: Info icon text font-size matched as expected'); + } else { + errors.push(`Expected: Info icon font-size "13px"; Actual: "${result.fontSize}"`); + } + + //color + if (result.color === 'rgb(40, 39, 90)') { + console.log('Passed: Info icon text color matched as expected'); + } else { + errors.push(`Expected: Info icon color rgb(40, 39, 90)"; Actual: "${result.color}"`); + } + + //background-color + if (result.backgroundColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Info icon background-color matched as expected'); + } else { + errors.push(`Expected: Info icon background-color "rgba(0, 0, 0, 0)"; Actual: "${result.backgroundColor}"`); + } + + //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')); + } + } + }, + + //note + { + description: 'Validate note text, font, size, and color', + action: async () => { + const multipleChecks = 'note label'; + const element = await driver.findElement(By.css('em')); + + //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 === '** note - including related standards may cause increased page load times') { + console.log("Passed: ** note text matched as expected"); + } else { + errors.push(`Expected: "** note - including related standards may cause increased page load times" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: ** note text font-family matched as expected'); + } else { + errors.push(`Expected: ** note text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '10.4px') { + console.log('Passed: ** note text font-size matched as expected'); + } else { + errors.push(`Expected: **n ote text font-size "10.4px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: ** note text color matched as expected'); + } else { + errors.push(`Expected: ** note text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + errors.push(message) + } + + //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 Search button', + action: async () => { + await driver.findElement(By.css('#stdsubmit')).click(); + console.log('----->| NEXT ACTION: Clicked Search button'); + + //Wait for page to load completely await driver.wait(async () => { const readyState = await driver.executeScript('return document.readyState'); return readyState === 'complete'; - }, 30000, 'ExACT landing page did not fully load within 30 seconds'); + }, 30000, 'Standards search page did not fully load within 30 seconds'); + console.log('Passed: Standards Search Page loaded successfully'); - console.log('----------------->| LOGGED OUT SUCCESSFULLY |<-----------------'); - await driver.sleep(5000); + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Standards breadcrumb label did not become visible within 20 seconds'); + + console.log('Passed: Standards breadcrumb label loaded successfully'); } }, + + ...myStandardsSearch_AlignedContent(driver), + ]; const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => { @@ -4761,7 +7933,7 @@ const clearOldResults = () => { fs.mkdirSync(screenshotDir, { recursive: true }); //Remove old Excel file - if (fs.existsSync('dashboardMyStandardsResultsResults.xlsx')) { + if (fs.existsSync('dashboardMyStandardsResults.xlsx')) { fs.unlinkSync('dashboardMyStandardsResults.xlsx'); } }; @@ -4782,26 +7954,24 @@ try { 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 - ); + try { + await step.action(); + worksheet = logStep( + worksheet, + step.description, + 'Passed', + stepIndex, + timestamp, + null + ); } catch (error) { - //Only take screenshot if the step fails const screenshotPath = await takeScreenshot( driver, stepIndex, @@ -4818,19 +7988,21 @@ try { ); console.error(`Step ${stepIndex} FAILED: ${error.message}`); + failedSteps.push(`Step ${stepIndex}: ${step.description} - ${error.message}`); //Track failed step testStatus = 'Failed'; allStepsPassed = false; } } - //Check if log out was successful - const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); - - if (loginButton && allStepsPassed) { - console.log('PASSED: My Standards Widget(ExACT_dashboardMyStandards); All test steps completed successfully'); + if (allStepsPassed) { + console.log('------------->| THE END |<-------------'); + console.log('PASSED: DASHBOARD - My Standards Widget (dashboardMyStandards); All test steps completed successfully'); testStatus = 'Passed'; } else { - console.log('FAILED: My Standards Widget(ExACT_dashboardMyStandards); One or more test steps failed'); + console.log('------------->| THE END |<-------------'); + console.log('FAILED: DASHBOARD - My Standards Widget (dashboardMyStandards); One or more test steps failed'); + console.log('FAILED STEPS:'); + failedSteps.forEach(step => console.error(` ✗ ${step}`)); testStatus = 'Failed'; } @@ -4844,7 +8016,7 @@ try { } finally { await driver.quit(); } -})(); + })(); } -export default ExACT_dashboardMyStandards; +export default dashboardMyStandards; diff --git a/tests/ExACT_dashboardSemanticStandardsComparison.js b/tests/ExACT_dashboardSemanticStandardsComparison.js index 249eab8..ab4cf11 100644 --- a/tests/ExACT_dashboardSemanticStandardsComparison.js +++ b/tests/ExACT_dashboardSemanticStandardsComparison.js @@ -55,10 +55,11 @@ const steps = [ action: async () => { const element = await driver.findElement(By.css('.e-heading')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; @@ -71,6 +72,14 @@ const steps = [ errors.push(message); } + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Dashboard - Page title text font matched as expected'); + } else { + const message = `Expected: Dashboard - Page title text font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + //Validate color -navy blue if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Dashboard - Page title text color matched as expected'); @@ -122,10 +131,11 @@ const steps = [ action: async () => { const element = await driver.findElement(By.css('.standards-compare h2')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; @@ -138,6 +148,22 @@ const steps = [ errors.push(message); } + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title font matched as expected'); + } else { + const message = `Expected: Dashboard - Semantic Standards Comparison Widget title font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + + //Validate size + if (elementSize === '18px') { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-size matched as expected'); + } else { + const message = `Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "18px"; Actual: "${elementSize}"`; + errors.push(message); + } + //Validate color -navy blue if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected'); @@ -173,10 +199,11 @@ const steps = [ action: async () => { const element = await driver.findElement(By.css('#sscMap-tab')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; @@ -189,6 +216,14 @@ const steps = [ errors.push(message); } + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Dashboard - National Standards tab title font matched as expected'); + } else { + const message = `Expected: Dashboard - National Standards tab title font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + //Validate color -navy blue if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Dashboard - National Standards tab title text color matched as expected'); @@ -224,10 +259,11 @@ const steps = [ action: async () => { const element = await driver.findElement(By.css('#sscFilterLaunch-tab')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; @@ -240,6 +276,14 @@ const steps = [ errors.push(message); } + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Dashboard - Custom Comparison tab title font matched as expected'); + } else { + const message = `Expected: Dashboard - Custom Comparison tab title font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + //Validate color -gray if (elementColor === 'rgba(182, 186, 181, 1)') { console.log('Passed: Dashboard - Custom Comparison tab title color matched as expected'); @@ -413,16 +457,17 @@ const steps = [ } }, - //Dashboard - National Standards tab title, text, and font size (dimmed) + //National Standards tab title, text, and font size (dimmed) { - description: 'Validate Dashboard - National Standards tab title text, color, and size', + description: 'Validate National Standards tab title text, color, and size', action: async () => { const element = await driver.findElement(By.css('#sscMap-tab')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; @@ -435,6 +480,14 @@ const steps = [ errors.push(message); } + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Dashboard - National Standards tab title font matched as expected'); + } else { + const message = `Expected: Dashboard - National Standards tab title font "Poppins, sans-serif"; Actual: "${elementFont}"`; + errors.push(message); + } + //Validate color -gray if (elementColor === 'rgba(182, 186, 181, 1)') { console.log('Passed: Dashboard - National Standards tab title text color matched as expected'); @@ -464,41 +517,50 @@ const steps = [ } }, - //Dashboard - Custom Comparison tab title and color (active) + //Custom Comparison tab title and color (active) { - description: 'Validate Dashboard - Custom Comparison tab title, text color, and size', + description: 'Validate Custom Comparison tab title, text color, and size', action: async () => { const element = await driver.findElement(By.css('#sscFilterLaunch-tab')); - //Get text, color, and size + //Get text, font, size, and color const elementText = await element.getText(); - const elementColor = await element.getCssValue('color'); + 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 = []; //Validate text if (elementText === 'Custom Comparison') { - console.log('Passed: Dashboard - Custom Comparison tab title matched as expected'); + console.log('Passed: Custom Comparison tab title matched as expected'); } else { - const message = `Expected: Dashboard - "Custom Comparison" tab title; Actual: "${elementText}"`; + const message = `Expected: "Custom Comparison" tab title; Actual: "${elementText}"`; + errors.push(message); + } + + //Validate font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Custom Comparison tab title font matched as expected'); + } else { + const message = `Expected: Custom Comparison tab title font "Poppins, sans-serif"; Actual: "${elementFont}"`; errors.push(message); } //Validate color -navy blue if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: Dashboard - Custom Comparison tab title color matched as expected'); + console.log('Passed: Custom Comparison tab title color matched as expected'); } else { - const message = `Expected: Dashboard - Custom Comparison tab title color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; + const message = `Expected: Custom Comparison tab title color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; errors.push(message); } //Validate font size if (elementSize === '15px') { - console.log('Passed: Dashboard - Custom Comparison tab title font size matched as expected'); + console.log('Passed: Custom Comparison tab title font size matched as expected'); } else { - const message = `Expected: Dashboard - Custom Comparison tab title font size "15px"; Actual: "${elementSize}"`; + const message = `Expected: Custom Comparison tab title font size "15px"; Actual: "${elementSize}"`; errors.push(message); } @@ -522,9 +584,9 @@ const steps = [ const elementText = await driver.findElement(By.css('#sscFilterLaunchPane > div > div')).getText(); if (elementText === `EdGate's advanced analysis tool provides semantic similarities, differences, and gaps across different state or organizational standards. Our advanced text analysis calculates semantic matches and provides a comprehensive comparison dataset for your team to make informed decisions faster and more effectively.`) { - console.log("Passed: Dashboard - Custom Comparison info text matched as expected"); + console.log("Passed: Custom Comparison - info text matched as expected"); } else { - throw new Error(`Expected: Dashboard - "Custom Comparison info text did not match"; Actual: "${elementText}"`); + throw new Error(`Expected: Custom Comparison - "Custom Comparison info text did not match"; Actual: "${elementText}"`); } } }, @@ -558,25 +620,25 @@ const steps = [ //Validate text if (elementText === 'Get Started') { - console.log('Passed: Dashboard - Get Started button text matched as expected'); + console.log('Passed: Custom Comparison - Get Started button text matched as expected'); } else { - const message = `Expected: Dashboard - "Get Started" button text; Actual: "${elementText}"`; + const message = `Expected: Custom Comparison - "Get Started" button text; Actual: "${elementText}"`; errors.push(message); } //Validate color -green if (elementColor === 'rgba(48, 200, 172, 1)') { - console.log('Passed: Dashboard - Get Started button color matched as expected'); + console.log('Passed: Custom Comparison - Get Started button color matched as expected'); } else { - const message = `Expected: Dashboard - Get Started button color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`; + const message = `Expected: Custom Comparison - Get Started button color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`; errors.push(message); } //Validate button icon is present if (icon) { - console.log('Passed: Dashboard - Get Started button icon is present'); + console.log('Passed: Custom Comparison - Get Started button icon is present'); } else { - const message = 'Expected: Dashboard - Get Started button icon not found'; + const message = 'Expected: Custom Comparison - Get Started button icon not found'; errors.push(message); } @@ -621,9 +683,9 @@ const steps = [ } }, - //Dashboard - National Standards tab title, text, and font size (active) + //Custom Comparison - National Standards tab title, text, and font size (active) { - description: 'Validate Dashboard - National Standards tab title text, color, and size', + description: 'Validate Custom Comparison - National Standards tab title text, color, and size', action: async () => { const element = await driver.findElement(By.css('#sscMap-tab')); @@ -637,25 +699,25 @@ const steps = [ //Validate text if (elementText === 'National Standards') { - console.log('Passed: Dashboard - National Standards tab title matched as expected'); + console.log('Passed: Custom Comparison - National Standards tab title matched as expected'); } else { - const message = `Expected: Dashboard - "National Standards"; Actual: "${elementText}"`; + const message = `Expected: Custom Comparison - "National Standards"; Actual: "${elementText}"`; errors.push(message); } //Validate color -navy blue if (elementColor === 'rgba(40, 39, 90, 1)') { - console.log('Passed: Dashboard - National Standards tab title text color matched as expected'); + console.log('Passed: Custom Comparison - National Standards tab title text color matched as expected'); } else { - const message = `Expected: Dashboard - National Standards tab title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; + const message = `Expected: Custom Comparison - National Standards tab title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`; errors.push(message); } //Validate font size if (elementSize === '15px') { - console.log('Passed: Dashboard - National Standards tab title text font-size matched as expected'); + console.log('Passed: Custom Comparison - National Standards tab title text font-size matched as expected'); } else { - const message = `Expected: Dashboard - National Standards tab title text font-size "15px"; Actual: "${elementSize}"`; + const message = `Expected: Custom Comparison - National Standards tab title text font-size "15px"; Actual: "${elementSize}"`; errors.push(message); } @@ -672,9 +734,9 @@ const steps = [ } }, - //Dashboard - Custom Comparison tab title and color (dimmed) + //Custom Comparison - Custom Comparison tab title and color (dimmed) { - description: 'Validate Dashboard - Custom Comparison tab title, text color, and size', + description: 'Validate Custom Comparison - Custom Comparison tab title, text color, and size', action: async () => { const element = await driver.findElement(By.css('#sscFilterLaunch-tab')); @@ -688,25 +750,25 @@ const steps = [ //Validate text if (elementText === 'Custom Comparison') { - console.log('Passed: Dashboard - Custom Comparison tab title matched as expected'); + console.log('Passed: Custom Comparison - Custom Comparison tab title matched as expected'); } else { - const message = `Expected: Dashboard - "Custom Comparison" tab title; Actual: "${elementText}"`; + const message = `Expected: Custom Comparison - "Custom Comparison" tab title; Actual: "${elementText}"`; errors.push(message); } //Validate color -gray if (elementColor === 'rgba(182, 186, 181, 1)') { - console.log('Passed: Dashboard - Custom Comparison tab title color matched as expected'); + console.log('Passed: Custom Comparison - Custom Comparison tab title color matched as expected'); } else { - const message = `Expected: Dashboard - Custom Comparison tab title color "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`; + const message = `Expected: Custom Comparison - Custom Comparison tab title color "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`; errors.push(message); } //Validate font size if (elementSize === '15px') { - console.log('Passed: Dashboard - Custom Comparison tab title font size matched as expected'); + console.log('Passed: Custom Comparison - Custom Comparison tab title font size matched as expected'); } else { - const message = `Expected: Dashboard - Custom Comparison tab title font size "15px"; Actual: "${elementSize}"`; + const message = `Expected: Custom Comparison - Custom Comparison tab title font size "15px"; Actual: "${elementSize}"`; errors.push(message); } diff --git a/tests/ExACT_editItem.js b/tests/ExACT_editItem.js index 712e1d8..ef90ad6 100644 --- a/tests/ExACT_editItem.js +++ b/tests/ExACT_editItem.js @@ -1,2652 +1,16048 @@ -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'; +import { brotliCompress } from 'zlib'; const ExACT_editItem = (req, res) => { - res.send('

ExACT Automated Test Script - Edit Item(ExACT_editItem): Initiated

'); + res.send('

ExACT Automated Test Script: CONTENT - Edit Item (ExACT_editItem) | 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(); 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('------------->| EDIT ITEM |<-------------'); + 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: 'Validate 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 elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = 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}"`); } - console.log('Passed: Dashboard title matched as expected'); - } - }, - //Dashboard My Content Item Count - { - description: 'Validate Dashboard My Content Item Count', - action: async () => { - const elementText = await driver.findElement(By.css('#badge_content_total')).getText(); - if (elementText !== '3552 items') { - throw new Error(`Expected: "3552 items"; Actual: "${elementText}"`); + //font-family + if (elementTextFont === `"DM Serif Display", serif`) { + console.log('Passed: Dashboard title font matched as expected'); + } else { + errors.push(`Expected: Dashboard title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); } - console.log('Passed: Dashboard - My Content Item Count matched as expected'); - } - }, - //Biology-QA - { - description: 'Validate Biology-QA title', - action: async () => { - const elementText = await driver.findElement(By.linkText('Biology - QA')).getText(); - if (elementText !== 'Biology - QA') { - throw new Error(`Expected: "Biology - QA"; Actual: "${elementText}"`); + //font size + if (elementTextSize === '32px') { + console.log('Passed: Dashboard title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard title text font-size "32px"; Actual: "${elementTextSize}"`); } - console.log('Passed: Biology-QA link title matched as expected'); - } - }, - { - description: 'Validate Biology-QA edit icon color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .fa')).getCssValue('color'); - if (elementStyle !== 'rgba(73, 80, 87, 1)') { - throw new Error(`Biology-QA edit icon color did not match; Actual: "${elementStyle}"`); + //color + if (elementTextColor === '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: "${elementTextColor}"`); } - console.log('Passed: Bioloby-QA edit icon color matched as expected'); - } - }, - //Biology-QA Count - { - description: 'Validate Biology-QA Count', - action: async () => { - const elementText = await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .badge')).getText(); - if (elementText !== '1046') { - throw new Error(`Expected: "1046"; Actual: "${elementText}"`); - } - console.log('Passed: Biology-QA Count matched as expected'); - } - }, - - //NEXT ACTION - NAVIGATE TO CONTENT PAGE - { description: 'Click Biology - QA link', action: async () => await driver.findElement(By.linkText('Biology - QA')).click() }, - - //Wait for Biology - QA Content page to load - { - description: 'Wait for Content page load to completely', - action: async () => { - return await driver.wait(until.elementLocated(By.css('.float-left:nth-child(5)')), 10000).catch(() => false); - } - }, - - //Results 1-25 of 1046 label - { - description: 'Validate Results 1-25 of 1046 label', - action: async () => { - const elementText = await driver.findElement(By.css('.float-left:nth-child(5)')).getText(); - if (elementText !== 'Results 1 - 25 of 1046') { - throw new Error(`Expected: "Results 1 - 25 of 1046" label; Actual: "${elementText}"`); - } - console.log('Passed: Results 1 - 25 of 1046 label matched as expected'); - } - }, - - //CONTENT RESULTS - CONTENT ITEMS - //Content 1 Title - { - description: 'Validate Content 1 title', - action: async () => { - const elementText = await driver.findElement(By.linkText('AAA My Test III')).getText(); - if (elementText !== 'AAA My Test III') { - throw new Error(`Expected: Content 1 item "AAA My Test III" title; Actual: "${elementText}"`); - } - console.log('Passed: Content 1 item AAA My Test III tittle matched as expected'); - } - }, - - //Content 1 edit icon - { - description: 'Verify Content 1 edit icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.card:nth-child(8) .lo-title .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Content 1 edit icon not found'); - } - console.log('Passed: Content 1 edit icon present'); - } - }, - - //Content 1 edit button text - { - description: 'Validate Content 1 edit button text', - action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(8) .ml-3')).getText(); - if (elementText !== 'Edit') { - throw new Error(`Expected: Content 1 "Edit" button text; Actual: "${elementText}"`); - } - console.log('Passed: Content 1 Edit button text matched as expected'); - } - }, - - //Content 1 edit button color -green - { - description: 'Validate Content 1 Edit button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.card:nth-child(8) .ml-3')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Content 1 "Edit" button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Content 1 Edit button color matched as expected'); - } - }, - - //Content 1 description - { - description: 'Validate Content 1 description', - action: async () => { - try { - const element = await driver.findElement(By.css('.card:nth-child(8) .lo-descr')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'Yes, it should work! Perhaps'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: Content 1 description "${expectedText}" text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: Content 1 description "${expectedText}" text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); + //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`); } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } } }, - //Content 1 content set label + //MY CONTENT WIDGET + + //Dashboard My Content Widget title { - description: 'Validate Content 1 content set label', + description: 'Validate My Content widget title text, color, and size', action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(8) small')).getText(); - if (elementText !== 'Content Set: Biology - QA') { - throw new Error(`Expected: Content 1 content set label did not match; Actual: "${elementText}"`); + const multipleChecks = 'My Content widget title'; + const element = await driver.findElement(By.css('.h-100 h2:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'My Content') { + console.log('Passed: My Content widget title text matched as expected'); + } else { + errors.push(`Expected: "My Content"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: My Content widget title font matched as expected'); + } else { + errors.push(`Expected: My Content widget title font "Poppins, sans-serif", serif; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '18px') { + console.log('Passed: My Content widget title text font-size matched as expected'); + } else { + errors.push(`Expected: My Content widget title text font-size "18px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: My Content widget title text color matched as expected'); + } else { + errors.push(`Expected: My Content widget title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Content 1 content set label matched as expected'); } }, - //Content 1 alignment label + //My Content total item Count (SPECIAL CASE: with button) { - description: 'Validate Content 1 ECS Alignement label', + description: 'Validate My Content total item count', action: async () => { - const elementText = await driver.findElement(By.css('#alignstatuslink874454004 > .display-alignment')).getText(); - if (elementText !== 'Aligned (reset)') { - throw new Error(`Expected: Content 1 "Aligned (reset)" label did not match; Actual: "${elementText}"`); + const multipleChecks = 'My Content total item count'; + const element = await driver.findElement(By.css('#badge_content_total')); + + //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 === '3415 items') { + console.log('Passed: Total item count button text matched as expected'); + } else { + errors.push(`Expected: "3415 items"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Total item count button text font matched as expected'); + } else { + errors.push(`Expected: Total item count button text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13.5px') { + console.log('Passed: Total item count button text font-size matched as expected'); + } else { + errors.push(`Expected: Total item count button text font-size "13.5px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Total item count button text color matched as expected'); + } else { + errors.push(`Expected: Total item count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Total item count button background color matched as expected'); + } else { + errors.push(`Expected: Total item count button background color: "rgba(40, 39, 90, 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')); } - console.log('Passed: Content 1 Aligned (reset) label matched as expected'); } }, - //Content 1 alignment reset link + //NEXT ACTION { - description: 'Validate Content 1 Aligned (reset) reset link', + description: 'Click Biology content link', action: async () => { - const elementText = await driver.findElement(By.css('#alignstatuslink874454004 b')).getText(); - if (elementText !== 'reset') { - throw new Error(`Expected: Content 1 "Aligned (reset)" reset liink did not match; Actual: "${elementText}"`); - } - console.log('Passed: Content 1 Aligned (reset) reset link matched as expected'); + await driver.findElement(By.linkText('Biology')).click(); + console.log('----->| NEXT ACTION: Clicked Biology content link'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Biology content page did not fully load within 30 seconds'); + + //Wait until the element exists in the DOM + const filterResultsLabel = await driver.wait( + until.elementLocated(By.css('.well > b')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(filterResultsLabel), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Biology content page did not fully load within 30 seconds'); + console.log('Passed: Biology content page loaded successfully'); } }, - //Content 1 view standards button icon - { - description: 'Verify Content 1 View Standards button icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.card:nth-child(8) .well .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Content 1 "View Standards" button icon not found'); - } - console.log('Passed: Content 1 View Standards button icon present'); - } - }, + //Biology - Content Results page - //Content 1 view standards button text + //Content result card 3 title { - description: 'Validate Content 1 View Standards button text', + description: 'Validate Content result card 3 title', action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(8) .well > .btn')).getText(); - if (elementText !== 'View Standards') { - throw new Error(`Expected: Content 1 "View Standards" button text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Content result card 3 title'; + const element = await driver.findElement(By.linkText('4X4')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === '4X4') { + console.log('Passed: Content result card 3 title text matched as expected'); + } else { + errors.push(`Expected: Content result card 3 title: "4X4"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 3 title text font matched as expected'); + } else { + errors.push(`Expected: Content result card 3 title text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 3 title text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 3 title text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content result card 3 title text color matched as expected'); + } else { + errors.push(`Expected: Content result card 3 title text color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //url + if (elementURL === 'http://pulse.pharmacy.arizona.edu/9th_grade/culture_cycles/science/4X4.html') { + console.log('Passed: Content result card 3 URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 3 URL: "http://pulse.pharmacy.arizona.edu/9th_grade/culture_cycles/science/4X4.html"; Actual: "${elementURL}"`); + } + + //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: Content 1 View Standards button text matched as expected'); } }, - //Content 1 view standards button color -green + //Content result card 3 edit button { - description: 'Validate Content 1 view standards button color', + description: 'Validate Content result card 3 edit button', action: async () => { - const elementStyle = await driver.findElement(By.css('.card:nth-child(8) .well > .btn')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Content 1 "View Standards" button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Content result card 3 edit button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(10) .lo-title .fa')); + const element = await driver.findElement(By.css('.card:nth-child(10) .ml-3')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 3 button Edit icon is present'); + } else { + errors.push('Content result card 3 button "Edit" icon was not found'); + } + + //text + if (elementText === 'Edit') { + console.log('Passed: Content result card 3 Edit button text matched as expected'); + } else { + errors.push(`Expected: Content result card 3 button text: "Edit"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 3 Edit button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 3 Edit button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Content result card 3 Edit button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 3 Edit button text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 3 Edit button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 3 Edit button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 3 Edit button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 3 Edit 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')); } - console.log('Passed: Content 1 View Standards button color matched as expected'); } }, - //NEXT ACTION - VIEW STANDARDS DIV - { description: 'Click Content 1 Edit button', action: async () => await driver.findElement(By.css('.card:nth-child(8) .well > .btn')).click() }, + //Content result card 3 thumbnail + { + description: 'Verify Content result card 3 thumbnail', + action: async () => { + const multipleChecks = 'Content result card 3 thumbnail'; + const element = await driver.wait(until.elementLocated(By.css('#pub > div:nth-child(10) > div > div > div:nth-child(1) > a')), 5000).catch(() => false); + const elementURL = await element.getAttribute('href'); - //Wait for Edit page to open - Resource tab + //Track all errors + const errors = []; + + //thumbnail + if (element) { + console.log('Passed: Content result card 3 thumbnail present'); + } else { + errors.push('Content result card 3 thumbnail not found'); + } + + //url + if (elementURL === 'http://pulse.pharmacy.arizona.edu/9th_grade/culture_cycles/science/4X4.html') { + console.log('Passed: Content result card 3 thumbnail URL link matched as expected'); + } else { + errors.push(`Expected: Content result card 3 thumbnail URL: "http://pulse.pharmacy.arizona.edu/9th_grade/culture_cycles/science/4X4.html"; Actual: "${elementURL}"`); + } + + //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 result card 3 View Details button + { + description: 'Validate Content result card 3 View Details button', + action: async () => { + const multipleChecks = 'Content result card 3 View Details button'; + const element = await driver.findElement(By.css('.card:nth-child(10) > .card-body > div > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'View Details') { + console.log('Passed: Content result card 3 View Details button text matched as expected'); + } else { + errors.push(`Expected: Content result card 3 button text: "View Details"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 3 View Details button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 3 View Details button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 3 View Details button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 3 View Details button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 3 View Details button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 3 View Details button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 3 View Details button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 3 View Details 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')); + } + } + }, + + //Content result card 3 View Details - details (SPECIAL CASE: trim text) + { + description: 'Validate Content result card 3 View Details info', + action: async () => { + const multipleChecks = 'Content result card 3 View Details info'; + + //Track all errors + const errors = []; + + //Target the specific content div using the matching onclick ID + const contentText = await driver.executeScript(` + const viewDetailsBtn = document.querySelector('a[onclick*="content1162099585"]'); + if (!viewDetailsBtn) return 'button not found'; + const div = viewDetailsBtn.previousElementSibling; + if (!div) return 'div not found'; + return div.innerHTML + .replace(/
/gi, '\\n') + .replace(/<[^>]+>/g, '') + .trim(); + `); + //console.log('----->| DEBUG content text:', contentText); + + const expectedLines = [ + 'Alignment Status: Not Aligned', + 'Content Type: Lesson Plan', + 'Format: HTML', + 'Free or Fee: Free', + 'Grade Range: 8 to 12', + 'Language: English', + 'Level-On Target: 12', + 'Source: University of Arizona', + 'Subject(s): Science,Social Studies', + 'Target Audience: Teacher' + ]; + + const actualLines = contentText + .split('\n') + .map(line => line.trim()) + .filter(line => line !== ''); + + //console.log('----->| DEBUG actual lines:', JSON.stringify(actualLines)); + + for (const expectedLine of expectedLines) { + if (actualLines.includes(expectedLine)) { + console.log(`Passed: Content result card 3 details: ${expectedLine} text matched as expected`); + } else { + errors.push(`Expected: "${expectedLine}" text not found in content 1 details`); + } + } + + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + } + }, + + //Content result card 3 description + { + description: 'Validate Content result card 3 description', + action: async () => { + const multipleChecks = 'Content result card 3 description'; + const element = await driver.findElement(By.css('.card:nth-child(10) .lo-descr')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Extract the bare text node (everything that's not a tag) + const elementTrimmedText = await driver.executeScript(` + const el = arguments[0]; + for (const node of el.childNodes) { + if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) { + return node.textContent.trim(); + } + } + return null; + `, element); + + //Track all errors + const errors = []; + + //text + if (elementTrimmedText === 'In the previous lessons, students have considered first an article about new standards in groundwater arsenic levels and problems with compliance and the historical impact of arsenic. In this explain lesson, they are asked to generate 4 statements and 4 questions about arsenic based on these lessons. As the historical information is the most recent, and since the thrust of this learning cycle is to use arsenic as a focal point for discussions about groundwater, it will be useful to spend the first part of class revisiting the first article in light of what was learned in the explore lesson.') { + console.log('Passed: Content result card 3 description text found and matched as expected'); + } else { + errors.push(`Expected: Content result card 3 description text to contain: "In the previous lessons, students have considered first an article about new standards in groundwater arsenic levels and problems with compliance and the historical impact of arsenic. In this explain lesson, they are asked to generate 4 statements and 4 questions about arsenic based on these lessons. As the historical information is the most recent, and since the thrust of this learning cycle is to use arsenic as a focal point for discussions about groundwater, it will be useful to spend the first part of class revisiting the first article in light of what was learned in the explore lesson."; Actual: "${elementTrimmedText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 3 description text font matched as expected'); + } else { + errors.push(`Expected: Content result card 3 description text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 3 description text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 3 description text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 3 description text color matched as expected'); + } else { + errors.push(`Expected: Content result card 3 description text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 3 Content Set + { + description: 'Validate Content result card 3 Content Set', + action: async () => { + const multipleChecks = 'Content result card 3 Content Set'; + const element = await driver.findElement(By.css('.card:nth-child(10) small')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Set: Biology') { + console.log('Passed: Content result card 3 Content Set: Biology text matched as expected'); + } else { + errors.push(`Expected: Content result card 3: "Content Set: Biology"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 3 Content Set: Biology text font matched as expected'); + } else { + errors.push(`Expected: Content result card 3 Content Set: Biology text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '10.4px') { + console.log('Passed: Content result card 3 Content Set: Biology text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 3 Content Set: Biology text font-size "10.4px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 3 Content Set: Biology text color matched as expected'); + } else { + errors.push(`Expected: Content result card 3 Content Set: Biology text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 3 Alignment Status + { + description: 'Validate Content result card 3 Alignment Status', + action: async () => { + const multipleChecks = 'Content result card 3 Alignment Status'; + const element = await driver.findElement(By.css('#alignstatuslink1162099585 > .display-alignment')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Not Aligned') { + console.log('Passed: Content result card 3 Not Aligned text matched as expected'); + } else { + errors.push(`Expected: Content result card 3: "Not Aligned"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 3 Not Aligned text font matched as expected'); + } else { + errors.push(`Expected: Content result card 3 Not Aligned text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Content result card 3 Not Aligned text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 3 Not Aligned text font-size "13px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content result card 3 Not Aligned text color matched as expected'); + } else { + errors.push(`Expected: Content result card 3 Not Aligned text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 result card 3 View Standards button + { + description: 'Validate Content result card 3 View Standards button', + action: async () => { + const multipleChecks = 'Content result card 3 View Standards button'; + const elementIcon = await driver.findElement(By.css('.card:nth-child(10) .well .fa')); + const element = await driver.findElement(By.css('.card:nth-child(10) .well > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content result card 3 button View Standards icon is present'); + } else { + errors.push('Content result card 3 button "View Standards" icon was not found'); + } + + //text + if (elementText === 'View Standards') { + console.log('Passed: Content result card 3 View Standards button text matched as expected'); + } else { + errors.push(`Expected: Content result card 3 button text: "View Standards"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Content result card 3 View Standards button text font matched as expected'); + } else { + errors.push(`Expected: Content result card 3 View Standards button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Content result card 3 View Standards button text font-size matched as expected'); + } else { + errors.push(`Expected: Content result card 3 View Standards button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Content result card 3 View Standards button text color matched as expected'); + } else { + errors.push(`Expected: Content result card 3 View Standards button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content result card 3 View Standards button background color matched as expected'); + } else { + errors.push(`Expected: Content result card 3 View Standards 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')); + } + } + }, + + //NEXT ACTION { - description: 'Wait for Edit page to open', + description: 'Click Edit button', action: async () => { - return await driver.wait(until.elementLocated(By.css('.modal-title')), 5000).catch(() => false); - } - }, + await driver.findElement(By.css('.card:nth-child(10) .ml-3')).click(); + console.log('----->| NEXT ACTION: Clicked Content 4x4 Edit button'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Edit Item page did not fully load within 30 seconds'); - //Content 1 view standards DIV - { - description: 'Validate Standards DIV title text', - action: async () => { - const elementText = await driver.findElement(By.css('.modal-title')).getText(); - if (elementText !== 'View Standards') { - throw new Error(`Expected: Content 1 "View Standards" button text did not match; Actual: "${elementText}"`); - } - console.log('Passed: Content 1 View Standards button text matched as expected'); + //Wait until the element exists in the DOM + const pageTitle = await driver.wait( + until.elementLocated(By.css('#myModalLabel')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(pageTitle), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Edit Item page did not fully load within 30 seconds'); + console.log('Passed: Edit Item page loaded successfully'); } }, - //View standards x close icon color -red - { - description: 'Validate Content 1 View standards x icon color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.modal-header span')).getCssValue('color'); - if (elementStyle !== 'rgba(246, 60, 40, 1)') { - throw new Error(`Expected: Content 1 X icon color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Content 1 X icon color matched as expected'); - } - }, - - //Content 1 view standards DIV sub-title - { - description: 'Validate Standards DIV sub-title text', - action: async () => { - const elementText = await driver.findElement(By.css('.mb-1:nth-child(1)')).getText(); - if (elementText !== 'Please select which standards you wish to view:') { - throw new Error(`Expected: Content 1 "Please select which standards you wish to view" sub-title text did not match; Actual: "${elementText}"`); - } - console.log('Passed: Content 1 Please select which standards you wish to view: sub-title text matched as expected'); - } - }, - - //Content 1 view standards DIV label - { - description: 'Validate Standards DIV label', - action: async () => { - const elementText = await driver.findElement(By.css('label > b')).getText(); - if (elementText !== 'Standards') { - throw new Error(`Expected: Content 1 "Standards" label did not match; Actual: "${elementText}"`); - } - console.log('Passed: Content 1 Standards label matched as expected'); - } - }, - - //Select Standards dropdown - { - description: 'Validate select standards dropdown value', - action: async () => { - const elementValue = await driver.findElement(By.css('#iStateIds')).getAttribute('value'); - if (elementValue !== 'none') { - throw new Error(`Expected: Dropdown value to be "none" (Select Standards); Actual: "${elementValue}"`); - } - console.log('Passed: Dropdown value "none" (Select Standards), matched as expected'); - } - }, - - //View standards button text - { - description: 'Validate View Standards button text', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group > .btn')).getAttribute('value'); - if (elementText !== 'View Standards') { - throw new Error(`Expected: Content 1 "View Standards" button text did not match; Actual: "${elementText}"`); - } - console.log('Passed: Content 1 View Standards button text matched as expected'); - } - }, - - //View standards button color -green - { - description: 'Validate Content 1 View standards button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.form-group > .btn')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: Content 1 "View Standards" button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Content 1 View Standards button color matched as expected'); - } - }, - - //NEXT ACTION - CLOSE VIEW STANDARDS DIV - { description: 'Click close icon', action: async () => await driver.findElement(By.css('.modal-header span')).click() }, - { description: 'Wait for process to complete', action: async () => await driver.sleep(2000) }, - - //NEXT ACTION - EDIT CONTENT PAGE - { description: 'Click Content 1 Edit button', action: async () => await driver.findElement(By.css('.card:nth-child(8) .ml-3')).click() }, - - //Wait for Edit page to open - Resource tab - { - description: 'Wait for Edit page to open', - action: async () => { - return await driver.wait(until.elementLocated(By.css('#myModalLabel')), 5000).catch(() => false); - } - }, + //Edit Item - Resource page //Page title { - description: 'Validate Page title', + description: 'Validate Edit page title text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('#myModalLabel')).getText(); - if (elementText !== 'Edit Item') { - throw new Error(`Expected: "Edit Item" title did not match; Actual: "${elementText}"`); + const multipleChecks = 'Edit page title'; + const element = await driver.findElement(By.css('#myModalLabel')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Edit Item') { + console.log('Passed: Edit page title text matched as expected'); + } else { + errors.push(`Expected: "Edit Item"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === `"DM Serif Display", serif`) { + console.log('Passed: Edit page title font matched as expected'); + } else { + errors.push(`Expected: Edit page title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '32px') { + console.log('Passed: Edit page title text font-size matched as expected'); + } else { + errors.push(`Expected: Edit page title text font-size "32px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Edit page title text color matched as expected'); + } else { + errors.push(`Expected: Edit page title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Edit Item title matched as expected'); } }, - //Page title color -navy blue + //Resource tab title (active) { - description: 'Validate Page title color', + description: 'Validate Resource tab title text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.css('#myModalLabel')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: "Edit Item" Page title color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Edit Item Page title color matched as expected'); - } - }, + const multipleChecks = 'Resource title'; + const element = await driver.findElement(By.linkText('Resource')); - //Page title font size -32px - { - description: 'Validate Page title font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('#myModalLabel')).getCssValue('font-size'); - if (elementStyle !== '32px') { - throw new Error(`Expected: "Edit Item" Page title font size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Edit Item Page title font size matched as expected'); - } - }, + //Get text, font, size, and 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'); - //Resource tab - { - description: 'Validate edit item tab 1', - action: async () => { - const elementText = await driver.findElement(By.linkText('Resource')).getText(); - if (elementText !== 'Resource') { - throw new Error(`Expected: "Resource" tab label did not match; Actual: "${elementText}"`); - } - console.log('Passed: Resource tab label matched as expected'); - } - }, + //Track all errors + const errors = []; - //Resource tab label color -navy blue - { - description: 'Validate edit item tab 1', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Resource')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Active "Resource" tab label color did not match; Actual: "${elementStyle}"`); + //text + if (elementText === 'Resource') { + console.log('Passed: Resource tab title text matched as expected'); + } else { + errors.push(`Expected: "Resource"; Actual: "${elementText}"`); } - console.log('Passed: Active Resource tab label color matched as expected'); - } - }, - //Metadata tab - { - description: 'Validate edit item tab 2', - action: async () => { - const elementText = await driver.findElement(By.linkText('Metadata')).getText(); - if (elementText !== 'Metadata') { - throw new Error(`Expected: "Metadata" tab label did not match; Actual: "${elementText}"`); + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Resource tab title font matched as expected'); + } else { + errors.push(`Expected: Resource tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); } - console.log('Passed: Metadata tab label matched as expected'); - } - }, - //Metadata tab label color -gray (dimmed) - { - description: 'Validate edit item tab 2', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Metadata')).getCssValue('color'); - if (elementStyle !== 'rgba(182, 186, 181, 1)') { - throw new Error(`Expected: Dimmed "Metadata" tab label color did not match; Actual: "${elementStyle}"`); + //font size + if (elementTextSize === '14px') { + console.log('Passed: Resource tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Resource tab title text font-size "14px"; Actual: "${elementTextSize}"`); } - console.log('Passed: Dimmed Metadata tab label color matched as expected'); - } - }, - //Concepts/Correlate tab - { - description: 'Validate edit item tab 3', - action: async () => { - const elementText = await driver.findElement(By.linkText('Concepts/Correlate')).getText(); - if (elementText !== 'Concepts/Correlate') { - throw new Error(`Expected: "Concepts/Correlate" tab label did not match; Actual: "${elementText}"`); + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Resource tab title text color matched as expected'); + } else { + errors.push(`Expected: Resource tab title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); } - console.log('Passed: Concepts/Correlate tab label matched as expected'); - } - }, - //Concepts/Correlate tab label color -gray (dimmed) - { - description: 'Validate edit item tab 3', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Concepts/Correlate')).getCssValue('color'); - if (elementStyle !== 'rgba(182, 186, 181, 1)') { - throw new Error(`Expected: Dimmed "Concepts/Correlate" tab label color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Dimmed Concepts/Correlate tab label color matched as expected'); - } - }, + //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`); + } - //Edit item Save button icon - { - description: 'Verify Edit item Save button icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.glyphicon-save')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Save button icon not found'); + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Save button icon present'); - } - }, - - //Edit item Save button - { - description: 'Validate Save button text', - action: async () => { - const elementText = await driver.findElement(By.css('.submit-content-button')).getText(); - if (elementText !== 'Save Changes') { - throw new Error(`Expected: "Save Changes" button text did not match; Actual: "${elementText}"`); - } - console.log('Passed: Save Changes button text matched as expected'); - } - }, - - //Edit item Save button -green - { - description: 'Validate Save button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.submit-content-button')).getCssValue('color'); - if (elementStyle !== 'rgba(255, 255, 255, 1)') { - throw new Error(`Expected: "Save" button text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Save button text color matched as expected'); - } - }, - - //Edit item required label - { - description: 'Validate Required label', - action: async () => { - const elementText = await driver.findElement(By.css('#tabsr-1 > div:nth-child(1)')).getText(); - if (elementText !== '* Required') { - throw new Error(`Expected: "* Required" label did not match; Actual: "${elementText}"`); - } - console.log('Passed: * Required label matched as expected'); - } - }, - - //Edit item required label -red - { - description: 'Validate Required label text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#tabsr-1 > div:nth-child(1)')).getCssValue('color'); - if (elementStyle !== 'rgba(255, 0, 0, 1)') { - throw new Error(`Expected: "Required" label color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Required label color matched as expected'); - } - }, - - //Edit item title label - { - description: 'Validate title label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(3) > label')).getText(); - if (elementText !== '* Title') { - throw new Error(`Expected: "* Title" label did not match; Actual: "${elementText}"`); - } - console.log('Passed: * Title label matched as expected'); - } - }, - - //Edit item title textbox value - { - description: 'Validate Title value text', - action: async () => { - const elementValue = await driver.findElement(By.css('#cutitle')).getAttribute('value'); - if (elementValue !== 'AAA My Test III') { - throw new Error(`Expected: "AAA My Test III"; Actual: "${elementValue}"`); - } - console.log('Passed: AAA My Test III value text matched as expected'); } }, - //Edit item description label + //Metadata tab tab title { - description: 'Validate Description label', + description: 'Validate Metadata tab title text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(4) > label')).getText(); - if (elementText !== 'Description') { - throw new Error(`Expected: "Description" label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Metadata tab title'; + const element = await driver.findElement(By.linkText('Metadata')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Metadata') { + console.log('Passed: Metadata tab title text matched as expected'); + } else { + errors.push(`Expected: "Metadata"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Metadata tab title font matched as expected'); + } else { + errors.push(`Expected: Metadata tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Metadata tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Metadata tab title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Metadata tab title text color matched as expected'); + } else { + errors.push(`Expected: Metadata tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Description label matched as expected'); } }, - //Edit item description textbox value + //Concepts/Correlate tab title { - description: 'Validate Description value text', + description: 'Validate ConceptsCorrelate tab title text, size, and color', action: async () => { - const elementValue = await driver.findElement(By.css('#cudesc')).getAttribute('value'); - if (elementValue !== 'Yes, it should work! Perhaps') { - throw new Error(`Expected: "Yes, it should work! Perhaps"; Actual: "${elementValue}"`); + const multipleChecks = 'Concepts/Correlate title'; + const element = await driver.findElement(By.linkText('Concepts/Correlate')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Concepts/Correlate') { + console.log('Passed: Concepts/Correlate tab title text matched as expected'); + } else { + errors.push(`Expected: "Concepts/Correlate"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Concepts/Correlate tab title font matched as expected'); + } else { + errors.push(`Expected: Concepts/Correlate tab title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Concepts/Correlate tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Concepts/Correlate tab title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Concepts/Correlate tab title text color matched as expected'); + } else { + errors.push(`Expected: Concepts/Correlate tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Yes, it should work! Perhaps value text matched as expected'); } }, - //Edit item URL label + //Save Changes button { - description: 'Validate URL label', + description: 'Validate Save Changes button', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(5) > label')).getText(); - if (elementText !== 'URL') { - throw new Error(`Expected: "URL" label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Save Changes button'; + const elementIcon = await driver.findElement(By.css('.glyphicon-save')); + const element = await driver.findElement(By.css('.submit-content-button')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Save Changes icon is present'); + } else { + errors.push('Save Changes icon was not found'); + } + + //text + if (elementText === 'Save Changes') { + console.log('Passed: Save Changes button text matched as expected'); + } else { + errors.push(`Expected: Button text: "Save Changes"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Save Changes button text font matched as expected'); + } else { + errors.push(`Expected: Save Changes button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Save Changes button text font-size matched as expected'); + } else { + errors.push(`Expected: Save Changes button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Save Changes button text color matched as expected'); + } else { + errors.push(`Expected: Save Changes button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Save Changes button background color matched as expected'); + } else { + errors.push(`Expected: Save Changes 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')); } - console.log('Passed: URL label matched as expected'); } }, - //Edit item URL textbox placeholder + //* Required label { - description: 'Validate URL placeholder text', + description: 'Validate Required label text, size, and color', action: async () => { - const elementValue = await driver.findElement(By.css('#cuurl')).getAttribute('placeholder'); - if (elementValue !== 'https://example.com') { - throw new Error(`Expected: "https://example.com"; Actual: "${elementValue}"`); + const multipleChecks = 'Required label'; + const element = await driver.findElement(By.css('#tabsr-1 > div:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === '* Required') { + console.log('Passed: * Required label text matched as expected'); + } else { + errors.push(`Expected: "* Required"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: * Required label font matched as expected'); + } else { + errors.push(`Expected: * Required label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: * Required label text font-size matched as expected'); + } else { + errors.push(`Expected: * Required label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 0, 0, 1)') { + console.log('Passed: * Required label text color matched as expected'); + } else { + errors.push(`Expected: * Required label text color: "rgba(255, 0, 0, 1)"; Actual: "${elementTextColor}"`); + } + + //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: https://example.com placeholder text matched as expected'); } }, - //Edit item Client Item ID label + //Title label { - description: 'Validate Client Item ID label', + description: 'Validate Title label text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > label')).getText(); - if (elementText !== 'Client Item ID') { - throw new Error(`Expected: "Client Item ID" label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Title label'; + const elementIcon = await driver.findElement(By.css('.form-group:nth-child(3) span')); + const element = await driver.findElement(By.css('.form-group:nth-child(3) > label')); + + //Get text, font, size, and color + const elementIconText = await elementIcon.getText(); + const elementIconTextColor = await elementIcon.getCssValue('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'); + + //Track all errors + const errors = []; + + //icon text + if (elementIconText === '*') { + console.log('Passed: * Title icon label text matched as expected'); + } else { + errors.push(`Expected: "*" Title icon label; Actual: "${elementIconText}"`); + } + + //icon color + if (elementIconTextColor === 'rgba(255, 0, 0, 1)') { + console.log('Passed: * Title icon label text color matched as expected'); + } else { + errors.push(`Expected: * Title icon label text color: "rgba(255, 0, 0, 1)"; Actual: "${elementIconTextColor}"`); + } + + //text + if (elementText === '* Title') { + console.log('Passed: * Title label text matched as expected'); + } else { + errors.push(`Expected: "* Title"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: * Title label font matched as expected'); + } else { + errors.push(`Expected: * Title label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: * Title label text font-size matched as expected'); + } else { + errors.push(`Expected: * Title label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: * Title label text color matched as expected'); + } else { + errors.push(`Expected: * Title label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Client Item ID label matched as expected'); } }, - //Edit item Client Item ID textbox value + //Title textbox { - description: 'Validate Client Item ID value text', + description: 'Validate Title textbox', action: async () => { - const elementValue = await driver.findElement(By.css('#culoid')).getAttribute('value'); - if (elementValue !== '') { - throw new Error(`Expected: Client Item ID "empty"; Actual: "${elementValue}"`); + const multipleChecks = 'Title texbox'; + const element = await driver.findElement(By.css('#cutitle')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === '4X4') { + console.log('Passed: Title textbox text matched as expected'); + } else { + errors.push(`Expected: Title: "4X4"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Title textbox font matched as expected'); + } else { + errors.push(`Expected: Title textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Title textbox font-size matched as expected'); + } else { + errors.push(`Expected: Title textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Title textbox color matched as expected'); + } else { + errors.push(`Expected: Title textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Client Item Id empty value text matched as expected'); } }, - //Edit item Content Set label + //Description label { - description: 'Validate Content Set label', + description: 'Validate Description label text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(7) > label')).getText(); - if (elementText !== '* Content Set') { - throw new Error(`Expected: "* Content Set" label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Description label'; + const element = await driver.findElement(By.css('.form-group:nth-child(4) > label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Description') { + console.log('Passed: Description label text matched as expected'); + } else { + errors.push(`Expected: "Description"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Description label font matched as expected'); + } else { + errors.push(`Expected: Description label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Description label text font-size matched as expected'); + } else { + errors.push(`Expected: Description label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Description label text color matched as expected'); + } else { + errors.push(`Expected: Description label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: *Content Set label matched as expected'); } }, - //Edit item Content Set textbox value (Biology - QA) + //Description textbox { - description: 'Validate Content Set value text', + description: 'Validate Description textbox', action: async () => { - const elementValue = await driver.findElement(By.css('#orgs')).getAttribute('value'); - if (elementValue !== '873576067') { - throw new Error(`Expected: "Biology - QA"; Actual: "${elementValue}"`); + const multipleChecks = 'Description texbox'; + const element = await driver.findElement(By.css('#cudesc')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'In the previous lessons, students have considered first an article about new standards in groundwater arsenic levels and problems with compliance and the historical impact of arsenic. In this explain lesson, they are asked to generate 4 statements and 4 questions about arsenic based on these lessons. As the historical information is the most recent, and since the thrust of this learning cycle is to use arsenic as a focal point for discussions about groundwater, it will be useful to spend the first part of class revisiting the first article in light of what was learned in the explore lesson.') { + console.log('Passed: Description textbox text matched as expected'); + } else { + errors.push(`Expected: Description: "In the previous lessons, students have considered first an article about new standards in groundwater arsenic levels and problems with compliance and the historical impact of arsenic. In this explain lesson, they are asked to generate 4 statements and 4 questions about arsenic based on these lessons. As the historical information is the most recent, and since the thrust of this learning cycle is to use arsenic as a focal point for discussions about groundwater, it will be useful to spend the first part of class revisiting the first article in light of what was learned in the explore lesson."; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Description textbox font matched as expected'); + } else { + errors.push(`Expected: Description textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Description textbox font-size matched as expected'); + } else { + errors.push(`Expected: Description textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Description textbox color matched as expected'); + } else { + errors.push(`Expected: Description textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Biology - QA value text matched as expected'); } }, - //Edit item Grades label + //URL label { - description: 'Validate Grades label', + description: 'Validate URL label text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(8) > label')).getText(); - if (elementText !== '* Grades') { - throw new Error(`Expected: "* Grades" label did not match; Actual: "${elementText}"`); + const multipleChecks = 'URL label'; + const element = await driver.findElement(By.css('.form-group:nth-child(5) > label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'URL') { + console.log('Passed: URL label text matched as expected'); + } else { + errors.push(`Expected: "URL"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: URL label font matched as expected'); + } else { + errors.push(`Expected: URL label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: URL label text font-size matched as expected'); + } else { + errors.push(`Expected: URL label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: URL label text color matched as expected'); + } else { + errors.push(`Expected: URL label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: * Grades label matched as expected'); } }, - //K grade checkbox + //URL textbox { - description: 'Verify K grade checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.id('38')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('"K grade" checkbox icon not found'); - } - console.log('Passed: K grade checkbox icon present'); - } - }, - - //K grade label - { - description: 'Validate K grade label', + description: 'Validate URL textbox', action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(3) > .form-check-label')).getText(); - if (elementText !== 'K') { - throw new Error(`Expected: "K grade"; Actual: "${elementText}"`); + const multipleChecks = 'URL texbox'; + const element = await driver.findElement(By.css('#cuurl')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'http://pulse.pharmacy.arizona.edu/9th_grade/culture_cycles/science/4X4.html') { + console.log('Passed: URL textbox text matched as expected'); + } else { + errors.push(`Expected: URL: "http://pulse.pharmacy.arizona.edu/9th_grade/culture_cycles/science/4X4.html"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: URL textbox font matched as expected'); + } else { + errors.push(`Expected: URL textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: URL textbox font-size matched as expected'); + } else { + errors.push(`Expected: URL textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: URL textbox color matched as expected'); + } else { + errors.push(`Expected: URL textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //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: K grade label matched as expected'); } }, - //Grade 1 checkbox + //Client Item ID label { - description: 'Verify grade 1 checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.id('39')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('"Grade 1" checkbox icon not found'); - } - console.log('Passed: Grade 1 checkbox icon present'); - } - }, - - //Grade 1 label - { - description: 'Validate grade 1 label', + description: 'Validate Client Item ID label text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(4) > .form-check-label')).getText(); - if (elementText !== '1') { - throw new Error(`Expected: "Grade 1"; Actual: "${elementText}"`); + const multipleChecks = 'Client Item ID label'; + const element = await driver.findElement(By.css('.form-group:nth-child(6) > label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Client Item ID') { + console.log('Passed: Client Item ID label text matched as expected'); + } else { + errors.push(`Expected: "Client Item ID"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Client Item ID label font matched as expected'); + } else { + errors.push(`Expected: Client Item ID label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Client Item ID label text font-size matched as expected'); + } else { + errors.push(`Expected: Client Item ID label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Client Item ID label text color matched as expected'); + } else { + errors.push(`Expected: Client Item ID label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 1 label matched as expected'); } }, - //Grade 2 checkbox + //Client Item ID textbox { - description: 'Verify grade 2 checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.id('40')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('"Grade 2" checkbox icon not found'); - } - console.log('Passed: Grade 2 checkbox icon present'); - } - }, - - //Grade 2 label - { - description: 'Validate grade 2 label', + description: 'Validate Client Item ID textbox', action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(5) > .form-check-label')).getText(); - if (elementText !== '2') { - throw new Error(`Expected: "Grade 2"; Actual: "${elementText}"`); + const multipleChecks = 'Client Item ID texbox'; + const element = await driver.findElement(By.css('#culoid')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'CMXUASC1411000001') { + console.log('Passed: Client Item ID textbox text matched as expected'); + } else { + errors.push(`Expected: Client Item ID: "CMXUASC1411000001"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Client Item ID textbox font matched as expected'); + } else { + errors.push(`Expected: Client Item ID textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Client Item ID textbox font-size matched as expected'); + } else { + errors.push(`Expected: Client Item ID textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Client Item ID textbox color matched as expected'); + } else { + errors.push(`Expected: Client Item ID textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 2 label matched as expected'); } }, - //Grade 3 checkbox + //Content Set label { - description: 'Verify grade 3 checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.id('41')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('"Grade 3" checkbox icon not found'); - } - console.log('Passed: Grade 3 checkbox icon present'); - } - }, - - //Grade 3 label - { - description: 'Validate grade 3 label', + description: 'Validate Content Set label text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(6) > .form-check-label')).getText(); - if (elementText !== '3') { - throw new Error(`Expected: "Grade 3"; Actual: "${elementText}"`); + const multipleChecks = 'Content Set label'; + const elementIcon = await driver.findElement(By.css('.form-group:nth-child(7) span')); + const element = await driver.findElement(By.css('.form-group:nth-child(7) > label')); + + //Get text, font, size, and color + const elementIconText = await elementIcon.getText(); + const elementIconTextColor = await elementIcon.getCssValue('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'); + + //Track all errors + const errors = []; + + //icon text + if (elementIconText === '*') { + console.log('Passed: * Content Set icon label text matched as expected'); + } else { + errors.push(`Expected: "*" Content Set icon label; Actual: "${elementIconText}"`); + } + + //icon color + if (elementIconTextColor === 'rgba(255, 0, 0, 1)') { + console.log('Passed: * Content Set icon label text color matched as expected'); + } else { + errors.push(`Expected: * Content Set icon label text color: "rgba(255, 0, 0, 1)"; Actual: "${elementIconTextColor}"`); + } + + //text + if (elementText === '* Content Set') { + console.log('Passed: * Content Set label text matched as expected'); + } else { + errors.push(`Expected: "* Content Set"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: * Content Set label font matched as expected'); + } else { + errors.push(`Expected: * Content Set label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '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: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === '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: "${elementTextColor}"`); + } + + //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: Grade 3 label matched as expected'); } }, - //Grade 4 checkbox + //Content Set dropdown { - description: 'Verify grade 4 checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.id('43')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('"Grade 4" checkbox icon not found'); - } - console.log('Passed: Grade 4 checkbox icon present'); - } - }, - - //Grade 4 label - { - description: 'Validate grade 4 label', + description: 'Validate Content Set dropdown', action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(7) > .form-check-label')).getText(); - if (elementText !== '4') { - throw new Error(`Expected: "Grade 4"; Actual: "${elementText}"`); + const multipleChecks = 'Content Set List'; + const elementDropdown = await driver.findElement(By.css('#orgs')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); + + const elementText = await selectedOption.getText(); + const elementTextFont = await selectedOption.getCssValue('font-family'); + const elementTextSize = await selectedOption.getCssValue('font-size'); + const elementTextColor = await selectedOption.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Biology') { + console.log('Passed: Content Set dropdown text matched as expected'); + } else { + throw new Error(`Expected: Content Set: "Biology"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Content Set dropdown font matched as expected'); + } else { + errors.push(`Expected: Content Set dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Content Set dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Content Set dropdown font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content Set dropdown color matched as expected'); + } else { + errors.push(`Expected: Content Set dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + 'Algebra', + 'Biology', + 'Copy Move Delete Test 1', + 'Copy Move Delete Test 2', + 'create me', + 'English I', + 'Import Align - Concept Based 1', + 'Import Align - Concept Based 2', + 'Import Align - Direct Align 1', + 'Import Align - Direct Align 2', + 'Math Alignment Import Test', + 'US History III' + ]; + + 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 - Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Content Set - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //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: Grade 4 label matched as expected'); } }, - //Grade 5 checkbox + //Grades label { - description: 'Verify grade 5 checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.id('44')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('"Grade 5" checkbox icon not found'); - } - console.log('Passed: Grade 5 checkbox icon present'); - } - }, - - //Grade 5 label - { - description: 'Validate grade 5 label', + description: 'Validate Grades label text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(8) > .form-check-label')).getText(); - if (elementText !== '5') { - throw new Error(`Expected: "Grade 5"; Actual: "${elementText}"`); + const multipleChecks = 'Grades label'; + const elementIcon = await driver.findElement(By.css('.form-group:nth-child(8) span')); + const element = await driver.findElement(By.css('.form-group:nth-child(8) > label')); + + //Get text, font, size, and color + const elementIconText = await elementIcon.getText(); + const elementIconTextColor = await elementIcon.getCssValue('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'); + + //Track all errors + const errors = []; + + //icon text + if (elementIconText === '*') { + console.log('Passed: * Grades icon label text matched as expected'); + } else { + errors.push(`Expected: "*" Grades icon label; Actual: "${elementIconText}"`); + } + + //icon color + if (elementIconTextColor === 'rgba(255, 0, 0, 1)') { + console.log('Passed: * Grades icon label text color matched as expected'); + } else { + errors.push(`Expected: * Grades icon label text color: "rgba(255, 0, 0, 1)"; Actual: "${elementIconTextColor}"`); + } + + //text + if (elementText === '* Grades') { + console.log('Passed: * Grades label text matched as expected'); + } else { + errors.push(`Expected: "* Grades"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: * Grades label font matched as expected'); + } else { + errors.push(`Expected: * Grades label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: * Grades label text font-size matched as expected'); + } else { + errors.push(`Expected: * Grades label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: * Grades label text color matched as expected'); + } else { + errors.push(`Expected: * Grades label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 5 label matched as expected'); } }, - //Grade 6 checkbox + //Grade K { - description: 'Verify grade 6 checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.id('45')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('"Grade 6" checkbox icon not found'); - } - console.log('Passed: Grade 6 checkbox icon present'); - } - }, - - //Grade 6 label - { - description: 'Validate grade 6 label', + description: 'Validate Grade K text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(9) > .form-check-label')).getText(); - if (elementText !== '6') { - throw new Error(`Expected: "Grade 6"; Actual: "${elementText}"`); + const multipleChecks = 'Grade K'; + const elementIcon = await driver.findElement(By.css('#\\33 8')); + const element = await driver.findElement(By.css('.form-check:nth-child(3) > .form-check-label')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade K checkbox is present'); + } else { + errors.push('Grade K checkbox was not found'); + } + + //text + if (elementText === 'K') { + console.log('Passed: Grade K label text matched as expected'); + } else { + errors.push(`Expected: "K"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade K label font matched as expected'); + } else { + errors.push(`Expected: Grade K label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade K label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade K label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade K label text color matched as expected'); + } else { + errors.push(`Expected: Grade K label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 6 label matched as expected'); } }, - //Grade 7 checkbox + //Grade 1 { - description: 'Verify grade 7 checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.id('47')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('"Grade 7" checkbox icon not found'); - } - console.log('Passed: Grade 7 checkbox icon present'); - } - }, - - //Grade 7 label - { - description: 'Validate grade 7 label', + description: 'Validate Grade 1 text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(10) > .form-check-label')).getText(); - if (elementText !== '7') { - throw new Error(`Expected: "Grade 7"; Actual: "${elementText}"`); + const multipleChecks = 'Grade 1'; + const elementIcon = await driver.findElement(By.css('#\\33 9')); + const element = await driver.findElement(By.css('.form-check:nth-child(4) > .form-check-label')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade 1 checkbox is present'); + } else { + errors.push('Grade 1 checkbox was not found'); + } + + //text + if (elementText === '1') { + console.log('Passed: Grade 1 label text matched as expected'); + } else { + errors.push(`Expected: "1"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade 1 label font matched as expected'); + } else { + errors.push(`Expected: Grade 1 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 1 label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade 1 label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 1 label text color matched as expected'); + } else { + errors.push(`Expected: Grade 1 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 7 label matched as expected'); } }, - //Grade 8 checkbox + //Grade 2 { - description: 'Verify grade 8 checkbox icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.id('48')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('"Grade 8" checkbox icon not found'); - } - console.log('Passed: Grade 8 checkbox icon present'); - } - }, - - //Grade 8 label - { - description: 'Validate grade 8 label', + description: 'Validate Grade 2 text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(11) > .form-check-label')).getText(); - if (elementText !== '8') { - throw new Error(`Expected: "Grade 8"; Actual: "${elementText}"`); + const multipleChecks = 'Grade 2'; + const elementIcon = await driver.findElement(By.css('#\\34 0')); + const element = await driver.findElement(By.css('.form-check:nth-child(5) > .form-check-label')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade 2 checkbox is present'); + } else { + errors.push('Grade 2 checkbox was not found'); + } + + //text + if (elementText === '2') { + console.log('Passed: Grade 2 label text matched as expected'); + } else { + errors.push(`Expected: "2"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade 2 label font matched as expected'); + } else { + errors.push(`Expected: Grade 2 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 2 label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade 2 label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 2 label text color matched as expected'); + } else { + errors.push(`Expected: Grade 2 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 8 label matched as expected'); } }, - - //Grade 9 checkbox -enabled + + //Grade 3 { - description: 'Validate Grade 9 checkbox enabled', + description: 'Validate Grade 3 text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.id('49')).getAttribute('checked'); - if (elementStyle !== 'true') { - throw new Error(`Grade 9 checked value did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Grade 3'; + const elementIcon = await driver.findElement(By.css('#\\34 1')); + const element = await driver.findElement(By.css('.form-check:nth-child(6) > .form-check-label')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade 3 checkbox is present'); + } else { + errors.push('Grade 3 checkbox was not found'); + } + + //text + if (elementText === '3') { + console.log('Passed: Grade 3 label text matched as expected'); + } else { + errors.push(`Expected: "3"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade 3 label font matched as expected'); + } else { + errors.push(`Expected: Grade 3 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 3 label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade 3 label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 3 label text color matched as expected'); + } else { + errors.push(`Expected: Grade 3 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 9 checkbox enabled as expected'); } }, - - //Grade 9 label + + //Grade 4 { - description: 'Validate grade 9 label', + description: 'Validate Grade 4 text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(12) > .form-check-label')).getText(); - if (elementText !== '9') { - throw new Error(`Expected: "Grade 9"; Actual: "${elementText}"`); + const multipleChecks = 'Grade 4'; + const elementIcon = await driver.findElement(By.css('#\\34 3')); + const element = await driver.findElement(By.css('.form-check:nth-child(7) > .form-check-label')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade 4 checkbox is present'); + } else { + errors.push('Grade 4 checkbox was not found'); + } + + //text + if (elementText === '4') { + console.log('Passed: Grade 4 label text matched as expected'); + } else { + errors.push(`Expected: "4"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade 4 label font matched as expected'); + } else { + errors.push(`Expected: Grade 4 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 4 label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade 4 label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 4 label text color matched as expected'); + } else { + errors.push(`Expected: Grade 4 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 9 label matched as expected'); } }, - //Grade 10 checkbox -enabled + //Grade 5 { - description: 'Validate Grade 10 checkbox enabled', + description: 'Validate Grade 5 text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.id('51')).getAttribute('checked'); - if (elementStyle !== 'true') { - throw new Error(`Grade 10 checked value did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Grade 5'; + const elementIcon = await driver.findElement(By.css('#\\34 4')); + const element = await driver.findElement(By.css('.form-check:nth-child(8) > .form-check-label')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade 5 checkbox is present'); + } else { + errors.push('Grade 5 checkbox was not found'); + } + + //text + if (elementText === '5') { + console.log('Passed: Grade 5 label text matched as expected'); + } else { + errors.push(`Expected: "5"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade 5 label font matched as expected'); + } else { + errors.push(`Expected: Grade 5 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 5 label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade 5 label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 5 label text color matched as expected'); + } else { + errors.push(`Expected: Grade 5 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 10 checkbox enabled as expected'); } }, - //Grade 10 label + //Grade 6 { - description: 'Validate grade 10 label', + description: 'Validate Grade 6 text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(13) > .form-check-label')).getText(); - if (elementText !== '10') { - throw new Error(`Expected: "Grade 10"; Actual: "${elementText}"`); + const multipleChecks = 'Grade 6'; + const elementIcon = await driver.findElement(By.css('#\\34 5')); + const element = await driver.findElement(By.css('.form-check:nth-child(9) > .form-check-label')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade 6 checkbox is present'); + } else { + errors.push('Grade 6 checkbox was not found'); + } + + //text + if (elementText === '6') { + console.log('Passed: Grade 6 label text matched as expected'); + } else { + errors.push(`Expected: "6"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade 6 label font matched as expected'); + } else { + errors.push(`Expected: Grade 6 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 6 label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade 6 label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 6 label text color matched as expected'); + } else { + errors.push(`Expected: Grade 6 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 10 label matched as expected'); } }, - //Grade 11 checkbox -enabled + //Grade 7 { - description: 'Validate Grade 11 checkbox enabled', + description: 'Validate Grade 7 text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.id('52')).getAttribute('checked'); - if (elementStyle !== 'true') { - throw new Error(`Grade 11 checked value did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Grade 7'; + const elementIcon = await driver.findElement(By.css('#\\34 7')); + const element = await driver.findElement(By.css('.form-check:nth-child(10) > .form-check-label')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade 7 checkbox is present'); + } else { + errors.push('Grade 7 checkbox was not found'); + } + + //text + if (elementText === '7') { + console.log('Passed: Grade 7 label text matched as expected'); + } else { + errors.push(`Expected: "7"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade 7 label font matched as expected'); + } else { + errors.push(`Expected: Grade 7 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 7 label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade 7 label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 7 label text color matched as expected'); + } else { + errors.push(`Expected: Grade 7 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 11 checkbox enabled as expected'); } }, - //Grade 11 label + //Grade 8 { - description: 'Validate grade 11 label', + description: 'Validate Grade 8 text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(14) > .form-check-label')).getText(); - if (elementText !== '11') { - throw new Error(`Expected: "Grade 11"; Actual: "${elementText}"`); + const multipleChecks = 'Grade 8'; + const elementIcon = await driver.findElement(By.css('#\\34 8')); + const element = await driver.findElement(By.css('.form-check:nth-child(11) > .form-check-label')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade 8 checkbox is present'); + } else { + errors.push('Grade 8 checkbox was not found'); + } + + //text + if (elementText === '8') { + console.log('Passed: Grade 8 label text matched as expected'); + } else { + errors.push(`Expected: "8"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade 8 label font matched as expected'); + } else { + errors.push(`Expected: Grade 8 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 8 label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade 8 label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 8 label text color matched as expected'); + } else { + errors.push(`Expected: Grade 8 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 11 label matched as expected'); } }, - //Grade 12 checkbox -enabled + //Grade 9 { - description: 'Validate Grade 12 checkbox enabled', + description: 'Validate Grade 9 text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.id('53')).getAttribute('checked'); - if (elementStyle !== 'true') { - throw new Error(`Grade 12 checked value did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Grade 9'; + const elementIcon = await driver.findElement(By.css('#\\34 9')); + const element = await driver.findElement(By.css('.form-check:nth-child(12) > .form-check-label')); + + const elementSelected = await elementIcon.getAttribute('checked'); + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade 9 checkbox is present'); + } else { + errors.push('Grade 9 checkbox was not found'); + } + + //selected + if (elementSelected) { + console.log('Passed: Grade 9 checkbox is selected'); + } else { + errors.push('Grade 9 checkbox was not selected'); + } + + //text + if (elementText === '9') { + console.log('Passed: Grade 9 label text matched as expected'); + } else { + errors.push(`Expected: "9"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade 9 label font matched as expected'); + } else { + errors.push(`Expected: Grade 9 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 9 label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade 9 label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 9 label text color matched as expected'); + } else { + errors.push(`Expected: Grade 9 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 12 checkbox enabled as expected'); } }, - - //Grade 12 label + + //Grade 10 { - description: 'Validate grade 12 label', + description: 'Validate Grade 10 text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(15) > .form-check-label')).getText(); - if (elementText !== '12') { - throw new Error(`Expected: "Grade 12"; Actual: "${elementText}"`); + const multipleChecks = 'Grade 10'; + const elementIcon = await driver.findElement(By.css('#\\35 1')); + const element = await driver.findElement(By.css('.form-check:nth-child(13) > .form-check-label')); + + const elementSelected = await elementIcon.getAttribute('checked'); + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade 10 checkbox is present'); + } else { + errors.push('Grade 10 checkbox was not found'); + } + + //selected + if (elementSelected) { + console.log('Passed: Grade 10 checkbox is selected'); + } else { + errors.push('Grade 10 checkbox was not selected'); + } + + //text + if (elementText === '10') { + console.log('Passed: Grade 10 label text matched as expected'); + } else { + errors.push(`Expected: "10"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade 10 label font matched as expected'); + } else { + errors.push(`Expected: Grade 10 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 10 label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade 10 label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 10 label text color matched as expected'); + } else { + errors.push(`Expected: Grade 10 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Grade 12 label matched as expected'); } }, - //NEXT ACTION - METADATA - { description: 'Click Metadata tab link', action: async () => await driver.findElement(By.linkText('Metadata')).click() }, - { description: 'Wait for login process to complete', action: async () => await driver.sleep(5000) }, + //Grade 11 + { + description: 'Validate Grade 11 text, size, and color', + action: async () => { + const multipleChecks = 'Grade 11'; + const elementIcon = await driver.findElement(By.css('#\\35 2')); + const element = await driver.findElement(By.css('.form-check:nth-child(14) > .form-check-label')); + + const elementSelected = await elementIcon.getAttribute('checked'); + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade 11 checkbox is present'); + } else { + errors.push('Grade 11 checkbox was not found'); + } + + //selected + if (elementSelected) { + console.log('Passed: Grade 11 checkbox is selected'); + } else { + errors.push('Grade 11 checkbox was not selected'); + } + + //text + if (elementText === '11') { + console.log('Passed: Grade 11 label text matched as expected'); + } else { + errors.push(`Expected: "11"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade 11 label font matched as expected'); + } else { + errors.push(`Expected: Grade 11 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 11 label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade 11 label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 11 label text color matched as expected'); + } else { + errors.push(`Expected: Grade 11 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Grade 12 + { + description: 'Validate Grade 12 text, size, and color', + action: async () => { + const multipleChecks = 'Grade 12'; + const elementIcon = await driver.findElement(By.css('#\\35 3')); + const element = await driver.findElement(By.css('.form-check:nth-child(15) > .form-check-label')); + + const elementSelected = await elementIcon.getAttribute('checked'); + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade 12 checkbox is present'); + } else { + errors.push('Grade 12 checkbox was not found'); + } + + //selected + if (elementSelected) { + console.log('Passed: Grade 12 checkbox is selected'); + } else { + errors.push('Grade 12 checkbox was not selected'); + } + + //text + if (elementText === '12') { + console.log('Passed: Grade 12 label text matched as expected'); + } else { + errors.push(`Expected: "12"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade 12 label font matched as expected'); + } else { + errors.push(`Expected: Grade 12 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade 12 label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade 12 label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade 12 label text color matched as expected'); + } else { + errors.push(`Expected: Grade 12 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 Metadata tab link', + action: async () => { + await driver.findElement(By.linkText('Metadata')).click(); + console.log('----->| NEXT ACTION: Clicked Metadata tab link'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Edit Item - Metadata page did not fully load within 30 seconds'); + + //Wait until the element exists in the DOM + const pageHeader = await driver.wait( + until.elementLocated(By.css('#tabsr-4 > div:nth-child(1) > b')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(pageHeader), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Edit Item - Metadata page did not fully load within 30 seconds'); + console.log('Passed: Edit Item - Metadata page loaded successfully'); + } + }, + + //Edit Item - Metadata page //Page title { - description: 'Validate Page title', + description: 'Validate Edit page title text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('#myModalLabel')).getText(); - if (elementText !== 'Edit Item') { - throw new Error(`Expected: "Edit Item" title did not match; Actual: "${elementText}"`); + const multipleChecks = 'Edit page title'; + const element = await driver.findElement(By.css('#myModalLabel')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Edit Item') { + console.log('Passed: Edit page title text matched as expected'); + } else { + errors.push(`Expected: "Edit Item"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === `"DM Serif Display", serif`) { + console.log('Passed: Edit page title font matched as expected'); + } else { + errors.push(`Expected: Edit page title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '32px') { + console.log('Passed: Edit page title text font-size matched as expected'); + } else { + errors.push(`Expected: Edit page title text font-size "32px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Edit page title text color matched as expected'); + } else { + errors.push(`Expected: Edit page title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Edit Item title matched as expected'); } }, - //Page title color -navy blue + //Resource tab title { - description: 'Validate Page title color', + description: 'Validate Resource tab title text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.css('#myModalLabel')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: "Edit Item" Page title color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Resource title'; + const element = await driver.findElement(By.linkText('Resource')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Resource') { + console.log('Passed: Resource tab title text matched as expected'); + } else { + errors.push(`Expected: "Resource"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Resource tab title font matched as expected'); + } else { + errors.push(`Expected: Resource tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Resource tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Resource tab title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Resource tab title text color matched as expected'); + } else { + errors.push(`Expected: Resource tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Metadata tab tab title (active) + { + description: 'Validate Metadata tab title text, size, and color', + action: async () => { + const multipleChecks = 'Metadata tab title'; + const element = await driver.findElement(By.linkText('Metadata')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Metadata') { + console.log('Passed: Metadata tab title text matched as expected'); + } else { + errors.push(`Expected: "Metadata"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Metadata tab title font matched as expected'); + } else { + errors.push(`Expected: Metadata tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Metadata tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Metadata tab title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Metadata tab title text color matched as expected'); + } else { + errors.push(`Expected: Metadata tab title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Edit Item Page title color matched as expected'); } }, - //Page title font size -32px + //Concepts/Correlate tab title { - description: 'Validate Page title color', + description: 'Validate ConceptsCorrelate tab title text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.css('#myModalLabel')).getCssValue('font-size'); - if (elementStyle !== '32px') { - throw new Error(`Expected: "Edit Item" Page title font size did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Concepts/Correlate title'; + const element = await driver.findElement(By.linkText('Concepts/Correlate')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Concepts/Correlate') { + console.log('Passed: Concepts/Correlate tab title text matched as expected'); + } else { + errors.push(`Expected: "Concepts/Correlate"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Concepts/Correlate tab title font matched as expected'); + } else { + errors.push(`Expected: Concepts/Correlate tab title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Concepts/Correlate tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Concepts/Correlate tab title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Concepts/Correlate tab title text color matched as expected'); + } else { + errors.push(`Expected: Concepts/Correlate tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Edit Item Page title font size matched as expected'); } }, - //Resource tab + //Save Changes button { - description: 'Validate edit item tab 1', + description: 'Validate Save Changes button', action: async () => { - const elementText = await driver.findElement(By.linkText('Resource')).getText(); - if (elementText !== 'Resource') { - throw new Error(`Expected: "Resource" tab label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Save Changes button'; + const elementIcon = await driver.findElement(By.css('.glyphicon-save')); + const element = await driver.findElement(By.css('.submit-content-button')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Save Changes icon is present'); + } else { + errors.push('Save Changes icon was not found'); + } + + //text + if (elementText === 'Save Changes') { + console.log('Passed: Save Changes button text matched as expected'); + } else { + errors.push(`Expected: Button text: "Save Changes"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Save Changes button text font matched as expected'); + } else { + errors.push(`Expected: Save Changes button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Save Changes button text font-size matched as expected'); + } else { + errors.push(`Expected: Save Changes button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Save Changes button text color matched as expected'); + } else { + errors.push(`Expected: Save Changes button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Save Changes button background color matched as expected'); + } else { + errors.push(`Expected: Save Changes 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')); } - console.log('Passed: Resource tab label matched as expected'); } }, - //Resource tab label color -gray (dimmed) + //Field Name header { - description: 'Validate edit item tab 1', + description: 'Validate Field Name header text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.linkText('Resource')).getCssValue('color'); - if (elementStyle !== 'rgba(182, 186, 181, 1)') { - throw new Error(`Expected: Dimmed "Resource" tab label color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Field Name header'; + const element = await driver.findElement(By.css('#tabsr-4 > div:nth-child(1) > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Field Name') { + console.log('Passed: Field Name header text matched as expected'); + } else { + errors.push(`Expected: "Field Name"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Field Name header font matched as expected'); + } else { + errors.push(`Expected: Field Name header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Field Name header text font-size matched as expected'); + } else { + errors.push(`Expected: Field Name header text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Field Name header text color matched as expected'); + } else { + errors.push(`Expected: Field Name header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Dimmed Resource tab label color matched as expected'); } }, - //Metadata tab + //Field Name dropdown (SPECIAL CASE:
  • elements with data-value) { - description: 'Validate edit item tab 2', + description: 'Validate Field Name dropdown', action: async () => { - const elementText = await driver.findElement(By.linkText('Metadata')).getText(); - if (elementText !== 'Metadata') { - throw new Error(`Expected: "Metadata" tab label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Field Name dropdown'; + const errors = []; + + //Target the combobox input + const elementDropdown = await driver.wait(until.elementLocated(By.css('input.combobox.form-control')), 5000); + + const elementText = await elementDropdown.getAttribute('placeholder'); + const elementTextFont = await elementDropdown.getCssValue('font-family'); + const elementTextSize = await elementDropdown.getCssValue('font-size'); + const elementTextColor = await elementDropdown.getCssValue('color'); + + //Click to open dropdown + await driver.findElement(By.css('.input-group-text')).click(); + console.log('----->| NEXT ACTION: Clicked Field Name dropdown arrow to open list'); + + //Wait for typeahead list to populate + await driver.wait(async () => { + const count = await driver.executeScript(` + return document.querySelectorAll('ul.typeahead li[data-value]').length; + `); + return count > 0; + }, 5000, 'Typeahead dropdown did not populate within 5 seconds'); + + //Now get the options + const actual = await driver.executeScript(` + const items = document.querySelectorAll('ul.typeahead li[data-value]'); + return Array.from(items).map(li => li.getAttribute('data-value')); + `); + //console.log('----->| DEBUG actual options:', JSON.stringify(actual)); + + //placeholder text + if (elementText === 'Select/Enter Field...') { + console.log('Passed: Field Name dropdown placeholder matched as expected'); + } else { + errors.push(`Expected: Field Name dropdown placeholder "Select/Enter Field..."; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Field Name dropdown font matched as expected'); + } else { + errors.push(`Expected: Field Name dropdown font "Poppins, sans-serif"; Actual: "${elementTextFont}"`); + } + + //font-size + if (elementTextSize === '16px') { + console.log('Passed: Field Name dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Field Name dropdown font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Field Name dropdown color matched as expected'); + } else { + errors.push(`Expected: Field Name dropdown color "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + 'Author Name', + 'Career Cluster', + 'Career Pathway', + 'Content Type', + 'Copyright Date', + 'Descriptors', + 'Entry-Level Education', + 'For Kids', + 'Format', + 'Free or Fee', + 'Grade Range', + 'Grouping', + 'High Grade', + 'ICD 9', + 'Includes', + 'InstructorRequired', + 'Language', + 'Learning Style', + 'Length', + 'Level - Challenging', + 'Level - On Target', + 'Level - Skill Builder', + 'Lexile Scale', + 'Low Grade', + 'Medical Focus', + 'Method', + 'Notes', + 'Occupation', + 'Pedagogy', + 'Price', + 'Producer', + 'Reading Level', + 'Source', + 'StudentFacingDigital ', + 'StudentFacingPrint', + 'Subject', + 'Submitted By', + 'Target Audience', + 'TeacherMaterials', + 'Technology', + 'Terms of Use' + ]; + + if (JSON.stringify(actual) === JSON.stringify(expected)) { + console.log('Passed: Field Name dropdown list matched as expected'); + } else { + errors.push(`Expected: Field Name dropdown list: ${JSON.stringify(expected)}\nActual: ${JSON.stringify(actual)}`); + } + + //Click to close dropdown + await driver.findElement(By.css('.input-group-text')).click(); + console.log('----->| NEXT ACTION: Clicked Field Name dropdown arrow to close list'); + await driver.sleep(2000); + + //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')); } - console.log('Passed: Metadata tab label matched as expected'); } }, - //Metadata tab label color -navy blue + //Value header { - description: 'Validate edit item tab 2', + description: 'Validate Value header text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.linkText('Metadata')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Active "Metadata" tab label color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Value header'; + const element = await driver.findElement(By.css('div:nth-child(2) > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Value') { + console.log('Passed: Value header text matched as expected'); + } else { + errors.push(`Expected: "Value"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Value header font matched as expected'); + } else { + errors.push(`Expected: Value header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Value header text font-size matched as expected'); + } else { + errors.push(`Expected: Value header text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Value header text color matched as expected'); + } else { + errors.push(`Expected: Value header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Active Metadata tab label color matched as expected'); } }, - //Concepts/Correlate tab + //Value textbox { - description: 'Validate edit item tab 3', + description: 'Verify Value textbox is present', action: async () => { - const elementText = await driver.findElement(By.linkText('Concepts/Correlate')).getText(); - if (elementText !== 'Concepts/Correlate') { - throw new Error(`Expected: "Concepts/Correlate" tab label did not match; Actual: "${elementText}"`); + const element = await driver.wait(until.elementLocated(By.css('#meta_value')), 5000).catch(() => false); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Value textbox appeared as expected'); + } else { + errors.push('Value textbox not found'); } - console.log('Passed: Concepts/Correlate tab label matched as expected'); } }, - //Concepts/Correlate tab label color -gray (dimmed) + //Add Metadata button { - description: 'Validate edit item tab 3', + description: 'Validate Add Metadata button', action: async () => { - const elementStyle = await driver.findElement(By.linkText('Concepts/Correlate')).getCssValue('color'); - if (elementStyle !== 'rgba(182, 186, 181, 1)') { - throw new Error(`Expected: Dimmed "Concepts/Correlate" tab label color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Add Metadata button'; + const element = await driver.findElement(By.css('.btn:nth-child(5)')); + + //Get text, font, color, and size + const elementText = await element.getAttribute('value'); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'Add Metadata') { + console.log('Passed: Add Metadata button text matched as expected'); + } else { + errors.push(`Expected: Button text: "Add Metadata"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Add Metadata button text font matched as expected'); + } else { + errors.push(`Expected: Add Metadata button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Add Metadata button text font-size matched as expected'); + } else { + errors.push(`Expected: Add Metadata button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Add Metadata button text color matched as expected'); + } else { + errors.push(`Expected: Add Metadata button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Add Metadata button background color matched as expected'); + } else { + errors.push(`Expected: Add Metadata 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')); } - console.log('Passed: Dimmed Concepts/Correlate tab label color matched as expected'); } }, - //Edit item Save button icon + //Current Metadata header { - description: 'Verify Save button icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.glyphicon-save')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Save button icon not found'); + description: 'Validate Current Metadata header text, size, and color', + action: async () => { + const multipleChecks = 'Current Metadata header'; + const element = await driver.findElement(By.css('span:nth-child(7)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Current Metadata') { + console.log('Passed: Current Metadata header text matched as expected'); + } else { + errors.push(`Expected: "Current Metadata"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Current Metadata header font matched as expected'); + } else { + errors.push(`Expected: Current Metadata header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Current Metadata header text font-size matched as expected'); + } else { + errors.push(`Expected: Current Metadata header text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Current Metadata header text color matched as expected'); + } else { + errors.push(`Expected: Current Metadata header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Save button icon present'); } }, - //Edit item Save button + //Name header { - description: 'Validate Save button text', + description: 'Validate Name header text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.submit-content-button')).getText(); - if (elementText !== 'Save Changes') { - throw new Error(`Expected: "Save Changes" button text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Name header'; + const element = await driver.findElement(By.css('th:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Name') { + console.log('Passed: Name header text matched as expected'); + } else { + errors.push(`Expected: "Name"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Name header font matched as expected'); + } else { + errors.push(`Expected: Name header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Name header text font-size matched as expected'); + } else { + errors.push(`Expected: Name header text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Name header text color matched as expected'); + } else { + errors.push(`Expected: Name header text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Save Changes button text matched as expected'); } }, - //Edit item Save button color -green + //Data header { - description: 'Validate Save button color', + description: 'Validate Data header text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.css('.submit-content-button')).getCssValue('color'); - if (elementStyle !== 'rgba(255, 255, 255, 1)') { - throw new Error(`Expected: "Save" button text color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Data header'; + const element = await driver.findElement(By.css('th:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Data') { + console.log('Passed: Data header text matched as expected'); + } else { + errors.push(`Expected: "Data"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Data header font matched as expected'); + } else { + errors.push(`Expected: Data header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Data header text font-size matched as expected'); + } else { + errors.push(`Expected: Data header text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Data header text color matched as expected'); + } else { + errors.push(`Expected: Data header text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Save button text color matched as expected'); } }, - //Field Name title + //Ads label { - description: 'Validate Field Name title', + description: 'Validate Ads label text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('#tabsr-4 > div:nth-child(1) > b')).getText(); - if (elementText !== 'Field Name') { - throw new Error(`Expected: "Field Name" title did not match; Actual: "${elementText}"`); + const multipleChecks = 'Ads label'; + const element = await driver.findElement(By.css('#m718311f909243a985798d8f4937c4308 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Ads') { + console.log('Passed: Ads label text matched as expected'); + } else { + errors.push(`Expected: Label: "Ads"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Ads label font matched as expected'); + } else { + errors.push(`Expected: Ads label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Ads label text font-size matched as expected'); + } else { + errors.push(`Expected: Ads label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Ads label text color matched as expected'); + } else { + errors.push(`Expected: Ads label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Field Name title matched as expected'); } }, - //Field Name textbox placeholder + //Ads textbox and delete icon { - description: 'Validate Field Name placeholder text', + description: 'Validate Ads textbox and delete icon', action: async () => { - const elementValue = await driver.findElement(By.css('.combobox:nth-child(1)')).getAttribute('placeholder'); - if (elementValue !== 'Select/Enter Field...') { - throw new Error(`Expected: "Select/Enter Field..."; Actual: "${elementValue}"`); + const multipleChecks = 'Ads textbox and delete icon'; + const element = await driver.findElement(By.css('#m718311f909243a985798d8f4937c4308 .form-control')); + const elementIcon = await driver.findElement(By.css('#m718311f909243a985798d8f4937c4308 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'No') { + console.log('Passed: Ads data textbox text matched as expected'); + } else { + errors.push(`Expected: Ads: "No"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Ads data textbox font matched as expected'); + } else { + errors.push(`Expected: Ads data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Ads data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Ads data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Ads data textbox color matched as expected'); + } else { + errors.push(`Expected: Ads data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Ads Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Ads: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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: Select/Enter Field... placeholder text matched as expected'); } }, - //Value title + //Content Type label { - description: 'Validate Value title', + description: 'Validate Content Type label text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('div:nth-child(2) > b')).getText(); - if (elementText !== 'Value') { - throw new Error(`Expected: "Value" title did not match; Actual: "${elementText}"`); + const multipleChecks = 'Content Type label'; + const element = await driver.findElement(By.css('#mb2fa2c551d7d04604b3a90dfbffcde87 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Type') { + console.log('Passed: Content Type label text matched as expected'); + } else { + errors.push(`Expected: Label: "Content Type"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Content Type label font matched as expected'); + } else { + errors.push(`Expected: Content Type label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Content Type label text font-size matched as expected'); + } else { + errors.push(`Expected: Content Type label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Content Type label text color matched as expected'); + } else { + errors.push(`Expected: Content Type label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Value title matched as expected'); } }, - //Value textbox placeholder + //Content Type dropdown and delete icon { - description: 'Validate Value placeholder text', + description: 'Validate Content Type dropdown and delete icon', action: async () => { - const elementValue = await driver.findElement(By.css('#meta_value')).getAttribute('placeholder'); - if (elementValue !== '') { - throw new Error(`Expected: "empty"; Actual: "${elementValue}"`); + const multipleChecks = 'Content Type dropdown and delete icon'; + const element = await driver.findElement(By.css('#mb2fa2c551d7d04604b3a90dfbffcde87 .form-control')); + const selectedOption = await element.findElement(By.css('option:checked')); + const elementIcon = await driver.findElement(By.css('#mb2fa2c551d7d04604b3a90dfbffcde87 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + const options = await element.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Lesson Plan') { + console.log('Passed: Content Type data dropdown text matched as expected'); + } else { + errors.push(`Expected: Content Type: "Lesson Plan"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Content Type data dropdown font matched as expected'); + } else { + errors.push(`Expected: Content Type data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Content Type data dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Content Type data dropdown font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content Type data dropdown color matched as expected'); + } else { + errors.push(`Expected: Content Type data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + 'Activity', + 'Article', + 'Assessment Question', + 'Course', + 'Curricular Theme', + 'General Resource', + 'Interactive Exercise', + 'Interactive Resource', + 'Lab Experiment', + 'Lesson Plan', + 'Quiz / Test', + 'Teacher Guide', + 'Timeline Resource', + 'Tutorial', + 'Unit', + 'Worksheet' + ]; + + 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 Type - Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Content Type - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Content Type Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Content Type: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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: empty placeholder text matched as expected'); } }, - //Add Metadata button text + //Format label { - description: 'Validate Metadata button text', + description: 'Validate Format label text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.btn:nth-child(5)')).getAttribute('value'); - if (elementText !== 'Add Metadata') { - throw new Error(`Expected: "Add Metadata" button text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Format label'; + const element = await driver.findElement(By.css('#maf6ee65f869419e9bf9b091223b6da37 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Format') { + console.log('Passed: Format label text matched as expected'); + } else { + errors.push(`Expected: Label: "Format"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Format label font matched as expected'); + } else { + errors.push(`Expected: Format label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Format label text font-size matched as expected'); + } else { + errors.push(`Expected: Format label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Format label text color matched as expected'); + } else { + errors.push(`Expected: Format label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Add Metadata button text matched as expected'); } }, - //Add Metadata button color -green + //Format dropdown and delete icon { - description: 'Validate Add Metadata button color', + description: 'Validate Format dropdown and delete icon', action: async () => { - const elementStyle = await driver.findElement(By.css('.btn:nth-child(5)')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: "Add Metadata" button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Format dropdown and delete icon'; + const element = await driver.findElement(By.css('#maf6ee65f869419e9bf9b091223b6da37 .form-control')); + const selectedOption = await element.findElement(By.css('option:checked')); + const elementIcon = await driver.findElement(By.css('#maf6ee65f869419e9bf9b091223b6da37 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + const options = await element.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'HTML') { + console.log('Passed: Format data dropdown text matched as expected'); + } else { + errors.push(`Expected: Format: "HTML"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Format data dropdown font matched as expected'); + } else { + errors.push(`Expected: Format data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Format data dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Format data dropdown font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Format data dropdown color matched as expected'); + } else { + errors.push(`Expected: Format data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + 'HTML', + 'Online Video', + 'PDF' + ]; + + 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: Format - Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Format - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Format Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Format: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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: Add Metadata button color matched as expected'); } }, - //Current Metadata title + //Free or Fee label { - description: 'Validate Current Metadata title', + description: 'Validate Free or Fee label text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('span:nth-child(7)')).getText(); - if (elementText !== 'Current Metadata') { - throw new Error(`Expected: "Current Metadata" title did not match; Actual: "${elementText}"`); + const multipleChecks = 'Free or Fee label'; + const element = await driver.findElement(By.css('#m351eb217b1f32cca4bafbfa2131bc449 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Free or Fee') { + console.log('Passed: Free or Fee label text matched as expected'); + } else { + errors.push(`Expected: Label: "Free or Fee"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Free or Fee label font matched as expected'); + } else { + errors.push(`Expected: Free or Fee label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Free or Fee label text font-size matched as expected'); + } else { + errors.push(`Expected: Free or Fee label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Free or Fee label text color matched as expected'); + } else { + errors.push(`Expected: Free or Fee label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Current Metadata title matched as expected'); } }, - //Name title + //Free or Fee dropdown and delete icon { - description: 'Validate Name title', + description: 'Validate Free or Fee dropdown and delete icon', action: async () => { - const elementText = await driver.findElement(By.css('th:nth-child(1)')).getText(); - if (elementText !== 'Name') { - throw new Error(`Expected: "Name" title did not match; Actual: "${elementText}"`); + const multipleChecks = 'Free or Fee dropdown and delete icon'; + const element = await driver.findElement(By.css('#m351eb217b1f32cca4bafbfa2131bc449 .form-control')); + const selectedOption = await element.findElement(By.css('option:checked')); + const elementIcon = await driver.findElement(By.css('#m351eb217b1f32cca4bafbfa2131bc449 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + const options = await element.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Free') { + console.log('Passed: Free or Fee data dropdown text matched as expected'); + } else { + errors.push(`Expected: Free or Fee: "Free"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Free or Fee data dropdown font matched as expected'); + } else { + errors.push(`Expected: Free or Fee data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Free or Fee data dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Free or Fee data dropdown font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Free or Fee data dropdown color matched as expected'); + } else { + errors.push(`Expected: Free or Fee data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + '$$', + 'Free', + 'Free Samples' + ]; + + 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: Free or Fee - Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Free or Fee - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Free or Fee Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Free or Fee: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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: Name title matched as expected'); } }, - //Data title + //Grade Range label { - description: 'Validate Data title', + description: 'Validate Grade Range label text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('th:nth-child(2)')).getText(); - if (elementText !== 'Data') { - throw new Error(`Expected: "Data" titlel did not match; Actual: "${elementText}"`); + const multipleChecks = 'Grade Range label'; + const element = await driver.findElement(By.css('#mff2cd573a71e3519aed5b913db085dcf > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Grade Range') { + console.log('Passed: Grade Range label text matched as expected'); + } else { + errors.push(`Expected: Label: "Grade Range"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade Range label font matched as expected'); + } else { + errors.push(`Expected: Grade Range label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Grade Range label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade Range label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Grade Range label text color matched as expected'); + } else { + errors.push(`Expected: Grade Range label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Data title matched as expected'); } }, - //Alginment Status title + //Grade Range textbox and delete icon { - description: 'Validate Alignment title', + description: 'Validate Grade Range textbox and delete icon', action: async () => { - const elementText = await driver.findElement(By.xpath('//tr[2]/td')).getText(); - if (elementText !== 'Alignment Status') { - throw new Error(`Expected: "Alignment Status" title did not match; Actual: "${elementText}"`); + const multipleChecks = 'Grade Range textbox and delete icon'; + const element = await driver.findElement(By.css('#mff2cd573a71e3519aed5b913db085dcf .form-control')); + const elementIcon = await driver.findElement(By.css('#mff2cd573a71e3519aed5b913db085dcf > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === '8 to 12') { + console.log('Passed: Grade Range data textbox text matched as expected'); + } else { + errors.push(`Expected: Grade Range: "8 to 12"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade Range data textbox font matched as expected'); + } else { + errors.push(`Expected: Grade Range data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Grade Range data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Grade Range data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Grade Range data textbox color matched as expected'); + } else { + errors.push(`Expected: Grade Range data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Grade Range Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Grade Range: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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: Alignment Status title matched as expected'); } }, - //Alignment Status textbox value + //Language label { - description: 'Validate textbox value', + description: 'Validate Language label text, size, and color', action: async () => { - const elementValue = await driver.findElement(By.css('td > .form-control')).getAttribute('value'); - if (elementValue !== 'Aligned') { - throw new Error(`Expected: Alignment Status value "Aligned"; Actual: "${elementValue}"`); + const multipleChecks = 'Language label'; + const element = await driver.findElement(By.css('#m69a67e85dc8d37db26e54e93a8731eef > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Language') { + console.log('Passed: Language label text matched as expected'); + } else { + errors.push(`Expected: Label: "Language"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Language label font matched as expected'); + } else { + errors.push(`Expected: Language label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Language label text font-size matched as expected'); + } else { + errors.push(`Expected: Language label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Language label text color matched as expected'); + } else { + errors.push(`Expected: Language label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Alignment Status value Aligned text matched as expected'); } }, - /*X delete icon - tooltip UNABLE TO FIND TOOLTIP + //Language dropdown and delete icon { - description: 'Validate X delete icon tooltip', + description: 'Validate Language dropdown and delete icon', action: async () => { - const elementStyle = await driver.findElement(By.css('#me51861f7f132f814cec419806f86545e > td:nth-child(3) > a > img')).getAttribute('title'); - if (elementStyle !== 'Remove Field') { - throw new Error(`Expected: X delete icon "Remove Field" tooltip did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: X delete icon Remove Field tooltip matched as expected'); - } - },*/ + const multipleChecks = 'Language dropdown and delete icon'; + const element = await driver.findElement(By.css('#m69a67e85dc8d37db26e54e93a8731eef .form-control')); + const selectedOption = await element.findElement(By.css('option:checked')); + const elementIcon = await driver.findElement(By.css('#m69a67e85dc8d37db26e54e93a8731eef > td:nth-child(3) > a')); - //NEXT ACTION - CONCEPTS/CORRELTATE - { description: 'Click Concepts Correlate tab link', action: async () => await driver.findElement(By.linkText('Concepts/Correlate')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(5000) }, + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + const options = await element.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'English') { + console.log('Passed: Language data dropdown text matched as expected'); + } else { + errors.push(`Expected: Language: "English"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Language data dropdown font matched as expected'); + } else { + errors.push(`Expected: Language data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Language data dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Language data dropdown font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Language data dropdown color matched as expected'); + } else { + errors.push(`Expected: Language data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + 'Arabic', + 'English', + 'French', + 'German', + 'Italian', + 'Japanese', + 'Latin', + 'More Than One', + 'Pacific Language', + 'Portuguese', + 'Spanish' + ]; + + 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: Language - Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Language - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Language Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Language: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Level-Challenging label + { + description: 'Validate LevelChallenging label text, size, and color', + action: async () => { + const multipleChecks = 'Level-Challenging label'; + const element = await driver.findElement(By.css('#m8dd4934d544003c3ca1af42caaaf7985 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Level-Challenging') { + console.log('Passed: Level-Challenging label text matched as expected'); + } else { + errors.push(`Expected: Label: "Level-Challenging"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Level-Challenging label font matched as expected'); + } else { + errors.push(`Expected: Level-Challenging label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Level-Challenging label text font-size matched as expected'); + } else { + errors.push(`Expected: Level-Challenging label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Level-Challenging label text color matched as expected'); + } else { + errors.push(`Expected: Level-Challenging label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Level-Challenging textbox and delete icon + { + description: 'Validate LevelChallenging textbox and delete icon', + action: async () => { + const multipleChecks = 'Level-Challenging textbox and delete icon'; + const element = await driver.findElement(By.css('#m8dd4934d544003c3ca1af42caaaf7985 .form-control')); + const elementIcon = await driver.findElement(By.css('#m8dd4934d544003c3ca1af42caaaf7985 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === '8') { + console.log('Passed: Level-Challenging data textbox text matched as expected'); + } else { + errors.push(`Expected: Level-Challenging: "8"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Level-Challenging data textbox font matched as expected'); + } else { + errors.push(`Expected: Level-Challenging data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Level-Challenging data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Level-Challenging data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Level-Challenging data textbox color matched as expected'); + } else { + errors.push(`Expected: Level-Challenging data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Level-Challenging Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Level-Challenging: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Level-On Target label + { + description: 'Validate LevelOn Target label text, size, and color', + action: async () => { + const multipleChecks = 'Level-On Target label'; + const element = await driver.findElement(By.css('#md1a8bc96f5a2edcfa8ee134238cd5ead > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Level-On Target') { + console.log('Passed: Level-On Target label text matched as expected'); + } else { + errors.push(`Expected: Label: "Level-On Target"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Level-On Target label font matched as expected'); + } else { + errors.push(`Expected: Level-On Target label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Level-On Target label text font-size matched as expected'); + } else { + errors.push(`Expected: Level-On Target label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Level-On Target label text color matched as expected'); + } else { + errors.push(`Expected: Level-On Target label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Level-On Target textbox and delete icon + { + description: 'Validate LevelOn Target textbox and delete icon', + action: async () => { + const multipleChecks = 'Level-On Target textbox and delete icon'; + const element = await driver.findElement(By.css('#md1a8bc96f5a2edcfa8ee134238cd5ead .form-control')); + const elementIcon = await driver.findElement(By.css('#md1a8bc96f5a2edcfa8ee134238cd5ead > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === '12') { + console.log('Passed: Level-On Target data textbox text matched as expected'); + } else { + errors.push(`Expected: Level-On Target: "12"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Level-On Target data textbox font matched as expected'); + } else { + errors.push(`Expected: Level-On Target data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Level-On Target data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Level-On Target data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Level-On Target data textbox color matched as expected'); + } else { + errors.push(`Expected: Level-On Target data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Level-On Target Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Level-On Target: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Level_Challenging label + { + description: 'Validate LevelChallenging label text, size, and color', + action: async () => { + const multipleChecks = 'Level_Challenging label'; + const element = await driver.findElement(By.css('#m4aa48829c2cbcee79bc0d5c9c6b3a6c2 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Level_Challenging') { + console.log('Passed: Level_Challenging label text matched as expected'); + } else { + errors.push(`Expected: Label: "Level_Challenging"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Level_Challenging label font matched as expected'); + } else { + errors.push(`Expected: Level_Challenging label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Level_Challenging label text font-size matched as expected'); + } else { + errors.push(`Expected: Level_Challenging label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Level_Challenging label text color matched as expected'); + } else { + errors.push(`Expected: Level_Challenging label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Level_Challenging textbox and delete icon + { + description: 'Validate LevelChallenging textbox and delete icon', + action: async () => { + const multipleChecks = 'Level_Challenging textbox and delete icon'; + const element = await driver.findElement(By.css('#m4aa48829c2cbcee79bc0d5c9c6b3a6c2 .form-control')); + const elementIcon = await driver.findElement(By.css('#m4aa48829c2cbcee79bc0d5c9c6b3a6c2 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === '8') { + console.log('Passed: Level_Challenging data textbox text matched as expected'); + } else { + errors.push(`Expected: Level_Challenging: "8"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Level_Challenging data textbox font matched as expected'); + } else { + errors.push(`Expected: Level_Challenging data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Level_Challenging data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Level_Challenging data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Level_Challenging data textbox color matched as expected'); + } else { + errors.push(`Expected: Level_Challenging data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Level_Challenging Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Level_Challenging: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Level_On Target label + { + description: 'Validate LevelOn Target label text, size, and color', + action: async () => { + const multipleChecks = 'Level_On Target label'; + const element = await driver.findElement(By.css('#m19a1d038868c30f294ee5045203780c1 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Level_On Target') { + console.log('Passed: Level_On Target label text matched as expected'); + } else { + errors.push(`Expected: Label: "Level_On Target"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Level_On Target label font matched as expected'); + } else { + errors.push(`Expected: Level_On Target label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Level_On Target label text font-size matched as expected'); + } else { + errors.push(`Expected: Level_On Target label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Level_On Target label text color matched as expected'); + } else { + errors.push(`Expected: Level_On Target label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Level_On Target textbox and delete icon + { + description: 'Validate LevelOn Target textbox and delete icon', + action: async () => { + const multipleChecks = 'Level_On Target textbox and delete icon'; + const element = await driver.findElement(By.css('#m19a1d038868c30f294ee5045203780c1 .form-control')); + const elementIcon = await driver.findElement(By.css('#m19a1d038868c30f294ee5045203780c1 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === '9,10,11,12') { + console.log('Passed: Level_On Target data textbox text matched as expected'); + } else { + errors.push(`Expected: Level_On Target: "9,10,11,12"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Level_On Target data textbox font matched as expected'); + } else { + errors.push(`Expected: Level_On Target data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Level_On Target data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Level_On Target data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Level_On Target data textbox color matched as expected'); + } else { + errors.push(`Expected: Level_On Target data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Level_On Target Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Level_On Target: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Login Required label + { + description: 'Validate Login Required label text, size, and color', + action: async () => { + const multipleChecks = 'Login Required label'; + const element = await driver.findElement(By.css('#m66634eae9c5df8a656d5862b2f3c61b1 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Login Required') { + console.log('Passed: Login Required label text matched as expected'); + } else { + errors.push(`Expected: Label: "Login Required"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Login Required label font matched as expected'); + } else { + errors.push(`Expected: Login Required label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Login Required label text font-size matched as expected'); + } else { + errors.push(`Expected: Login Required label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Login Required label text color matched as expected'); + } else { + errors.push(`Expected: Login Required label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Login Required textbox and delete icon + { + description: 'Validate Login Required textbox and delete icon', + action: async () => { + const multipleChecks = 'Login Required textbox and delete icon'; + const element = await driver.findElement(By.css('#m66634eae9c5df8a656d5862b2f3c61b1 .form-control')); + const elementIcon = await driver.findElement(By.css('#m66634eae9c5df8a656d5862b2f3c61b1 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'No') { + console.log('Passed: Login Required data textbox text matched as expected'); + } else { + errors.push(`Expected: Login Required: "No"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Login Required data textbox font matched as expected'); + } else { + errors.push(`Expected: Login Required data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Login Required data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Login Required data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Login Required data textbox color matched as expected'); + } else { + errors.push(`Expected: Login Required data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Login Required Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Login Required: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Printable label + { + description: 'Validate Printable label text, size, and color', + action: async () => { + const multipleChecks = 'Printable label'; + const element = await driver.findElement(By.css('#m45868127f2091b432170a9e864bbdd67 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Printable') { + console.log('Passed: Printable label text matched as expected'); + } else { + errors.push(`Expected: Label: "Printable"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Printable label font matched as expected'); + } else { + errors.push(`Expected: Printable label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Printable label text font-size matched as expected'); + } else { + errors.push(`Expected: Printable label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Printable label text color matched as expected'); + } else { + errors.push(`Expected: Printable label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Printable textbox and delete icon + { + description: 'Validate Printable textbox and delete icon', + action: async () => { + const multipleChecks = 'Printable textbox and delete icon'; + const element = await driver.findElement(By.css('#m45868127f2091b432170a9e864bbdd67 .form-control')); + const elementIcon = await driver.findElement(By.css('#m45868127f2091b432170a9e864bbdd67 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Yes') { + console.log('Passed: Printable data textbox text matched as expected'); + } else { + errors.push(`Expected: Printable: "Yes"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Printable data textbox font matched as expected'); + } else { + errors.push(`Expected: Printable data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Printabled data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Printable data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Printable data textbox color matched as expected'); + } else { + errors.push(`Expected: Printable data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Printable Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Printable: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Source label + { + description: 'Validate Source label text, size, and color', + action: async () => { + const multipleChecks = 'Source label'; + const element = await driver.findElement(By.css('#mec897a8d88912c6d5a93e7375db92d1c > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Source') { + console.log('Passed: Source label text matched as expected'); + } else { + errors.push(`Expected: Label: "Source"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Source label font matched as expected'); + } else { + errors.push(`Expected: Source label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Source label text font-size matched as expected'); + } else { + errors.push(`Expected: Source label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Source label text color matched as expected'); + } else { + errors.push(`Expected: Source label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Source textbox and delete icon + { + description: 'Validate Source textbox and delete icon', + action: async () => { + const multipleChecks = 'Source textbox and delete icon'; + const element = await driver.findElement(By.css('#mec897a8d88912c6d5a93e7375db92d1c .form-control')); + const elementIcon = await driver.findElement(By.css('#mec897a8d88912c6d5a93e7375db92d1c > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'University of Arizona') { + console.log('Passed: Source data textbox text matched as expected'); + } else { + errors.push(`Expected: Source: "University of Arizona"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Source data textbox font matched as expected'); + } else { + errors.push(`Expected: Source data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Source data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Source data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Source data textbox color matched as expected'); + } else { + errors.push(`Expected: Source data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Source Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Source: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Subject(s) label + { + description: 'Validate Subjects label text, size, and color', + action: async () => { + const multipleChecks = 'Subject(s) label'; + const element = await driver.findElement(By.css('#m28b7dfc64f791860c5f2f20f7c1a2027 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Subject(s)') { + console.log('Passed: Subject(s) label text matched as expected'); + } else { + errors.push(`Expected: Label: "Subject(s)"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Subject(s) label font matched as expected'); + } else { + errors.push(`Expected: Subject(s) label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Subject(s) label text font-size matched as expected'); + } else { + errors.push(`Expected: Subject(s) label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Subject(s) label text color matched as expected'); + } else { + errors.push(`Expected: Subject(s) label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Subject(s) textbox and delete icon + { + description: 'Validate Subjects textbox and delete icon', + action: async () => { + const multipleChecks = 'Subject(s) textbox and delete icon'; + const element = await driver.findElement(By.css('#m28b7dfc64f791860c5f2f20f7c1a2027 .form-control')); + const elementIcon = await driver.findElement(By.css('#m28b7dfc64f791860c5f2f20f7c1a2027 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Science,Social Studies') { + console.log('Passed: Subject(s) data textbox text matched as expected'); + } else { + errors.push(`Expected: Subject(s): "Science,Social Studies"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Subject(s) data textbox font matched as expected'); + } else { + errors.push(`Expected: Subject(s) data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Subject(s) data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Subject(s) data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Subject(s) data textbox color matched as expected'); + } else { + errors.push(`Expected: Subject(s) data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Subject(s) Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Subject(s): "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Target Audience label + { + description: 'Validate Target Audience label text, size, and color', + action: async () => { + const multipleChecks = 'Target Audience label'; + const element = await driver.findElement(By.css('#mfd8a2f5a0931f475e59ebbe64afc045b > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Target Audience') { + console.log('Passed: Target Audience label text matched as expected'); + } else { + errors.push(`Expected: Label: "Target Audience"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Target Audience label font matched as expected'); + } else { + errors.push(`Expected: Target Audience label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Target Audience label text font-size matched as expected'); + } else { + errors.push(`Expected: Target Audience label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Target Audience label text color matched as expected'); + } else { + errors.push(`Expected: Target Audience label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Target Audience dropdown and delete icon + { + description: 'Validate Target Audience dropdown and delete icon', + action: async () => { + const multipleChecks = 'Target Audiencee dropdown and delete icon'; + const element = await driver.findElement(By.css('#mfd8a2f5a0931f475e59ebbe64afc045b .form-control')); + const selectedOption = await element.findElement(By.css('option:checked')); + const elementIcon = await driver.findElement(By.css('#mfd8a2f5a0931f475e59ebbe64afc045b > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + const options = await element.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Teacher') { + console.log('Passed: Target Audience data dropdown text matched as expected'); + } else { + errors.push(`Expected: Target Audience: "English"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Target Audience data dropdown font matched as expected'); + } else { + errors.push(`Expected: Target Audience data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Target Audience data dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Target Audience data dropdown font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Target Audience data dropdown color matched as expected'); + } else { + errors.push(`Expected: Target Audiencee data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + 'Administrator', + 'Adult', + 'College/ University Instructor', + 'Curriculum Supervisor', + 'Educator', + 'Elementary School Teacher', + 'General Public', + 'Librarian / Media Specialist', + 'Medical Professional', + 'Middle School Teacher', + 'Other Educational Professional', + 'Parent', + 'Patient', + 'Policy-Maker', + 'Professional', + 'Secondary School Teacher', + 'Student', + 'Student Teacher', + 'Supervisor', + 'Teacher', + 'Teacher Educator', + 'Teaching Professional', + 'Technology Coordinator' + ]; + + 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: Target Audience - Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Target Audience - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Target Audience Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Target Audience: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Terms of Use label + { + description: 'Validate Terms of Use label text, size, and color', + action: async () => { + const multipleChecks = 'Terms of Use label'; + const element = await driver.findElement(By.css('#m65386aa4c4a432df8917936cd48ce822 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Terms of Use') { + console.log('Passed: Terms of Use label text matched as expected'); + } else { + errors.push(`Expected: Label: "Terms of Use"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Terms of Use label font matched as expected'); + } else { + errors.push(`Expected: Terms of Use label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Terms of Use label text font-size matched as expected'); + } else { + errors.push(`Expected: Terms of Use label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Terms of Use label text color matched as expected'); + } else { + errors.push(`Expected: Terms of Use label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Terms of Use textbox and delete icon + { + description: 'Validate Terms of Use textbox and delete icon', + action: async () => { + const multipleChecks = 'Terms of Use textbox and delete icon'; + const element = await driver.findElement(By.css('#m65386aa4c4a432df8917936cd48ce822 .form-control')); + const elementIcon = await driver.findElement(By.css('#m65386aa4c4a432df8917936cd48ce822 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'http://pulse.pharmacy.arizona.edu/about/index.html') { + console.log('Passed: Terms of Use data textbox text matched as expected'); + } else { + errors.push(`Expected: Terms of Use: "http://pulse.pharmacy.arizona.edu/about/index.html"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Terms of Use data textbox font matched as expected'); + } else { + errors.push(`Expected: Terms of Use data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Terms of Use data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Terms of Use data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Terms of Use data textbox color matched as expected'); + } else { + errors.push(`Expected: Terms of Use data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Terms of Use Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Terms of Use: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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 Status label + { + description: 'Validate Alignment Status label text, size, and color', + action: async () => { + const multipleChecks = 'Alignment Status label'; + const element = await driver.findElement(By.css('#mda419069683b65df715651e536180454 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Alignment Status') { + console.log('Passed: Alignment Status label text matched as expected'); + } else { + errors.push(`Expected: Label: "Alignment Status"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Alignment Status label font matched as expected'); + } else { + errors.push(`Expected: Alignment Status label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Alignment Status label text font-size matched as expected'); + } else { + errors.push(`Expected: Alignment Status label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Alignment Status label text color matched as expected'); + } else { + errors.push(`Expected: Alignment Status label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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 Status textbox and delete icon + { + description: 'Validate Alignment Status textbox and delete icon', + action: async () => { + const multipleChecks = 'Alignment Status textbox and delete icon'; + const element = await driver.findElement(By.css('#mda419069683b65df715651e536180454 .form-control')); + const elementIcon = await driver.findElement(By.css('#mda419069683b65df715651e536180454 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Not Aligned') { + console.log('Passed: Alignment Status data textbox text matched as expected'); + } else { + errors.push(`Expected: Alignment Status: "Not Aligned"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Alignment Status data textbox font matched as expected'); + } else { + errors.push(`Expected: Alignment Status data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Alignment Status data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Alignment Status data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Alignment Status data textbox color matched as expected'); + } else { + errors.push(`Expected: Alignment Status data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Alignment Status Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Alignment Status: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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: 'Add Metadata', + action: async () => { + await driver.findElement(By.css('.input-group-text')).click(); + await driver.sleep(2000); + + await driver.findElement(By.linkText('Descriptors')).click(); + await driver.sleep(2000); + + await driver.findElement(By.css('#meta_value')).sendKeys('Metadata automated check'); + await driver.sleep(2000); + + await driver.findElement(By.css('.btn:nth-child(5)')).click(); + console.log('----->| NEXT ACTION: Enter Field Name, value, then click Add Metadata button'); + + //Wait until the element exists in the DOM + const newMetadataRow = await driver.wait( + until.elementLocated(By.xpath('//tbody[2]/tr/td')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(newMetadataRow), + 30000 + ); + } + }, + + //Field Name header + { + description: 'Validate Field Name header text, size, and color', + action: async () => { + const multipleChecks = 'Field Name header'; + const element = await driver.findElement(By.css('#tabsr-4 > div:nth-child(1) > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Field Name') { + console.log('Passed: Field Name header text matched as expected'); + } else { + errors.push(`Expected: "Field Name"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Field Name header font matched as expected'); + } else { + errors.push(`Expected: Field Name header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Field Name header text font-size matched as expected'); + } else { + errors.push(`Expected: Field Name header text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Field Name header text color matched as expected'); + } else { + errors.push(`Expected: Field Name header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Field Name dropdown (SPECIAL CASE:
  • elements with data-value) + { + description: 'Validate Field Name dropdown', + action: async () => { + const multipleChecks = 'Field Name dropdown'; + const errors = []; + + //Target the combobox input + const elementDropdown = await driver.wait(until.elementLocated(By.css('input.combobox.form-control')), 5000); + + const elementText = await elementDropdown.getAttribute('placeholder'); + const elementTextFont = await elementDropdown.getCssValue('font-family'); + const elementTextSize = await elementDropdown.getCssValue('font-size'); + const elementTextColor = await elementDropdown.getCssValue('color'); + + //Click to open dropdown + await driver.findElement(By.css('.input-group-text')).click(); + console.log('----->| NEXT ACTION: Clicked Field Name dropdown arrow to open list'); + + //Wait for typeahead list to populate + await driver.wait(async () => { + const count = await driver.executeScript(` + return document.querySelectorAll('ul.typeahead li[data-value]').length; + `); + return count > 0; + }, 5000, 'Typeahead dropdown did not populate within 5 seconds'); + + //Now get the options + const actual = await driver.executeScript(` + const items = document.querySelectorAll('ul.typeahead li[data-value]'); + return Array.from(items).map(li => li.getAttribute('data-value')); + `); + //console.log('----->| DEBUG actual options:', JSON.stringify(actual)); + + //placeholder text + if (elementText === 'Select/Enter Field...') { + console.log('Passed: Field Name dropdown placeholder matched as expected'); + } else { + errors.push(`Expected: Field Name dropdown placeholder "Select/Enter Field..."; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Field Name dropdown font matched as expected'); + } else { + errors.push(`Expected: Field Name dropdown font "Poppins, sans-serif"; Actual: "${elementTextFont}"`); + } + + //font-size + if (elementTextSize === '16px') { + console.log('Passed: Field Name dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Field Name dropdown font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Field Name dropdown color matched as expected'); + } else { + errors.push(`Expected: Field Name dropdown color "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + 'Author Name', + 'Career Cluster', + 'Career Pathway', + 'Content Type', + 'Copyright Date', + 'Descriptors', + 'Entry-Level Education', + 'For Kids', + 'Format', + 'Free or Fee', + 'Grade Range', + 'Grouping', + 'High Grade', + 'ICD 9', + 'Includes', + 'InstructorRequired', + 'Language', + 'Learning Style', + 'Length', + 'Level - Challenging', + 'Level - On Target', + 'Level - Skill Builder', + 'Lexile Scale', + 'Low Grade', + 'Medical Focus', + 'Method', + 'Notes', + 'Occupation', + 'Pedagogy', + 'Price', + 'Producer', + 'Reading Level', + 'Source', + 'StudentFacingDigital ', + 'StudentFacingPrint', + 'Subject', + 'Submitted By', + 'Target Audience', + 'TeacherMaterials', + 'Technology', + 'Terms of Use' + ]; + + if (JSON.stringify(actual) === JSON.stringify(expected)) { + console.log('Passed: Field Name dropdown list matched as expected'); + } else { + errors.push(`Expected: Field Name dropdown list: ${JSON.stringify(expected)}\nActual: ${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')); + } + } + }, + + //Value header + { + description: 'Validate Value header text, size, and color', + action: async () => { + const multipleChecks = 'Value header'; + const element = await driver.findElement(By.css('div:nth-child(2) > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Value') { + console.log('Passed: Value header text matched as expected'); + } else { + errors.push(`Expected: "Value"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Value header font matched as expected'); + } else { + errors.push(`Expected: Value header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Value header text font-size matched as expected'); + } else { + errors.push(`Expected: Value header text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Value header text color matched as expected'); + } else { + errors.push(`Expected: Value header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Value textbox + { + description: 'Verify Value textbox is present', + action: async () => { + const element = await driver.wait(until.elementLocated(By.css('#meta_value')), 5000).catch(() => false); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Value textbox appeared as expected'); + } else { + errors.push('Value textbox not found'); + } + } + }, + + //Add Metadata button + { + description: 'Validate Add Metadata button', + action: async () => { + const multipleChecks = 'Add Metadata button'; + const element = await driver.findElement(By.css('.btn:nth-child(5)')); + + //Get text, font, color, and size + const elementText = await element.getAttribute('value'); + const elementFont = await element.getCssValue('font-family'); + const elementSize = 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 === 'Add Metadata') { + console.log('Passed: Add Metadata button text matched as expected'); + } else { + errors.push(`Expected: Button text: "Add Metadata"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Add Metadata button text font matched as expected'); + } else { + errors.push(`Expected: Add Metadata button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Add Metadata button text font-size matched as expected'); + } else { + errors.push(`Expected: Add Metadata button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Add Metadata button text color matched as expected'); + } else { + errors.push(`Expected: Add Metadata button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color (button highlighted) + if (elementButtonColor === 'rgba(46, 163, 153, 1)') { + console.log('Passed: Add Metadata button background color matched as expected'); + } else { + errors.push(`Expected: Add Metadata button background color: "rgba(46, 163, 153, 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')); + } + } + }, + + //Current Metadata header + { + description: 'Validate Current Metadata header text, size, and color', + action: async () => { + const multipleChecks = 'Current Metadata header'; + const element = await driver.findElement(By.css('span:nth-child(7)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Current Metadata') { + console.log('Passed: Current Metadata header text matched as expected'); + } else { + errors.push(`Expected: "Current Metadata"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Current Metadata header font matched as expected'); + } else { + errors.push(`Expected: Current Metadata header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Current Metadata header text font-size matched as expected'); + } else { + errors.push(`Expected: Current Metadata header text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Current Metadata header text color matched as expected'); + } else { + errors.push(`Expected: Current Metadata header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Name header + { + description: 'Validate Name header text, size, and color', + action: async () => { + const multipleChecks = 'Name header'; + const element = await driver.findElement(By.css('th:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Name') { + console.log('Passed: Name header text matched as expected'); + } else { + errors.push(`Expected: "Name"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Name header font matched as expected'); + } else { + errors.push(`Expected: Name header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Name header text font-size matched as expected'); + } else { + errors.push(`Expected: Name header text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Name header text color matched as expected'); + } else { + errors.push(`Expected: Name header text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Data header + { + description: 'Validate Data header text, size, and color', + action: async () => { + const multipleChecks = 'Data header'; + const element = await driver.findElement(By.css('th:nth-child(2)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Data') { + console.log('Passed: Data header text matched as expected'); + } else { + errors.push(`Expected: "Data"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Data header font matched as expected'); + } else { + errors.push(`Expected: Data header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Data header text font-size matched as expected'); + } else { + errors.push(`Expected: Data header text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Data header text color matched as expected'); + } else { + errors.push(`Expected: Data header text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Ads label + { + description: 'Validate Ads label text, size, and color', + action: async () => { + const multipleChecks = 'Ads label'; + const element = await driver.findElement(By.css('#m718311f909243a985798d8f4937c4308 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Ads') { + console.log('Passed: Ads label text matched as expected'); + } else { + errors.push(`Expected: Label: "Ads"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Ads label font matched as expected'); + } else { + errors.push(`Expected: Ads label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Ads label text font-size matched as expected'); + } else { + errors.push(`Expected: Ads label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Ads label text color matched as expected'); + } else { + errors.push(`Expected: Ads label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Ads textbox and delete icon + { + description: 'Validate Ads textbox and delete icon', + action: async () => { + const multipleChecks = 'Ads textbox and delete icon'; + const element = await driver.findElement(By.css('#m718311f909243a985798d8f4937c4308 .form-control')); + const elementIcon = await driver.findElement(By.css('#m718311f909243a985798d8f4937c4308 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'No') { + console.log('Passed: Ads data textbox text matched as expected'); + } else { + errors.push(`Expected: Ads: "No"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Ads data textbox font matched as expected'); + } else { + errors.push(`Expected: Ads data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Ads data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Ads data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Ads data textbox color matched as expected'); + } else { + errors.push(`Expected: Ads data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Ads Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Ads: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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 Type label + { + description: 'Validate Content Type label text, size, and color', + action: async () => { + const multipleChecks = 'Content Type label'; + const element = await driver.findElement(By.css('#mb2fa2c551d7d04604b3a90dfbffcde87 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Content Type') { + console.log('Passed: Content Type label text matched as expected'); + } else { + errors.push(`Expected: Label: "Content Type"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Content Type label font matched as expected'); + } else { + errors.push(`Expected: Content Type label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Content Type label text font-size matched as expected'); + } else { + errors.push(`Expected: Content Type label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Content Type label text color matched as expected'); + } else { + errors.push(`Expected: Content Type label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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 Type dropdown and delete icon + { + description: 'Validate Content Type dropdown and delete icon', + action: async () => { + const multipleChecks = 'Content Type dropdown and delete icon'; + const element = await driver.findElement(By.css('#mb2fa2c551d7d04604b3a90dfbffcde87 .form-control')); + const selectedOption = await element.findElement(By.css('option:checked')); + const elementIcon = await driver.findElement(By.css('#mb2fa2c551d7d04604b3a90dfbffcde87 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + const options = await element.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Lesson Plan') { + console.log('Passed: Content Type data dropdown text matched as expected'); + } else { + errors.push(`Expected: Content Type: "Lesson Plan"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Content Type data dropdown font matched as expected'); + } else { + errors.push(`Expected: Content Type data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Content Type data dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Content Type data dropdown font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content Type data dropdown color matched as expected'); + } else { + errors.push(`Expected: Content Type data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + 'Activity', + 'Article', + 'Assessment Question', + 'Course', + 'Curricular Theme', + 'General Resource', + 'Interactive Exercise', + 'Interactive Resource', + 'Lab Experiment', + 'Lesson Plan', + 'Quiz / Test', + 'Teacher Guide', + 'Timeline Resource', + 'Tutorial', + 'Unit', + 'Worksheet' + ]; + + 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 Type - Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Content Type - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Content Type Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Content Type: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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 label + { + description: 'Validate Format label text, size, and color', + action: async () => { + const multipleChecks = 'Format label'; + const element = await driver.findElement(By.css('#maf6ee65f869419e9bf9b091223b6da37 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Format') { + console.log('Passed: Format label text matched as expected'); + } else { + errors.push(`Expected: Label: "Format"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Format label font matched as expected'); + } else { + errors.push(`Expected: Format label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Format label text font-size matched as expected'); + } else { + errors.push(`Expected: Format label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Format label text color matched as expected'); + } else { + errors.push(`Expected: Format label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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 dropdown and delete icon + { + description: 'Validate Format dropdown and delete icon', + action: async () => { + const multipleChecks = 'Format dropdown and delete icon'; + const element = await driver.findElement(By.css('#maf6ee65f869419e9bf9b091223b6da37 .form-control')); + const selectedOption = await element.findElement(By.css('option:checked')); + const elementIcon = await driver.findElement(By.css('#maf6ee65f869419e9bf9b091223b6da37 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + const options = await element.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'HTML') { + console.log('Passed: Format data dropdown text matched as expected'); + } else { + errors.push(`Expected: Format: "HTML"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Format data dropdown font matched as expected'); + } else { + errors.push(`Expected: Format data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Format data dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Format data dropdown font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Format data dropdown color matched as expected'); + } else { + errors.push(`Expected: Format data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + 'HTML', + 'Online Video', + 'PDF' + ]; + + 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: Format: Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Format - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Format Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Format: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Free or Fee label + { + description: 'Validate Free or Fee label text, size, and color', + action: async () => { + const multipleChecks = 'Free or Fee label'; + const element = await driver.findElement(By.css('#m351eb217b1f32cca4bafbfa2131bc449 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Free or Fee') { + console.log('Passed: Free or Fee label text matched as expected'); + } else { + errors.push(`Expected: Label: "Free or Fee"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Free or Fee label font matched as expected'); + } else { + errors.push(`Expected: Free or Fee label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Free or Fee label text font-size matched as expected'); + } else { + errors.push(`Expected: Free or Fee label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Free or Fee label text color matched as expected'); + } else { + errors.push(`Expected: Free or Fee label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Free or Fee dropdown and delete icon + { + description: 'Validate Free or Fee dropdown and delete icon', + action: async () => { + const multipleChecks = 'Free or Fee dropdown and delete icon'; + const element = await driver.findElement(By.css('#m351eb217b1f32cca4bafbfa2131bc449 .form-control')); + const selectedOption = await element.findElement(By.css('option:checked')); + const elementIcon = await driver.findElement(By.css('#m351eb217b1f32cca4bafbfa2131bc449 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + const options = await element.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Free') { + console.log('Passed: Free or Fee data dropdown text matched as expected'); + } else { + errors.push(`Expected: Free or Fee: "Free"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Free or Fee data dropdown font matched as expected'); + } else { + errors.push(`Expected: Free or Fee data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Free or Fee data dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Free or Fee data dropdown font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Free or Fee data dropdown color matched as expected'); + } else { + errors.push(`Expected: Free or Fee data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + '$$', + 'Free', + 'Free Samples' + ]; + + 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: Free or Fee - Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Free or Fee - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Free or Fee Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Free or Fee: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Grade Range label + { + description: 'Validate Grade Range label text, size, and color', + action: async () => { + const multipleChecks = 'Grade Range label'; + const element = await driver.findElement(By.css('#mff2cd573a71e3519aed5b913db085dcf > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Grade Range') { + console.log('Passed: Grade Range label text matched as expected'); + } else { + errors.push(`Expected: Label: "Grade Range"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade Range label font matched as expected'); + } else { + errors.push(`Expected: Grade Range label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Grade Range label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade Range label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Grade Range label text color matched as expected'); + } else { + errors.push(`Expected: Grade Range label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Grade Range textbox and delete icon + { + description: 'Validate Grade Range textbox and delete icon', + action: async () => { + const multipleChecks = 'Grade Range textbox and delete icon'; + const element = await driver.findElement(By.css('#mff2cd573a71e3519aed5b913db085dcf .form-control')); + const elementIcon = await driver.findElement(By.css('#mff2cd573a71e3519aed5b913db085dcf > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === '8 to 12') { + console.log('Passed: Grade Range data textbox text matched as expected'); + } else { + errors.push(`Expected: Grade Range: "8 to 12"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Grade Range data textbox font matched as expected'); + } else { + errors.push(`Expected: Grade Range data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Grade Range data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Grade Range data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Grade Range data textbox color matched as expected'); + } else { + errors.push(`Expected: Grade Range data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Grade Range Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Grade Range: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Language label + { + description: 'Validate Language label text, size, and color', + action: async () => { + const multipleChecks = 'Language label'; + const element = await driver.findElement(By.css('#m69a67e85dc8d37db26e54e93a8731eef > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Language') { + console.log('Passed: Language label text matched as expected'); + } else { + errors.push(`Expected: Label: "Language"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Language label font matched as expected'); + } else { + errors.push(`Expected: Language label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Language label text font-size matched as expected'); + } else { + errors.push(`Expected: Language label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Language label text color matched as expected'); + } else { + errors.push(`Expected: Language label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Language dropdown and delete icon + { + description: 'Validate Language dropdown and delete icon', + action: async () => { + const multipleChecks = 'Language dropdown and delete icon'; + const element = await driver.findElement(By.css('#m69a67e85dc8d37db26e54e93a8731eef .form-control')); + const selectedOption = await element.findElement(By.css('option:checked')); + const elementIcon = await driver.findElement(By.css('#m69a67e85dc8d37db26e54e93a8731eef > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + const options = await element.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'English') { + console.log('Passed: Language data dropdown text matched as expected'); + } else { + errors.push(`Expected: Language: "English"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Language data dropdown font matched as expected'); + } else { + errors.push(`Expected: Language data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Language data dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Language data dropdown font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Language data dropdown color matched as expected'); + } else { + errors.push(`Expected: Language data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + 'Arabic', + 'English', + 'French', + 'German', + 'Italian', + 'Japanese', + 'Latin', + 'More Than One', + 'Pacific Language', + 'Portuguese', + 'Spanish' + ]; + + 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: Language - Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Language - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Language Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Language: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Level-Challenging label + { + description: 'Validate LevelChallenging label text, size, and color', + action: async () => { + const multipleChecks = 'Level-Challenging label'; + const element = await driver.findElement(By.css('#m8dd4934d544003c3ca1af42caaaf7985 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Level-Challenging') { + console.log('Passed: Level-Challenging label text matched as expected'); + } else { + errors.push(`Expected: Label: "Level-Challenging"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Level-Challenging label font matched as expected'); + } else { + errors.push(`Expected: Level-Challenging label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Level-Challenging label text font-size matched as expected'); + } else { + errors.push(`Expected: Level-Challenging label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Level-Challenging label text color matched as expected'); + } else { + errors.push(`Expected: Level-Challenging label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Level-Challenging textbox and delete icon + { + description: 'Validate LevelChallenging textbox and delete icon', + action: async () => { + const multipleChecks = 'Level-Challenging textbox and delete icon'; + const element = await driver.findElement(By.css('#m8dd4934d544003c3ca1af42caaaf7985 .form-control')); + const elementIcon = await driver.findElement(By.css('#m8dd4934d544003c3ca1af42caaaf7985 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === '8') { + console.log('Passed: Level-Challenging data textbox text matched as expected'); + } else { + errors.push(`Expected: Level-Challenging: "8"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Level-Challenging data textbox font matched as expected'); + } else { + errors.push(`Expected: Level-Challenging data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Level-Challenging data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Level-Challenging data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Level-Challenging data textbox color matched as expected'); + } else { + errors.push(`Expected: Level-Challenging data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Level-Challenging Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Level-Challenging: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Level-On Target label + { + description: 'Validate LevelOn Target label text, size, and color', + action: async () => { + const multipleChecks = 'Level-On Target label'; + const element = await driver.findElement(By.css('#md1a8bc96f5a2edcfa8ee134238cd5ead > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Level-On Target') { + console.log('Passed: Level-On Target label text matched as expected'); + } else { + errors.push(`Expected: Label: "Level-On Target"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Level-On Target label font matched as expected'); + } else { + errors.push(`Expected: Level-On Target label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Level-On Target label text font-size matched as expected'); + } else { + errors.push(`Expected: Level-On Target label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Level-On Target label text color matched as expected'); + } else { + errors.push(`Expected: Level-On Target label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Level-On Target textbox and delete icon + { + description: 'Validate LevelOn Target textbox and delete icon', + action: async () => { + const multipleChecks = 'Level-On Target textbox and delete icon'; + const element = await driver.findElement(By.css('#md1a8bc96f5a2edcfa8ee134238cd5ead .form-control')); + const elementIcon = await driver.findElement(By.css('#md1a8bc96f5a2edcfa8ee134238cd5ead > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === '12') { + console.log('Passed: Level-On Target data textbox text matched as expected'); + } else { + errors.push(`Expected: Level-On Target: "12"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Level-On Target data textbox font matched as expected'); + } else { + errors.push(`Expected: Level-On Target data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Level-On Target data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Level-On Target data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Level-On Target data textbox color matched as expected'); + } else { + errors.push(`Expected: Level-On Target data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Level-On Target Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Level-On Target: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Level_Challenging label + { + description: 'Validate LevelChallenging label text, size, and color', + action: async () => { + const multipleChecks = 'Level_Challenging label'; + const element = await driver.findElement(By.css('#m4aa48829c2cbcee79bc0d5c9c6b3a6c2 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Level_Challenging') { + console.log('Passed: Level_Challenging label text matched as expected'); + } else { + errors.push(`Expected: Label: "Level_Challenging"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Level_Challenging label font matched as expected'); + } else { + errors.push(`Expected: Level_Challenging label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Level_Challenging label text font-size matched as expected'); + } else { + errors.push(`Expected: Level_Challenging label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Level_Challenging label text color matched as expected'); + } else { + errors.push(`Expected: Level_Challenging label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Level_Challenging textbox and delete icon + { + description: 'Validate LevelChallenging textbox and delete icon', + action: async () => { + const multipleChecks = 'Level_Challenging textbox and delete icon'; + const element = await driver.findElement(By.css('#m4aa48829c2cbcee79bc0d5c9c6b3a6c2 .form-control')); + const elementIcon = await driver.findElement(By.css('#m4aa48829c2cbcee79bc0d5c9c6b3a6c2 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === '8') { + console.log('Passed: Level_Challenging data textbox text matched as expected'); + } else { + errors.push(`Expected: Level_Challenging: "8"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Level_Challenging data textbox font matched as expected'); + } else { + errors.push(`Expected: Level_Challenging data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Level_Challenging data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Level_Challenging data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Level_Challenging data textbox color matched as expected'); + } else { + errors.push(`Expected: Level_Challenging data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Level_Challenging Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Level_Challenging: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Level_On Target label + { + description: 'Validate LevelOn Target label text, size, and color', + action: async () => { + const multipleChecks = 'Level_On Target label'; + const element = await driver.findElement(By.css('#m19a1d038868c30f294ee5045203780c1 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Level_On Target') { + console.log('Passed: Level_On Target label text matched as expected'); + } else { + errors.push(`Expected: Label: "Level_On Target"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Level_On Target label font matched as expected'); + } else { + errors.push(`Expected: Level_On Target label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Level_On Target label text font-size matched as expected'); + } else { + errors.push(`Expected: Level_On Target label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Level_On Target label text color matched as expected'); + } else { + errors.push(`Expected: Level_On Target label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Level_On Target textbox and delete icon + { + description: 'Validate LevelOn Target textbox and delete icon', + action: async () => { + const multipleChecks = 'Level_On Target textbox and delete icon'; + const element = await driver.findElement(By.css('#m19a1d038868c30f294ee5045203780c1 .form-control')); + const elementIcon = await driver.findElement(By.css('#m19a1d038868c30f294ee5045203780c1 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === '9,10,11,12') { + console.log('Passed: Level_On Target data textbox text matched as expected'); + } else { + errors.push(`Expected: Level_On Target: "9,10,11,12"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Level_On Target data textbox font matched as expected'); + } else { + errors.push(`Expected: Level_On Target data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Level_On Target data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Level_On Target data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Level_On Target data textbox color matched as expected'); + } else { + errors.push(`Expected: Level_On Target data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Level_On Target Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Level_On Target: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Login Required label + { + description: 'Validate Login Required label text, size, and color', + action: async () => { + const multipleChecks = 'Login Required label'; + const element = await driver.findElement(By.css('#m66634eae9c5df8a656d5862b2f3c61b1 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Login Required') { + console.log('Passed: Login Required label text matched as expected'); + } else { + errors.push(`Expected: Label: "Login Required"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Login Required label font matched as expected'); + } else { + errors.push(`Expected: Login Required label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Login Required label text font-size matched as expected'); + } else { + errors.push(`Expected: Login Required label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Login Required label text color matched as expected'); + } else { + errors.push(`Expected: Login Required label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Login Required textbox and delete icon + { + description: 'Validate Login Required textbox and delete icon', + action: async () => { + const multipleChecks = 'Login Required textbox and delete icon'; + const element = await driver.findElement(By.css('#m66634eae9c5df8a656d5862b2f3c61b1 .form-control')); + const elementIcon = await driver.findElement(By.css('#m66634eae9c5df8a656d5862b2f3c61b1 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'No') { + console.log('Passed: Login Required data textbox text matched as expected'); + } else { + errors.push(`Expected: Login Required: "No"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Login Required data textbox font matched as expected'); + } else { + errors.push(`Expected: Login Required data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Login Required data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Login Required data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Login Required data textbox color matched as expected'); + } else { + errors.push(`Expected: Login Required data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Login Required Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Login Required: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Printable label + { + description: 'Validate Printable label text, size, and color', + action: async () => { + const multipleChecks = 'Printable label'; + const element = await driver.findElement(By.css('#m45868127f2091b432170a9e864bbdd67 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Printable') { + console.log('Passed: Printable label text matched as expected'); + } else { + errors.push(`Expected: Label: "Printable"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Printable label font matched as expected'); + } else { + errors.push(`Expected: Printable label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Printable label text font-size matched as expected'); + } else { + errors.push(`Expected: Printable label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Printable label text color matched as expected'); + } else { + errors.push(`Expected: Printable label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Printable textbox and delete icon + { + description: 'Validate Printable textbox and delete icon', + action: async () => { + const multipleChecks = 'Printable textbox and delete icon'; + const element = await driver.findElement(By.css('#m45868127f2091b432170a9e864bbdd67 .form-control')); + const elementIcon = await driver.findElement(By.css('#m45868127f2091b432170a9e864bbdd67 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Yes') { + console.log('Passed: Printable data textbox text matched as expected'); + } else { + errors.push(`Expected: Printable: "Yes"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Printable data textbox font matched as expected'); + } else { + errors.push(`Expected: Printable data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Printabled data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Printable data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Printable data textbox color matched as expected'); + } else { + errors.push(`Expected: Printable data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Printable Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Printable: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Source label + { + description: 'Validate Source label text, size, and color', + action: async () => { + const multipleChecks = 'Source label'; + const element = await driver.findElement(By.css('#mec897a8d88912c6d5a93e7375db92d1c > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Source') { + console.log('Passed: Source label text matched as expected'); + } else { + errors.push(`Expected: Label: "Source"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Source label font matched as expected'); + } else { + errors.push(`Expected: Source label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Source label text font-size matched as expected'); + } else { + errors.push(`Expected: Source label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Source label text color matched as expected'); + } else { + errors.push(`Expected: Source label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Source textbox and delete icon + { + description: 'Validate Source textbox and delete icon', + action: async () => { + const multipleChecks = 'Source textbox and delete icon'; + const element = await driver.findElement(By.css('#mec897a8d88912c6d5a93e7375db92d1c .form-control')); + const elementIcon = await driver.findElement(By.css('#mec897a8d88912c6d5a93e7375db92d1c > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'University of Arizona') { + console.log('Passed: Source data textbox text matched as expected'); + } else { + errors.push(`Expected: Source: "University of Arizona"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Source data textbox font matched as expected'); + } else { + errors.push(`Expected: Source data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Source data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Source data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Source data textbox color matched as expected'); + } else { + errors.push(`Expected: Source data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Source Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Source: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Subject(s) label + { + description: 'Validate Subjects label text, size, and color', + action: async () => { + const multipleChecks = 'Subject(s) label'; + const element = await driver.findElement(By.css('#m28b7dfc64f791860c5f2f20f7c1a2027 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Subject(s)') { + console.log('Passed: Subject(s) label text matched as expected'); + } else { + errors.push(`Expected: Label: "Subject(s)"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Subject(s) label font matched as expected'); + } else { + errors.push(`Expected: Subject(s) label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Subject(s) label text font-size matched as expected'); + } else { + errors.push(`Expected: Subject(s) label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Subject(s) label text color matched as expected'); + } else { + errors.push(`Expected: Subject(s) label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Subject(s) textbox and delete icon + { + description: 'Validate Subjects textbox and delete icon', + action: async () => { + const multipleChecks = 'Subject(s) textbox and delete icon'; + const element = await driver.findElement(By.css('#m28b7dfc64f791860c5f2f20f7c1a2027 .form-control')); + const elementIcon = await driver.findElement(By.css('#m28b7dfc64f791860c5f2f20f7c1a2027 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Science,Social Studies') { + console.log('Passed: Subject(s) data textbox text matched as expected'); + } else { + errors.push(`Expected: Subject(s): "Science,Social Studies"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Subject(s) data textbox font matched as expected'); + } else { + errors.push(`Expected: Subject(s) data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Subject(s) data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Subject(s) data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Subject(s) data textbox color matched as expected'); + } else { + errors.push(`Expected: Subject(s) data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Subject(s) Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Subject(s): "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Target Audience label + { + description: 'Validate Target Audience label text, size, and color', + action: async () => { + const multipleChecks = 'Target Audience label'; + const element = await driver.findElement(By.css('#mfd8a2f5a0931f475e59ebbe64afc045b > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Target Audience') { + console.log('Passed: Target Audience label text matched as expected'); + } else { + errors.push(`Expected: Label: "Target Audience"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Target Audience label font matched as expected'); + } else { + errors.push(`Expected: Target Audience label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Target Audience label text font-size matched as expected'); + } else { + errors.push(`Expected: Target Audience label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Target Audience label text color matched as expected'); + } else { + errors.push(`Expected: Target Audience label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Target Audience dropdown and delete icon + { + description: 'Validate Target Audience dropdown and delete icon', + action: async () => { + const multipleChecks = 'Target Audiencee dropdown and delete icon'; + const element = await driver.findElement(By.css('#mfd8a2f5a0931f475e59ebbe64afc045b .form-control')); + const selectedOption = await element.findElement(By.css('option:checked')); + const elementIcon = await driver.findElement(By.css('#mfd8a2f5a0931f475e59ebbe64afc045b > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + const options = await element.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Teacher') { + console.log('Passed: Target Audience data dropdown text matched as expected'); + } else { + errors.push(`Expected: Target Audience: "English"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Target Audience data dropdown font matched as expected'); + } else { + errors.push(`Expected: Target Audience data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Target Audience data dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Target Audience data dropdown font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Target Audience data dropdown color matched as expected'); + } else { + errors.push(`Expected: Target Audiencee data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + 'Administrator', + 'Adult', + 'College/ University Instructor', + 'Curriculum Supervisor', + 'Educator', + 'Elementary School Teacher', + 'General Public', + 'Librarian / Media Specialist', + 'Medical Professional', + 'Middle School Teacher', + 'Other Educational Professional', + 'Parent', + 'Patient', + 'Policy-Maker', + 'Professional', + 'Secondary School Teacher', + 'Student', + 'Student Teacher', + 'Supervisor', + 'Teacher', + 'Teacher Educator', + 'Teaching Professional', + 'Technology Coordinator' + ]; + + 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: Target Audience - Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Target Audience - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Target Audience Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Target Audience: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Terms of Use label + { + description: 'Validate Terms of Use label text, size, and color', + action: async () => { + const multipleChecks = 'Terms of Use label'; + const element = await driver.findElement(By.css('#m65386aa4c4a432df8917936cd48ce822 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Terms of Use') { + console.log('Passed: Terms of Use label text matched as expected'); + } else { + errors.push(`Expected: Label: "Terms of Use"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Terms of Use label font matched as expected'); + } else { + errors.push(`Expected: Terms of Use label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Terms of Use label text font-size matched as expected'); + } else { + errors.push(`Expected: Terms of Use label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Terms of Use label text color matched as expected'); + } else { + errors.push(`Expected: Terms of Use label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Terms of Use textbox and delete icon + { + description: 'Validate Terms of Use textbox and delete icon', + action: async () => { + const multipleChecks = 'Terms of Use textbox and delete icon'; + const element = await driver.findElement(By.css('#m65386aa4c4a432df8917936cd48ce822 .form-control')); + const elementIcon = await driver.findElement(By.css('#m65386aa4c4a432df8917936cd48ce822 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'http://pulse.pharmacy.arizona.edu/about/index.html') { + console.log('Passed: Terms of Use data textbox text matched as expected'); + } else { + errors.push(`Expected: Terms of Use: "http://pulse.pharmacy.arizona.edu/about/index.html"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Terms of Use data textbox font matched as expected'); + } else { + errors.push(`Expected: Terms of Use data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Terms of Use data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Terms of Use data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Terms of Use data textbox color matched as expected'); + } else { + errors.push(`Expected: Terms of Use data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Terms of Use Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Terms of Use: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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 Status label + { + description: 'Validate Alignment Status label text, size, and color', + action: async () => { + const multipleChecks = 'Alignment Status label'; + const element = await driver.findElement(By.css('#mda419069683b65df715651e536180454 > td:nth-child(1)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Alignment Status') { + console.log('Passed: Alignment Status label text matched as expected'); + } else { + errors.push(`Expected: Label: "Alignment Status"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Alignment Status label font matched as expected'); + } else { + errors.push(`Expected: Alignment Status label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Alignment Status label text font-size matched as expected'); + } else { + errors.push(`Expected: Alignment Status label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Alignment Status label text color matched as expected'); + } else { + errors.push(`Expected: Alignment Status label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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 Status textbox and delete icon + { + description: 'Validate Alignment Status textbox and delete icon', + action: async () => { + const multipleChecks = 'Alignment Status textbox and delete icon'; + const element = await driver.findElement(By.css('#mda419069683b65df715651e536180454 .form-control')); + const elementIcon = await driver.findElement(By.css('#mda419069683b65df715651e536180454 > td:nth-child(3) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + const elementIconTooltip = await elementIcon.getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Not Aligned') { + console.log('Passed: Alignment Status data textbox text matched as expected'); + } else { + errors.push(`Expected: Alignment Status: "Not Aligned"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Alignment Status data textbox font matched as expected'); + } else { + errors.push(`Expected: Alignment Status data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Alignment Status data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Alignment Status data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Alignment Status data textbox color matched as expected'); + } else { + errors.push(`Expected: Alignment Status data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon tool-tip + if (elementIconTooltip === 'Remove Field') { + console.log('Passed: Alignment Status Delete icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Alignment Status: "Remove Field"; Actual: "${elementIconTooltip}"`); + } + + //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')); + } + } + }, + + //Descriptors label + { + description: 'Validate Descriptors label text, size, and color', + action: async () => { + const multipleChecks = 'Descriptors label'; + const element = await driver.findElement(By.xpath('//tbody[2]/tr/td')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Descriptors') { + console.log('Passed: Descriptors label text matched as expected'); + } else { + errors.push(`Expected: Label: "Descriptors"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Descriptors label font matched as expected'); + } else { + errors.push(`Expected: Descriptors label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Descriptors label text font-size matched as expected'); + } else { + errors.push(`Expected: Descriptors label text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Descriptors label text color matched as expected'); + } else { + errors.push(`Expected: Descriptors label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Descriptors textbox and delete icon + { + description: 'Validate Descriptors textbox and delete icon', + action: async () => { + const multipleChecks = 'Descriptors textbox and delete icon'; + const element = await driver.findElement(By.xpath('//tbody[2]/tr/td[2]/input')); + const elementIcon = await driver.findElement(By.xpath('//tbody[2]/tr/td[3]/a/img')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + const elementTextFont = await element.getCssValue('font-family'); + const elementTextSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Metadata automated check') { + console.log('Passed: Descriptors data textbox text matched as expected'); + } else { + errors.push(`Expected: Descriptors: "Metadata automated check"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Descriptors data textbox font matched as expected'); + } else { + errors.push(`Expected: Descriptors data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Descriptors data textbox font-size matched as expected'); + } else { + errors.push(`Expected: Descriptors data textbox font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Descriptors data textbox color matched as expected'); + } else { + errors.push(`Expected: Descriptors data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + //icon + if (elementIcon) { + console.log('Passed: Descriptors data Delete icon icon is present'); + } else { + errors.push('Descriptors data Delete icon icon was not found'); + } + + //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: 'Delete added metadata and validate alert message', + action: async () => { + const multipleChecks = 'Delete metadata alert'; + const errors = []; + + //Click delete button + const deleteButton = await driver.wait(until.elementLocated(By.xpath('//tbody[2]/tr/td[3]/a/img')), 5000); + await deleteButton.click(); + await driver.sleep(5000); + console.log('----->| NEXT ACTION: Clicked Delete icon for added metadata'); + + //Wait for confirm dialog to appear + const alert = await driver.wait(until.alertIsPresent(), 5000); + console.log('----->| NEXT ACTION: Alert dialog appeared as expected'); + + //Get alert text + const alertText = await alert.getText(); + + //Validate alert message text + const expectedText = 'Are you sure you want to delete this?'; + if (alertText === expectedText) { + console.log('Passed: Delete Alert dialog text matched as expected'); + } else { + errors.push(`Expected: "${expectedText}"; Actual: "${alertText}"`); + } + + //Throw summary before dismissing if errors found + if (errors.length > 0) { + await alert.dismiss(); //Cancel the delete if validation failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + + //Accept the alert (click OK) to proceed with deletion + await alert.accept(); + console.log('----->| NEXT ACTION: Clicked OK to confirm alert div Content Set deletion'); + await driver.sleep(5000); + + //Wait until the element is no longer visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.xpath('//tbody[2]/tr/td')); + return !(await element.isDisplayed()); //! flips visible to not visible + } catch (e) { + return true; //Element not found at all = also acceptable + } + }, 20000, 'Field Name: Descriptors did not disappear within 20 seconds'); + + console.log('Passed: Field Name: Descriptors is no longer visible as expected'); + } + }, + + //NEXT ACTION + { + description: 'Click ConceptsCorrelate tab link', + action: async () => { + await driver.executeScript('window.scrollTo(0, 0);'); + await driver.sleep(2000); + + await driver.findElement(By.linkText('Concepts/Correlate')).click(); + console.log('----->| NEXT ACTION: Scrolled to top of page and clicked Concepts/Correlate tab link'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Edit Item - Concepts/Correlate page did not fully load within 30 seconds'); + + //Wait until the element exists in the DOM + const pageHeader = await driver.wait( + until.elementLocated(By.css('.ui-widget-heading')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(pageHeader), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Edit Item - Concepts/Correlate page did not fully load within 30 seconds'); + console.log('Passed: Edit Item - Concepts/Correlate page loaded successfully'); + } + }, + + //Edit Item - Concepts/Correlate page //Page title { - description: 'Validate Page title', + description: 'Validate Edit page title text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('#myModalLabel')).getText(); - if (elementText !== 'Edit Item') { - throw new Error(`Expected: "Edit Item" title did not match; Actual: "${elementText}"`); - } - console.log('Passed: Edit Item title matched as expected'); - } - }, + const multipleChecks = 'Edit page title'; + const element = await driver.findElement(By.css('#myModalLabel')); - //Page title color -navy blue - { - description: 'Validate Page title color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#myModalLabel')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: "Edit Item" Page title color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Edit Item Page title color matched as expected'); - } - }, + //Get text, font, size, and 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'); - //Page title font size -32px - { - description: 'Validate Page title color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#myModalLabel')).getCssValue('font-size'); - if (elementStyle !== '32px') { - throw new Error(`Expected: "Edit Item" Page title font size did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Edit Item Page title font size matched as expected'); - } - }, + //Track all errors + const errors = []; - //Resource tab - { - description: 'Validate edit item tab 1', - action: async () => { - const elementText = await driver.findElement(By.linkText('Resource')).getText(); - if (elementText !== 'Resource') { - throw new Error(`Expected: "Resource" tab label did not match; Actual: "${elementText}"`); + //text + if (elementText === 'Edit Item') { + console.log('Passed: Edit page title text matched as expected'); + } else { + errors.push(`Expected: "Edit Item"; Actual: "${elementText}"`); } - console.log('Passed: Resource tab label matched as expected'); - } - }, - //Resource tab label color -gray (dimmed) - { - description: 'Validate edit item tab 1', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Resource')).getCssValue('color'); - if (elementStyle !== 'rgba(182, 186, 181, 1)') { - throw new Error(`Expected: Dimmed "Resource" tab label color did not match; Actual: "${elementStyle}"`); + //font-family + if (elementTextFont === `"DM Serif Display", serif`) { + console.log('Passed: Edit page title font matched as expected'); + } else { + errors.push(`Expected: Edit page title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); } - console.log('Passed: Dimmed Resource tab label color matched as expected'); - } - }, - //Metadata tab - { - description: 'Validate edit item tab 2', - action: async () => { - const elementText = await driver.findElement(By.linkText('Metadata')).getText(); - if (elementText !== 'Metadata') { - throw new Error(`Expected: "Metadata" tab label did not match; Actual: "${elementText}"`); + //font size + if (elementTextSize === '32px') { + console.log('Passed: Edit page title text font-size matched as expected'); + } else { + errors.push(`Expected: Edit page title text font-size "32px"; Actual: "${elementTextSize}"`); } - console.log('Passed: Metadata tab label matched as expected'); - } - }, - //Metadata tab label color -gray (dimmed) - { - description: 'Validate edit item tab 2', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Metadata')).getCssValue('color'); - if (elementStyle !== 'rgba(182, 186, 181, 1)') { - throw new Error(`Expected: Dimmed "Metadata" tab label color did not match; Actual: "${elementStyle}"`); + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Edit page title text color matched as expected'); + } else { + errors.push(`Expected: Edit page title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); } - console.log('Passed: Dimmed Metadata tab label color matched as expected'); - } - }, - //Concepts/Correlate tab - { - description: 'Validate edit item tab 3', - action: async () => { - const elementText = await driver.findElement(By.linkText('Concepts/Correlate')).getText(); - if (elementText !== 'Concepts/Correlate') { - throw new Error(`Expected: "Concepts/Correlate" tab label did not match; Actual: "${elementText}"`); - } - console.log('Passed: Concepts/Correlate tab label matched as expected'); - } - }, - - //Concepts/Correlate tab label color -navy bue - { - description: 'Validate edit item tab 3', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Concepts/Correlate')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Active "Concepts/Correlate" tab label color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Active Concepts/Correlate tab label color matched as expected'); - } - }, - - //Edit item Save button icon - { - description: 'Verify Save button icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.glyphicon-save')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Save button icon not found'); - } - console.log('Passed: Save button icon present'); - } - }, - - //Edit item Save button - { - description: 'Validate Save button text', - action: async () => { - const elementText = await driver.findElement(By.css('.submit-content-button')).getText(); - if (elementText !== 'Save Changes') { - throw new Error(`Expected: "Save Changes" button text did not match; Actual: "${elementText}"`); - } - console.log('Passed: Save Changes button text matched as expected'); - } - }, - - //Edit item Save button color -green - { - description: 'Validate Save button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.submit-content-button')).getCssValue('color'); - if (elementStyle !== 'rgba(255, 255, 255, 1)') { - throw new Error(`Expected: "Save" button text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Save button text color matched as expected'); - } - }, - - //Tagged Concepts title - { - description: 'Validate Tagged Concepts title text', - action: async () => { - const elementText = await driver.findElement(By.css('.ui-widget-heading')).getText(); - if (elementText !== 'Tagged Concepts:') { - throw new Error(`Expected: "Tagged Concepts:" title text did not match; Actual: "${elementText}"`); - } - console.log('Passed: Tagged Concepts: title text matched as expected'); - } - }, - - //Tagged Concepts breadcrumb 1 text - { - description: 'Validate Tagged Concepts breadcrumb 1 text', - action: async () => { - try { - const element = await driver.findElement(By.css('#k11532326')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'Science | Physical Science | Chemistry | Scientists | General'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: Content 1 description "${expectedText}" text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: Content 1 description "${expectedText}" text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); + //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`); } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } } }, - //Tagged Concepts remove button 1 icon + //Resource tab title { - description: 'Verify remove button 1 icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#k11532326 .glyphicon')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Tagged Concept "Remove" button 1 icon not found'); - } - console.log('Passed: Tagged Concept Remove button 1 icon present'); - } - }, - - //Tagged Concepts remove button 1 text - { - description: 'Validate Tagged Concepts delete button 1 text', + description: 'Validate Resource tab title text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('#k11532326 > .btn')).getText(); - if (elementText !== 'Remove') { - throw new Error(`Expected: Tagged Concept "Remove" button 1 text did not match; Actual: "${elementText}"`); - } - console.log('Passed: Tagged Concept Remove button 1 text matched as expected'); - } - }, + const multipleChecks = 'Resource title'; + const element = await driver.findElement(By.linkText('Resource')); - //Tagged Concepts remove button 1 color -red - { - description: 'Validate remove button 1 label color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#k11532326 > .btn')).getCssValue('background-color'); - if (elementStyle !== 'rgba(246, 60, 40, 1)') { - throw new Error(`Expected: Tagged Concept "Remove" button 1 color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Tagged Concept Remove button 1 color matched as expected'); - } - }, + //Get text, font, size, and 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'); - //Tagged Concepts remove button 1 -tooltip - { - description: 'Validate Tagged Concepts remove button 1 tooltip', - action: async () => { - const elementStyle = await driver.findElement(By.css('#k11532326 > .btn')).getAttribute('title'); - if (elementStyle !== 'Remove Concept') { - throw new Error(`Expected: Tagged Concept "Remove Concept" button 1 tooltip did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Tagged Concepts Remove Concept button 1 tooltip matched as expected'); - } - }, + //Track all errors + const errors = []; - //Tagged Concepts primary toggle button 1 - { - description: 'Verify primary toggle button 1 is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#k11532326 .switch-primary')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Tagged Concept "Primary" toggle button 1 icon not found'); + //text + if (elementText === 'Resource') { + console.log('Passed: Resource tab title text matched as expected'); + } else { + errors.push(`Expected: "Resource"; Actual: "${elementText}"`); } - console.log('Passed: Tagged Concept Primary toggle button 1 icon present'); - } - }, - //Tagged Concepts breadcrumb 2 text - { - description: 'Validate Tagged Concepts breadcrumb 2 text', - action: async () => { - try { - const element = await driver.findElement(By.css('#k425604097')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'Language Arts | General'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: Content 1 description "${expectedText}" text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: Content 1 description "${expectedText}" text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Resource tab title font matched as expected'); + } else { + errors.push(`Expected: Resource tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Resource tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Resource tab title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Resource tab title text color matched as expected'); + } else { + errors.push(`Expected: Resource tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //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`); } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } } }, - - //Tagged Concepts remove button 2 icon + + //Metadata tab tab title { - description: 'Verify remove button 2 icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#k425604097 .glyphicon')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Tagged Concept "Remove" button 2 icon not found'); - } - console.log('Passed: Remove button 2 icon present'); - } - }, - - //Tagged Concepts remove button 2 text - { - description: 'Validate Tagged Concepts delete button 2 text', + description: 'Validate Metadata tab title text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('#k425604097 > .btn')).getText(); - if (elementText !== 'Remove') { - throw new Error(`Expected: Tagged Concept "Remove" button 2 text did not match; Actual: "${elementText}"`); - } - console.log('Passed: Tagged Concept Remove button 2 text matched as expected'); - } - }, + const multipleChecks = 'Metadata tab title'; + const element = await driver.findElement(By.linkText('Metadata')); - //Tagged Concepts remove button 2 color -red - { - description: 'Validate remove button 2 color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#k425604097 > .btn')).getCssValue('background-color'); - if (elementStyle !== 'rgba(246, 60, 40, 1)') { - throw new Error(`Expected: Tagged Concept "Remove" button 2 text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Tagged Concept Remove button 2 text color matched as expected'); - } - }, + //Get text, font, size, and 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'); - //Tagged Concepts remove button 2 -tooltip - { - description: 'Validate Tagged Concepts remove button 2 tooltip', - action: async () => { - const elementStyle = await driver.findElement(By.css('#k425604097 > .btn')).getAttribute('title'); - if (elementStyle !== 'Remove Concept') { - throw new Error(`Expected: Tagged Concept "Remove Concept" button 2 tooltip did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Tagged Concept Remove Concept button 2 tooltip matched as expected'); - } - }, + //Track all errors + const errors = []; - //Tagged Concepts primary toggle button 2 - { - description: 'Verify primary toggle button 2 is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#k425604097 .switch-primary')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Tagged Concept "Primary" toggle button 2 icon not found'); + //text + if (elementText === 'Metadata') { + console.log('Passed: Metadata tab title text matched as expected'); + } else { + errors.push(`Expected: "Metadata"; Actual: "${elementText}"`); } - console.log('Passed: Tagged Concept Primary toggle button 2 icon present'); - } - }, - //Tagged Concepts breadcrumb 3 text - { - description: 'Validate Tagged Concepts breadcrumb 3 text', - action: async () => { - try { - const element = await driver.findElement(By.css('#k425604100')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'Social Studies | General'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: Content 1 description "${expectedText}" text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: Content 1 description "${expectedText}" text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Metadata tab title font matched as expected'); + } else { + errors.push(`Expected: Metadata tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Metadata tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Metadata tab title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Metadata tab title text color matched as expected'); + } else { + errors.push(`Expected: Metadata tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //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`); } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } } }, - //Tagged Concepts remove button 3 icon + //Concepts/Correlate tab title (active) { - description: 'Verify remove button 3 icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#k425604100 .glyphicon')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Tagged Concept "Remove" button 3 icon not found'); - } - console.log('Passed: Remove button 3 icon present'); - } - }, - - //Tagged Concepts remove button 3 text - { - description: 'Validate Tagged Concepts delete button 3 text', + description: 'Validate ConceptsCorrelate tab title text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('#k425604100 > .btn')).getText(); - if (elementText !== 'Remove') { - throw new Error(`Expected: Tagged Concept "Remove" button 3 text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Concepts/Correlate title'; + const element = await driver.findElement(By.linkText('Concepts/Correlate')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Concepts/Correlate') { + console.log('Passed: Concepts/Correlate tab title text matched as expected'); + } else { + errors.push(`Expected: "Concepts/Correlate"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Concepts/Correlate tab title font matched as expected'); + } else { + errors.push(`Expected: Concepts/Correlate tab title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14px') { + console.log('Passed: Concepts/Correlate tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Concepts/Correlate tab title text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Concepts/Correlate tab title text color matched as expected'); + } else { + errors.push(`Expected: Concepts/Correlate tab title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Tagged Concept Remove button 3 text matched as expected'); } }, - - //Tagged Concepts remove button 3 color -red + + //Save Changes button { - description: 'Validate remove button 3 color', + description: 'Validate Save Changes button', action: async () => { - const elementStyle = await driver.findElement(By.css('#k425604100 > .btn')).getCssValue('background-color'); - if (elementStyle !== 'rgba(246, 60, 40, 1)') { - throw new Error(`Expected: Tagged Concept "Remove" button 3 text color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Save Changes button'; + const elementIcon = await driver.findElement(By.css('.glyphicon-save')); + const element = await driver.findElement(By.css('.submit-content-button')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Save Changes icon is present'); + } else { + errors.push('Save Changes icon was not found'); + } + + //text + if (elementText === 'Save Changes') { + console.log('Passed: Save Changes button text matched as expected'); + } else { + errors.push(`Expected: Button text: "Save Changes"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Save Changes button text font matched as expected'); + } else { + errors.push(`Expected: Save Changes button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Save Changes button text font-size matched as expected'); + } else { + errors.push(`Expected: Save Changes button text font-size "14px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Save Changes button text color matched as expected'); + } else { + errors.push(`Expected: Save Changes button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Save Changes button background color matched as expected'); + } else { + errors.push(`Expected: Save Changes 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')); } - console.log('Passed: Tagged Concept Remove button 3 text color matched as expected'); } }, - //Tagged Concepts remove button 3 -tooltip + //Tagged Concepts: header { - description: 'Validate Tagged Concepts remove button 3 tooltip', + description: 'Validate Tagged Concepts header text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.css('#k425604100 > .btn')).getAttribute('title'); - if (elementStyle !== 'Remove Concept') { - throw new Error(`Expected: Tagged Concept "Remove Concept" button 3 tooltip did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Tagged Concepts: header'; + const element = await driver.findElement(By.css('.ui-widget-heading')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Tagged Concepts:') { + console.log('Passed: Tagged Concepts: header text matched as expected'); + } else { + errors.push(`Expected: "Tagged Concepts:"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: header font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Tagged Concepts: header text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: header text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Tagged Concepts: header text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Tagged Concept Remove Concept button 3 tooltip matched as expected'); } }, - - //Tagged Concepts primary toggle button 3 + + //Tagged Concepts: Language Arts | General text { - description: 'Verify primary toggle button 3 is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#k425604100 .switch-primary')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Tagged Concept "Primary" toggle button 3 icon not found'); - } - console.log('Passed: Tagged Concept Primary toggle button 3 icon present'); - } - }, - - //Find Concepts title text - { - description: 'Validate Find Concepts title text', + description: 'Validate Tagged Concepts Language Arts General text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('p')).getText(); - if (elementText !== 'Find Concepts') { - throw new Error(`Expected: "Find Concepts" title text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Tagged Concepts: Language Arts | General'; + const element = await driver.findElement(By.css('#k425604097')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Language Arts | General')) { + console.log('Passed: Tagged Concepts: Language Arts | General text matched as expected'); + } else { + errors.push(`Expected: "Language Arts | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Language Arts | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Language Arts | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Language Arts | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Language Arts | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Language Arts | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Language Arts | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Find Concepts title text matched as expected'); } }, + //Remove button1 + { + description: 'Validate Remove button1', + action: async () => { + const multipleChecks = 'Save Changes button1'; + const elementIcon = await driver.findElement(By.css('#k425604097 .glyphicon')); + const element = await driver.findElement(By.css('#k425604097 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 1 icon is present'); + } else { + errors.push('Save Remove button 1 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 1 text matched as expected'); + } else { + errors.push(`Expected: Button 1 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 1 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 1 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 1 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 1 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 1 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 1 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 1 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 1 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 1 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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')); + } + } + }, + + //Primary toggle icon1 + { + description: 'Verify Primary toggle icon1 is present', + action: async () => { + const element = await driver.wait(until.elementLocated(By.css('#k425604097 label')), 5000).catch(() => false); + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('li#k425604097'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Primary toggle icon 1 appeared as expected'); + } else { + errors.push('Primary toggle icon 1 not found'); + } + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Primary toggle icon 1 toggle switch listed as expected'); + } else { + errors.push(`Expected: Primary toggle icon 1: "switch-toggle"; Actual: "${toggleClass}"`); + } + } + }, + + //Tagged Concepts: Mathematics | General text + { + description: 'Validate Tagged Concepts Mathematics General text, size, and color', + action: async () => { + const multipleChecks = 'Tagged Concepts: Mathematics | General'; + const element = await driver.findElement(By.css('#k425604098')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Mathematics | General')) { + console.log('Passed: Tagged Concepts: Mathematics | General text matched as expected'); + } else { + errors.push(`Expected: "Mathematics | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Mathematics | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Mathematics | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Mathematics | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Mathematics | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Mathematics | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Mathematics | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Remove button2 + { + description: 'Validate Remove button2', + action: async () => { + const multipleChecks = 'Save Changes button2'; + const elementIcon = await driver.findElement(By.css('#k425604098 .glyphicon')); + const element = await driver.findElement(By.css('#k425604098 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 2 icon is present'); + } else { + errors.push('Save Remove button 2 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 2 text matched as expected'); + } else { + errors.push(`Expected: Button 2 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 2 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 2 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 2 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 2 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 2 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 2 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 2 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 2 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 2 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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')); + } + } + }, + + //Primary toggle icon2 + { + description: 'Verify Primary toggle icon2 is present', + action: async () => { + const element = await driver.wait(until.elementLocated(By.css('#k425604098 label')), 5000).catch(() => false); + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('li#k425604098'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Primary toggle icon 2 appeared as expected'); + } else { + errors.push('Primary toggle icon 2 not found'); + } + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Primary toggle icon 2 toggle switch listed as expected'); + } else { + errors.push(`Expected: Primary toggle icon 2: "switch-toggle"; Actual: "${toggleClass}"`); + } + } + }, + + //Tagged Concepts: Science | General text + { + description: 'Validate Tagged Concepts Science General text, size, and color', + action: async () => { + const multipleChecks = 'Tagged Concepts: Science | General'; + const element = await driver.findElement(By.css('#k425604099')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Science | General')) { + console.log('Passed: Tagged Concepts: Science | General text matched as expected'); + } else { + errors.push(`Expected: "Science | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Science | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Science | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Science | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Science | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Science | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Science | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Remove button3 + { + description: 'Validate Remove button3', + action: async () => { + const multipleChecks = 'Save Changes button3'; + const elementIcon = await driver.findElement(By.css('#k425604099 .glyphicon')); + const element = await driver.findElement(By.css('#k425604099 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 3 icon is present'); + } else { + errors.push('Save Remove button 3 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 3 text matched as expected'); + } else { + errors.push(`Expected: Button 3 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 3 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 3 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 3 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 3 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 3 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 3 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 3 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 3 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 3 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 3 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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')); + } + } + }, + + //Primary toggle icon3 + { + description: 'Verify Primary toggle icon3 is present', + action: async () => { + const element = await driver.wait(until.elementLocated(By.css('#k425604099 label')), 5000).catch(() => false); + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('li#k425604099'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Primary toggle icon 3 appeared as expected'); + } else { + errors.push('Primary toggle icon 3 not found'); + } + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Primary toggle icon 3 toggle switch listed as expected'); + } else { + errors.push(`Expected: Primary toggle icon 3: "switch-toggle"; Actual: "${toggleClass}"`); + } + } + }, + + //Tagged Concepts: Social Studies | General text + { + description: 'Validate Tagged Concepts Social Studies General text, size, and color', + action: async () => { + const multipleChecks = 'Tagged Concepts: Social Studies | General'; + const element = await driver.findElement(By.css('#k425604100')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Social Studies | General')) { + console.log('Passed: Tagged Concepts: Social Studies | General text matched as expected'); + } else { + errors.push(`Expected: "Social Studies | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Social Studies | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Social Studies | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Social Studies | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Social Studies | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Social Studies | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Social Studies | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Remove button4 + { + description: 'Validate Remove button4', + action: async () => { + const multipleChecks = 'Save Changes button4'; + const elementIcon = await driver.findElement(By.css('#k425604100 .glyphicon')); + const element = await driver.findElement(By.css('#k425604100 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 4 icon is present'); + } else { + errors.push('Save Remove button 4 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 4 text matched as expected'); + } else { + errors.push(`Expected: Button 4 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 4 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 4 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 4 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 4 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 4 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 4 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 4 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 4 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 4 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 4 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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')); + } + } + }, + + //Primary toggle icon4 + { + description: 'Verify Primary toggle icon4 is present', + action: async () => { + const element = await driver.wait(until.elementLocated(By.css('#k425604100 label')), 5000).catch(() => false); + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('li#k425604100'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Primary toggle icon 4 appeared as expected'); + } else { + errors.push('Primary toggle icon 4 not found'); + } + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Primary toggle icon 4 toggle switch listed as expected'); + } else { + errors.push(`Expected: Primary toggle icon 4: "switch-toggle"; Actual: "${toggleClass}"`); + } + } + }, + + //NEXT ACTION + { + description: 'Click Primary toggle for tagged Science concept', + action: async () => { + await driver.findElement(By.css('#k425604099 label')).click(); + console.log('----->| NEXT ACTION: Clicked Primary toggle for tagged concept'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Edit Item page did not fully load within 30 seconds'); + + //Wait until the element exists in the DOM + const primaryToggleEnabled = await driver.wait( + until.elementLocated(By.css('#k425604099 .switch-primary')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(primaryToggleEnabled), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Edit Item page did not fully load within 30 seconds'); + console.log('Passed: Edit Item page loaded successfully'); + } + }, + + //Tagged Concepts: header + { + description: 'Validate Tagged Concepts header text, size, and color', + action: async () => { + const multipleChecks = 'Tagged Concepts: header'; + const element = await driver.findElement(By.css('.ui-widget-heading')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Tagged Concepts:') { + console.log('Passed: Tagged Concepts: header text matched as expected'); + } else { + errors.push(`Expected: "Tagged Concepts:"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: header font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Tagged Concepts: header text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: header text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Tagged Concepts: header text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Tagged Concepts: Language Arts | General text + { + description: 'Validate Tagged Concepts Language Arts General text, size, and color', + action: async () => { + const multipleChecks = 'Tagged Concepts: Language Arts | General'; + const element = await driver.findElement(By.css('#k425604097')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Language Arts | General')) { + console.log('Passed: Tagged Concepts: Language Arts | General text matched as expected'); + } else { + errors.push(`Expected: "Language Arts | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Language Arts | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Language Arts | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Language Arts | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Language Arts | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Language Arts | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Language Arts | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Remove button1 + { + description: 'Validate Remove button1', + action: async () => { + const multipleChecks = 'Save Changes button1'; + const elementIcon = await driver.findElement(By.css('#k425604097 .glyphicon')); + const element = await driver.findElement(By.css('#k425604097 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 1 icon is present'); + } else { + errors.push('Save Remove button 1 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 1 text matched as expected'); + } else { + errors.push(`Expected: Button 1 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 1 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 1 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 1 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 1 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 1 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 1 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 1 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 1 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 1 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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')); + } + } + }, + + //Primary toggle icon1 + { + description: 'Verify Primary toggle icon1 is present', + action: async () => { + const element = await driver.wait(until.elementLocated(By.css('#k425604097 label')), 5000).catch(() => false); + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('li#k425604097'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Primary toggle icon 1 appeared as expected'); + } else { + errors.push('Primary toggle icon 1 not found'); + } + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Primary toggle icon 1 toggle switch listed as expected'); + } else { + errors.push(`Expected: Primary toggle icon 1: "switch-toggle"; Actual: "${toggleClass}"`); + } + } + }, + + //Tagged Concepts: Mathematics | General text + { + description: 'Validate Tagged Concepts Mathematics General text, size, and color', + action: async () => { + const multipleChecks = 'Tagged Concepts: Mathematics | General'; + const element = await driver.findElement(By.css('#k425604098')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Mathematics | General')) { + console.log('Passed: Tagged Concepts: Mathematics | General text matched as expected'); + } else { + errors.push(`Expected: "Mathematics | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Mathematics | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Mathematics | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Mathematics | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Mathematics | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Mathematics | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Mathematics | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Remove button2 + { + description: 'Validate Remove button2', + action: async () => { + const multipleChecks = 'Save Changes button2'; + const elementIcon = await driver.findElement(By.css('#k425604098 .glyphicon')); + const element = await driver.findElement(By.css('#k425604098 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 2 icon is present'); + } else { + errors.push('Save Remove button 2 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 2 text matched as expected'); + } else { + errors.push(`Expected: Button 2 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 2 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 2 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 2 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 2 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 2 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 2 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 2 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 2 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 2 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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')); + } + } + }, + + //Primary toggle icon2 + { + description: 'Verify Primary toggle icon2 is present', + action: async () => { + const element = await driver.wait(until.elementLocated(By.css('#k425604098 label')), 5000).catch(() => false); + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('li#k425604098'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Primary toggle icon 2 appeared as expected'); + } else { + errors.push('Primary toggle icon 2 not found'); + } + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Primary toggle icon 2 toggle switch listed as expected'); + } else { + errors.push(`Expected: Primary toggle icon 2: "switch-toggle"; Actual: "${toggleClass}"`); + } + } + }, + + //Tagged Concepts: Science | General text + { + description: 'Validate Tagged Concepts Science General text, size, and color', + action: async () => { + const multipleChecks = 'Tagged Concepts: Science | General'; + const element = await driver.findElement(By.css('#k425604099')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Science | General')) { + console.log('Passed: Tagged Concepts: Science | General text matched as expected'); + } else { + errors.push(`Expected: "Science | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Science | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Science | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Science | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Science | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Science | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Science | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Remove button3 + { + description: 'Validate Remove button3', + action: async () => { + const multipleChecks = 'Save Changes button3'; + const elementIcon = await driver.findElement(By.css('#k425604099 .glyphicon')); + const element = await driver.findElement(By.css('#k425604099 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 3 icon is present'); + } else { + errors.push('Save Remove button 3 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 3 text matched as expected'); + } else { + errors.push(`Expected: Button 3 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 3 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 3 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 3 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 3 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 3 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 3 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 3 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 3 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 3 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 3 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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')); + } + } + }, + + //Primary toggle icon3 (SPECIAL CASE: use executeScript for all CSS values) + { + description: 'Verify Primary toggle icon3 is present', + action: async () => { + const element = await driver.wait(until.elementLocated(By.css('#k425604099 .switch-primary')), 5000).catch(() => false); + const errors = []; + + //Get text + const elementText = await element.getText(); + + //Get all CSS values via executeScript + const styles = await driver.executeScript(` + const span = document.querySelector('#k425604099 .switch-primary'); + if (!span) return null; + const style = window.getComputedStyle(span); + return { + fontFamily: style.getPropertyValue('font-family'), + fontSize: style.getPropertyValue('font-size'), + color: style.getPropertyValue('color'), + backgroundColor: style.getPropertyValue('background-color') + }; + `); + //console.log('----->| DEBUG styles:', JSON.stringify(styles)); + + //Get toggle class from correct parent element + const toggleClass = await driver.executeScript(` + const span = document.querySelector('#k425604099 .switch-primary'); + if (!span) return 'not found'; + // Navigate up to find the switch-toggle div + let element = span.parentElement; + while (element) { + if (element.classList.contains('switch-toggle')) return element.className; + element = element.parentElement; + } + return 'switch-toggle not found in parents'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //text + if (elementText === 'Primary') { + console.log('Passed: Enabled Primary toggle icon 3 text matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 text: "Primary"; Actual: "${elementText}"`); + } + + //font-family + if (styles.fontFamily === 'Poppins, sans-serif') { + console.log('Passed: Enabled Primary toggle icon 3 text font matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 font "Poppins, sans-serif"; Actual: "${styles.fontFamily}"`); + } + + //font-size + if (styles.fontSize === '10px') { + console.log('Passed: Enabled Primary toggle icon 3 font-size matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 font-size "10px"; Actual: "${styles.fontSize}"`); + } + + //color + if (styles.color === 'rgb(255, 255, 255)') { + console.log('Passed: Enabled Primary toggle icon 3 text color matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 color "rgb(255, 255, 255)"; Actual: "${styles.color}"`); + } + + //background color + if (styles.backgroundColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Enabled Primary toggle icon 3 background color matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 background color "rgba(0, 0, 0, 0)"; Actual: "${styles.backgroundColor}"`); + } + + //toggle class + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Enabled Primary toggle icon 3 is a toggle switch as expected'); + } else { + errors.push(`Expected: "switch-toggle" in parent; Actual: "${toggleClass}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift('Primary toggle icon 3 - Multiple validation checks did not pass'); + } + throw new Error(errors.join('\n')); + } + } + }, + + //Tagged Concepts: Social Studies | General text + { + description: 'Validate Tagged Concepts Social Studies General text, size, and color', + action: async () => { + const multipleChecks = 'Tagged Concepts: Social Studies | General'; + const element = await driver.findElement(By.css('#k425604100')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Social Studies | General')) { + console.log('Passed: Tagged Concepts: Social Studies | General text matched as expected'); + } else { + errors.push(`Expected: "Social Studies | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Social Studies | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Social Studies | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Social Studies | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Social Studies | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Social Studies | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Social Studies | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Remove button4 + { + description: 'Validate Remove button4', + action: async () => { + const multipleChecks = 'Save Changes button4'; + const elementIcon = await driver.findElement(By.css('#k425604100 .glyphicon')); + const element = await driver.findElement(By.css('#k425604100 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 4 icon is present'); + } else { + errors.push('Save Remove button 4 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 4 text matched as expected'); + } else { + errors.push(`Expected: Button 4 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 4 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 4 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 4 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 4 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 4 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 4 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 4 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 4 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 4 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 4 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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')); + } + } + }, + + //Primary toggle icon4 + { + description: 'Verify Primary toggle icon4 is present', + action: async () => { + const element = await driver.wait(until.elementLocated(By.css('#k425604100 label')), 5000).catch(() => false); + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('li#k425604100'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Primary toggle icon 4 appeared as expected'); + } else { + errors.push('Primary toggle icon 4 not found'); + } + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Primary toggle icon 4 toggle switch listed as expected'); + } else { + errors.push(`Expected: Primary toggle icon 4: "switch-toggle"; Actual: "${toggleClass}"`); + } + } + }, + + //Find Concepts header + { + description: 'Validate Find Concepts header text, size, and color', + action: async () => { + const multipleChecks = 'Find Concepts header'; + const element = await driver.findElement(By.css('p')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Find Concepts') { + console.log('Passed: Find Concepts header text matched as expected'); + } else { + errors.push(`Expected: "Find Concepts"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Find Concepts header font matched as expected'); + } else { + errors.push(`Expected: Find Concepts header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Find Concepts header text font-size matched as expected'); + } else { + errors.push(`Expected: Find Concepts header text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Find Concepts header text color matched as expected'); + } else { + errors.push(`Expected: Find Concepts header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + //Browse tab title (active) { - description: 'Validate browse tab title', + description: 'Validate Browse tab title text, size, and color', action: async () => { - const elementText = await driver.findElement(By.linkText('Browse')).getText(); - if (elementText !== 'Browse') { - throw new Error(`Expected: "Browse" tab title text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Browse tab title'; + const element = await driver.findElement(By.linkText('Browse')); + + //Get text, font, size, and 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 === 'Browse') { + console.log('Passed: Browse tab title text matched as expected'); + } else { + errors.push(`Expected: "Browse"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Browse tab title font matched as expected'); + } else { + errors.push(`Expected: Browse tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: Browse tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Browse tab title text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Browse tab title text color matched as expected'); + } else { + errors.push(`Expected: Browse tab title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Browse tab background color matched as expected'); + } else { + errors.push(`Expected: Browse tab background color: "rgba(40, 39, 90, 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')); + } + } + }, + + //By Standard tab tab title + { + description: 'Validate By Standard tab title text, size, and color', + action: async () => { + const multipleChecks = 'By Standard tab title'; + const element = await driver.findElement(By.linkText('By Standard')); + + //Get text, font, size, and 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 === 'By Standard') { + console.log('Passed: By Standard tab title text matched as expected'); + } else { + errors.push(`Expected: "By Standard"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: By Standard tab title font matched as expected'); + } else { + errors.push(`Expected: By Standard tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: By Standard tab title text font-size matched as expected'); + } else { + errors.push(`Expected: By Standard tab title text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: By Standard tab title text color matched as expected'); + } else { + errors.push(`Expected: By Standard tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: By Standard tab background color matched as expected'); + } else { + errors.push(`Expected: By Standard tab background color: "rgba(0, 0, 0, 0)"; 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')); } - console.log('Passed: Browse tab title text matched as expected'); } }, - //Browse tab text title -white (active) + //AutoAlign tab title { - description: 'Validate browse tab text color', + description: 'Validate AutoAlign tab title text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('color'); - if (elementStyle !== 'rgba(255, 255, 255, 1)') { - throw new Error(`Expected: "Browse" tab text title color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'AutoAlign tab title'; + const element = await driver.findElement(By.linkText('AutoAlign')); + + //Get text, font, size, and 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 === 'AutoAlign') { + console.log('Passed: AutoAlign tab title text matched as expected'); + } else { + errors.push(`Expected: "AutoAlign"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: AutoAlign tab title font matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: AutoAlign tab title text font-size matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab title text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: AutoAlign tab title text color matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: AutoAlign tab background color matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab background color: "rgba(0, 0, 0, 0)"; 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')); } - console.log('Passed: Browse tab text title color matched as expected'); } }, - //Browse tab title -navy blue (active) + //Browse concepts header { - description: 'Validate browse tab color', + description: 'Validate Browse Concepts header text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: "Browse" tab title color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Find Concepts header'; + const element = await driver.findElement(By.css('.mt-2 > h5')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Browse the concept list and filter by term') { + console.log('Passed: Browse Concepts header text matched as expected'); + } else { + errors.push(`Expected: "Browse the concept list and filter by term"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Browse Concepts header font matched as expected'); + } else { + errors.push(`Expected: Browse Concepts header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '20px') { + console.log('Passed: Browse Concepts header text font-size matched as expected'); + } else { + errors.push(`Expected: Browse Concepts header text font-size "20px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Browse Concepts header text color matched as expected'); + } else { + errors.push(`Expected: Browse Concepts header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Browse tab title color matched as expected'); } }, - //By Standard tab title (dimmed) + //Filter concepts label { - description: 'Validate by standard tab title', + description: 'Validate Filter Concepts label text, size, and color', action: async () => { - const elementText = await driver.findElement(By.linkText('By Standard')).getText(); - if (elementText !== 'By Standard') { - throw new Error(`Expected: "By Standard" tab title text did not match; Actual: "${elementText}"`); - } - console.log('Passed: By Standard tab title text matched as expected'); - } - }, + const multipleChecks = 'Find Concepts header'; + const element = await driver.findElement(By.css('.mr-1')); - //By Standard tab text title -gray (dimmed) - { - description: 'Validate by standard tab text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('color'); - if (elementStyle !== 'rgba(182, 186, 181, 1)') { - throw new Error(`Expected: "By Standard" tab text title color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: By Standard tab text title color matched as expected'); - } - }, + //Get text, font, size, and 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'); - //By Standard tab title -white (dimmed) - { - description: 'Validate by standard tab color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('background-color'); - if (elementStyle !== 'rgba(0, 0, 0, 0)') { - throw new Error(`Expected: "By Standard" tab title color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: By Standard tab title color matched as expected'); - } - }, + //Track all errors + const errors = []; - //AutoAlign tab title (dimmed) - { - description: 'Validate AutoAlign tab title', - action: async () => { - const elementText = await driver.findElement(By.linkText('AutoAlign')).getText(); - if (elementText !== 'AutoAlign') { - throw new Error(`Expected: "AutoAlign" tab title text did not match; Actual: "${elementText}"`); + //text + if (elementText === 'Filter Concepts') { + console.log('Passed: Filter Concepts header text matched as expected'); + } else { + errors.push(`Expected: "Filter Concepts"; Actual: "${elementText}"`); } - console.log('Passed: AutoAlign tab title text matched as expected'); - } - }, - //AutoAlign tab text title -gray (dimmed) - { - description: 'Validate AutoAlign tab text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('color'); - if (elementStyle !== 'rgba(182, 186, 181, 1)') { - throw new Error(`Expected: "AutoAlign" tab text title color did not match; Actual: "${elementStyle}"`); + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Filter Concepts label font matched as expected'); + } else { + errors.push(`Expected: Filter Concepts label font "Poppins, sans-serif"; Actual: ${elementTextFont}`); } - console.log('Passed: AutoAlign tab text title color matched as expected'); - } - }, - //AutoAlign tab title -white (dimmed) - { - description: 'Validate AutoAlign tab color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('background-color'); - if (elementStyle !== 'rgba(0, 0, 0, 0)') { - throw new Error(`Expected: "AutoAlign" tab title color did not match; Actual: "${elementStyle}"`); + //font size + if (elementTextSize === '13px') { + console.log('Passed: Filter Concepts label text font-size matched as expected'); + } else { + errors.push(`Expected: Filter Concepts label text font-size "13px"; Actual: "${elementTextSize}"`); } - console.log('Passed: AutoAlign tab title color matched as expected'); - } - }, - //Browse the concept list and filter by term title - { - description: 'Validate Browse the concept list and filter by term title', - action: async () => { - const elementText = await driver.findElement(By.css('.mt-2 > h5')).getText(); - if (elementText !== 'Browse the concept list and filter by term') { - throw new Error(`Expected: "Browse the concept list and filter by term" title text did not match; Actual: "${elementText}"`); + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Filter Concepts label text color matched as expected'); + } else { + errors.push(`Expected: Filter Concepts label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); } - console.log('Passed: Browse the concept list and filter by term title text matched as expected'); - } - }, - //Browse the concept list and filter by term -navy blue - { - description: 'Validate Browse the concept list and filter by term title color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.mt-2 > h5')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: "Browse the concept list and filter by term" title color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Browse the concept list and filter by term title color matched as expected'); - } - }, + //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`); + } - //Browse the concept list and filter by term font size -20px - { - description: 'Validate Page title color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.mt-2 > h5')).getCssValue('font-size'); - if (elementStyle !== '20px') { - throw new Error(`Expected: "Browse the concept list and filter by term" title font size did not match; Actual: "${elementStyle}"`); + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Browse the concept list and filter by term title font size matched as expected'); - } - }, - - //Filter Concepts label - { - description: 'Validate Filter Concepts label', - action: async () => { - const elementText = await driver.findElement(By.css('.mr-1')).getText(); - if (elementText !== 'Filter Concepts') { - throw new Error(`Expected: "Filter Concepts" label text did not match; Actual: "${elementText}"`); - } - console.log('Passed: Filter Concepts label text matched as expected'); } }, //Filter Concepts textbox placeholder { - description: 'Validate URL placeholder text', + description: 'Validate Filter Concepts placeholder text', action: async () => { - const elementValue = await driver.findElement(By.css('#q')).getAttribute('placeholder'); - if (elementValue !== 'Enter Term...') { - throw new Error(`Expected: "Enter Term..."; Actual: "${elementValue}"`); + const multipleChecks = 'Filter Concepts textbox placeholder'; + const element = await driver.findElement(By.css('#q')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Enter Term...') { + console.log('Passed: Filter Concepts placeholder text matched as expected'); + } else { + errors.push(`Expected: "Enter Term..." placeholder; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Filter Concepts placeholder text font matched as expected'); + } else { + errors.push(`Expected: Filter Concepts placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '14.4px') { + console.log('Passed: Filter Concepts placeholder text font-size matched as expected'); + } else { + errors.push(`Expected: Filter Concepts placeholder text font-size "14.4px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Filter Concepts placeholder text color matched as expected'); + } else { + errors.push(`Expected: Filter Concepts placeholder text color: "rgb(108, 117, 125)"; 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: Enter Term... placeholder text matched as expected'); } }, - //Filter button text + //Filter button { - description: 'Validate filter button text', + description: 'Validate Filter button', action: async () => { - const elementText = await driver.findElement(By.css('#qbutton')).getText(); - if (elementText !== 'Filter') { - throw new Error(`Expected: "Filter" button text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Filter button'; + const element = await driver.findElement(By.css('#qbutton')); + + //Get text, font, size, and 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 === 'Filter') { + console.log('Passed: Filter button text matched as expected'); + } else { + errors.push(`Expected: "Filter"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Filter button font matched as expected'); + } else { + errors.push(`Expected: Filter button font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Filter button text font-size matched as expected'); + } else { + errors.push(`Expected: Filter button text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Filter button text color matched as expected'); + } else { + errors.push(`Expected: Filter button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Filter button background color matched as expected'); + } else { + errors.push(`Expected: Filter 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')); } - console.log('Passed: Filter button text matched as expected'); } }, - //Filter button color -green + //Health and PE { - description: 'Validate filter button color', + description: 'Validate Health and PE handle text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.css('#qbutton')).getCssValue('background-color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: "Filter" button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Health and PE handle'; + const element = await driver.findElement(By.css('.list-group-item:nth-child(1) > div:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Health and PE') { + console.log('Passed: Health and PE handle text matched as expected'); + } else { + errors.push(`Expected: "Health and PE"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Health and PE handle font matched as expected'); + } else { + errors.push(`Expected: Health and PE handle font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Health and PE handle text font-size matched as expected'); + } else { + errors.push(`Expected: Health and PE handle text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Health and PE handle text color matched as expected'); + } else { + errors.push(`Expected: Health and PE handle text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Filter button color matched as expected'); } }, - //Language Arts label + //Health and PE count button and icon { - description: 'Validate language arts label text', + description: 'Validate Health and PE count button and icon', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(1) > div:nth-child(3)')).getText(); - if (elementText !== 'Language Arts') { - throw new Error(`Expected: "Language Arts" label text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Health and PE count button and icon'; + const element = await driver.findElement(By.css('.list-group-item:nth-child(1) > .badge')); + const elementIcon = await driver.findElement(By.css('.list-group-item:nth-child(1) > .fa')); + + //Get text, font, size, and 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'); + const elementTooltip = await element.getAttribute('title'); + + const elementIconColor = await elementIcon.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === '1267') { + console.log('Passed: Health and PE count button text matched as expected'); + } else { + errors.push(`Expected: "1267"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Health and PE count button font matched as expected'); + } else { + errors.push(`Expected: Health and PE count button font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12.87px') { + console.log('Passed: Health and PE count button text font-size matched as expected'); + } else { + errors.push(`Expected: Health and PE count button text font-size "12.87px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Health and PE count button text color matched as expected'); + } else { + errors.push(`Expected: Health and PE count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Health and PE countr button background color matched as expected'); + } else { + errors.push(`Expected: Health and PE count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`); + } + + //icon color + if (elementIconColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Health and PE count button text color matched as expected'); + } else { + errors.push(`Expected: Health and PE count button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementIconColor}"`); + } + + //icon tool-tip + if (elementTooltip === '1267 sub-concepts') { + console.log('Passed: Health and PE count button tool-tip text matched as expected'); + } else { + errors.push(`Expected: Health and PE count button tool-tip: "1267 sub-concepts"; Actual: "${elementTooltip}"`); + } + + //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: Language Arts label text matched as expected'); } }, - //Language Arts button text + //Language Arts { - description: 'Validate language arts button text', + description: 'Validate Language Arts handle text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(1) > .badge')).getText(); - if (elementText !== '1359') { - throw new Error(`Expected: "Language Arts" button text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Language Arts handle'; + const element = await driver.findElement(By.css('.list-group-item:nth-child(2) > div:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Language Arts') { + console.log('Passed: Language Arts handle text matched as expected'); + } else { + errors.push(`Expected: "Language Arts"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Language Arts handle font matched as expected'); + } else { + errors.push(`Expected: Language Arts handle font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Language Arts handle text font-size matched as expected'); + } else { + errors.push(`Expected: Language Arts handle text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Language Arts handle text color matched as expected'); + } else { + errors.push(`Expected: Language Arts handle text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Language Arts button text matched as expected'); } }, - //Language Arts button color -navy blue + //Language Arts count button and icon { - description: 'Validate language arts button color', + description: 'Validate Language Arts count button and icon', action: async () => { - const elementStyle = await driver.findElement(By.css('.list-group-item:nth-child(1) > .badge')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Language Arts button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Language Arts count button and icon'; + const element = await driver.findElement(By.css('.list-group-item:nth-child(2) > .badge')); + const elementIcon = await driver.findElement(By.css('.list-group-item:nth-child(2) > .fa')); + + //Get text, font, size, and 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'); + const elementTooltip = await element.getAttribute('title'); + + const elementIconColor = await elementIcon.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === '2046') { + console.log('Passed: Language Arts count button text matched as expected'); + } else { + errors.push(`Expected: "2046"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Language Arts count button font matched as expected'); + } else { + errors.push(`Expected: Language Arts count button font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12.87px') { + console.log('Passed: Language Arts count button text font-size matched as expected'); + } else { + errors.push(`Expected: Language Arts count button text font-size "12.87px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Language Arts count button text color matched as expected'); + } else { + errors.push(`Expected: Language Arts count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Language Arts countr button background color matched as expected'); + } else { + errors.push(`Expected: Language Arts count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`); + } + + //icon color + if (elementIconColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Language Arts count button text color matched as expected'); + } else { + errors.push(`Expected: Language Arts count button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementIconColor}"`); + } + + //icon tool-tip + if (elementTooltip === '2046 sub-concepts') { + console.log('Passed: Language Arts count button tool-tip text matched as expected'); + } else { + errors.push(`Expected: Language Arts count button tool-tip: "2046 sub-concepts"; Actual: "${elementTooltip}"`); + } + + //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: Language Arts button color matched as expected'); } }, - //Language Arts arrow icon + //Mathematics { - description: 'Verify language arts arrow icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(1) > .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Language Arts arrow icon not found'); - } - console.log('Passed: Language Arts arrow icon present'); - } - }, - - //Mathematics label - { - description: 'Validate mathematics label text', + description: 'Validate Mathematics handle text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(2) > div:nth-child(3)')).getText(); - if (elementText !== 'Mathematics') { - throw new Error(`Expected: "Mathematics" label text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Mathematics handle'; + const element = await driver.findElement(By.css('.list-group-item:nth-child(3) > div:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Mathematics') { + console.log('Passed: Mathematics handle text matched as expected'); + } else { + errors.push(`Expected: "Mathematics"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Mathematics handle font matched as expected'); + } else { + errors.push(`Expected: Mathematics handle font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Mathematics handle text font-size matched as expected'); + } else { + errors.push(`Expected: Mathematics handle text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Mathematics handle text color matched as expected'); + } else { + errors.push(`Expected: Mathematics handle text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Mathematics label text matched as expected'); } }, - //Mathematics button text + //Mathematics count button and icon { - description: 'Validate mathematics button text', + description: 'Validate Mathematics count button and icon', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(2) > .badge')).getText(); - if (elementText !== '1219') { - throw new Error(`Expected: "Mathematics" button text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Mathematics count button and icon'; + const element = await driver.findElement(By.css('.list-group-item:nth-child(3) > .badge')); + const elementIcon = await driver.findElement(By.css('.list-group-item:nth-child(3) > .fa')); + + //Get text, font, size, and 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'); + const elementTooltip = await element.getAttribute('title'); + + const elementIconColor = await elementIcon.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === '1760') { + console.log('Passed: Mathematics count button text matched as expected'); + } else { + errors.push(`Expected: "1760"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Mathematics count button font matched as expected'); + } else { + errors.push(`Expected: Mathematics count button font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12.87px') { + console.log('Passed: Mathematics count button text font-size matched as expected'); + } else { + errors.push(`Expected: Mathematics count button text font-size "12.87px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Mathematics count button text color matched as expected'); + } else { + errors.push(`Expected: Mathematics count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Mathematics countr button background color matched as expected'); + } else { + errors.push(`Expected: Mathematics count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`); + } + + //icon color + if (elementIconColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Mathematics count button text color matched as expected'); + } else { + errors.push(`Expected: Mathematics count button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementIconColor}"`); + } + + //icon tool-tip + if (elementTooltip === '1760 sub-concepts') { + console.log('Passed: Mathematics count button tool-tip text matched as expected'); + } else { + errors.push(`Expected: Mathematics count button tool-tip: "1760 sub-concepts"; Actual: "${elementTooltip}"`); + } + + //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: Mathematics button text matched as expected'); } }, - //Mathematics button color -navy blue + //Science { - description: 'Validate mathematics button color', + description: 'Validate Science handle text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.css('.list-group-item:nth-child(2) > .badge')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Mathematics button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Science handle'; + const element = await driver.findElement(By.css('.list-group-item:nth-child(4) > div:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Science') { + console.log('Passed: Science handle text matched as expected'); + } else { + errors.push(`Expected: "Science"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Science handle font matched as expected'); + } else { + errors.push(`Expected: Science handle font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Science handle text font-size matched as expected'); + } else { + errors.push(`Expected: Science handle text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Science handle text color matched as expected'); + } else { + errors.push(`Expected: Science handle text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Mathematics button color matched as expected'); } }, - //Mathematics arrow icon + //Science count button and icon { - description: 'Verify mathematics arrow icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(2) > .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Mathematics arrow icon not found'); - } - console.log('Passed: Mathematics arrow icon present'); - } - }, - - //Science label - { - description: 'Validate science label text', + description: 'Validate Science count button and icon', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(3) > div:nth-child(3)')).getText(); - if (elementText !== 'Science') { - throw new Error(`Expected: "Science" label text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Science count button and icon'; + const element = await driver.findElement(By.css('.list-group-item:nth-child(4) > .badge')); + const elementIcon = await driver.findElement(By.css('.list-group-item:nth-child(4) > .fa')); + + //Get text, font, size, and 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'); + const elementTooltip = await element.getAttribute('title'); + + const elementIconColor = await elementIcon.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === '3156') { + console.log('Passed: Science count button text matched as expected'); + } else { + errors.push(`Expected: "3156"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Science count button font matched as expected'); + } else { + errors.push(`Expected: Science count button font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12.87px') { + console.log('Passed: Science count button text font-size matched as expected'); + } else { + errors.push(`Expected: Science count button text font-size "12.87px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Science count button text color matched as expected'); + } else { + errors.push(`Expected: Science count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Science countr button background color matched as expected'); + } else { + errors.push(`Expected: Science count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`); + } + + //icon color + if (elementIconColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Science count button text color matched as expected'); + } else { + errors.push(`Expected: Science count button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementIconColor}"`); + } + + //icon tool-tip + if (elementTooltip === '3156 sub-concepts') { + console.log('Passed: Science count button tool-tip text matched as expected'); + } else { + errors.push(`Expected: Science count button tool-tip: "3156 sub-concepts"; Actual: "${elementTooltip}"`); + } + + //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: Science label text matched as expected'); } }, - //Science button text + //Social Studies { - description: 'Validate science button text', + description: 'Validate Social Studies handle text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(3) > .badge')).getText(); - if (elementText !== '2108') { - throw new Error(`Expected: "Science" button text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Social Studies handle'; + const element = await driver.findElement(By.css('.list-group-item:nth-child(5) > div:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Social Studies') { + console.log('Passed: Social Studies handle text matched as expected'); + } else { + errors.push(`Expected: "Social Studies"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Social Studies handle font matched as expected'); + } else { + errors.push(`Expected: Social Studies handle font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Social Studies handle text font-size matched as expected'); + } else { + errors.push(`Expected: Social Studies handle text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Social Studies handle text color matched as expected'); + } else { + errors.push(`Expected: Social Studies handle text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Science button text matched as expected'); } }, - //Science button color -navy blue + //Social Studies count button and icon { - description: 'Validate science button color', + description: 'Validate Social Studies count button and icon', action: async () => { - const elementStyle = await driver.findElement(By.css('.list-group-item:nth-child(3) > .badge')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Science button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Social Studies count button and icon'; + const element = await driver.findElement(By.css('.list-group-item:nth-child(5) > .badge')); + const elementIcon = await driver.findElement(By.css('.list-group-item:nth-child(5) > .fa')); + + //Get text, font, size, and 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'); + const elementTooltip = await element.getAttribute('title'); + + const elementIconColor = await elementIcon.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === '4474') { + console.log('Passed: Social Studies count button text matched as expected'); + } else { + errors.push(`Expected: "4474"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Social Studies count button font matched as expected'); + } else { + errors.push(`Expected: Social Studies count button font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12.87px') { + console.log('Passed: Social Studies count button text font-size matched as expected'); + } else { + errors.push(`Expected: Social Studies count button text font-size "12.87px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Social Studies count button text color matched as expected'); + } else { + errors.push(`Expected: Social Studies count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Social Studies countr button background color matched as expected'); + } else { + errors.push(`Expected: Social Studies count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`); + } + + //icon color + if (elementIconColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Social Studies count button text color matched as expected'); + } else { + errors.push(`Expected: Social Studies count button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementIconColor}"`); + } + + //icon tool-tip + if (elementTooltip === '4474 sub-concepts') { + console.log('Passed: Social Studies count button tool-tip text matched as expected'); + } else { + errors.push(`Expected: Social Studies count button tool-tip: "4474 sub-concepts"; Actual: "${elementTooltip}"`); + } + + //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: Science button color matched as expected'); } }, - //Science arrow icon + //Technology Education { - description: 'Verify science arrow icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(3) > .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Science arrow icon not found'); - } - console.log('Passed: Science arrow icon present'); - } - }, - - //Social Studies label - { - description: 'Validate social studies label text', + description: 'Validate Technology Education handle text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(4) > div:nth-child(3)')).getText(); - if (elementText !== 'Social Studies') { - throw new Error(`Expected: "Social Studies" label text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Technology Education handle'; + const element = await driver.findElement(By.css('.list-group-item:nth-child(6) > div:nth-child(3)')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Technology Education') { + console.log('Passed: Technology Education handle text matched as expected'); + } else { + errors.push(`Expected: "Technology Education"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Technology Education handle font matched as expected'); + } else { + errors.push(`Expected: Technology Education handle font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '14.3px') { + console.log('Passed: Technology Education handle text font-size matched as expected'); + } else { + errors.push(`Expected: Technology Education handle text font-size "14.3px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Technology Education handle text color matched as expected'); + } else { + errors.push(`Expected: Technology Education handle text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Social Studies label text matched as expected'); } }, - //Social Studies label button text + //Technology Education count button and icon { - description: 'Validate social studies button text', + description: 'Validate Technology Education count button and icon', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(4) > .badge')).getText(); - if (elementText !== '2188') { - throw new Error(`Expected: "Social Studies" button text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Technology Education count button and icon'; + const element = await driver.findElement(By.css('.list-group-item:nth-child(6) > .badge')); + const elementIcon = await driver.findElement(By.css('.list-group-item:nth-child(6) > .fa')); + + //Get text, font, size, and 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'); + const elementTooltip = await element.getAttribute('title'); + + const elementIconColor = await elementIcon.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === '1211') { + console.log('Passed: Technology Education count button text matched as expected'); + } else { + errors.push(`Expected: "1211"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Technology Education count button font matched as expected'); + } else { + errors.push(`Expected: Technology Education count button font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12.87px') { + console.log('Passed: Technology Education count button text font-size matched as expected'); + } else { + errors.push(`Expected: Technology Education count button text font-size "12.87px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Technology Education count button text color matched as expected'); + } else { + errors.push(`Expected: Technology Education count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Technology Education countr button background color matched as expected'); + } else { + errors.push(`Expected: Technology Education count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`); + } + + //icon color + if (elementIconColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Technology Education count button text color matched as expected'); + } else { + errors.push(`Expected: Technology Education count button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementIconColor}"`); + } + + //icon tool-tip + if (elementTooltip === '1211 sub-concepts') { + console.log('Passed: Technology Education count button tool-tip text matched as expected'); + } else { + errors.push(`Expected: Technology Education count button tool-tip: "1211 sub-concepts"; Actual: "${elementTooltip}"`); + } + + //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: Social Studies button text matched as expected'); } }, - //Social Studies button color -navy blue - { - description: 'Validate social studies button color', + //NEXT ACTION + { + description: 'Click By Standard tab link', action: async () => { - const elementStyle = await driver.findElement(By.css('.list-group-item:nth-child(4) > .badge')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: Social Studies button color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Social Studies button color matched as expected'); + await driver.findElement(By.linkText('By Standard')).click(); + console.log('----->| NEXT ACTION: Clicked By Standard tab link'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Page did not fully load within 30 seconds'); + + //Wait until the element exists in the DOM + const sectionHeader = await driver.wait( + until.elementLocated(By.css('#concept-standard > label')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(sectionHeader), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'By Standards page did not fully load within 30 seconds'); + console.log('Passed: By Standards page loaded successfully'); } }, - //Social Studies arrow icon + //Browse tab title { - description: 'Verify social studies arrow icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(4) > .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Social Studies arrow icon not found'); - } - console.log('Passed: Social Studies arrow icon present'); - } - }, - - //World Languages label - { - description: 'Validate world languages label text', + description: 'Validate Browse tab title text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(5) > div:nth-child(3)')).getText(); - if (elementText !== 'World Languages') { - throw new Error(`Expected: "World Languages" label text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Browse tab title'; + const element = await driver.findElement(By.linkText('Browse')); + + //Get text, font, size, and 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 === 'Browse') { + console.log('Passed: Browse tab title text matched as expected'); + } else { + errors.push(`Expected: "Browse"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Browse tab title font matched as expected'); + } else { + errors.push(`Expected: Browse tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: Browse tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Browse tab title text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Browse tab title text color matched as expected'); + } else { + errors.push(`Expected: Browse tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Browse tab background color matched as expected'); + } else { + errors.push(`Expected: Browse tab background color: "rgba(0, 0, 0, 0)"; 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')); } - console.log('Passed: World Languages label text matched as expected'); } }, - - //World Languages label button text + + //By Standard tab tab title (active) { - description: 'Validate world languages button text', + description: 'Validate By Standard tab title text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(5) > .badge')).getText(); - if (elementText !== '375') { - throw new Error(`Expected: "World Languages" button text did not match; Actual: "${elementText}"`); + const multipleChecks = 'By Standard tab title'; + const element = await driver.findElement(By.linkText('By Standard')); + + //Get text, font, size, and 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 === 'By Standard') { + console.log('Passed: By Standard tab title text matched as expected'); + } else { + errors.push(`Expected: "By Standard"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: By Standard tab title font matched as expected'); + } else { + errors.push(`Expected: By Standard tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: By Standard tab title text font-size matched as expected'); + } else { + errors.push(`Expected: By Standard tab title text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: By Standard tab title text color matched as expected'); + } else { + errors.push(`Expected: By Standard tab title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: By Standard tab background color matched as expected'); + } else { + errors.push(`Expected: By Standard tab background color: "rgba(40, 39, 90, 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')); } - console.log('Passed: World Languages button text matched as expected'); } }, - //World Languages button color -navy blue + //AutoAlign tab title { - description: 'Validate world languages button color', + description: 'Validate AutoAlign tab title text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.css('.list-group-item:nth-child(5) > .badge')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: World Languages button color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'AutoAlign tab title'; + const element = await driver.findElement(By.linkText('AutoAlign')); + + //Get text, font, size, and 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 === 'AutoAlign') { + console.log('Passed: AutoAlign tab title text matched as expected'); + } else { + errors.push(`Expected: "AutoAlign"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: AutoAlign tab title font matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: AutoAlign tab title text font-size matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab title text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: AutoAlign tab title text color matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: AutoAlign tab background color matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab background color: "rgba(0, 0, 0, 0)"; 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')); } - console.log('Passed: World Languages button color matched as expected'); } }, - //World Languages arrow icon + //Tagged Concepts: header { - description: 'Verify world languages arrow icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(5) > .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('World Languages arrow icon not found'); - } - console.log('Passed: World Languages arrow icon present'); - } - }, - - //NEXT ACTION - By Standar - { description: 'Click By Standard tab link', action: async () => await driver.findElement(By.linkText('By Standard')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(5000) }, - - //Browse tab title (dimmed) - { - description: 'Validate browse tab title', + description: 'Validate Tagged Concepts header text, size, and color', action: async () => { - const elementText = await driver.findElement(By.linkText('Browse')).getText(); - if (elementText !== 'Browse') { - throw new Error(`Expected: "Browse" tab title text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Tagged Concepts: header'; + const element = await driver.findElement(By.css('.ui-widget-heading')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Tagged Concepts:') { + console.log('Passed: Tagged Concepts: header text matched as expected'); + } else { + errors.push(`Expected: "Tagged Concepts:"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: header font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Tagged Concepts: header text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: header text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Tagged Concepts: header text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Tagged Concepts: Language Arts | General text + { + description: 'Validate Tagged Concepts Language Arts General text, size, and color', + action: async () => { + const multipleChecks = 'Tagged Concepts: Language Arts | General'; + const element = await driver.findElement(By.css('#k425604097')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Language Arts | General')) { + console.log('Passed: Tagged Concepts: Language Arts | General text matched as expected'); + } else { + errors.push(`Expected: "Language Arts | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Language Arts | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Language Arts | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Language Arts | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Language Arts | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Language Arts | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Language Arts | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Browse tab title text matched as expected'); } }, - //Browse tab text title -gray (dimmed) + //Remove button1 { - description: 'Validate browse tab text color', + description: 'Validate Remove button1', action: async () => { - const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('color'); - if (elementStyle !== 'rgba(182, 186, 181, 1)') { - throw new Error(`Expected: "Browse" tab text title color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Save Changes button1'; + const elementIcon = await driver.findElement(By.css('#k425604097 .glyphicon')); + const element = await driver.findElement(By.css('#k425604097 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 1 icon is present'); + } else { + errors.push('Save Remove button 1 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 1 text matched as expected'); + } else { + errors.push(`Expected: Button 1 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 1 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 1 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 1 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 1 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 1 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 1 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 1 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 1 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 1 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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: Browse tab text title color matched as expected'); } }, - //Browse tab title -white (dimmed) + //Primary toggle icon1 { - description: 'Validate browse tab color', + description: 'Verify Primary toggle icon1 is present', action: async () => { - const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('background-color'); - if (elementStyle !== 'rgba(0, 0, 0, 0)') { - throw new Error(`Expected: "Browse" tab title color did not match; Actual: "${elementStyle}"`); + const element = await driver.wait(until.elementLocated(By.css('#k425604097 label')), 5000).catch(() => false); + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('li#k425604097'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Primary toggle icon 1 appeared as expected'); + } else { + errors.push('Primary toggle icon 1 not found'); + } + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Primary toggle icon 1 toggle switch listed as expected'); + } else { + errors.push(`Expected: Primary toggle icon 1: "switch-toggle"; Actual: "${toggleClass}"`); } - console.log('Passed: Browse tab title color matched as expected'); } }, - //By Standard tab title (active) + //Tagged Concepts: Mathematics | General text { - description: 'Validate by standard tab title', + description: 'Validate Tagged Concepts Mathematics General text, size, and color', action: async () => { - const elementText = await driver.findElement(By.linkText('By Standard')).getText(); - if (elementText !== 'By Standard') { - throw new Error(`Expected: "By Standard" tab title text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Tagged Concepts: Mathematics | General'; + const element = await driver.findElement(By.css('#k425604098')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Mathematics | General')) { + console.log('Passed: Tagged Concepts: Mathematics | General text matched as expected'); + } else { + errors.push(`Expected: "Mathematics | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Mathematics | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Mathematics | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Mathematics | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Mathematics | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Mathematics | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Mathematics | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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: By Standard tab title text matched as expected'); } }, - //By Standard tab text title -navy blue (active) + //Remove button2 { - description: 'Validate by standard tab text color', + description: 'Validate Remove button2', action: async () => { - const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('color'); - if (elementStyle !== 'rgba(255, 255, 255, 1)') { - throw new Error(`Expected: "By Standard" tab text title color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Save Changes button2'; + const elementIcon = await driver.findElement(By.css('#k425604098 .glyphicon')); + const element = await driver.findElement(By.css('#k425604098 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 2 icon is present'); + } else { + errors.push('Save Remove button 2 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 2 text matched as expected'); + } else { + errors.push(`Expected: Button 2 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 2 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 2 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 2 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 2 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 2 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 2 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 2 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 2 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 2 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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: By Standard tab text title color matched as expected'); } }, - //By Standard tab title -navy blue (active) + //Primary toggle icon2 { - description: 'Validate by standard tab color', + description: 'Verify Primary toggle icon2 is present', action: async () => { - const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: "By Standard" tab title color did not match; Actual: "${elementStyle}"`); + const element = await driver.wait(until.elementLocated(By.css('#k425604098 label')), 5000).catch(() => false); + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('li#k425604098'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Primary toggle icon 2 appeared as expected'); + } else { + errors.push('Primary toggle icon 2 not found'); + } + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Primary toggle icon 2 toggle switch listed as expected'); + } else { + errors.push(`Expected: Primary toggle icon 2: "switch-toggle"; Actual: "${toggleClass}"`); } - console.log('Passed: By Standard tab title color matched as expected'); } }, - //AutoAlign tab title (dimmed) + //Tagged Concepts: Science | General text { - description: 'Validate AutoAlign tab title', + description: 'Validate Tagged Concepts Science General text, size, and color', action: async () => { - const elementText = await driver.findElement(By.linkText('AutoAlign')).getText(); - if (elementText !== 'AutoAlign') { - throw new Error(`Expected: "AutoAlign" tab title text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Tagged Concepts: Science | General'; + const element = await driver.findElement(By.css('#k425604099')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Science | General')) { + console.log('Passed: Tagged Concepts: Science | General text matched as expected'); + } else { + errors.push(`Expected: "Science | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Science | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Science | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Science | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Science | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Science | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Science | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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: AutoAlign tab title text matched as expected'); } }, - //AutoAlign tab text title -gray (dimmed) + //Remove button3 { - description: 'Validate AutoAlign tab text color', + description: 'Validate Remove button3', action: async () => { - const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('color'); - if (elementStyle !== 'rgba(182, 186, 181, 1)') { - throw new Error(`Expected: "AutoAlign" tab text title color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Save Changes button3'; + const elementIcon = await driver.findElement(By.css('#k425604099 .glyphicon')); + const element = await driver.findElement(By.css('#k425604099 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 3 icon is present'); + } else { + errors.push('Save Remove button 3 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 3 text matched as expected'); + } else { + errors.push(`Expected: Button 3 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 3 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 3 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 3 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 3 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 3 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 3 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 3 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 3 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 3 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 3 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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: AutoAlign tab text title color matched as expected'); } }, - //AutoAlign tab title -white (dimmed) + //Primary toggle icon3 (SPECIAL CASE: use executeScript for all CSS values) { - description: 'Validate AutoAlign tab color', + description: 'Verify Primary toggle icon3 is present', action: async () => { - const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('background-color'); - if (elementStyle !== 'rgba(0, 0, 0, 0)') { - throw new Error(`Expected: "AutoAlign" tab title color did not match; Actual: "${elementStyle}"`); + const element = await driver.wait(until.elementLocated(By.css('#k425604099 .switch-primary')), 5000).catch(() => false); + const errors = []; + + //Get text + const elementText = await element.getText(); + + //Get all CSS values via executeScript + const styles = await driver.executeScript(` + const span = document.querySelector('#k425604099 .switch-primary'); + if (!span) return null; + const style = window.getComputedStyle(span); + return { + fontFamily: style.getPropertyValue('font-family'), + fontSize: style.getPropertyValue('font-size'), + color: style.getPropertyValue('color'), + backgroundColor: style.getPropertyValue('background-color') + }; + `); + //console.log('----->| DEBUG styles:', JSON.stringify(styles)); + + //Get toggle class from correct parent element + const toggleClass = await driver.executeScript(` + const span = document.querySelector('#k425604099 .switch-primary'); + if (!span) return 'not found'; + // Navigate up to find the switch-toggle div + let element = span.parentElement; + while (element) { + if (element.classList.contains('switch-toggle')) return element.className; + element = element.parentElement; + } + return 'switch-toggle not found in parents'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //text + if (elementText === 'Primary') { + console.log('Passed: Enabled Primary toggle icon 3 text matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 text: "Primary"; Actual: "${elementText}"`); + } + + //font-family + if (styles.fontFamily === 'Poppins, sans-serif') { + console.log('Passed: Enabled Primary toggle icon 3 text font matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 font "Poppins, sans-serif"; Actual: "${styles.fontFamily}"`); + } + + //font-size + if (styles.fontSize === '10px') { + console.log('Passed: Enabled Primary toggle icon 3 font-size matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 font-size "10px"; Actual: "${styles.fontSize}"`); + } + + //color + if (styles.color === 'rgb(255, 255, 255)') { + console.log('Passed: Enabled Primary toggle icon 3 text color matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 color "rgb(255, 255, 255)"; Actual: "${styles.color}"`); + } + + //background color + if (styles.backgroundColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Enabled Primary toggle icon 3 background color matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 background color "rgba(0, 0, 0, 0)"; Actual: "${styles.backgroundColor}"`); + } + + //toggle class + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Enabled Primary toggle icon 3 is a toggle switch as expected'); + } else { + errors.push(`Expected: "switch-toggle" in parent; Actual: "${toggleClass}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift('Primary toggle icon 3 - Multiple validation checks did not pass'); + } + throw new Error(errors.join('\n')); } - console.log('Passed: AutoAlign tab title color matched as expected'); } }, - //Select a set of standards label + //Tagged Concepts: Social Studies | General text { - description: 'Validate select a set of standards label', + description: 'Validate Tagged Concepts Social Studies General text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('label:nth-child(4)')).getText(); - if (elementText !== 'Select a set of standards:') { - throw new Error(`Expected: "Select a set of standards:" label text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Tagged Concepts: Social Studies | General'; + const element = await driver.findElement(By.css('#k425604100')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Social Studies | General')) { + console.log('Passed: Tagged Concepts: Social Studies | General text matched as expected'); + } else { + errors.push(`Expected: "Social Studies | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Social Studies | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Social Studies | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Social Studies | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Social Studies | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Social Studies | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Social Studies | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Select a set of standards: label text matched as expected'); } }, - //Standards dropdown + //Remove button4 { - description: 'Validate standards dropdown value', + description: 'Validate Remove button4', action: async () => { - const elementValue = await driver.findElement(By.css('#correlate-select-state')).getAttribute('value'); - if (elementValue !== 'none') { - throw new Error(`Expected: Dropdown value to be "none"; Actual: "${elementValue}"`); + const multipleChecks = 'Save Changes button4'; + const elementIcon = await driver.findElement(By.css('#k425604100 .glyphicon')); + const element = await driver.findElement(By.css('#k425604100 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 4 icon is present'); + } else { + errors.push('Save Remove button 4 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 4 text matched as expected'); + } else { + errors.push(`Expected: Button 4 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 4 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 4 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 4 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 4 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 4 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 4 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 4 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 4 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 4 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 4 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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: Dropdown "none" value matched as expected'); } }, - //NEXT ACTION - AutoAlign - { description: 'Click AutoAlign tab link', action: async () => await driver.findElement(By.linkText('AutoAlign')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(5000) }, - - //Browse tab title (dimmed) + //Primary toggle icon4 { - description: 'Validate browse tab title', + description: 'Verify Primary toggle icon4 is present', action: async () => { - const elementText = await driver.findElement(By.linkText('Browse')).getText(); - if (elementText !== 'Browse') { - throw new Error(`Expected: "Browse" tab title text did not match; Actual: "${elementText}"`); + const element = await driver.wait(until.elementLocated(By.css('#k425604100 label')), 5000).catch(() => false); + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('li#k425604100'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Primary toggle icon 4 appeared as expected'); + } else { + errors.push('Primary toggle icon 4 not found'); + } + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Primary toggle icon 4 toggle switch listed as expected'); + } else { + errors.push(`Expected: Primary toggle icon 4: "switch-toggle"; Actual: "${toggleClass}"`); } - console.log('Passed: Browse tab title text matched as expected'); } }, - //Browse tab text title -gray (dimmed) + //Select a set of standards: header { - description: 'Validate browse tab text color', + description: 'Validate Select a set of standards header text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('color'); - if (elementStyle !== 'rgba(182, 186, 181, 1)') { - throw new Error(`Expected: "Browse" tab text title color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Select a set of standards: header'; + const element = await driver.findElement(By.css('#concept-standard > label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Select a set of standards:') { + console.log('Passed: Select a set of standards: header text matched as expected'); + } else { + errors.push(`Expected: "Select a set of standards:"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Select a set of standards: header font matched as expected'); + } else { + errors.push(`Expected: Select a set of standards: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Select a set of standards: header text font-size matched as expected'); + } else { + errors.push(`Expected: Select a set of standards: header text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Select a set of standards: header text color matched as expected'); + } else { + errors.push(`Expected: Select a set of standards: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Browse tab text title color matched as expected'); } }, - //Browse tab title -white (dimmed) + //Set of standards dropdown list { - description: 'Validate browse tab color', + description: 'Validate Set of standards dropdown list', action: async () => { - const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('background-color'); - if (elementStyle !== 'rgba(0, 0, 0, 0)') { - throw new Error(`Expected: "Browse" tab title color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Set of standards dropdown list'; + const element = await driver.findElement(By.css('#correlate-select-state')); + + const options = await element.findElements(By.css('option')); + + //Track all errors + const errors = []; + + const expected = [ + '', + 'California', + 'Common Core State Standards', + 'Texas', + 'Alabama', + 'Arizona', + 'Florida', + 'Georgia', + 'New York', + 'Washington', + 'Alberta Standards', + 'Ontario Curriculum', + 'Australian Curriculum (ACARA) v8', + 'New South Wales', + 'Illinois', + 'NCSSFL-ACTFL CAN-DO STATEMENTS', + 'WIDA Consortium (2020)', + 'Imported Framework Updated', + 'Widget Test', + 'California Mathematics 1997', + '5th Grade Import ECS-2732', + 'Stats Test Framework', + 'Georgia Archived Language Arts QA', + 'Georgia Current Language Arts QA', + 'Georgia Future Language Arts QA', + 'create group test', + 'ECS-2933 Testing On Prod', + '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: Set of standards - Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Set of standards - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //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: Browse tab title color matched as expected'); } }, - //By Standard tab title (dimmed) - { - description: 'Validate by standard tab title', + //NEXT ACTION + { + description: 'Click AutoAlign tab link', action: async () => { - const elementText = await driver.findElement(By.linkText('By Standard')).getText(); - if (elementText !== 'By Standard') { - throw new Error(`Expected: "By Standard" tab title text did not match; Actual: "${elementText}"`); - } - console.log('Passed: By Standard tab title text matched as expected'); + await driver.findElement(By.linkText('AutoAlign')).click(); + console.log('----->| NEXT ACTION: Clicked AutoAlign tab link'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Page did not fully load within 30 seconds'); + + //Wait until the element exists in the DOM + const sectionHeader = await driver.wait( + until.elementLocated(By.css('#suggest_form > b')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(sectionHeader), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'AutoAlign page did not fully load within 30 seconds'); + console.log('Passed: AutoAlign page loaded successfully'); } }, - //By Standard tab text title -gray (dimmed) + //Browse tab title { - description: 'Validate by standard tab text color', + description: 'Validate Browse tab title text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('color'); - if (elementStyle !== 'rgba(182, 186, 181, 1)') { - throw new Error(`Expected: "By Standard" tab text title color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Browse tab title'; + const element = await driver.findElement(By.linkText('Browse')); + + //Get text, font, size, and 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 === 'Browse') { + console.log('Passed: Browse tab title text matched as expected'); + } else { + errors.push(`Expected: "Browse"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Browse tab title font matched as expected'); + } else { + errors.push(`Expected: Browse tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: Browse tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Browse tab title text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Browse tab title text color matched as expected'); + } else { + errors.push(`Expected: Browse tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Browse tab background color matched as expected'); + } else { + errors.push(`Expected: Browse tab background color: "rgba(0, 0, 0, 0)"; 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')); } - console.log('Passed: By Standard tab text title color matched as expected'); } }, - - //By Standard tab title -white (dimmed) + + //By Standard tab tab title { - description: 'Validate by standard tab color', + description: 'Validate By Standard tab title text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('background-color'); - if (elementStyle !== 'rgba(0, 0, 0, 0)') { - throw new Error(`Expected: "By Standard" tab title color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'By Standard tab title'; + const element = await driver.findElement(By.linkText('By Standard')); + + //Get text, font, size, and 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 === 'By Standard') { + console.log('Passed: By Standard tab title text matched as expected'); + } else { + errors.push(`Expected: "By Standard"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: By Standard tab title font matched as expected'); + } else { + errors.push(`Expected: By Standard tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: By Standard tab title text font-size matched as expected'); + } else { + errors.push(`Expected: By Standard tab title text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: By Standard tab title text color matched as expected'); + } else { + errors.push(`Expected: By Standard tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: By Standard tab background color matched as expected'); + } else { + errors.push(`Expected: By Standard tab background color: "rgba(0, 0, 0, 0)"; 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')); } - console.log('Passed: By Standard tab title color matched as expected'); } }, //AutoAlign tab title (active) { - description: 'Validate AutoAlign tab title', + description: 'Validate AutoAlign tab title text, size, and color', action: async () => { - const elementText = await driver.findElement(By.linkText('AutoAlign')).getText(); - if (elementText !== 'AutoAlign') { - throw new Error(`Expected: "AutoAlign" tab title text did not match; Actual: "${elementText}"`); + const multipleChecks = 'AutoAlign tab title'; + const element = await driver.findElement(By.linkText('AutoAlign')); + + //Get text, font, size, and 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 === 'AutoAlign') { + console.log('Passed: AutoAlign tab title text matched as expected'); + } else { + errors.push(`Expected: "AutoAlign"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: AutoAlign tab title font matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab title font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '15px') { + console.log('Passed: AutoAlign tab title text font-size matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab title text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: AutoAlign tab title text color matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: AutoAlign tab background color matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab background color: "rgba(40, 39, 90, 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')); } - console.log('Passed: AutoAlign tab title text matched as expected'); } }, - //AutoAlign tab text title -navy blue (active) + //Tagged Concepts: header { - description: 'Validate AutoAlign tab text color', + description: 'Validate Tagged Concepts header text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('color'); - if (elementStyle !== 'rgba(255, 255, 255, 1)') { - throw new Error(`Expected: "AutoAlign" tab text title color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Tagged Concepts: header'; + const element = await driver.findElement(By.css('.ui-widget-heading')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Tagged Concepts:') { + console.log('Passed: Tagged Concepts: header text matched as expected'); + } else { + errors.push(`Expected: "Tagged Concepts:"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: header font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Tagged Concepts: header text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: header text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Tagged Concepts: header text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: AutoAlign tab text title color matched as expected'); } }, - - //AutoAlign tab title -navy blue (active) + + //Tagged Concepts: Language Arts | General text { - description: 'Validate AutoAlign tab color', + description: 'Validate Tagged Concepts Language Arts General text, size, and color', action: async () => { - const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Expected: "AutoAlign" tab title color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Tagged Concepts: Language Arts | General'; + const element = await driver.findElement(By.css('#k425604097')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Language Arts | General')) { + console.log('Passed: Tagged Concepts: Language Arts | General text matched as expected'); + } else { + errors.push(`Expected: "Language Arts | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Language Arts | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Language Arts | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Language Arts | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Language Arts | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Language Arts | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Language Arts | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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: AutoAlign tab title color matched as expected'); } }, - //EdGates AutoAlign system...title + //Remove button1 { - description: 'Validate EdGates AutoAlign title', + description: 'Validate Remove button1', action: async () => { - const elementText = await driver.findElement(By.css('#suggest_form > b')).getText(); - if (elementText !== `EdGate's AutoAlign system can suggest concepts that may be relevant`) { - throw new Error(`Expected: "EdGate's AutoAlign system can suggest concepts that may be relevant" tab title text did not match; Actual: "${elementText}"`); + const multipleChecks = 'Save Changes button1'; + const elementIcon = await driver.findElement(By.css('#k425604097 .glyphicon')); + const element = await driver.findElement(By.css('#k425604097 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 1 icon is present'); + } else { + errors.push('Save Remove button 1 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 1 text matched as expected'); + } else { + errors.push(`Expected: Button 1 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 1 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 1 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 1 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 1 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 1 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 1 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 1 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 1 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 1 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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: EdGate's AutoAlign system can suggest concepts that may be relevant title text matched as expected`); } }, - /*Base Suggestions On sub-title + //Primary toggle icon1 { - description: 'Validate AutoAlign sub-title', + description: 'Verify Primary toggle icon1 is present', action: async () => { - const elementText = await driver.findElement(By.css('#suggest_form')).getText(); - if (elementText !== 'Base Suggestions On:2') { - throw new Error(`Expected: "Base Suggestions On1" sub-title text did not match; Actual: "${elementText}"`); - } - console.log('Passed: Base Suggestions1 On sub-title text matched as expected'); - } - },*/ + const element = await driver.wait(until.elementLocated(By.css('#k425604097 label')), 5000).catch(() => false); + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('li#k425604097'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); - //Title checkbox - { - description: 'Verify Title checkbox is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#inlineCheckbox1')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Title checkbox not found'); + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Primary toggle icon 1 appeared as expected'); + } else { + errors.push('Primary toggle icon 1 not found'); + } + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Primary toggle icon 1 toggle switch listed as expected'); + } else { + errors.push(`Expected: Primary toggle icon 1: "switch-toggle"; Actual: "${toggleClass}"`); } - console.log('Passed: Title checkbox present'); } }, - //Title checkbox label + //Tagged Concepts: Mathematics | General text { - description: 'Validate Title checkbox label', + description: 'Validate Tagged Concepts Mathematics General text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('.checkbox-inline:nth-child(1)')).getText(); - if (elementText !== 'Title') { - throw new Error(`Expected: "Title" checkbox label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Tagged Concepts: Mathematics | General'; + const element = await driver.findElement(By.css('#k425604098')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Mathematics | General')) { + console.log('Passed: Tagged Concepts: Mathematics | General text matched as expected'); + } else { + errors.push(`Expected: "Mathematics | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Mathematics | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Mathematics | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Mathematics | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Mathematics | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Mathematics | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Mathematics | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Title checkbox label matched as expected'); } }, - //Description checkbox + //Remove button2 { - description: 'Verify Description checkbox is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#inlineCheckbox2')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Description checkbox not found'); - } - console.log('Passed: Description checkbox present'); - } - }, - - //Description checkbox label - { - description: 'Validate Description checkbox label', + description: 'Validate Remove button2', action: async () => { - const elementText = await driver.findElement(By.css('.checkbox-inline:nth-child(2)')).getText(); - if (elementText !== 'Description') { - throw new Error(`Expected: "Description" checkbox label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Save Changes button2'; + const elementIcon = await driver.findElement(By.css('#k425604098 .glyphicon')); + const element = await driver.findElement(By.css('#k425604098 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 2 icon is present'); + } else { + errors.push('Save Remove button 2 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 2 text matched as expected'); + } else { + errors.push(`Expected: Button 2 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 2 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 2 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 2 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 2 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 2 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 2 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 2 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 2 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 2 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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: Description checkbox label matched as expected'); } }, - //Alignment Status checkbox + //Primary toggle icon2 { - description: 'Verify Alignment Status checkbox is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#inlineCheckbox3')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Alignment Status checkbox not found'); - } - console.log('Passed: Alignment Status checkbox present'); - } - }, - - //Alignment Status checkbox label - { - description: 'Validate Alignment Status checkbox label', + description: 'Verify Primary toggle icon2 is present', action: async () => { - const elementText = await driver.findElement(By.css('.checkbox-inline:nth-child(3)')).getText(); - if (elementText !== 'Alignment Status') { - throw new Error(`Expected: "Alignment Status" checkbox label did not match; Actual: "${elementText}"`); + const element = await driver.wait(until.elementLocated(By.css('#k425604098 label')), 5000).catch(() => false); + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('li#k425604098'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Primary toggle icon 2 appeared as expected'); + } else { + errors.push('Primary toggle icon 2 not found'); + } + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Primary toggle icon 2 toggle switch listed as expected'); + } else { + errors.push(`Expected: Primary toggle icon 2: "switch-toggle"; Actual: "${toggleClass}"`); } - console.log('Passed: Alignment Status checkbox label matched as expected'); } }, - /*# of Concepts label + //Tagged Concepts: Science | General text { - description: 'Validate # of Concepts label', + description: 'Validate Tagged Concepts Science General text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('#suggest_form')).getText(); - if (elementText !== '# of Concepts') { - throw new Error(`Expected: "# of Concepts" label did not match; Actual: "${elementText}"`); - } - console.log('Passed: # of Concepts label matched as expected'); - } - },*/ + const multipleChecks = 'Tagged Concepts: Science | General'; + const element = await driver.findElement(By.css('#k425604099')); - //# of Concepts dropdown value - { - description: 'Validate # of Concepts dropdown value text', - action: async () => { - const elementValue = await driver.findElement(By.css('#conceptnum')).getAttribute('value'); - if (elementValue !== '5') { - throw new Error(`Expected: "5"; Actual: "${elementValue}"`); + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Science | General')) { + console.log('Passed: Tagged Concepts: Science | General text matched as expected'); + } else { + errors.push(`Expected: "Science | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Science | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Science | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Science | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Science | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Science | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Science | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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: 5 value text matched as expected'); } }, - /*Subject Areas label + //Remove button3 { - description: 'Validate Subject Areas label', + description: 'Validate Remove button3', action: async () => { - const elementText = await driver.findElement(By.css('#suggest_form')).getText(); - if (elementText !== 'Subject Areas') { - throw new Error(`Expected: "Subject Areas" label did not match; Actual: "${elementText}"`); - } - console.log('Passed: Subject Areas label matched as expected'); - } - },*/ + const multipleChecks = 'Save Changes button3'; + const elementIcon = await driver.findElement(By.css('#k425604099 .glyphicon')); + const element = await driver.findElement(By.css('#k425604099 > .btn')); - //Subject Area value -Language Arts - { - description: 'Validate Subject Area value Language Arts text', - action: async () => { - const elementText = await driver.findElement(By.css('#concept_subjects > option:nth-child(1)')).getText(); - if (elementText !== 'Language Arts') { - throw new Error(`Expected: Subject Areas: "Language Arts" label did not match; Actual: "${elementText}"`); + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 3 icon is present'); + } else { + errors.push('Save Remove button 3 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 3 text matched as expected'); + } else { + errors.push(`Expected: Button 3 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 3 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 3 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 3 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 3 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 3 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 3 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 3 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 3 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 3 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 3 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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: Subject Areas: Language Arts label matched as expected'); } }, - //Subject Area value -Mathematics + //Primary toggle icon3 (SPECIAL CASE: use executeScript for all CSS values) { - description: 'Validate Subject Area value Mathematics text', + description: 'Verify Primary toggle icon3 is present', action: async () => { - const elementText = await driver.findElement(By.css('#concept_subjects > option:nth-child(2)')).getText(); - if (elementText !== 'Mathematics') { - throw new Error(`Expected: Subject Areas: "Mathematics" label did not match; Actual: "${elementText}"`); + const element = await driver.wait(until.elementLocated(By.css('#k425604099 .switch-primary')), 5000).catch(() => false); + const errors = []; + + //Get text + const elementText = await element.getText(); + + //Get all CSS values via executeScript + const styles = await driver.executeScript(` + const span = document.querySelector('#k425604099 .switch-primary'); + if (!span) return null; + const style = window.getComputedStyle(span); + return { + fontFamily: style.getPropertyValue('font-family'), + fontSize: style.getPropertyValue('font-size'), + color: style.getPropertyValue('color'), + backgroundColor: style.getPropertyValue('background-color') + }; + `); + //console.log('----->| DEBUG styles:', JSON.stringify(styles)); + + //Get toggle class from correct parent element + const toggleClass = await driver.executeScript(` + const span = document.querySelector('#k425604099 .switch-primary'); + if (!span) return 'not found'; + // Navigate up to find the switch-toggle div + let element = span.parentElement; + while (element) { + if (element.classList.contains('switch-toggle')) return element.className; + element = element.parentElement; + } + return 'switch-toggle not found in parents'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //text + if (elementText === 'Primary') { + console.log('Passed: Enabled Primary toggle icon 3 text matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 text: "Primary"; Actual: "${elementText}"`); + } + + //font-family + if (styles.fontFamily === 'Poppins, sans-serif') { + console.log('Passed: Enabled Primary toggle icon 3 text font matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 font "Poppins, sans-serif"; Actual: "${styles.fontFamily}"`); + } + + //font-size + if (styles.fontSize === '10px') { + console.log('Passed: Enabled Primary toggle icon 3 font-size matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 font-size "10px"; Actual: "${styles.fontSize}"`); + } + + //color + if (styles.color === 'rgb(255, 255, 255)') { + console.log('Passed: Enabled Primary toggle icon 3 text color matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 color "rgb(255, 255, 255)"; Actual: "${styles.color}"`); + } + + //background color + if (styles.backgroundColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Enabled Primary toggle icon 3 background color matched as expected'); + } else { + errors.push(`Expected: Enabled Primary toggle icon 3 background color "rgba(0, 0, 0, 0)"; Actual: "${styles.backgroundColor}"`); + } + + //toggle class + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Enabled Primary toggle icon 3 is a toggle switch as expected'); + } else { + errors.push(`Expected: "switch-toggle" in parent; Actual: "${toggleClass}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift('Primary toggle icon 3 - Multiple validation checks did not pass'); + } + throw new Error(errors.join('\n')); } - console.log('Passed: Subject Areas: Mathematics label matched as expected'); } }, - //Subject Area value -Science + //Tagged Concepts: Social Studies | General text { - description: 'Validate Subject Area value Science text', + description: 'Validate Tagged Concepts Social Studies General text, size, and color', action: async () => { - const elementText = await driver.findElement(By.css('#concept_subjects > option:nth-child(3)')).getText(); - if (elementText !== 'Science') { - throw new Error(`Expected: Subject Areas: "Science" label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Tagged Concepts: Social Studies | General'; + const element = await driver.findElement(By.css('#k425604100')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Social Studies | General')) { + console.log('Passed: Tagged Concepts: Social Studies | General text matched as expected'); + } else { + errors.push(`Expected: "Social Studies | General"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Tagged Concepts: Social Studies | General text font matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Social Studies | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '12px') { + console.log('Passed: Tagged Concepts: Social Studies | General text font-size matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Social Studies | General text font-size "12px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(99, 99, 99, 1)') { + console.log('Passed: Tagged Concepts: Social Studies | General text color matched as expected'); + } else { + errors.push(`Expected: Tagged Concepts: Social Studies | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Subject Areas: Science label matched as expected'); } }, - //Subject Area value -Social Studies + //Remove button4 { - description: 'Validate Subject Area value Social Studies text', + description: 'Validate Remove button4', action: async () => { - const elementText = await driver.findElement(By.css('#concept_subjects > option:nth-child(4)')).getText(); - if (elementText !== 'Social Studies') { - throw new Error(`Expected: Subject Areas: "Social Studies" label did not match; Actual: "${elementText}"`); + const multipleChecks = 'Save Changes button4'; + const elementIcon = await driver.findElement(By.css('#k425604100 .glyphicon')); + const element = await driver.findElement(By.css('#k425604100 > .btn')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + const elementTooltip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Remove button 4 icon is present'); + } else { + errors.push('Save Remove button 4 icon was not found'); + } + + //text + if (elementText === 'Remove') { + console.log('Passed: Remove button 4 text matched as expected'); + } else { + errors.push(`Expected: Button 4 text: "Remove"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Remove button 4 text font matched as expected'); + } else { + errors.push(`Expected: Remove button 4 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Remove button 4 text font-size matched as expected'); + } else { + errors.push(`Expected: Remove button 4 text font-size "12px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Remove button 4 text color matched as expected'); + } else { + errors.push(`Expected: Remove button 4 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(246, 60, 40, 1)') { + console.log('Passed: Remove button 4 background color matched as expected'); + } else { + errors.push(`Expected: Remove button 4 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`); + } + + //tool-tip + if (elementTooltip === 'Remove Concept') { + console.log('Passed: Remove button 4 tool-tip text matched as expected'); + } else { + errors.push(`Expected: Button 4 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`); + } + + //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: Subject Areas: Social Studies label matched as expected'); } }, - //Suggest Concepts button text + //Primary toggle icon4 { - description: 'Validate Suggest Concepts button text', + description: 'Verify Primary toggle icon4 is present', action: async () => { - const elementText = await driver.findElement(By.css('.btn:nth-child(9)')).getText(); - if (elementText !== 'Suggest Concepts') { - throw new Error(`Expected: "Suggest Concepts" button text did not match; Actual: "${elementText}"`); + const element = await driver.wait(until.elementLocated(By.css('#k425604100 label')), 5000).catch(() => false); + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('li#k425604100'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + //console.log('----->| DEBUG toggle class:', toggleClass); + + //Track all errors + const errors = []; + + if (element) { + console.log('Passed: Primary toggle icon 4 appeared as expected'); + } else { + errors.push('Primary toggle icon 4 not found'); + } + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Primary toggle icon 4 toggle switch listed as expected'); + } else { + errors.push(`Expected: Primary toggle icon 4: "switch-toggle"; Actual: "${toggleClass}"`); } - console.log('Passed: Suggest Concepts button text matched as expected'); } }, - //Suggest Concepts button icon + //EdGate's AutoAlign system... header { - description: 'Verify Suggest Concepts button icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.glyphicon-tags')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Suggest Concepts button icon not found'); - } - console.log('Passed: Suggest Concepts button icon present'); - } - }, - - //Suggest Concepts button color -green - { - description: 'Validate Suggest Concepts button color', + description: 'Validate EdGates AutoAlign system header text, size, and color', action: async () => { - const elementValue = await driver.findElement(By.css('.btn:nth-child(9)')).getCssValue('background-color'); - if (elementValue !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Expected: "Suggest Concepts" button color did not match; Actual: "${elementValue}"`); + const multipleChecks = 'EdGates AutoAlign system header'; + const element = await driver.findElement(By.css('#suggest_form > b')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === `EdGate's AutoAlign system can suggest concepts that may be relevant`) { + console.log(`Passed: EdGate's AutoAlign system... header text matched as expected`); + } else { + errors.push(`Expected: "EdGate's AutoAlign system can suggest concepts that may be relevant"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log(`Passed: EdGate's AutoAlign system... header font matched as expected`); + } else { + errors.push(`Expected: EdGate's AutoAlign system... header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log(`Passed: EdGate's AutoAlign system... header text font-size matched as expected`); + } else { + errors.push(`Expected: EdGate's AutoAlign system... header text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log(`Passed: EdGate's AutoAlign system... header text color matched as expected`); + } else { + errors.push(`Expected: EdGate's AutoAlign system... header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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: Suggest Concepts button color matched as expected'); } }, - //LOG OUT - //NEXT ACTION - Log out - { description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, - { description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + //Base Suggestion On: header + { + description: 'Validate Base Suggestion On header text, size, and color', + action: async () => { + const multipleChecks = 'Base Suggestion On: header'; + const element = await driver.findElement(By.css('#suggest_form')); - //Wait for login screen to load + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Base Suggestion On:')) { + console.log('Passed: Base Suggestion On: header text matched as expected'); + } else { + errors.push(`Expected: "Base Suggestion On:"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Base Suggestion On: header font matched as expected'); + } else { + errors.push(`Expected: Base Suggestion On: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Base Suggestion On: header text font-size matched as expected'); + } else { + errors.push(`Expected: Base Suggestion On: header text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Base Suggestion On: header text color matched as expected'); + } else { + errors.push(`Expected: Base Suggestion On: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 + { + description: 'Validate Title text, size, and color', + action: async () => { + const multipleChecks = 'Title checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox1')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(1)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Title checkbox is present'); + } else { + errors.push('Title checkbox was not found'); + } + + //text + if (elementText === 'Title') { + console.log('Passed: Title label text matched as expected'); + } else { + errors.push(`Expected: "Title"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Title label font matched as expected'); + } else { + errors.push(`Expected: Title label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Title label text font-size matched as expected'); + } else { + errors.push(`Expected: Title label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Title label text color matched as expected'); + } else { + errors.push(`Expected: Title label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Description + { + description: 'Validate Description text, size, and color', + action: async () => { + const multipleChecks = 'Description checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox2')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(2)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Description checkbox is present'); + } else { + errors.push('Description checkbox was not found'); + } + + //text + if (elementText === 'Description') { + console.log('Passed: Description label text matched as expected'); + } else { + errors.push(`Expected: "Description"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Description label font matched as expected'); + } else { + errors.push(`Expected: Description label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Description label text font-size matched as expected'); + } else { + errors.push(`Expected: Description label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Description label text color matched as expected'); + } else { + errors.push(`Expected: Description label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Ads + { + description: 'Validate Ads text, size, and color', + action: async () => { + const multipleChecks = 'Ads checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox3')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(3)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Ads checkbox is present'); + } else { + errors.push('Ads checkbox was not found'); + } + + //text + if (elementText === 'Ads') { + console.log('Passed: Ads label text matched as expected'); + } else { + errors.push(`Expected: "Ads"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Ads label font matched as expected'); + } else { + errors.push(`Expected: Ads label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Ads label text font-size matched as expected'); + } else { + errors.push(`Expected: Ads label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Ads label text color matched as expected'); + } else { + errors.push(`Expected: Ads label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 Type + { + description: 'Validate Content Type text, size, and color', + action: async () => { + const multipleChecks = 'Content Type checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox4')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(4)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Content Type checkbox is present'); + } else { + errors.push('Content Type checkbox was not found'); + } + + //text + if (elementText === 'Content Type') { + console.log('Passed: Content Type label text matched as expected'); + } else { + errors.push(`Expected: "Content Type"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Content Type label font matched as expected'); + } else { + errors.push(`Expected: Content Type label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Content Type label text font-size matched as expected'); + } else { + errors.push(`Expected: Content Type label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Content Type label text color matched as expected'); + } else { + errors.push(`Expected: Content Type label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 + { + description: 'Validate Format text, size, and color', + action: async () => { + const multipleChecks = 'Format checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox5')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(5)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Format checkbox is present'); + } else { + errors.push('Format checkbox was not found'); + } + + //text + if (elementText === 'Format') { + console.log('Passed: Format label text matched as expected'); + } else { + errors.push(`Expected: "Format"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Format label font matched as expected'); + } else { + errors.push(`Expected: Format label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Format label text font-size matched as expected'); + } else { + errors.push(`Expected: Format label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Format label text color matched as expected'); + } else { + errors.push(`Expected: Format label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Free or Fee + { + description: 'Validate Free or Fee text, size, and color', + action: async () => { + const multipleChecks = 'Free or Fee checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox6')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(6)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Free or Fee checkbox is present'); + } else { + errors.push('Free or Fee checkbox was not found'); + } + + //text + if (elementText === 'Free or Fee') { + console.log('Passed: Free or Fee label text matched as expected'); + } else { + errors.push(`Expected: "Free or Fee"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Free or Fee label font matched as expected'); + } else { + errors.push(`Expected: Free or Fee label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Free or Fee label text font-size matched as expected'); + } else { + errors.push(`Expected: Free or Fee label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Free or Fee label text color matched as expected'); + } else { + errors.push(`Expected: Free or Fee label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Grade Range + { + description: 'Validate Grade Range text, size, and color', + action: async () => { + const multipleChecks = 'Grade Range checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox7')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(7)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Grade Range checkbox is present'); + } else { + errors.push('Grade Range checkbox was not found'); + } + + //text + if (elementText === 'Grade Range') { + console.log('Passed: Grade Range label text matched as expected'); + } else { + errors.push(`Expected: "Grade Range"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Grade Range label font matched as expected'); + } else { + errors.push(`Expected: Grade Range label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Grade Range label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade Range label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade Range label text color matched as expected'); + } else { + errors.push(`Expected: Grade Range label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Language + { + description: 'Validate Language text, size, and color', + action: async () => { + const multipleChecks = 'Language checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox8')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(8)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Language checkbox is present'); + } else { + errors.push('Language checkbox was not found'); + } + + //text + if (elementText === 'Language') { + console.log('Passed: Language label text matched as expected'); + } else { + errors.push(`Expected: "Language"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Language label font matched as expected'); + } else { + errors.push(`Expected: Language label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Language label text font-size matched as expected'); + } else { + errors.push(`Expected: Language label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Language label text color matched as expected'); + } else { + errors.push(`Expected: Language label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Level-Challenging + { + description: 'Validate Level-Challenging text, size, and color', + action: async () => { + const multipleChecks = 'Level-Challenging checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox9')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(9)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Level-Challenging checkbox is present'); + } else { + errors.push('Level-Challenging checkbox was not found'); + } + + //text + if (elementText === 'Level-Challenging') { + console.log('Passed: Level-Challenging label text matched as expected'); + } else { + errors.push(`Expected: "Level-Challenging"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Level-Challenging label font matched as expected'); + } else { + errors.push(`Expected: Level-Challenging label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Level-Challenging label text font-size matched as expected'); + } else { + errors.push(`Expected: Level-Challenging label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Level-Challenging label text color matched as expected'); + } else { + errors.push(`Expected: Level-Challenging label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Level-On Target + { + description: 'Validate Level-On Target text, size, and color', + action: async () => { + const multipleChecks = 'Level-On Target checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox10')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(10)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Level-On Target checkbox is present'); + } else { + errors.push('Level-On Target checkbox was not found'); + } + + //text + if (elementText === 'Level-On Target') { + console.log('Passed: Level-On Target label text matched as expected'); + } else { + errors.push(`Expected: "Level-On Target"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Level-On Target label font matched as expected'); + } else { + errors.push(`Expected: Level-On Target label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Level-On Target label text font-size matched as expected'); + } else { + errors.push(`Expected: Level-On Target label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Level-On Target label text color matched as expected'); + } else { + errors.push(`Expected: Level-On Target label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Level_Challenging + { + description: 'Validate Level_Challenging text, size, and color', + action: async () => { + const multipleChecks = 'Level_Challenging checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox11')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(11)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Level_Challenging checkbox is present'); + } else { + errors.push('Level_Challenging checkbox was not found'); + } + + //text + if (elementText === 'Level_Challenging') { + console.log('Passed: Level_Challenging label text matched as expected'); + } else { + errors.push(`Expected: "Level_Challenging"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Level_Challenging label font matched as expected'); + } else { + errors.push(`Expected: Level_Challenging label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Level_Challenging label text font-size matched as expected'); + } else { + errors.push(`Expected: Level_Challenging label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Level_Challenging label text color matched as expected'); + } else { + errors.push(`Expected: Level_Challenging label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Level_On Target + { + description: 'Validate Level_On Target text, size, and color', + action: async () => { + const multipleChecks = 'Level_On Target checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox12')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(12)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Level_On Target checkbox is present'); + } else { + errors.push('Level_On Target checkbox was not found'); + } + + //text + if (elementText === 'Level_On Target') { + console.log('Passed: Level_On Target label text matched as expected'); + } else { + errors.push(`Expected: "Level_On Target"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Level_On Target label font matched as expected'); + } else { + errors.push(`Expected: Level_On Target label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Level_On Target label text font-size matched as expected'); + } else { + errors.push(`Expected: Level_On Target label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Level_On Target label text color matched as expected'); + } else { + errors.push(`Expected: Level_On Target label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Login Required + { + description: 'Validate Login Required text, size, and color', + action: async () => { + const multipleChecks = 'Login Required checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox13')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(13)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Login Required checkbox is present'); + } else { + errors.push('Login Required checkbox was not found'); + } + + //text + if (elementText === 'Login Required') { + console.log('Passed: Login Required label text matched as expected'); + } else { + errors.push(`Expected: "Login Required"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Login Required label font matched as expected'); + } else { + errors.push(`Expected: Login Required label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Login Required label text font-size matched as expected'); + } else { + errors.push(`Expected: Login Required label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Login Required label text color matched as expected'); + } else { + errors.push(`Expected: Login Required label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Printable + { + description: 'Validate Printable text, size, and color', + action: async () => { + const multipleChecks = 'Printable checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox14')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(14)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Printable checkbox is present'); + } else { + errors.push('Printable checkbox was not found'); + } + + //text + if (elementText === 'Printable') { + console.log('Passed: Printable label text matched as expected'); + } else { + errors.push(`Expected: "Printable"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Printable label font matched as expected'); + } else { + errors.push(`Expected: Printable label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Printable label text font-size matched as expected'); + } else { + errors.push(`Expected: Printable label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Printable label text color matched as expected'); + } else { + errors.push(`Expected: Printable label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Source + { + description: 'Validate Source text, size, and color', + action: async () => { + const multipleChecks = 'Source checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox15')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(15)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Source checkbox is present'); + } else { + errors.push('Source checkbox was not found'); + } + + //text + if (elementText === 'Source') { + console.log('Passed: Source label text matched as expected'); + } else { + errors.push(`Expected: "Source"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Source label font matched as expected'); + } else { + errors.push(`Expected: Source label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Source label text font-size matched as expected'); + } else { + errors.push(`Expected: Source label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Source label text color matched as expected'); + } else { + errors.push(`Expected: Source label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Subject(s) + { + description: 'Validate Subjects text, size, and color', + action: async () => { + const multipleChecks = 'Subject(s) checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox16')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(16)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Subject(s) checkbox is present'); + } else { + errors.push('Subject(s) checkbox was not found'); + } + + //text + if (elementText === 'Subject(s)') { + console.log('Passed: Subject(s) label text matched as expected'); + } else { + errors.push(`Expected: "Subject(s)"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Subject(s) label font matched as expected'); + } else { + errors.push(`Expected: Subject(s) label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Subject(s) label text font-size matched as expected'); + } else { + errors.push(`Expected: Subject(s) label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Subject(s) label text color matched as expected'); + } else { + errors.push(`Expected: Subject(s) label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Target Audience + { + description: 'Validate Target Audience text, size, and color', + action: async () => { + const multipleChecks = 'Target Audience checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox17')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(17)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Target Audience checkbox is present'); + } else { + errors.push('Target Audience checkbox was not found'); + } + + //text + if (elementText === 'Target Audience') { + console.log('Passed: Target Audience label text matched as expected'); + } else { + errors.push(`Expected: "Target Audience"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Target Audience label font matched as expected'); + } else { + errors.push(`Expected: Target Audience label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Target Audience label text font-size matched as expected'); + } else { + errors.push(`Expected: Target Audience label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Target Audience label text color matched as expected'); + } else { + errors.push(`Expected: Target Audience label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Terms of Use + { + description: 'Validate Terms of Use text, size, and color', + action: async () => { + const multipleChecks = 'Terms of Use checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox18')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(18)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Terms of Use checkbox is present'); + } else { + errors.push('Terms of Use checkbox was not found'); + } + + //text + if (elementText === 'Terms of Use') { + console.log('Passed: Terms of Use label text matched as expected'); + } else { + errors.push(`Expected: "Terms of Use"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Terms of Use label font matched as expected'); + } else { + errors.push(`Expected: Terms of Use label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Terms of Use label text font-size matched as expected'); + } else { + errors.push(`Expected: Terms of Use label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Terms of Use label text color matched as expected'); + } else { + errors.push(`Expected: Terms of Use label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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 Status + { + description: 'Validate Alignment Status text, size, and color', + action: async () => { + const multipleChecks = 'Alignment Status checkbox'; + const elementIcon = await driver.findElement(By.css('#inlineCheckbox19')); + const element = await driver.findElement(By.css('.checkbox-inline:nth-child(19)')); + + 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'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Alignment Status checkbox is present'); + } else { + errors.push('Alignment Status checkbox was not found'); + } + + //text + if (elementText === 'Alignment Status') { + console.log('Passed: Alignment Status label text matched as expected'); + } else { + errors.push(`Expected: "Alignment Status"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Alignment Status label font matched as expected'); + } else { + errors.push(`Expected: Alignment Status label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Alignment Status label text font-size matched as expected'); + } else { + errors.push(`Expected: Alignment Status label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Alignment Status label text color matched as expected'); + } else { + errors.push(`Expected: Alignment Status label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //# Of Concepts: header + { + description: 'Validate # Of Concepts header text, size, and color', + action: async () => { + const multipleChecks = '# Of Concepts: header'; + const element = await driver.findElement(By.css('#suggest_form')); + + //Get text, font, size, and 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 conceptsText = await driver.executeScript(` + const div = document.querySelector('#suggest_form'); + if (!div) return 'not found'; + //Get all text nodes and find the one containing "# of Concepts" + const childNodes = div.childNodes; + for (let node of childNodes) { + if (node.nodeType === 3 && node.textContent.includes('# of Concepts')) { + return node.textContent.trim(); + } + } + return 'not found'; + `); + //console.log('----->| DEBUG concepts text:', conceptsText); + + //Track all errors + const errors = []; + + // text + if (conceptsText.includes('# of Concepts')) { + console.log('Passed: # of Concepts header text matched as expected'); + } else { + errors.push(`Expected text to contain: "# of Concepts"; Actual: "${conceptsText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: # Of Concepts: header font matched as expected'); + } else { + errors.push(`Expected: # Of Concepts: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: # Of Concepts: header text font-size matched as expected'); + } else { + errors.push(`Expected: # Of Concepts: header text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: # Of Concepts: header text color matched as expected'); + } else { + errors.push(`Expected: # Of Concepts: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //# of Concepts: dropdown + { + description: 'Validate # of Concepts dropdown', + action: async () => { + const multipleChecks = '# of Concepts: List'; + const elementDropdown = await driver.findElement(By.css('#conceptnum')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); + + const elementText = await selectedOption.getText(); + const elementTextFont = await selectedOption.getCssValue('font-family'); + const elementTextSize = await selectedOption.getCssValue('font-size'); + const elementTextColor = await selectedOption.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('1')) { + console.log('Passed: # of Concepts: dropdown text matched as expected'); + } else { + throw new Error(`Expected: # of Concepts: "1"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: # of Concepts: dropdown font matched as expected'); + } else { + errors.push(`Expected: # of Concepts: dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: # of Concepts: dropdown font-size matched as expected'); + } else { + errors.push(`Expected: # of Concepts: dropdown font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: # of Concepts: dropdown color matched as expected'); + } else { + errors.push(`Expected: # of Concepts: dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + '10' + ]; + + 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 - Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Content Set - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //Subject Areas: header + { + description: 'Validate Subject Areas header text, size, and color', + action: async () => { + const multipleChecks = 'Subject Areas: header'; + const element = await driver.findElement(By.css('#suggest_form')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes('Subject Areas:')) { + console.log('Passed: Subject Areas: header text matched as expected'); + } else { + errors.push(`Expected: "Subject Areas:"; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Subject Areas: header font matched as expected'); + } else { + errors.push(`Expected: Subject Areas: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Subject Areas: header text font-size matched as expected'); + } else { + errors.push(`Expected: Subject Areas: header text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Subject Areas: header text color matched as expected'); + } else { + errors.push(`Expected: Subject Areas: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Subject Areas: dropdown + { + description: 'Validate Subject Areas dropdown', + action: async () => { + const multipleChecks = 'Subject Areas: List'; + const elementDropdown = await driver.findElement(By.css('#concept_subjects')); + + const elementText = await elementDropdown.getText(); + const elementTextFont = await elementDropdown.getCssValue('font-family'); + const elementTextSize = await elementDropdown.getCssValue('font-size'); + const elementTextColor = await elementDropdown.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //font-family + if (elementTextFont === "Poppins, sans-serif") { + console.log('Passed: Subject Areas: dropdown font matched as expected'); + } else { + errors.push(`Expected: Subject Areas: dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '16px') { + console.log('Passed: Subject Areas: dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Subject Areas: dropdown font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Subject Areas: dropdown color matched as expected'); + } else { + errors.push(`Expected: Subject Areas: dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`); + } + + const expected = [ + 'Health and PE', + 'Language Arts', + 'Mathematics', + 'Science', + 'Social Studies', + 'Technology Education' + ]; + + 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: Subject Areas - Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Subject Areas - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //Suggest Concepts button + { + description: 'Validate Suggest Concepts button', + action: async () => { + const multipleChecks = 'Suggest Concepts button'; + const elementIcon = await driver.findElement(By.css('.glyphicon-tags')); + const element = await driver.findElement(By.css('.btn:nth-child(9)')); + + //Get text, font, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementSize = await element.getCssValue('font-size'); + const elementTextColor = await element.getCssValue('color'); + const elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: Suggest Concepts icon is present'); + } else { + errors.push('Suggest Concepts icon was not found'); + } + + //text + if (elementText === 'Suggest Concepts') { + console.log('Passed: Suggest Concepts button text matched as expected'); + } else { + errors.push(`Expected: Button text: "Suggest Concepts"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Suggest Concepts button text font matched as expected'); + } else { + errors.push(`Expected: Suggest Concepts button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Suggest Concepts button text font-size matched as expected'); + } else { + errors.push(`Expected: v button text font-size "16px"; Actual: "${elementSize}"`); + } + + //text color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Suggest Concepts button text color matched as expected'); + } else { + errors.push(`Expected: Suggest Concepts button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Suggest Concepts button background color matched as expected'); + } else { + errors.push(`Expected: Suggest Concepts 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')); + } + } + }, + + //NEXT ACTION { - description: 'Wait for log out process to complete', + description: 'Log Out', action: async () => { - return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false); + 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')); + } } }, ]; @@ -2698,26 +16094,24 @@ try { 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 + try { await step.action(); - - //Log a successful step with no screenshot worksheet = logStep( worksheet, step.description, 'Passed', stepIndex, timestamp, - null //No screenshot for passed steps + null ); } catch (error) { - //Only take screenshot if the step fails const screenshotPath = await takeScreenshot( driver, stepIndex, @@ -2734,19 +16128,21 @@ try { ); console.error(`Step ${stepIndex} FAILED: ${error.message}`); + failedSteps.push(`Step ${stepIndex}: ${step.description} - ${error.message}`); //Track failed step testStatus = 'Failed'; allStepsPassed = false; } } - //Check if log out was successful - const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); - - if (loginButton && allStepsPassed) { - console.log('PASSED: Edit Item(ExACT_editItem); All test steps completed successfully'); + if (allStepsPassed) { + console.log('------------->| THE END |<-------------'); + console.log('PASSED: CONTENT - Edit Item (ExACT_editItem); All test steps completed successfully'); testStatus = 'Passed'; } else { - console.log('FAILED: Edit Item(ExACT_editItem); One or more test steps failed'); + console.log('------------->| THE END |<-------------'); + console.log('FAILED: CONTENT - Edit Item (ExACT_editItem); One or more test steps failed'); + console.log('FAILED STEPS:'); + failedSteps.forEach(step => console.error(` ✗ ${step}`)); testStatus = 'Failed'; } @@ -2760,7 +16156,7 @@ try { } finally { await driver.quit(); } -})(); + })(); } export default ExACT_editItem; diff --git a/tests/ExACT_landingPage.js b/tests/ExACT_landingPage.js index 811630b..7ea349e 100644 --- a/tests/ExACT_landingPage.js +++ b/tests/ExACT_landingPage.js @@ -1,11 +1,12 @@ -import { Builder, By, Key, until } from 'selenium-webdriver'; +import { Builder, By, Key, until, Select } from 'selenium-webdriver'; import { Options as ChromeOptions } from 'selenium-webdriver/chrome.js'; import fs from 'fs'; import XLSX from 'xlsx'; import path from 'path'; +import { error } from 'console'; const ExACT_landingPage = (req, res) => { - res.send('

    ExACT Automated Test Script: ExACT Login Page(ExACT_landingPage); Initiated

    '); + res.send('

    ExACT Automated Test Script: EGATE LANDING PAGE: ExACT Login Page (ExACT_landingPage) | Initiated

    '); (async function example() { let driver = await new Builder() .forBrowser('chrome') @@ -30,13 +31,7 @@ const steps = [ { description: 'Loading Page', action: async () => { - //Wait for page to load completely - await driver.wait(async () => { - const readyState = await driver.executeScript('return document.readyState'); - return readyState === 'complete'; - }, 30000, 'ExACT Landing Page did not fully load within 30 seconds'); - console.log('------------->| BEGIN SCRIPT |<-------------'); - console.log('---------->| ExACT Landing Page |<----------'); + console.log('------------->| ExACT LANDING PAGE |<-------------'); //Wait until the element exists in the DOM const exactLogo = await driver.wait( @@ -55,7 +50,7 @@ const steps = [ 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'); + console.log('Passed: ExACT Landing Page loaded successfully'); } }, @@ -90,7 +85,7 @@ const steps = [ errors.push(`Expected: Title font "DM Serif Display", serif; Actual: ${elementFont}`); } - //color -white + //color if (elementColor === 'rgba(255, 255, 255, 1)') { console.log('Passed: Title text color matched as expected'); } else { @@ -147,7 +142,7 @@ const steps = [ errors.push(`Expected: Descriptive text 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -white + //color if (elementColor === 'rgba(255, 255, 255, 1)') { console.log('Passed: Descriptive text 1 text color matched as expected'); } else { @@ -204,7 +199,7 @@ const steps = [ errors.push(`Expected: Descriptive text 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -white + //color if (elementColor === 'rgba(255, 255, 255, 1)') { console.log('Passed: Descriptive text 2 text color matched as expected'); } else { @@ -261,7 +256,7 @@ const steps = [ errors.push(`Expected: Sign up text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -white + //color if (elementColor === 'rgba(255, 255, 255, 1)') { console.log('Passed: Sign up text color matched as expected'); } else { @@ -326,7 +321,7 @@ const steps = [ errors.push(`Expected: Free trial link text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -red/orange + //color if (elementColor === 'rgba(255, 111, 97, 1)') { console.log('Passed: Free trial link text color matched as expected'); } else { @@ -353,7 +348,7 @@ const steps = [ } }, - //NEXT ACTION - Click Free Trial link + //NEXT ACTION { description: 'Click Free Trial link', action: async () => { @@ -383,11 +378,16 @@ const steps = [ }, //Left Panel + //ExACT logo { description: 'Verify ExACT logo is present', action: async () => { const expectedExactLogo = await driver.wait(until.elementLocated(By.css('.logo')), 5000).catch(() => false); + + //Track all errors + const errors = []; + if (expectedExactLogo) { console.log('Passed: ExACT logo present'); } else { @@ -426,7 +426,7 @@ const steps = [ errors.push(`Expected: ExACT Free trial text font "DM Serif Display", serif; Actual: ${elementFont}`); } - //color -white + //color if (elementColor === 'rgba(255, 255, 255, 1)') { console.log('Passed: ExACT Free trial color matched as expected'); } else { @@ -483,7 +483,7 @@ const steps = [ errors.push(`Expected: ExACT Free trial text font "DM Serif Display", serif; Actual: ${elementFont}`); } - //color -red/orange + //color if (elementColor === 'rgba(255, 111, 97, 1)') { console.log('Passed: ExACT Free trial color matched as expected'); } else { @@ -540,7 +540,7 @@ const steps = [ errors.push(`Expected: 30 Day Free trial,...text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -white + //color if (elementColor === 'rgba(255, 255, 255, 1)') { console.log('Passed: 30 Day Free trial,...text color matched as expected'); } else { @@ -597,7 +597,7 @@ const steps = [ errors.push(`Expected: See for yourself why ExACT...text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -white + //color if (elementColor === 'rgba(255, 255, 255, 1)') { console.log('Passed: See for yourself why ExACT...text color matched as expected'); } else { @@ -696,7 +696,7 @@ const steps = [ } else { errors.push(`Expected: Absolutely Free text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color - white + //color if (elementColor === 'rgb(255, 255, 255)') { console.log('Passed: Absolutely Free text color matched as expected'); } else { @@ -723,7 +723,7 @@ const steps = [ errors.push(`Expected: "- no credit card required or hidden fees" text font "Poppins, sans-serif"; Actual: ${spanFont?.fontFamily}`); } - //color - span + //color if (spanFont?.color === 'rgb(255, 255, 255)') { console.log('Passed: "- no credit card required or hidden fees" text color matched as expected'); } else { @@ -819,7 +819,7 @@ const steps = [ } else { errors.push(`Expected: Instant Access text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color - white + //color if (elementColor === 'rgb(255, 255, 255)') { console.log('Passed: Instant Access text color matched as expected'); } else { @@ -846,7 +846,7 @@ const steps = [ errors.push(`Expected: "- Sign up and log-in, it’s that easy" text font "Poppins, sans-serif"; Actual: ${spanFont?.fontFamily}`); } - //color - span + //color if (spanFont?.color === 'rgb(255, 255, 255)') { console.log(`Passed: "- Sign up and log-in, it’s that easy" text color matched as expected`); } else { @@ -942,7 +942,7 @@ const steps = [ } else { errors.push(`Expected: Access Standards text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color - white + //color if (elementColor === 'rgb(255, 255, 255)') { console.log('Passed: Access Standards text color matched as expected'); } else { @@ -969,7 +969,7 @@ const steps = [ errors.push(`Expected: "- Access all Common Core, NGSS, and NCSS Standards free" text font "Poppins, sans-serif"; Actual: ${spanFont?.fontFamily}`); } - //color - span + //color if (spanFont?.color === 'rgb(255, 255, 255)') { console.log(`Passed: "- Access all Common Core, NGSS, and NCSS Standards free" text color matched as expected`); } else { @@ -1023,7 +1023,7 @@ const steps = [ errors.push(`Expected: Want to talk to a representative...text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -white + //color if (elementColor === 'rgba(255, 255, 255, 1)') { console.log('Passed: Want to talk to a representative...text color matched as expected'); } else { @@ -1088,7 +1088,7 @@ const steps = [ errors.push(`Expected: Contact Us link text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -teal + //color if (elementColor === 'rgba(48, 200, 172, 1)') { console.log('Passed: Contact Us link text color matched as expected'); } else { @@ -1135,32 +1135,28 @@ const steps = [ if (elementText === 'Sign Up') { console.log('Passed: Sign Up title text matched as expected'); } else { - const message = `Expected: "Sign Up"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: "Sign Up"; Actual: "${elementText}"`); } //font-family if (elementFont === "Poppins, sans-serif") { console.log('Passed: Sign Up title text font matched as expected'); } else { - const message = `Expected: Sign Up title text font "Poppins, sans-serif"; Actual: ${elementFont}`; - errors.push(message); + errors.push(`Expected: Sign Up title text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Sign Up title color matched as expected'); } else { - const message = `Expected: Sign Up title color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Sign Up title color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); } //font size if (elementSize === '24px') { console.log('Passed: Sign Up title text font-size matched as expected'); } else { - const message = `Expected: Sign Up title text font-size "24px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Sign Up title text font-size "24px"; Actual: "${elementSize}"`); } //Throw summary if any validation failed @@ -1196,32 +1192,28 @@ const steps = [ if (elementText === 'Already Have an account? Sign In') { console.log('Passed: Already Have an account? Sign In text matched as expected'); } else { - const message = `Expected: "Already Have an account? Sign In"; Actual: "${elementText}"`; - errors.push(message); + errors.push(`Expected: "Already Have an account? Sign In"; Actual: "${elementText}"`); } //font-family if (elementFont === "Poppins, sans-serif") { console.log('Passed: Already Have an account? Sign In text font matched as expected'); } else { - const message = `Expected: Already Have an account? Sign In text font "Poppins, sans-serif"; Actual: ${elementFont}`; - errors.push(message); + errors.push(`Expected: Already Have an account? Sign In text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -black + //color if (elementColor === 'rgba(32, 32, 32, 1)') { console.log('Passed: Already Have an account? Sign In color matched as expected'); } else { - const message = `Expected: Already Have an account? Sign In color "rgba(32, 32, 32, 1)"; Actual: "${elementColor}"`; - errors.push(message); + errors.push(`Expected: Already Have an account? Sign In color "rgba(32, 32, 32, 1)"; Actual: "${elementColor}"`); } //font size if (elementSize === '12px') { console.log('Passed: Already Have an account? Sign In text font-size matched as expected'); } else { - const message = `Expected: Already Have an account? Sign In text font-size "12px"; Actual: "${elementSize}"`; - errors.push(message); + errors.push(`Expected: Already Have an account? Sign In text font-size "12px"; Actual: "${elementSize}"`); } //Throw summary if any validation failed @@ -1275,7 +1267,7 @@ const steps = [ errors.push(`Expected: Sign In link text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color - teal + //color if (elementColor === 'rgba(48, 200, 172, 1)') { console.log('Passed: Sign In link text color matched as expected'); } else { @@ -1340,7 +1332,7 @@ const steps = [ errors.push(`Expected: First name label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgb(108, 117, 125)') { console.log('Passed: First name label text color matched as expected'); } else { @@ -1420,7 +1412,7 @@ const steps = [ errors.push(`Expected: Last name label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgb(108, 117, 125)') { console.log('Passed: Last name label text color matched as expected'); } else { @@ -1500,7 +1492,7 @@ const steps = [ errors.push(`Expected: Username label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgb(108, 117, 125)') { console.log('Passed: Username label text color matched as expected'); } else { @@ -1591,7 +1583,7 @@ const steps = [ errors.push(`Expected: Password label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgb(108, 117, 125)') { console.log('Passed: Password label text color matched as expected'); } else { @@ -1671,7 +1663,7 @@ const steps = [ errors.push(`Expected: Password Requirements: text font "DM Serif Display", serif; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Password Requirements: text color matched as expected'); } else { @@ -1728,7 +1720,7 @@ const steps = [ errors.push(`Expected: Must be at least 8 characters. text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Must be at least 8 characters. text color matched as expected'); } else { @@ -1794,7 +1786,7 @@ const steps = [ errors.push(`Expected: Contain at least one of each: text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Contain at least one of each: text color matched as expected'); } else { @@ -1851,7 +1843,7 @@ const steps = [ errors.push(`Expected: Uppercase letter text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Uppercase letter text color matched as expected'); } else { @@ -1908,7 +1900,7 @@ const steps = [ errors.push(`Expected: Lowercase letter text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Lowercase letter text color matched as expected'); } else { @@ -1965,7 +1957,7 @@ const steps = [ errors.push(`Expected: Number text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Number text color matched as expected'); } else { @@ -2022,7 +2014,7 @@ const steps = [ errors.push(`Expected: Special character (e.g. - ! @ # $ etc.) text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Special character (e.g. - ! @ # $ etc.) text color matched as expected'); } else { @@ -2090,7 +2082,7 @@ const steps = [ errors.push(`Expected: Email address label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgb(108, 117, 125)') { console.log('Passed: Email address label text color matched as expected'); } else { @@ -2177,7 +2169,7 @@ const steps = [ errors.push(`Expected: Organization label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgb(108, 117, 125)') { console.log('Passed: Organization label text color matched as expected'); } else { @@ -2257,7 +2249,7 @@ const steps = [ errors.push(`Expected: Position label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgb(108, 117, 125)') { console.log('Passed: Position label text color matched as expected'); } else { @@ -2325,7 +2317,7 @@ const steps = [ errors.push(`Expected: Phone number label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgb(108, 117, 125)') { console.log('Passed: Phone number label text color matched as expected'); } else { @@ -2390,7 +2382,7 @@ const steps = [ errors.push(`Expected: I agree to the terms of service text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: I agree to the terms of service text color matched as expected'); } else { @@ -2477,7 +2469,7 @@ const steps = [ errors.push(`Expected: terms of service link text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -teal + //color if (elementColor === 'rgba(48, 200, 172, 1)') { console.log('Passed: terms of service link text color matched as expected'); } else { @@ -2534,7 +2526,7 @@ const steps = [ errors.push(`Expected: Start Your Free Trial button text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Start Your Free Trial button background color matched as expected'); } else { @@ -2566,6 +2558,10 @@ const steps = [ description: 'Verify edgate logo is present', action: async () => { const expectedExactLogo = await driver.wait(until.elementLocated(By.css('.signuplogo > img')), 5000).catch(() => false); + + //Track all errors + const errors = []; + if (expectedExactLogo) { console.log('Passed: edgate logo present'); } else { @@ -2604,7 +2600,7 @@ const steps = [ errors.push(`Expected: © Copyright 2026 EdGate Correlation Services text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: © Copyright 2026 EdGate Correlation Services text color matched as expected'); } else { @@ -2631,7 +2627,7 @@ const steps = [ } }, - //NEXT ACTION - Click Sign In link + //NEXT ACTION { description: 'Click Sign In link', action: async () => { @@ -2665,7 +2661,7 @@ const steps = [ description: 'Validate bullet point 1', action: async () => { const multipleChecks = 'Bullet point 1'; - const elementicon = await driver.wait(until.elementLocated(By.css('li:nth-child(1) img')), 5000).catch(() => false); + const elementIcon = await driver.wait(until.elementLocated(By.css('li:nth-child(1) img')), 5000).catch(() => false); const element = await driver.findElement(By.css('li:nth-child(1) > .list-flex')); //Get icon, text, color, and size @@ -2678,7 +2674,7 @@ const steps = [ const errors = []; //icon - if (elementicon) { + if (elementIcon) { console.log('Passed: Bullet Point Icon 1 present'); } else { errors.push("Bullet Point Icon 1 not found"); @@ -2698,7 +2694,7 @@ const steps = [ errors.push(`Expected: Bullet point 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -white + //color if (elementColor === 'rgba(255, 255, 255, 1)') { console.log('Passed: Bullet point 1 text color matched as expected'); } else { @@ -2763,7 +2759,7 @@ const steps = [ errors.push(`Expected: ExACT AutoAlign, link text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -teal + //color if (elementColor === 'rgba(48, 200, 172, 1)') { console.log('Passed: ExACT AutoAlign, link text color matched as expected'); } else { @@ -2795,7 +2791,7 @@ const steps = [ description: 'Validate bullet point 2', action: async () => { const multipleChecks = 'Bullet point 2'; - const elementicon = await driver.wait(until.elementLocated(By.css('li:nth-child(2) img')), 5000).catch(() => false); + const elementIcon = await driver.wait(until.elementLocated(By.css('li:nth-child(2) img')), 5000).catch(() => false); const element = await driver.findElement(By.css('li:nth-child(2) > .list-flex')); //Get icon, text, color, and size @@ -2808,7 +2804,7 @@ const steps = [ const errors = []; //icon - if (elementicon) { + if (elementIcon) { console.log('Passed: Bullet Point Icon 2 present'); } else { errors.push("Bullet Point Icon 2 not found"); @@ -2828,7 +2824,7 @@ const steps = [ errors.push(`Expected: Bullet point 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -white + //color if (elementColor === 'rgba(255, 255, 255, 1)') { console.log('Passed: Bullet point 2 text color matched as expected'); } else { @@ -2893,7 +2889,7 @@ const steps = [ errors.push(`Expected: Correlation Analytics. link text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -teal + //color if (elementColor === 'rgba(48, 200, 172, 1)') { console.log('Passed: Correlation Analytics. link text color matched as expected'); } else { @@ -2925,7 +2921,7 @@ const steps = [ description: 'Validate bullet point 3', action: async () => { const multipleChecks = 'Bullet point 3'; - const elementicon = await driver.wait(until.elementLocated(By.css('li:nth-child(3) img')), 5000).catch(() => false); + const elementIcon = await driver.wait(until.elementLocated(By.css('li:nth-child(3) img')), 5000).catch(() => false); const element = await driver.findElement(By.css('li:nth-child(3) > .list-flex')); //Get icon, text, color, and size @@ -2938,7 +2934,7 @@ const steps = [ const errors = []; //icon - if (elementicon) { + if (elementIcon) { console.log('Passed: Bullet Point Icon 3 present'); } else { errors.push("Bullet Point Icon 3 not found"); @@ -2958,7 +2954,7 @@ const steps = [ errors.push(`Expected: Bullet point 3 text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -white + //color if (elementColor === 'rgba(255, 255, 255, 1)') { console.log('Passed: Bullet point 3 text color matched as expected'); } else { @@ -3023,7 +3019,7 @@ const steps = [ errors.push(`Expected: International Standards. link text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -teal + //color if (elementColor === 'rgba(48, 200, 172, 1)') { console.log('Passed: International Standards. link text color matched as expected'); } else { @@ -3051,11 +3047,16 @@ const steps = [ }, //RIGHT PANEL + //ExACT logo { description: 'Verify ExACT logo is present', action: async () => { const expectedExactLogo = await driver.wait(until.elementLocated(By.css('.logo')), 5000).catch(() => false); + + //Track all errors + const errors = []; + if (expectedExactLogo) { console.log('Passed: ExACT logo present'); } else { @@ -3070,7 +3071,7 @@ const steps = [ action: async () => { const multipleChecks = 'Welcome Back!'; const element = await driver.findElement(By.css('#formLogin > p')); - const elementicon = await driver.wait(until.elementLocated(By.css('p > img')), 5000).catch(() => false); + const elementIcon = await driver.wait(until.elementLocated(By.css('p > img')), 5000).catch(() => false); //Get icon, text, color, and size const elementText = await element.getText(); @@ -3095,7 +3096,7 @@ const steps = [ errors.push(`Expected: Welcome Back text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgba(117, 117, 117, 1)') { console.log('Passed: Welcome Back text color matched as expected'); } else { @@ -3110,7 +3111,7 @@ const steps = [ } //icon - if (elementicon) { + if (elementIcon) { console.log('Passed: Welcome Back Icon present'); } else { errors.push("Welcome Back Icon not found"); @@ -3159,7 +3160,7 @@ const steps = [ errors.push(`Expected: Login header text font "DM Serif Display", serif; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Login header text color matched as expected'); } else { @@ -3216,7 +3217,7 @@ const steps = [ errors.push(`Expected: Username label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Username label text color matched as expected'); } else { @@ -3284,7 +3285,7 @@ const steps = [ errors.push(`Expected: Username placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgb(108, 117, 125)') { console.log('Passed: Username placeholder text color matched as expected'); } else { @@ -3356,7 +3357,7 @@ const steps = [ errors.push(`Expected: Password label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Password label text color matched as expected'); } else { @@ -3424,7 +3425,7 @@ const steps = [ errors.push(`Expected: Password placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgb(108, 117, 125)') { console.log('Passed: Password placeholder text color matched as expected'); } else { @@ -3519,7 +3520,7 @@ const steps = [ errors.push(`Expected: Alert text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -red/orange + //color if (elementColor === 'rgba(231, 76, 60, 0.88)') { console.log('Passed: Alert text color matched as expected'); } else { @@ -3584,7 +3585,7 @@ const steps = [ errors.push(`Expected: Forgot password link text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Forgot password link text color matched as expected'); } else { @@ -3641,7 +3642,7 @@ const steps = [ errors.push(`Expected: Login buttonk text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -teal + //color if (elementColor === 'rgba(48, 200, 172, 1)') { console.log('Passed: Login button text background color matched as expected'); } else { @@ -3698,7 +3699,7 @@ const steps = [ errors.push(`Expected: Dont have an account text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -black + //color if (elementColor === 'rgba(32, 32, 32, 1)') { console.log('Passed: Dont have an account text color matched as expected'); } else { @@ -3763,7 +3764,7 @@ const steps = [ errors.push(`Expected: Free trial button text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -white + //color if (elementColor === 'rgba(255, 255, 255, 1)') { console.log('Passed: Free trial button background color matched as expected'); } else { @@ -3795,6 +3796,10 @@ const steps = [ description: 'Verify EdGate copyright logo is present', action: async () => { const expectedEdGateCopyright = await driver.wait(until.elementLocated(By.css('.logincopyright > img')), 5000).catch(() => false); + + //Track all errors + const errors = []; + if (expectedEdGateCopyright) { console.log('Passed: EdGate copyright logo present'); } else { @@ -3803,7 +3808,7 @@ const steps = [ } }, - //NEXT ACTION - Click Forgot password link + //NEXT ACTION { description: 'Click Forgot password link', action: async () => { @@ -3825,7 +3830,7 @@ const steps = [ } }, - //Recover Username textbox + //Recover Username textbox (SPECIAL CASE: Placeholder validation with trigger) { description: 'Validate Recover Username textbox', action: async () => { @@ -3866,7 +3871,7 @@ const steps = [ errors.push(`Expected: Username placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgb(108, 117, 125)') { console.log('Passed: Username placeholder text color matched as expected'); } else { @@ -3938,7 +3943,7 @@ const steps = [ errors.push(`Expected: Submit buttonk text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -teal + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Submit button text background color matched as expected'); } else { @@ -4003,7 +4008,7 @@ const steps = [ errors.push(`Expected: < Back to Login link text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: < Back to Login link text color matched as expected'); } else { @@ -4030,7 +4035,7 @@ const steps = [ } }, - //NEXT ACTION - Click Back to Login link + //NEXT ACTION { description: 'Click Back to Login link', action: async () => { @@ -4053,11 +4058,16 @@ const steps = [ }, //RIGHT PANEL + //ExACT logo { description: 'Verify ExACT logo is present', action: async () => { const expectedExactLogo = await driver.wait(until.elementLocated(By.css('.logo')), 5000).catch(() => false); + + //Track all errors + const errors = []; + if (expectedExactLogo) { console.log('Passed: ExACT logo present'); } else { @@ -4072,7 +4082,7 @@ const steps = [ action: async () => { const multipleChecks = 'Welcome Back!'; const element = await driver.findElement(By.css('#formLogin > p')); - const elementicon = await driver.wait(until.elementLocated(By.css('p > img')), 5000).catch(() => false); + const elementIcon = await driver.wait(until.elementLocated(By.css('p > img')), 5000).catch(() => false); //Get icon, text, color, and size const elementText = await element.getText(); @@ -4097,7 +4107,7 @@ const steps = [ errors.push(`Expected: Welcome Back text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgba(117, 117, 117, 1)') { console.log('Passed: Welcome Back text color matched as expected'); } else { @@ -4112,7 +4122,7 @@ const steps = [ } //icon - if (elementicon) { + if (elementIcon) { console.log('Passed: Welcome Back Icon present'); } else { errors.push("Welcome Back Icon not found"); @@ -4161,7 +4171,7 @@ const steps = [ errors.push(`Expected: Login header text font "DM Serif Display", serif; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Login header text color matched as expected'); } else { @@ -4218,7 +4228,7 @@ const steps = [ errors.push(`Expected: Username label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Username label text color matched as expected'); } else { @@ -4286,7 +4296,7 @@ const steps = [ errors.push(`Expected: Username label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgb(108, 117, 125)') { console.log('Passed: Username label text color matched as expected'); } else { @@ -4343,7 +4353,7 @@ const steps = [ errors.push(`Expected: Password label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Password label text color matched as expected'); } else { @@ -4411,7 +4421,7 @@ const steps = [ errors.push(`Expected: Password label text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -gray + //color if (elementColor === 'rgb(108, 117, 125)') { console.log('Passed: Password label text color matched as expected'); } else { @@ -4476,7 +4486,7 @@ const steps = [ errors.push(`Expected: Forgot password link text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -navy blue + //color if (elementColor === 'rgba(40, 39, 90, 1)') { console.log('Passed: Forgot password link text color matched as expected'); } else { @@ -4533,7 +4543,7 @@ const steps = [ errors.push(`Expected: Login buttonk text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -teal + //color if (elementColor === 'rgba(48, 200, 172, 1)') { console.log('Passed: Login button text background color matched as expected'); } else { @@ -4590,7 +4600,7 @@ const steps = [ errors.push(`Expected: Dont have an account text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -black + //color if (elementColor === 'rgba(32, 32, 32, 1)') { console.log('Passed: Dont have an account text color matched as expected'); } else { @@ -4655,7 +4665,7 @@ const steps = [ errors.push(`Expected: Free trial button text font "Poppins, sans-serif"; Actual: ${elementFont}`); } - //color -white + //color if (elementColor === 'rgba(255, 255, 255, 1)') { console.log('Passed: Free trial button background color matched as expected'); } else { @@ -4687,6 +4697,10 @@ const steps = [ description: 'Verify EdGate copyright logo is present', action: async () => { const expectedEdGateCopyright = await driver.wait(until.elementLocated(By.css('.logincopyright > img')), 5000).catch(() => false); + + //Track all errors + const errors = []; + if (expectedEdGateCopyright) { console.log('Passed: EdGate copyright logo present'); } else { @@ -4695,7 +4709,7 @@ const steps = [ } }, - //Login and Log out + //NEXT ACTION { description: 'Login and Log Out', action: async () => { @@ -4713,11 +4727,6 @@ const steps = [ await driver.findElement(By.css('.login')).click(); console.log('----->| NEXT ACTION: Clicked Login button'); - //Wait for page to load completely - 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'); console.log('------------->| ExACT Dashboard |<-------------'); //Wait until the element exists in the DOM @@ -4742,12 +4751,18 @@ const steps = [ errors.push(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`); } - //Wait for page to load completely + //Wait for the slowest resource to complete 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'); - console.log('Passed: ExACT Dashboard loaded successfully'); + 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'); await driver.findElement(By.css('#navbarDropdown > span')).click(); await driver.findElement(By.linkText('Log Out')).click(); @@ -4832,26 +4847,24 @@ try { 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 + try { await step.action(); - - //Log a successful step with no screenshot worksheet = logStep( worksheet, step.description, 'Passed', stepIndex, timestamp, - null //No screenshot for passed steps + null ); } catch (error) { - //Only take screenshot if the step fails const screenshotPath = await takeScreenshot( driver, stepIndex, @@ -4868,17 +4881,21 @@ try { ); console.error(`Step ${stepIndex} FAILED: ${error.message}`); + failedSteps.push(`Step ${stepIndex}: ${step.description} - ${error.message}`); //Track failed step testStatus = 'Failed'; allStepsPassed = false; } } - //Script completed if (allStepsPassed) { - console.log('PASSED: ExACT Login Page(ExACT_landingPage); All test steps completed successfully'); + console.log('------------->| THE END |<-------------'); + console.log('PASSED: EDGATE LANDING PAGE - ExACT Landing Page (ExACT_landingPage); All test steps completed successfully'); testStatus = 'Passed'; } else { - console.log('FAILED: ExACT Login Page(ExACT_landingPage); One or more test steps failed'); + console.log('------------->| THE END |<-------------'); + console.log('FAILED: EDGATE LANDING PAGE - ExACT Landing Page (ExACT_landingPage); One or more test steps failed'); + console.log('FAILED STEPS:'); + failedSteps.forEach(step => console.error(` ✗ ${step}`)); testStatus = 'Failed'; } @@ -4892,7 +4909,7 @@ try { } finally { await driver.quit(); } -})(); + })(); } export default ExACT_landingPage; diff --git a/tests/dashboardMyStandards.js b/tests/dashboardMyStandards.js new file mode 100644 index 0000000..300268f --- /dev/null +++ b/tests/dashboardMyStandards.js @@ -0,0 +1,8022 @@ +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'; +import { brotliCompress } from 'zlib'; +import { myStandardsSearch_AlignedContent } from './myStandardsSearchAlignedContent.js'; + +const dashboardMyStandards = (req, res) => { + res.send('

    ExACT Automated Test Script: DASHBOARD - My Standards Widget (dashboardMyStandards) | 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(); + +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('------------->| MY STANDARDS WIDGET |<-------------'); + 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 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')); + } + } + }, + + //MY STANDARDS WIDGET + //Dashboard - My Standards Widget title (active) + { + description: 'Validate Dashboard Semantic Standards Comparison Widget title text, color, and size', + action: async () => { + const multipleChecks = 'My Standards Widget title (active)'; + const element = await driver.findElement(By.css('#mystd-tab')); + + //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 === 'My Standards') { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title matched as expected'); + } else { + errors.push(`Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`); + } + + //font + if (elementFont === `Poppins, sans-serif`) { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget 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')); + } + } + }, + + //Dashboard - Other Available Stndards tab title + { + description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size', + action: async () => { + const multipleChecks = 'Other Available Stndards tab title'; + const element = await driver.findElement(By.css('#availstd-tab')); + + //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 === 'Other Available Standards') { + console.log('Passed: Dashboard - Other Available Standards tab title matched as expected'); + } else { + errors.push(`Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`); + } + + //font + if (elementFont === `Poppins, sans-serif`) { + console.log('Passed: Dashboard - Other Available Standards tab title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab title text color "rgba(182, 186, 181, 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')); + } + } + }, + + //Dashboard - My Standards dropdown + { + description: 'Validate Dashboard - My Standards dropdown list and value', + action: async () => { + const multipleChecks = 'My Standards dropdown list'; + const elementDropdown = await driver.findElement(By.css('#stdparent')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); + + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'United States Standards') { + console.log('Passed: Dashboard - My Standards dropdown text matched as expected'); + } else { + throw new Error(`Expected: Dashboard - My Standards: "United States Standards"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards dropdown font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Dashboard - My Standards dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards dropdown font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - My Standards dropdown color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const expected = [ + 'ACTFL', + 'Australia', + 'California', + 'Canada', + 'Common Core Standards', + 'Creating Org', + 'Demo Client Standards', + 'Demo Standards', + 'New Folder', + 'QA Client Test Frameworks', + 'United States Standards', + 'WIDA' + ]; + + 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: Dashboard - My Standards Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Dashboard - My Standards Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //Dashboard - My Standards Organization column title + { + description: 'Validate Dashboard - My Standards Organization column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards Organization column title' + const element = await driver.findElement(By.css('.table:nth-child(2) th:nth-child(1)')); + + //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 === 'Organization') { + console.log('Passed: Dashboard - My Standards Organization column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "Organization" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Organization column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Organization column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards Organization column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Organization column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards Organization column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Organization column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards Export column title + { + description: 'Validate Dashboard - My Standards Export column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards Export column title'; + const element = await driver.findElement(By.css('.table:nth-child(2) > thead .text-center: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Export') { + console.log('Passed: Dashboard - My Standards Export column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "Export" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Export column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Export column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards Export column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Export column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards Export column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Export column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards Manage column title + { + description: 'Validate Dashboard - My Standards Manage column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards Manage column title'; + const element = await driver.findElement(By.css('.text-center: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Manage') { + console.log('Passed: Dashboard - My Standards Manage column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "Manage" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Manage column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Manage column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards Manage column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Manage column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards Manage column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Manage column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards More Info column title + { + description: 'Validate Dashboard - My Standards More Info column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards More Info column title'; + const element = await driver.findElement(By.css('.table-sm > thead .text-center: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'More Info') { + console.log('Passed: Dashboard - My Standards More Info column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "More Info" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards More Info column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards More Info column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards More Info column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards More Info column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards More Info column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards More Info column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards View column title + { + description: 'Validate Dashboard - My Standards View column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards View column title'; + const element = await driver.findElement(By.css('thead .text-center: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'View') { + console.log('Passed: Dashboard - My Standards View column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "View" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards View column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards View column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards View column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards View column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards View column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards View column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards = Alabama + { + description: 'Validate Dashboard - My Standards Organization = Alabama Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Alabama'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Alabama') { + console.log("Passed: Dashboard - My Standards Alabama text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Alabama"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Alabama text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Alabama text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Alabama text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Alabama text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Alabama text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Alabama text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Alabama - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Alabama - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Alabama icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards Alabama: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Alabama - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Alabama - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = Arizona + { + description: 'Validate Dashboard - My Standards Organization = Arizona Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Arizona'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(2) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Arizona') { + console.log("Passed: Dashboard - My Standards Arizona text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Arizona"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Arizona text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Arizona text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Arizona text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Arizona text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Arizona text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Arizona text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Arizona - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Arizona - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Arizona icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards Arizona: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Arizona - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Arizona - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = California + { + description: 'Validate Dashboard - My Standards Organization = California Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - California'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(3) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'California') { + console.log("Passed: Dashboard - My Standards California text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "California"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards California text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards California text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards California text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards California text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards California text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards California text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards California - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards California - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards California icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards California: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards California - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards California - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = Florida + { + description: 'Validate Dashboard - My Standards Organization = Florida Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Florida'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(4) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Florida') { + console.log("Passed: Dashboard - My Standards Florida text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Florida"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Florida text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Florida text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Florida text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Florida text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Florida text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Florida text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Florida - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Florida - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Florida icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards Florida: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Florida - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Florida - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = Georgia + { + description: 'Validate Dashboard - My Standards Organization = Georgia Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Georgia'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(5) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Georgia') { + console.log("Passed: Dashboard - My Standards Georgia text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Georgia"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Georgia text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Georgia text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Georgia text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Georgia text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Georgia text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Georgia text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Georgia - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Georgia - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Georgia icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards Georgia: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Georgia - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Georgia - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = Illinois + { + description: 'Validate Dashboard - My Standards Organization = Illinois Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Illinois'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(6) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Illinois') { + console.log("Passed: Dashboard - My Standards Illinois text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Illinois"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Illinois text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Illinois text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Illinois text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Illinois text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Illinois text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Illinois text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Illinois - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Illinois - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Illinois icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards Illinois: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Illinois - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Illinois - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = New York + { + description: 'Validate Dashboard - My Standards Organization = New York Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - New York'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(7) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'New York') { + console.log("Passed: Dashboard - My Standards New York text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "New York"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards New York text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards New York text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards New York text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards New York text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards New York text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards New York text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards New York - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards New York - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards New York icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards New York: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards New York - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards New York - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = Texas + { + description: 'Validate Dashboard - My Standards Organization = Texas Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Texas'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(8) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Texas') { + console.log("Passed: Dashboard - My Standards Texas text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Texas"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Texas text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Texas text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Texas text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Texas text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Texas text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Texas text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Texas - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Texas - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Texas icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards Texas: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Texas - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Texas - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = Washington + { + description: 'Validate Dashboard - My Standards Organization = Washington Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Washington'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(9) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Washington') { + console.log("Passed: Dashboard - My Standards Washington text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Washington"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Washington text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Washington text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Washington text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Washington text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Washington text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Washington text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Washington - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Washington - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Washington icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards Washington: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Washington - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Washington - View icon not found'); + } + + //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: 'Dashboard - Click Other Available Standards tab', + action: async () => { + await driver.findElement(By.css('#availstd-tab')).click(); + console.log('----->| NEXT ACTION: Clicked Other Available Standards tab'); + + //Wait until the element exists in the DOM + const instructionText = await driver.wait( + until.elementLocated(By.css('p:nth-child(1)')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(instructionText), + 30000 + ); + } + }, + + //Dashboard - My Standards Widget title + { + description: 'Validate Dashboard Semantic Standards Comparison Widget title text, color, and size', + action: async () => { + const multipleChecks = 'Dashboard Semantic Standards Comparison Widget title'; + const element = await driver.findElement(By.css('#mystd-tab')); + + //Get text, font, color, and size + 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 === 'My Standards') { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title matched as expected'); + } else { + errors.push(`Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title text color "rgba(182, 186, 181, 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')); + } + } + }, + + //Dashboard - Other Available Stndards tab title (active) + { + description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size', + action: async () => { + const multipleChecks = 'Other Available Stndards tab title'; + const element = await driver.findElement(By.css('#availstd-tab')); + + //Get text, font, color, and size + 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 === 'Other Available Standards') { + console.log('Passed: Dashboard - Other Available Standards tab title matched as expected'); + } else { + errors.push(`Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards tab title text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab 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')); + } + } + }, + + //Dashboard - Other Available Stndards tab title + { + description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size', + action: async () => { + const multipleChecks = 'Other Available Stndards tab title'; + const element = await driver.findElement(By.css('p:nth-child(1)')); + + //Get text, font, color, and size + 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 === 'The following standards are also available to clients. If you would like access to any of these standards sets, please Contact Us.') { + console.log('Passed: Dashboard - Other Available Standards description text matched as expected'); + } else { + errors.push(`Expected: Dashboard - "The following standards are also available to clients. If you would like access to any of these standards sets, please Contact Us."; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards description text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards description text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab title text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab 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')); + } + } + }, + + //Dashboard - Other Available Standards dropdown + { + description: 'Validate Dashboard - Other Available Standards dropdown list and value', + action: async () => { + const multipleChecks = 'Other Available Standards'; + const elementDropdown = await driver.findElement(By.css('#defstdparent')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); + + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'United States Standards') { + console.log('Passed: Dashboard - Other Available Standards dropdown value matched as expected'); + } else { + throw new Error(`Expected: Dashboard - Other Available Standards dropdown value - "United States Standards"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards dropdown value font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards dropdown value font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Dashboard - Other Available Standards dropdown value font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards dropdown value font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - Other Available Standards dropdown value color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards dropdown value color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const expected = [ + 'ACT', + 'ACTFL', + 'AQA', + 'Australia', + 'Brazil', + 'Cambridge IGCSE', + 'Cambridge International AS & A Level', + 'Cambridge Secondary', + 'Canada', + 'Common Core Standards', + 'Edexcel', + 'England', + 'Finland', + 'India', + 'India NCERT (Archived)', + 'International Standards', + 'Ireland (Archived)', + 'Mexico', + 'National Standards', + 'New Zealand', + 'OCR', + 'Puerto Rico 2014', + 'Saudi Arabia', + 'Supplemental Standards', + 'Taiwan (Additional)', + 'Thailand (Additional)', + 'United Arab Emirates', + 'United States Standards' + ]; + + 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: Dashboard - Other Available Standards dropdown list matched as expected'); + } else { + throw new Error(`Expected: Dashboard - Other Available Standards dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //Dashboard - Other Available Standards Organization column title + { + description: 'Validate Dashboard - Other Available Standards Organization column title, text, and font size', + action: async () => { + const multiple = 'Other Available Standards Organization column title'; + const element = await driver.findElement(By.css('.table:nth-child(3) th:nth-child(1)')); + + //Get text, font, color, and size + 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 === 'Organization') { + console.log('Passed: Dashboard - Other Available Standards Organization column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards "Organization" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards Organization column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Organization column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - Other Available Standards Organization column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Organization column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - Other Available Standards Organization column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Organization column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - Other Available Organization column title + { + description: 'Validate Dashboard - Other Available Standards More Info column title, text, and font size', + action: async () => { + const multipleChecks = 'Other Available Organization column title'; + const element = await driver.findElement(By.css('.table:nth-child(3) > thead .text-center')); + + //Get text, font, color, and size + 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 === 'More Info') { + console.log('Passed: Dashboard - Other Available Standards More Info column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards "More Info" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards More Info column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards More Info column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - Other Available Standards More Info column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards More Info column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - Other Available Standards More Info column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards More Info column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - Other Available Standards - Alaska + { + description: 'Validate Dashboard - Other Available Standards - Alaska', + action: async () => { + const multipleChecks = 'Other Available Standards - Alaska'; + const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(1) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(1) > td.text-center > a')).getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Alaska') { + console.log('Passed: Dashboard - Other Available Standards Alaska column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards "Alaska" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards Alaska column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Alaska column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - Other Available Standards Alaska column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Alaska column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - Other Available Standards Alaska column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Alaska column title text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - Other Available Standards Alaska icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Alaska: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //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')); + } + } + }, + + //Dashboard - Other Available Standards - Arkansas + { + description: 'Validate Dashboard - Other Available Standards - Arkansas', + action: async () => { + const multipleChecks = 'Other Available Standards - Arkansas'; + const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(2) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(2) > td.text-center > a')).getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Arkansas') { + console.log('Passed: Dashboard - Other Available Standards Arkansas column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards "Arkansas" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards Arkansas column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Arkansas column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - Other Available Standards Arkansas column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Arkansas column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - Other Available Standards Arkansas column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Arkansas column title text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - Other Available Standards Arkansas icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Arkansas: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //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')); + } + } + }, + + //Dashboard - Other Available Standards - Colorado + { + description: 'Validate Dashboard - Other Available Standards - Colorado', + action: async () => { + const multipleChecks = 'Other Available Standards - Colorado'; + const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(3) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(3) > td.text-center > a')).getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Colorado') { + console.log('Passed: Dashboard - Other Available Standards Colorado column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards "Colorado" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards Colorado column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Colorado column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - Other Available Standards Colorado column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Colorado column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - Other Available Standards Colorado column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Colorado column title text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - Other Available Standards Colorado icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Colorado: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //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')); + } + } + }, + + //Dashboard - Other Available Standards - Connecticut + { + description: 'Validate Dashboard - Other Available Standards - Connecticut', + action: async () => { + const multipleChecks = 'Other Available Standards - Connecticut'; + const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(4) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(4) > td.text-center > a')).getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Connecticut') { + console.log('Passed: Dashboard - Other Available Standards Connecticut column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards "Connecticut" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards Connecticut column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Connecticut column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - Other Available Standards Connecticut column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Connecticut column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - Other Available Standards Connecticut column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Connecticut column title text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - Other Available Standards Connecticut icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Connecticut: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //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')); + } + } + }, + + //Dashboard - Other Available Standards - Delaware + { + description: 'Validate Dashboard - Other Available Standards - Delaware', + action: async () => { + const multipleChecks = 'Other Available Standards - Delaware'; + const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(5) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(5) > td.text-center > a')).getAttribute('title'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Delaware') { + console.log('Passed: Dashboard - Other Available Standards Delaware column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards "Delaware" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards Delaware column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Delaware column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - Other Available Standards Delaware column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Delaware column title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - Other Available Standards Delaware icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Delaware: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - Other Available Standards Delaware column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards Delaware column title text color "rgba(33, 37, 41, 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: 'Dashboard - Click My Standards tab', + action: async () => { + await driver.findElement(By.css('#mystd-tab')).click(); + console.log('----->| NEXT ACTION: Clicked My Standards tab'); + + //Wait until the element exists in the DOM + const myStandardsDropdown = await driver.wait( + until.elementLocated(By.css('#stdparent')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(myStandardsDropdown), + 30000 + ); + } + }, + + //Dashboard - My Standards Widget title (active) + { + description: 'Validate Dashboard Semantic Standards Comparison Widget title text, color, and size', + action: async () => { + const multipleChecks = 'My Standards Widget title (active)'; + const element = await driver.findElement(By.css('#mystd-tab')); + + //Get text, font, color, and size + 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 === 'My Standards') { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title matched as expected'); + } else { + errors.push(`Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget 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')); + } + } + }, + + //Dashboard - Other Available Stndards tab title + { + description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size', + action: async () => { + const multipleChecks = 'Other Available Stndards tab title'; + const element = await driver.findElement(By.css('#availstd-tab')); + + //Get text, font, color, and size + 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 === 'Other Available Standards') { + console.log('Passed: Dashboard - Other Available Standards tab title matched as expected'); + } else { + errors.push(`Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - Other Available Standards tab title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - Other Available Standards tab title text color "rgba(182, 186, 181, 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')); + } + } + }, + + //Dashboard - My Standards dropdown + { + description: 'Validate Dashboard - My Standards dropdown list and value', + action: async () => { + const multipleChecks = 'My Standards dropdown list'; + const elementDropdown = await driver.findElement(By.css('#stdparent')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); + + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'United States Standards') { + console.log('Passed: Dashboard - My Standards dropdown text matched as expected'); + } else { + throw new Error(`Expected: Dashboard - My Standards: "United States Standards"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards dropdown font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Dashboard - My Standards dropdown font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards dropdown font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Dashboard - My Standards dropdown color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const expected = [ + 'ACTFL', + 'Australia', + 'California', + 'Canada', + 'Common Core Standards', + 'Creating Org', + 'Demo Client Standards', + 'Demo Standards', + 'New Folder', + 'QA Client Test Frameworks', + 'United States Standards', + 'WIDA' + ]; + + 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: Dashboard - My Standards Dropdown list matched as expected'); + } else { + throw new Error(`Expected: Dashboard - My Standards Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //Dashboard - My Standards Organization column title + { + description: 'Validate Dashboard - My Standards Organization column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards Organization column title' + const element = await driver.findElement(By.css('.table:nth-child(2) th:nth-child(1)')); + + //Get text, font, color, and size + 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 === 'Organization') { + console.log('Passed: Dashboard - My Standards Organization column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "Organization" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Organization column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Organization column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards Organization column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Organization column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards Organization column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Organization column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards Export column title + { + description: 'Validate Dashboard - My Standards Export column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards Export column title'; + const element = await driver.findElement(By.css('.table:nth-child(2) > thead .text-center:nth-child(2)')); + + //Get text, font, color, and size + 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 === 'Export') { + console.log('Passed: Dashboard - My Standards Export column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "Export" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Export column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Export column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards Export column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Export column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards Export column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Export column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards Manage column title + { + description: 'Validate Dashboard - My Standards Manage column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards Manage column title'; + const element = await driver.findElement(By.css('.text-center:nth-child(3)')); + + //Get text, font, color, and size + 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 === 'Manage') { + console.log('Passed: Dashboard - My Standards Manage column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "Manage" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Manage column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Manage column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards Manage column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Manage column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards Manage column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Manage column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards More Info column title, + { + description: 'Validate Dashboard - My Standards More Info column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards More Info column title'; + const element = await driver.findElement(By.css('.table-sm > thead .text-center:nth-child(4)')); + + //Get text, font, color, and size + 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 === 'More Info') { + console.log('Passed: Dashboard - My Standards More Info column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "More Info" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards More Info column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards More Info column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards More Info column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards More Info column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards More Info column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards More Info column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards View column title + { + description: 'Validate Dashboard - My Standards View column title, text, and font size', + action: async () => { + const multipleChecks = 'My Standards View column title'; + const element = await driver.findElement(By.css('thead .text-center:nth-child(5)')); + + //Get text, font, color, and size + 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 === 'View') { + console.log('Passed: Dashboard - My Standards View column title matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards "View" column title; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards View column title font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards View column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Dashboard - My Standards View column title text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards View column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: Dashboard - My Standards View column title text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards View column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //Dashboard - My Standards = Alabama + { + description: 'Validate Dashboard - My Standards Organization = Alabama Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Alabama'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Alabama') { + console.log("Passed: Dashboard - My Standards Alabama text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Alabama"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Alabama text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Alabama text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Alabama text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Alabama text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Alabama text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Alabama text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Alabama - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Alabama - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Alabama icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards Alabama: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Alabama - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Alabama - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = Arizona + { + description: 'Validate Dashboard - My Standards Organization = Arizona Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Arizona'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(2) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Arizona') { + console.log("Passed: Dashboard - My Standards Arizona text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Arizona"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Arizona text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Arizona text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Arizona text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Arizona text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Arizona text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Arizona text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Arizona - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Arizona - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Arizona icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards Arizona: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Arizona - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Arizona - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = California + { + description: 'Validate Dashboard - My Standards Organization = California Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - California'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(3) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'California') { + console.log("Passed: Dashboard - My Standards California text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "California"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards California text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards California text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards California text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards California text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards California text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards California text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards California - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards California - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards California icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards California: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards California - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards California - View icon not found'); + } + + //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')); + } + } + }, + + //Dashboard - My Standards = Florida + { + description: 'Validate Dashboard - My Standards Organization = Florida Standards text', + action: async () => { + const multipleChecks = 'My Standards Organization - Florida'; + const element = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(1)')); + + //Get text, font, color, and size + 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 elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > .text-center:nth-child(2) img')); + const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(4) > a')).getAttribute('title'); + const elementViewIcon = await driver.findElement(By.css('tr:nth-child(4) > .text-center:nth-child(5) img')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Florida') { + console.log("Passed: Dashboard - My Standards Florida text matched as expected"); + } else { + throw new Error(`Expected: Dashboard - My Standards text: "Florida"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dashboard - My Standards Florida text font-family matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Florida text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Dashboard - My Standards Florida text font-size matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Florida text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Dashboard - My Standards Florida text color matched as expected'); + } else { + errors.push(`Expected: Dashboard - My Standards Florida text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //export icon + if (elementExportIcon) { + console.log('Passed: Dashboard - My Standards Florida - Export icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Florida - Export icon not found'); + } + + //more info icon tool-tip + if (elementMoreInfoIconTooltip === 'View Detail Information') { + console.log('Passed: Dashboard - My Standards Florida icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: ashboard - My Standards Florida: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`); + } + + //view icon + if (elementViewIcon) { + console.log('Passed: Dashboard - My Standards Florida - View icon is present'); + } else { + errors.push('Expected: Dashboard - My Standards Florida - View icon not found'); + } + + //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: 'Dashboard - Click Alabama Export icon', + action: async () => { + await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img')).click(); + console.log('----->| NEXT ACTION: Clicked Alabama Export icon'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Modal did not become visible within 20 seconds'); + + console.log('Passed: DIV - Loaded successfully'); + } + }, + + //EXPORT STANDARD DIV + //DIV - Export Standards title + { + description: 'Validate DIV - Export Standards title text, color, and size', + action: async () => { + const multipleChecks = 'DIV - Export Standards title'; + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + + //Get text, font, color, and size + 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 === 'Export Standards') { + console.log('Passed: DIV - Export Standards title matched as expected'); + } else { + errors.push(`Expected: DIV - "Export Standards"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Export Standards title text font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Export Standards title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '18px') { + console.log('Passed: DIV - Export Standards title text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Export Standards title text font-size "18px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Export Standards title text color matched as expected'); + } else { + errors.push(`Expected: DIV - Export Standards 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')); + } + } + }, + + //DIV - Alabama sub-title + { + description: 'Validate DIV - Alabama sub-title text, color, and size', + action: async () => { + const multipleChecks = 'DIV - Alabama sub-title'; + const element = await driver.findElement(By.css('p > b')); + + //Get text, font, color, and size + 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 === 'Alabama') { + console.log('Passed: DIV - Alabama sub-title matched as expected'); + } else { + errors.push(`Expected: DIV - sub-title "Alabama"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Alabama sub-title text font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama sub-title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: DIV - Alabama sub-title text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama sub-title text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Alabama sub-title text color matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama sub-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')); + } + } + }, + + //DIV - Alabama Standards Subject label + { + description: 'Validate DIV - Alabama Standards Subject label text, color, and size', + action: async () => { + const multipleChecks = 'DIV - Alabama Standards Subject label'; + const element = await driver.findElement(By.css('.form-row:nth-child(2) > .form-group:nth-child(1) > label')); + + //Get text, font, color, and size + 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 === 'Subject') { + console.log('Passed: DIV - Alabama Standards Subject label matched as expected'); + } else { + errors.push(`Expected: DIV - "Subject" label; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Alabama Standards Subject label text font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Standards Subject label text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: DIV - Alabama Standards Subject label text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Standards Subject label text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Alabama Standards Subject label text color matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Standards Subject 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')); + } + } + }, + + //DIV - Subject dropdown {custom-select} + { + description: 'Validate DIV - Subject dropdown list and value', + action: async () => { + const multipleChecks = 'DIV - Subject dropdown'; + const elementDropdown = await driver.findElement(By.css('#exsubject')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); + + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Choose a subject') { + console.log('Passed: DIV - Subject dropdown text matched as expected'); + } else { + throw new Error(`Expected: DIV - Subject: "Choose a subject"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Subject dropdown font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Subject dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: DIV - Subject dropdown font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Subject dropdown font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Subject dropdown color matched as expected'); + } else { + errors.push(`Expected: DIV - Subject dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const expectedList = [ + 'Choose a subject', + 'Health and PE', + 'Language Arts', + 'Mathematics', + 'Science', + 'Social Studies', + 'Technology Education' + ]; + + const actual = []; + + for (const opt of options) { + const text = (await opt.getText()).trim(); + actual.push(text); + } + + if (JSON.stringify(actual) === JSON.stringify(expectedList)) { + console.log('Passed: DIV - Subject Dropdown list matched as expected'); + } else { + errors.push(`Expected: DIV - Subject Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //DIV - Alabama Standards Format label + { + description: 'Validate DIV - Alabama Standards Format label text, color, and size', + action: async () => { + const multipleChecks = 'DIV - Alabama Standards Format label'; + const element = await driver.findElement(By.css('.form-row:nth-child(2) > .form-group:nth-child(2) > label')); + + //Get text, font, color, and size + 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 === 'Format') { + console.log('Passed: DIV - Alabama Standards Format label matched as expected'); + } else { + errors.push(`Expected: DIV - "Format" label; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Alabama Standards Format label font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Standards Format label font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: DIV - Alabama Standards Format label text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Standards Format label text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Alabama Standards Format label text color matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Standards Format 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')); + } + } + }, + + //DIV - Format dropdown + { + description: 'Validate DIV - Format dropdown list and value', + action: async () => { + const multipleChecks = 'DIV - Format dropdown'; + const elementDropdown = await driver.findElement(By.css('#exformat')); + const selectedOption = await elementDropdown.findElement(By.css('option:checked')); + + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'CSV') { + console.log('Passed: DIV - Format dropdown text matched as expected'); + } else { + throw new Error(`Expected: DIV - Format: "CSV"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Format dropdown font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Format dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: DIV - Format dropdown font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Format dropdown font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Format dropdown color matched as expected'); + } else { + errors.push(`Expected: DIV - Format dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const expectedList = [ + 'CSV', + 'JSON' + ]; + + const actual = []; + + for (const opt of options) { + const text = (await opt.getText()).trim(); + actual.push(text); + } + + if (JSON.stringify(actual) === JSON.stringify(expectedList)) { + console.log('Passed: DIV - Format Dropdown list matched as expected'); + } else { + errors.push(`Expected: DIV - Format Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //DIV - Grades label + { + description: 'Validate DIV - Grades label text, color, and size', + action: async () => { + const multipleChecks = 'DIV - Grades label'; + const element = await driver.findElement(By.css('.col-md-12:nth-child(1) > label')); + + //Get text, font, color, and size + 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 === 'Grades') { + console.log('Passed: DIV - Grades label matched as expected'); + } else { + errors.push(`Expected: DIV - "Grades" label; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Grades label font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Grades label font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: DIV - Grades label text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Grades label text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Grades label text color matched as expected'); + } else { + errors.push(`Expected: DIV - Grades 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')); + } + } + }, + + //DIV - Grades dropdown + { + description: 'Validate DIV - Grades dropdown list and value', + action: async () => { + const multipleChecks = 'DIV - Grades dropdown'; + const elementDropdown = await driver.findElement(By.css('#exgrades')); + + const elementText = await elementDropdown.getText(); + const elementFont = await elementDropdown.getCssValue('font-family'); + const elementSize = await elementDropdown.getCssValue('font-size'); + const elementColor = await elementDropdown.getCssValue('color'); + + const options = await elementDropdown.findElements(By.css('option')); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Please select a subject first') { + console.log('Passed: DIV - Grades dropdown text matched as expected'); + } else { + throw new Error(`Expected: DIV - Grades: "Please select a subject first"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Grades dropdown font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Grades dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: DIV - Grades dropdown font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Grades dropdown font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Grades dropdown color matched as expected'); + } else { + errors.push(`Expected: DIV - Grades dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const expectedList = [ + 'Please select a subject first' + ]; + + const actual = []; + + for (const opt of options) { + const text = (await opt.getText()).trim(); + actual.push(text); + } + + if (JSON.stringify(actual) === JSON.stringify(expectedList)) { + console.log('Passed: DIV - Grades Dropdown list matched as expected'); + } else { + errors.push(`Expected: DIV - Grades Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //DIV - Download button + { + description: 'Validate DIV - Download button icon, text, and color', + action: async () => { + const multipleChecks = 'DIV - Download button'; + const elementIcon = await driver.findElement(By.css('#exsubmit > .fa')); + const element = await driver.findElement(By.css('#exsubmit')); + + //Get text, font, color, and size + 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 elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //icon + if (elementIcon) { + console.log('Passed: DIV - Download button icon is present'); + } else { + errors.push('DIV - Download button icon was not found'); + } + + //text + if (elementText === 'Download') { + console.log('Passed: DIV - Download button text matched as expected'); + } else { + errors.push(`Expected: DIV - Button text: "Download"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Download button text font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Download button text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '16px') { + console.log('Passed: DIV - Download button text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Download button text font-size "16px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: DIV - Download button text color matched as expected'); + } else { + errors.push(`Expected: DIV - Download button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: DIV - Download button background color matched as expected'); + } else { + errors.push(`Expected: DIV - Download 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')); + } + } + }, + + //DIV - Close button + { + description: 'Validate DIV - Close button text, style, font, and color', + action: async () => { + const multipleChecks = 'DIV - Close button'; + const element = await driver.findElement(By.css('#modalclose')); + + //Get text, font, color, and size + 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 elementButtonColor = await element.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Close') { + console.log('Passed: DIV - Close button text matched as expected'); + } else { + errors.push(`Expected: DIV - Button text: "Close"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Close button text font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Close button text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '16px') { + console.log('Passed: DIV - Close button text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Close button text font-size "16px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Close button text color matched as expected'); + } else { + errors.push(`Expected: DIV - Close button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: DIV - Close button background color matched as expected'); + } else { + errors.push(`Expected: DIV - Close button background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + //NEXT ACTION + { + description: 'DIV - Click Export button', + action: async () => { + await driver.findElement(By.css('#exsubmit')).click(); + console.log('----->| NEXT ACTION: Clicked Export button'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('#metawarn > b')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Validation text not visible within 20 seconds'); + + console.log('Passed: DIV - Validation message appeared'); + } + }, + + //DIV - Validation + { + description: 'Validate DIV - Validation text, color, and size', + action: async () => { + const element = await driver.findElement(By.css('#metawarn > b')); + + //Get text, color, and size + 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 === 'A subject and at least one grade must be selected.') { + console.log('Passed: DIV - Validation text matched as expected'); + } else { + errors.push(`Expected: DIV - Validation text: "A subject and at least one grade must be selected."; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Validation text font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Validation text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: DIV - Validation text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Validation text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(220, 53, 69, 1)') { + console.log('Passed: DIV - Validation text color matched as expected'); + } else { + errors.push(`Expected: DIV - Validation text color: "rgba(220, 53, 69, 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('Multiple validation checks did not pass'); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //NEXT ACTION + { + description: 'Select subject and grade', + action: async () => { + //Select "Mathematics" from dropdown + await driver.findElement(By.css('#exsubject')).click(); + await driver.sleep(2000); + await driver.findElement(By.css('#exsubject > option:nth-child(4)')).click(); + console.log('----->| NEXT ACTION: Selected Subject - Mathematics'); + + //Wait for the X clear icon (Select2 uses this class) + const clearGradesIcon = await driver.wait( + until.elementLocated(By.css('#exgrades + span .select2-selection__clear')), + 20000 + ); + + //Wait until visible + await driver.wait( + until.elementIsVisible(clearGradesIcon), + 20000 + ); + + //Click to clear grades + await clearGradesIcon.click(); + await driver.sleep(1000); + console.log('----->| NEXT ACTION: Clicked Grades X clear icon'); + + await driver.findElement(By.xpath("//li[contains(text(), '9')]")).click(); + await driver.sleep(1000); + + await driver.findElement(By.xpath("//li[contains(text(), '10')]")).click(); + await driver.sleep(1000); + + await driver.findElement(By.xpath("//li[contains(text(), '11')]")).click(); + await driver.sleep(1000); + + await driver.findElement(By.xpath("//li[contains(text(), '12')]")).click(); + await driver.sleep(1000); + + //Click away from dropdown list + await driver.findElement(By.css('#exform > div:nth-child(3) > div > span')).click(); + await driver.sleep(1000); + + console.log('----->| NEXT ACTION: Selected grades: 9, 10, 11, and 12'); + }, + }, + + //DIV - Grade 9 + { + description: 'Validate DIV - Grade 9', + action: async () => { + const multipleChecks = 'DIV - Grade 9'; + const elementIconToolTip = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(1) > button')).getAttribute('title'); + const element = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(1)')); + + const elementText = await element.getText(); + const elementToolTip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon tool-tip + if (elementIconToolTip === 'Remove item') { + console.log('Passed: DIV - Grade 9 icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 9 icon tool-tip text: "Remove item"; Actual: "${elementIconToolTip}"`); + } + + //text + if (elementText.includes('9')) { + console.log('Passed: DIV - Grades selection included "9" text matched as expected'); + } else { + throw new Error(`Expected: DIV - Grades selection: "9"; Actual: "${elementText}"`); + } + + //tool-tip + if (elementToolTip === '9') { + console.log('Passed: DIV - Grade 9 tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 9 tool-tip text: "9"; Actual: "${elementToolTip}"`); + } + + //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')); + } + } + }, + + //DIV - Grade 10 + { + description: 'Validate DIV - Grade 10', + action: async () => { + const multipleChecks = 'DIV - Grade 10'; + const elementIconToolTip = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(2) > button')).getAttribute('title'); + const element = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(2)')); + + const elementText = await element.getText(); + const elementToolTip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon tool-tip + if (elementIconToolTip === 'Remove item') { + console.log('Passed: DIV - Grade 10 icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 10 icon tool-tip text: "Remove item"; Actual: "${elementIconToolTip}"`); + } + + //text + if (elementText.includes('10')) { + console.log('Passed: DIV - Grades selection included "10" text matched as expected'); + } else { + throw new Error(`Expected: DIV - Grades selection: "10"; Actual: "${elementText}"`); + } + + //tool-tip + if (elementToolTip === '10') { + console.log('Passed: DIV - Grade 10 tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 10 tool-tip text: "9"; Actual: "${elementToolTip}"`); + } + + //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')); + } + } + }, + + //DIV - Grade 11 + { + description: 'Validate DIV - Grade 11', + action: async () => { + const multipleChecks = 'DIV - Grade 11'; + const elementIconToolTip = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(3) > button')).getAttribute('title'); + const element = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(3)')); + + const elementText = await element.getText(); + const elementToolTip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon tool-tip + if (elementIconToolTip === 'Remove item') { + console.log('Passed: DIV - Grade 11 icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 11 icon tool-tip text: "Remove item"; Actual: "${elementIconToolTip}"`); + } + + //text + if (elementText.includes('11')) { + console.log('Passed: DIV - Grades selection included "11" text matched as expected'); + } else { + throw new Error(`Expected: DIV - Grades selection: "11"; Actual: "${elementText}"`); + } + + //tool-tip + if (elementToolTip === '11') { + console.log('Passed: DIV - Grade 11 tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 11 tool-tip text: "9"; Actual: "${elementToolTip}"`); + } + + //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')); + } + } + }, + + //DIV - Grade 12 + { + description: 'Validate DIV - Grade 12', + action: async () => { + const multipleChecks = 'DIV - Grade 12'; + const elementIconToolTip = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(4) > button')).getAttribute('title'); + const element = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(4)')); + + const elementText = await element.getText(); + const elementToolTip = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon tool-tip + if (elementIconToolTip === 'Remove item') { + console.log('Passed: DIV - Grade 12 icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 12 icon tool-tip text: "Remove item"; Actual: "${elementIconToolTip}"`); + } + + //text + if (elementText.includes('12')) { + console.log('Passed: DIV - Grades selection included "12" text matched as expected'); + } else { + throw new Error(`Expected: DIV - Grades selection: "12"; Actual: "${elementText}"`); + } + + //tool-tip + if (elementToolTip === '12') { + console.log('Passed: DIV - Grade 12 tool-tip text matched as expected'); + } else { + errors.push(`Expected: DIV - Grade 12 tool-tip text: "9"; Actual: "${elementToolTip}"`); + } + + //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: 'DIV - Click Export button then Close DIV', + action: async () => { + const multipleChecks = 'DIV - Processing status'; + + const errors = []; + + //Capture styles immediately via executeScript BEFORE clicking + //This sets up a MutationObserver to catch the spinner the moment it appears + await driver.executeScript(` + window._spinnerStyles = null; + const observer = new MutationObserver(() => { + const el = document.querySelector('#modalspin strong'); + if (el) { + const style = window.getComputedStyle(el); + const spinDiv = document.querySelector('#modalspin'); + const spinStyle = window.getComputedStyle(spinDiv); + if (spinStyle.display !== 'none') { + window._spinnerStyles = { + text: el.textContent.trim(), + fontFamily: style.getPropertyValue('font-family'), + fontSize: style.getPropertyValue('font-size'), + color: style.getPropertyValue('color') + }; + observer.disconnect(); + } + } + }); + observer.observe(document.querySelector('#modalspin'), { + attributes: true, + attributeFilter: ['style'] + }); + `); + + //Now click Export + await driver.findElement(By.css('#exsubmit')).click(); + console.log('----->| NEXT ACTION: Clicked Export button'); + + //Wait for MutationObserver to capture the styles + await driver.wait(async () => { + const captured = await driver.executeScript(`return window._spinnerStyles !== null;`); + return captured; + }, 15000, 'Processing spinner styles were not captured within 15 seconds'); + + //Get the captured styles + const styles = await driver.executeScript(`return window._spinnerStyles;`); + //console.log('----->| DEBUG captured styles:', JSON.stringify(styles)); + + //text + if (styles.text === 'Processing...') { + console.log('Passed: DIV - Status text matched as expected'); + } else { + errors.push(`Expected: DIV - Status text: "Processing..."; Actual: "${styles.text}"`); + } + + //font + if (styles.fontFamily === 'Poppins, sans-serif') { + console.log('Passed: DIV - Processing... status text font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Processing... status text font-family "Poppins, sans-serif"; Actual: "${styles.fontFamily}"`); + } + + //size + if (styles.fontSize === '23.4px') { + console.log('Passed: DIV - Processing... status text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Processing... status text font-size "23.4px"; Actual: "${styles.fontSize}"`); + } + + //color + if (styles.color === 'rgb(40, 39, 90)') { + console.log('Passed: DIV - Processing... status text color matched as expected'); + } else { + errors.push(`Expected: DIV - Processing... status text color "rgb(40, 39, 90)"; Actual: "${styles.color}"`); + } + + //Wait until processing is complete + await driver.wait(async () => { + try { + const spinDiv = await driver.findElement(By.css('#modalspin')); + return !(await spinDiv.isDisplayed()); + } catch (e) { + return true; + } + }, 30000, 'Processing... Status did not disappear within 30 seconds'); + console.log('Passed: Processing... Status is no longer visible as expected'); + + await driver.findElement(By.css('#modalclose')).click(); + console.log('----->| NEXT ACTION: Clicked Close button'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 20000, 'ExACT Dashboard did not fully load within 60 seconds'); + console.log('Passed: ExACT Dashboard 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')); + } + } + }, + + //NEXT ACTION + { + description: 'Dashboard - Click Alabama More Info icon', + action: async () => { + await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(4) img')).click(); + console.log('----->| NEXT ACTION: Clicked Alabama More Info icon'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Modal did not become visible within 20 seconds'); + + console.log('Passed: DIV - Loaded successfully'); + } + }, + + //Alabama Courses of Study DIV + //DIV - Alabama Courses of Study title + { + description: 'Validate DIV - Alabama Courses of Study title text, color, and size', + action: async () => { + const multipleChecks = 'DIV - Alabama Courses of Study title'; + const element = await driver.findElement(By.css('.modal-lg .modal-title')); + + //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 === 'Alabama Courses of Study') { + console.log('Passed: DIV - Alabama Courses of Study title matched as expected'); + } else { + errors.push(`Expected: DIV - "Alabama Courses of Study"; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - Alabama Courses of Study title font-family matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Courses of Study title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '18px') { + console.log('Passed: DIV - Alabama Courses of Study title text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Courses of Study title text font-size "18px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: DIV - Alabama Courses of Study title text color matched as expected'); + } else { + errors.push(`Expected: DIV - Alabama Courses of Study 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')); + } + } + }, + + //DIV - More Info Alabama sub-text + { + description: 'Validate DIV - More Info Alabma sub-text, color, and size', + action: async () => { + const multipleChecks = 'DIV - Alabama sut-text'; + const element = await driver.findElement(By.css('.modal-body > .notenabled')); + + //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 === '*Not enabled in Profile. If you would like access to any of these standards sets, please Contact Us.') { + console.log('Passed: DIV - More Info Arizona sub-text matched as expected'); + } else { + errors.push(`Expected: DIV - sub-text "*Not enabled in Profile. If you would like access to any of these standards sets, please Contact Us."; Actual: "${elementText}"`); + } + + //font + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: DIV - More Info Arizona sub-text font-family matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona sub-text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '11.7px') { + console.log('Passed: DIV - More Info Arizona sub-text text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona sub-text text font-size "11.7px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(119, 119, 119, 1)') { + console.log('Passed: DIV - More Info Arizona sub-text color matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona sub-text text color "rgba(119, 119, 119, 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')); + } + } + }, + + //DIV - More Info Alabama Contact Us link + { + description: 'Validate DIV - More Info Alabama Contact Us link text, color, and size', + action: async () => { + const multipleChecks = 'DIV - Alabama Courses of Study Contact Us link'; + const element = await driver.findElement(By.linkText('Contact Us')); + + //Get text, font, size, color, url + 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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Contact Us') { + console.log('Passed: DIV - More Info Alabama sub-text matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Alabama sub-text "Contact Us"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: DIV - More Info Alabama sub-text font-family matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Alabama sub-text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '11.7px') { + console.log('Passed: DIV - More Info Alabama Contact Us link text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Alabama Contact Us link text font-size "11.7px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: DIV - More Info Alabama Contact Us link text color matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Alabama Contact Us link text color "rgba(48, 200, 172, 1)"'; Actual: "${elementColor}"`); + } + + //url + if (elementURL === 'https://edgate.com/contact-us') { + console.log('Passed: DIV - More Info Alabama Contact Us URL link matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Alabama Contact Us URL: "https://edgate.com/contact-us"; Actual: "${elementURL}"`); + } + + //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')); + } + } + }, + + //DIV - More Info Alabama Subject column title + { + description: 'Validate DIV - More Info Alabama Subject column title text, color, and size', + action: async () => { + const multipleChecks = 'DIV - Alabama Courses of Study column title'; + const element = await driver.findElement(By.css('#myModal > div > div > div.modal-body > table > thead > tr > th:nth-child(1)')); + + //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 === 'Subject') { + console.log('Passed: DIV - More Info Arizona Subject column title text matched as expected'); + } else { + errors.push(`Expected: DIV - Arizona column title "Subject"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: DIV - More Info Arizona Subject column title font-family matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona Subject column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: DIV - More Info Arizona Subject column title text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona Subject column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: DIV - More Info Arizona Subject column title text color matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona Subject column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //DIV - More Info Alabama Adopted column title + { + description: 'Validate DIV - More Info Alabama Adopted column title text, color, and size', + action: async () => { + const multipleChecks = 'DIV - Alabama Courses of Study Adopted column title'; + const element = await driver.findElement(By.css('#myModal > div > div > div.modal-body > table > thead > tr > th: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') + + //Track all errors + const errors = []; + + //text + if (elementText === 'Adopted') { + console.log('Passed: DIV - More Info Arizona Adopted column title text matched as expected'); + } else { + errors.push(`Expected: DIV - Arizona column title "Adopted"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: DIV - More Info Arizona Adopted column title font-family matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona Adopted column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: DIV - More Info Arizona Adopted column title text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona Adopted column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: DIV - More Info Arizona Adopted column title text color matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona Adopted column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //DIV - More Info Alabama Grades column title + { + description: 'Validate DIV - More Info Alabama Grades column title text, color, and size', + action: async () => { + const multipleChecks = 'DIV - Alabama Courses of Study Grades column title'; + const element = await driver.findElement(By.css('#myModal > div > div > div.modal-body > table > thead > tr > th: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') + + //Track all errors + const errors = []; + + //text + if (elementText === 'Grades') { + console.log('Passed: DIV - More Info Arizona Grades column title text matched as expected'); + } else { + errors.push(`Expected: DIV - Arizona column title "Grades"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: DIV - More Info Arizona Grades column title font-family matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona Grades column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: DIV - More Info Arizona Grades column title text font-size matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona Grades column title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(94, 105, 116, 1)') { + console.log('Passed: DIV - More Info Arizona Grades column title text color matched as expected'); + } else { + errors.push(`Expected: DIV - More Info Arizona Grades column title text color "rgba(94, 105, 116, 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')); + } + } + }, + + //DIV - More Info Alabama Row 1 label + { + description: 'Validate DIV - More Info Alabama Row 1 label text, font, color, and size', + action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 1 label'; + + const checks = [ + //Subject + { + selector: '.text-success:nth-child(1) > td:nth-child(1)', + label: 'Health and PE', + expected: { + text: 'Health and PE', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + }, + + //Adopted + { + selector: '.text-success:nth-child(1) > td:nth-child(2)', + label: '2019', + expected: { + text: '2019', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + }, + + //All Grades list + { + selector: '.text-success:nth-child(1) > td:nth-child(3)', + label: 'Grades List', + expected: { + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + } + ]; + + const allErrors = []; + + async function validateCell({ selector, label, expected }) { + const element = await driver.findElement(By.css(selector)); + + const actualText = await element.getText(); + const actualFont = await element.getCssValue('font-family'); + const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); + + const errors = []; + + //text + if (actualText === expected.text) { + console.log(`Passed: DIV - More Info Alabama Row 1 ${label} label text matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 1 "${expected.text}"; Actual: "${actualText}"`); + } + + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 1 ${label} label text font-family matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 1 "${expected.font}"; Actual: "${actualFont}"`); + } + + //size + if (actualSize === expected.size) { + console.log(`Passed: DIV - More Info Alabama Row 1 ${label} label text font-size matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 1 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 1 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 1 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + } + + return errors; + } + + for (const check of checks) { + const errs = await validateCell(check); + allErrors.push(...errs); + } + + if (allErrors.length > 0) { + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + throw new Error(allErrors.join('\n')); + } + } + }, + + //DIV - More Info Alabama Row 2 label + { + description: 'Validate DIV - More Info Alabama Row 2 label text, font, color, and size', + action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 2 label'; + + const checks = [ + //Subject + { + selector: '.text-success:nth-child(2) > td:nth-child(1)', + label: 'Language Arts', + expected: { + text: 'Language Arts', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + }, + + //Adopted + { + selector: '.text-success:nth-child(2) > td:nth-child(2)', + label: '2021/Effective 2022', + expected: { + text: '2021/Effective 2022', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + }, + + //All Grades list + { + selector: '.text-success:nth-child(2) > td:nth-child(3)', + label: 'Grades List', + expected: { + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + } + ]; + + const allErrors = []; + + async function validateCell({ selector, label, expected }) { + const element = await driver.findElement(By.css(selector)); + + const actualText = await element.getText(); + const actualFont = await element.getCssValue('font-family'); + const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); + + const errors = []; + + //text + if (actualText === expected.text) { + console.log(`Passed: DIV - More Info Alabama Row 2 ${label} label text matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 2 "${expected.text}"; Actual: "${actualText}"`); + } + + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 2 ${label} label text font matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 2 "${expected.font}"; Actual: "${actualFont}"`); + } + + //size + if (actualSize === expected.size) { + console.log(`Passed: DIV - More Info Alabama Row 2 ${label} label text font-size matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 2 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 2 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 2 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + } + + return errors; + } + + for (const check of checks) { + const errs = await validateCell(check); + allErrors.push(...errs); + } + + if (allErrors.length > 0) { + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + throw new Error(allErrors.join('\n')); + } + } + }, + + //DIV - More Info Alabama Row 3 label + { + description: 'Validate DIV - More Info Alabama Row 3 label text, color, and font size', + action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 3 label'; + + const checks = [ + //Subject + { + selector: '.text-success:nth-child(3) > td:nth-child(1)', + label: 'Mathematics', + expected: { + text: 'Mathematics', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + }, + + //Adopted + { + selector: '.text-success:nth-child(3) > td:nth-child(2)', + label: '2019/Impl. 2020', + expected: { + text: '2019/Impl. 2020', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + }, + + //All Grades list + { + selector: '.text-success:nth-child(3) > td:nth-child(3)', + label: 'Grades List', + expected: { + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + } + ]; + + const allErrors = []; + + async function validateCell({ selector, label, expected }) { + const element = await driver.findElement(By.css(selector)); + + const actualText = await element.getText(); + const actualFont = await element.getCssValue('font-family'); + const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); + + const errors = []; + + //text + if (actualText === expected.text) { + console.log(`Passed: DIV - More Info Alabama Row 3 ${label} label text matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 3 "${expected.text}"; Actual: "${actualText}"`); + } + + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 3 ${label} label text font matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 3 "${expected.font}"; Actual: "${actualFont}"`); + } + + //size + if (actualSize === expected.size) { + console.log(`Passed: DIV - More Info Alabama Row 3 ${label} label text font-size matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 3 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 3 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 3 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + } + + return errors; + } + + for (const check of checks) { + const errs = await validateCell(check); + allErrors.push(...errs); + } + + if (allErrors.length > 0) { + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + throw new Error(allErrors.join('\n')); + } + } + }, + + //DIV - More Info Alabama Row 4 label + { + description: 'Validate DIV - More Info Alabama Row 4 label text, color, and font size', + action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 4 label'; + + const checks = [ + //Subject + { + selector: '.text-success:nth-child(4) > td:nth-child(1)', + label: 'Science', + expected: { + text: 'Science', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + }, + + //Adopted + { + selector: '.text-success:nth-child(4) > td:nth-child(2)', + label: '2023', + expected: { + text: '2023', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + }, + + //All Grades list + { + selector: '.text-success:nth-child(4) > td:nth-child(3)', + label: 'Grades List', + expected: { + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + } + ]; + + const allErrors = []; + + async function validateCell({ selector, label, expected }) { + const element = await driver.findElement(By.css(selector)); + + const actualText = await element.getText(); + const actualFont = await element.getCssValue('font-family'); + const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); + + const errors = []; + + //text + if (actualText === expected.text) { + console.log(`Passed: DIV - More Info Alabama Row 4 ${label} label text matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 4 "${expected.text}"; Actual: "${actualText}"`); + } + + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 4 ${label} label text font matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 4 "${expected.font}"; Actual: "${actualFont}"`); + } + + //size + if (actualSize === expected.size) { + console.log(`Passed: DIV - More Info Alabama Row 4 ${label} label text font-size matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 4 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 4 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 4 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + } + + return errors; + } + + for (const check of checks) { + const errs = await validateCell(check); + allErrors.push(...errs); + } + + if (allErrors.length > 0) { + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + throw new Error(allErrors.join('\n')); + } + } + }, + + //DIV - More Info Alabama Row 5 label + { + description: 'Validate DIV - More Info Alabama Row 5 label text, color, and font size', + action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 5 label'; + + const checks = [ + //Subject + { + selector: '.text-success:nth-child(5) > td:nth-child(1)', + label: 'Social Studies', + expected: { + text: 'Social Studies', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + }, + + //Adopted + { + selector: '.text-success:nth-child(5) > td:nth-child(2)', + label: '2024', + expected: { + text: '2024', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + }, + + //All Grades list + { + selector: '.text-success:nth-child(5) > td:nth-child(3)', + label: 'Grades List', + expected: { + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + } + ]; + + const allErrors = []; + + async function validateCell({ selector, label, expected }) { + const element = await driver.findElement(By.css(selector)); + + const actualText = await element.getText(); + const actualFont = await element.getCssValue('font-family'); + const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); + + const errors = []; + + //text + if (actualText === expected.text) { + console.log(`Passed: DIV - More Info Alabama Row 5 ${label} label text matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 5 "${expected.text}"; Actual: "${actualText}"`); + } + + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 5 ${label} label text font matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 5 "${expected.font}"; Actual: "${actualFont}"`); + } + + //size + if (actualSize === expected.size) { + console.log(`Passed: DIV - More Info Alabama Row 5 ${label} label text font-size matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 5 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 5 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 5 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + } + + return errors; + } + + for (const check of checks) { + const errs = await validateCell(check); + allErrors.push(...errs); + } + + if (allErrors.length > 0) { + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + throw new Error(allErrors.join('\n')); + } + } + }, + + //DIV - More Info Alabama Row 6 label + { + description: 'Validate DIV - More Info Alabama Row 6 label text, color, and font size', + action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 6 label'; + + const checks = [ + //Subject + { + selector: '.text-success:nth-child(6) > td:nth-child(1)', + label: 'Technology Education', + expected: { + text: 'Technology Education', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + }, + + //Adopted + { + selector: '.text-success:nth-child(6) > td:nth-child(2)', + label: '2025', + expected: { + text: '2025', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + }, + + //All Grades list + { + selector: '.text-success:nth-child(6) > td:nth-child(3)', + label: 'Grades List', + expected: { + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', + color: 'rgba(40, 167, 69, 1)', + size: '14.3px' + } + } + ]; + + const allErrors = []; + + async function validateCell({ selector, label, expected }) { + const element = await driver.findElement(By.css(selector)); + + const actualText = await element.getText(); + const actualFont = await element.getCssValue('font-family'); + const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); + + const errors = []; + + //text + if (actualText === expected.text) { + console.log(`Passed: DIV - More Info Alabama Row 6 ${label} label text matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 6 "${expected.text}"; Actual: "${actualText}"`); + } + + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 6 ${label} label text font matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 6 "${expected.font}"; Actual: "${actualFont}"`); + } + + //size + if (actualSize === expected.size) { + console.log(`Passed: DIV - More Info Alabama Row 6 ${label} label text font-size matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 6 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 6 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 6 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + } + + return errors; + } + + for (const check of checks) { + const errs = await validateCell(check); + allErrors.push(...errs); + } + + if (allErrors.length > 0) { + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + throw new Error(allErrors.join('\n')); + } + } + }, + + //DIV - More Info Alabama Row 7 label + { + description: 'Validate DIV - More Info Alabama Row 7 label text, color, and font size', + action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 7 label'; + + const checks = [ + //Subject + { + selector: '.notenabled:nth-child(7) > td:nth-child(1)', + label: 'Arts Education*', + expected: { + text: 'Arts Education*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + }, + + //Adopted + { + selector: '.notenabled:nth-child(7) > td:nth-child(2)', + label: '2017', + expected: { + text: '2017', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + }, + + //Grades + { + selector: '.notenabled:nth-child(7) > td:nth-child(3)', + label: 'Grades List', + expected: { + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + } + ]; + + const allErrors = []; + + async function validateCell({ selector, label, expected }) { + const element = await driver.findElement(By.css(selector)); + + const actualText = await element.getText(); + const actualFont = await element.getCssValue('font-family'); + const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); + + const errors = []; + + //text + if (actualText === expected.text) { + console.log(`Passed: DIV - More Info Alabama Row 7 ${label} label text matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 7 "${expected.text}"; Actual: "${actualText}"`); + } + + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 7 ${label} label text font matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 7 "${expected.font}"; Actual: "${actualFont}"`); + } + + //size + if (actualSize === expected.size) { + console.log(`Passed: DIV - More Info Alabama Row 7 ${label} label text font-size matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 7 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 7 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 7 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + } + + return errors; + } + + for (const check of checks) { + const errs = await validateCell(check); + allErrors.push(...errs); + } + + if (allErrors.length > 0) { + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + throw new Error(allErrors.join('\n')); + } + } + }, + + //DIV - More Info Alabama Row 8 label + { + description: 'Validate DIV - More Info Alabama Row 8 label text, color, and font size', + action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 8 label'; + + const checks = [ + //Subject + { + selector: '.notenabled:nth-child(8) > td:nth-child(1)', + label: 'Career Development*', + expected: { + text: 'Career Development*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + }, + + //Adopted + { + selector: '.notenabled:nth-child(8) > td:nth-child(2)', + label: '2016', + expected: { + text: '2016', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + }, + + //All Grades list + { + selector: '.notenabled:nth-child(8) > td:nth-child(3)', + label: 'Grades List', + expected: { + text: '9, 10, 11, 12', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + } + ]; + + const allErrors = []; + + async function validateCell({ selector, label, expected }) { + const element = await driver.findElement(By.css(selector)); + + const actualText = await element.getText(); + const actualFont = await element.getCssValue('font-family'); + const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); + + const errors = []; + + //text + if (actualText === expected.text) { + console.log(`Passed: DIV - More Info Alabama Row 8 ${label} label text matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 8 "${expected.text}"; Actual: "${actualText}"`); + } + + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 8 ${label} label text font matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 8 "${expected.font}"; Actual: "${actualFont}"`); + } + + //size + if (actualSize === expected.size) { + console.log(`Passed: DIV - More Info Alabama Row 8 ${label} label text font-size matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 8 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 8 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 8 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + } + + return errors; + } + + for (const check of checks) { + const errs = await validateCell(check); + allErrors.push(...errs); + } + + if (allErrors.length > 0) { + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + throw new Error(allErrors.join('\n')); + } + } + }, + + //DIV - More Info Alabama Row 9 label text + { + description: 'Validate DIV - More Info Alabama Row 9 label text, color, and font size', + action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 9 label'; + + const checks = [ + //Subject + { + selector: '.notenabled:nth-child(9) > td:nth-child(1)', + label: 'Early Childhood Education*', + expected: { + text: 'Early Childhood Education*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + }, + + //Adopted + { + selector: '.notenabled:nth-child(9) > td:nth-child(2)', + label: '2023', + expected: { + text: '2023', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + }, + + //Ages 3-5* + { + selector: '.notenabled:nth-child(9) .notenabled', + label: 'Ages 3-5*', + expected: { + text: 'Ages 3-5*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '11.583px' + } + }, + + //All Grades list 1 + { + selector: '.notenabled:nth-child(2)', + label: 'Ages Birth to 12 months*', + expected: { + text: 'Ages Birth to 12 months*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '11.583px' + } + }, + + //All Grades list 2 + { + selector: '.notenabled:nth-child(3)', + label: 'Ages 13 to 24 months*', + expected: { + text: 'Ages 13 to 24 months*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '11.583px' + } + }, + + //All Grades list 3 + { + selector: '.notenabled:nth-child(4)', + label: 'Ages 25 to 36 months*', + expected: { + text: 'Ages 25 to 36 months*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '11.583px' + } + } + ]; + + const allErrors = []; + + async function validateCell({ selector, label, expected }) { + const element = await driver.findElement(By.css(selector)); + + const actualText = await element.getText(); + const actualFont = await element.getCssValue('font-family'); + const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); + + const errors = []; + + //text + if (actualText === expected.text) { + console.log(`Passed: DIV - More Info Alabama Row 9 ${label} label text matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 9 "${expected.text}"; Actual: "${actualText}"`); + } + + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 9 ${label} label text font matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 9 "${expected.font}"; Actual: "${actualFont}"`); + } + + //size + if (actualSize === expected.size) { + console.log(`Passed: DIV - More Info Alabama Row 9 ${label} label text font-size matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 9 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 9 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 9 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + } + + return errors; + } + + for (const check of checks) { + const errs = await validateCell(check); + allErrors.push(...errs); + } + + if (allErrors.length > 0) { + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + throw new Error(allErrors.join('\n')); + } + } + }, + + //DIV - More Info Alabama Row 10 label text + { + description: 'Validate DIV - More Info Alabama Row 10 label text, color, and font size', + action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 10 label'; + + const checks = [ + //Subject + { + selector: '.notenabled:nth-child(10) > td:nth-child(1)', + label: 'English Language Learners*', + expected: { + text: 'English Language Learners*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + }, + + //Adopted + { + selector: '.notenabled:nth-child(10) > td:nth-child(2)', + label: '2020', + expected: { + text: '2020', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + }, + + //All Grades list + { + selector: '.notenabled:nth-child(10) > td:nth-child(3)', + label: 'Grades List', + expected: { + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + } + ]; + + const allErrors = []; + + async function validateCell({ selector, label, expected }) { + const element = await driver.findElement(By.css(selector)); + + const actualText = await element.getText(); + const actualFont = await element.getCssValue('font-family'); + const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); + + const errors = []; + + //text + if (actualText === expected.text) { + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 10 "${expected.text}"; Actual: "${actualText}"`); + } + + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text font matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 10 "${expected.font}"; Actual: "${actualFont}"`); + } + + //size + if (actualSize === expected.size) { + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text font-size matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 10 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 10 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + } + + return errors; + } + + for (const check of checks) { + const errs = await validateCell(check); + allErrors.push(...errs); + } + + if (allErrors.length > 0) { + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + throw new Error(allErrors.join('\n')); + } + } + }, + + //DIV - More Info Alabama Row 11 label + { + description: 'Validate DIV - More Info Alabama Row 11 label text, color, and font size', + action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 11 label'; + + const checks = [ + //Subject + { + selector: '.notenabled:nth-child(11) > td:nth-child(1)', + label: 'Social and Emotional Learning*', + expected: { + text: 'Social and Emotional Learning*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + }, + + //Adopted + { + selector: '.notenabled:nth-child(11) > td:nth-child(2)', + label: '2013', + expected: { + text: '2013', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + }, + + //Pre K* + { + selector: '.notenabled:nth-child(11) .notenabled', + label: 'Pre K*', + expected: { + text: 'Pre K*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '11.583px' + } + } + ]; + + const allErrors = []; + + async function validateCell({ selector, label, expected }) { + const element = await driver.findElement(By.css(selector)); + + const actualText = await element.getText(); + const actualFont = await element.getCssValue('font-family'); + const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); + + const errors = []; + + //text + if (actualText === expected.text) { + console.log(`Passed: DIV - More Info Alabama Row 11 ${label} label text matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 11 "${expected.text}"; Actual: "${actualText}"`); + } + + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 11 ${label} label text font matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 11 "${expected.font}"; Actual: "${actualFont}"`); + } + + //size + if (actualSize === expected.size) { + console.log(`Passed: DIV - More Info Alabama Row 11 ${label} label text font-size matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 11 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 11 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 11 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + } + + return errors; + } + + for (const check of checks) { + const errs = await validateCell(check); + allErrors.push(...errs); + } + + if (allErrors.length > 0) { + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + throw new Error(allErrors.join('\n')); + } + } + }, + + //DIV - More Info Alabama Row 12 label text + { + description: 'Validate DIV - More Info Alabama Row 12 label text, color, and font size', + action: async () => { + const multipleChecks = 'DIV - More Info Alabama Row 12 label'; + + const checks = [ + //Subject + { + selector: '.notenabled:nth-child(12) > td:nth-child(1)', + label: 'World Languages*', + expected: { + text: 'World Languages*', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + }, + + //Adopted + { + selector: '.notenabled:nth-child(12) > td:nth-child(2)', + label: '2017', + expected: { + text: '2017', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + }, + + //All Grades list + { + selector: '.notenabled:nth-child(12) > td:nth-child(3)', + label: 'Grades List', + expected: { + text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', + font: 'Poppins, sans-serif', + color: 'rgba(119, 119, 119, 1)', + size: '12.87px' + } + } + ]; + + const allErrors = []; + + async function validateCell({ selector, label, expected }) { + const element = await driver.findElement(By.css(selector)); + + const actualText = await element.getText(); + const actualFont = await element.getCssValue('font-family'); + const actualSize = await element.getCssValue('font-size'); + const actualColor = await element.getCssValue('color'); + + const errors = []; + + //text + if (actualText === expected.text) { + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 10 "${expected.text}"; Actual: "${actualText}"`); + } + + //font + if (actualFont === expected.font) { + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text font matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 10 "${expected.font}"; Actual: "${actualFont}"`); + } + + //size + if (actualSize === expected.size) { + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text font-size matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 10 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`); + } + + //color + if (actualColor === expected.color) { + console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text color matched as expected`); + } else { + errors.push(`Expected: DIV - More Info Alabama Row 10 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`); + } + + return errors; + } + + for (const check of checks) { + const errs = await validateCell(check); + allErrors.push(...errs); + } + + if (allErrors.length > 0) { + if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + throw new Error(allErrors.join('\n')); + } + } + }, + + //NEXT ACTION + { + description: 'Dashboard - Click DIV X icon', + action: async () => { + await driver.findElement(By.css('.modal-lg .modal-header span')).click(); + console.log('----->| NEXT ACTION: Clicked DIV X icon'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 20000, 'ExACT Dashboard did not fully load within 60 seconds'); + console.log('Passed: ExACT Dashboard loaded successfully'); + } + }, + + //NEXT ACTION + { + description: 'Dashboard - Click Alabama View icon', + action: async () => { + await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img')).click(); + console.log('----->| NEXT ACTION: Clicked Alabama View icon'); + + //Wait for page readyState + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Browse standards page did not fully load within 30 seconds'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.linkText('Content')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Content tab did not become visible within 20 seconds'); + + console.log('Passed: Content tab loaded successfully'); + } + }, + + //Content tab title + { + description: 'Validate Content tab title text, size, and color', + action: async () => { + const multipleChecks = 'Content tab title'; + const element = await driver.findElement(By.linkText('Content')); + + //Get text, font, size, and 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 === 'Content') { + console.log('Passed: Content tab title text matched as expected'); + } else { + errors.push(`Expected: "Content"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Content tab title font-family matched as expected'); + } else { + errors.push(`Expected: Content tab title font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Content tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Content tab title text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Content tab title text color matched as expected'); + } else { + errors.push(`Expected: Content tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Content tab background color matched as expected'); + } else { + errors.push(`Expected: Content tab background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + //Standards tab tab title (active) + { + description: 'Validate Standards tab title text, size, and color', + action: async () => { + const multipleChecks = 'By Standard tab title'; + const element = await driver.findElement(By.linkText('Standards')); + + //Get text, font, size, and 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 === 'Standards') { + console.log('Passed: Standards tab title text matched as expected'); + } else { + errors.push(`Expected: "Standards"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standards tab title font-family matched as expected'); + } else { + errors.push(`Expected: Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Standards tab title text font-size matched as expected'); + } else { + errors.push(`Expected: Standards tab title text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standards tab title text color matched as expected'); + } else { + errors.push(`Expected: Standards tab title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standards tab background color matched as expected'); + } else { + errors.push(`Expected: Standards tab background color: "rgba(40, 39, 90, 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')); + } + } + }, + + //AutoAlign tab title + { + description: 'Validate AutoAlign tab title text, size, and color', + action: async () => { + const multipleChecks = 'AutoAlign tab title'; + const element = await driver.findElement(By.linkText('AutoAlign')); + + //Get text, font, size, and 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 === 'AutoAlign') { + console.log('Passed: AutoAlign tab title text matched as expected'); + } else { + errors.push(`Expected: "AutoAlign"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: AutoAlign tab title font-family matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab title font-family "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: AutoAlign tab title text font-size matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab title text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: AutoAlign tab title text color matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: AutoAlign tab background color matched as expected'); + } else { + errors.push(`Expected: AutoAlign tab background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + //Browse - Browse standards sub-title + { + description: 'Validate Browse - Browse standards sub-title text, color, and size', + action: async () => { + const multipleChecks = 'Browse sub-title'; + const element = await driver.findElement(By.css('#std .fom-title')); + + //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 === 'Browse standards') { + console.log("Passed: Browse page - Browse standards sub-title matched as expected"); + } else { + errors.push(`Expected: "Browse standards" sub-title; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Browse page - Browse standards sub-title font-family matched as expected'); + } else { + errors.push(`Expected: Browse page - Browse standards sub-title font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Browse page - Browse standards sub-title text font-size matched as expected'); + } else { + errors.push(`Expected: Browse page - Browse standards sub-title text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Browse page - Browse standards sub-title text color matched as expected'); + } else { + errors.push(`Expected: Browse page - Browse standards sub-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')); + } + } + }, + + //Standards label + { + description: 'Validate Standards label text, font, size, and color', + action: async () => { + const multipleChecks = 'Standards label'; + const element = await driver.findElement(By.css('#browse-standards > .form-group:nth-child(1) > .col-sm-12')); + + //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 === 'Standards') { + console.log("Passed: Standards label matched as expected"); + } else { + errors.push(`Expected: "Standards" label; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standards label font-family matched as expected'); + } else { + errors.push(`Expected: Standards label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standards label text font-size matched as expected'); + } else { + errors.push(`Expected: Standards label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standards label text color matched as expected'); + } else { + errors.push(`Expected: Standards 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')); + } + } + }, + + //Standards dropdown + { + description: 'Validate Standards dropdown list and value', + action: async () => { + const multipleChecks = 'Standards Dropdown List'; + const select = await driver.findElement(By.css('#stdselect')); + + //Get text, font, size, and color + const selectedOption = await select.findElement(By.css('option:checked')); + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + //text + if (elementText === 'Alabama') { + console.log("Passed: Alabama default option matched as expected"); + } else { + errors.push(`Expected option: "Alabama"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Alabama default text font-family matched as expected'); + } else { + errors.push(`Expected: Alabama default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Alabama default text font-size matched as expected'); + } else { + errors.push(`Expected: Alabama default text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Alabama default text color matched as expected'); + } else { + errors.push(`Expected: Alabama default text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const options = await select.findElements(By.css('option')); + const expectedList = [ + 'Select standards', + 'Alabama', + 'Arizona', + 'California', + 'Florida', + 'Georgia', + 'Illinois', + 'New York', + 'Texas', + 'Washington', + 'Common Core State Standards', + 'Alberta Standards', + 'Ontario Curriculum', + 'Australian Curriculum (ACARA) v8', + 'New South Wales', + 'NCSSFL-ACTFL CAN-DO STATEMENTS', + 'WIDA Consortium (2020)', + '5th Grade Import ECS-2732', + 'Imported Framework Updated', + 'ECS-2933 Testing On Prod', + //'Stats Test Framework', + 'Widget Test', + 'California Mathematics 1997', + 'Georgia Archived Language Arts QA', + 'Georgia Current Language Arts QA', + 'Georgia Future Language Arts QA', + 'create group test', + 'IMport Test' + ]; + const actual = []; + + //Track all errors + const errors = []; + + for (const opt of options) { + const text = (await opt.getText()).trim(); + actual.push(text); + } + + if (JSON.stringify(actual) === JSON.stringify(expectedList)) { + console.log('Passed: Standards Dropdown list matched as expected'); + } else { + errors.push(`Expected: Standards Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //Standards Display label + { + description: 'Validate Standards Display label text, font, size, and color', + action: async () => { + const multipleChecks = 'Standards Display label'; + const element = await driver.findElement(By.css('.form-group:nth-child(2) > .col-sm-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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Standards Display') { + console.log("Passed: Standards Display label text matched as expected"); + } else { + errors.push(`Expected: ""Standards Display" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standards Display label font-family matched as expected'); + } else { + errors.push(`Expected: Standards Display label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standards Display label text font-size matched as expected'); + } else { + errors.push(`Expected: Standards Display label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standards Display label text color matched as expected'); + } else { + errors.push(`Expected: Standards Display 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')); + } + } + }, + + //All radio option + { + description: 'Validate All radio option text, font, size, and color', + action: async () => { + const multipleChecks = 'All radio option'; + const elementOption = await driver.findElement(By.css('#gap1')).getAttribute('checked'); + const element = await driver.findElement(By.css('.form-check:nth-child(1) > .form-check-label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //icon + if (elementOption === 'true') { + console.log('Passed: All radio option selected as expected'); + } else { + throw new Error(`All radio option value was not selected; Actual: "${elementOption}"`); + } + + //text + if (elementText === 'All') { + console.log('Passed: All radio label text matched as expected'); + } else { + errors.push(`Expected: "All" radio label text; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: All radio label font matched as expected'); + } else { + errors.push(`Expected: All radio label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: All radio label text font-size matched as expected'); + } else { + errors.push(`Expected: All radio label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: All radio label text color matched as expected'); + } else { + errors.push(`Expected: All radio label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Correlated Only radio option + { + description: 'Validate Correlated Only radio option text, font, size, and color', + action: async () => { + const multipleChecks = 'Correlated Only radio option'; + const elementOption = await driver.findElement(By.css('#gap2')); + const element = await driver.findElement(By.css('.form-check:nth-child(2) > .form-check-label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //icon + if (elementOption) { + console.log('Passed: Correlated Only radio option is present'); + } else { + throw new Error(`Correlated Only radio option was not found; Actual: "${elementOption}"`); + } + + //text + if (elementText === 'Correlated Only') { + console.log('Passed: Correlated Only radio label text matched as expected'); + } else { + errors.push(`Expected: "Correlated Only" radio label text; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Correlated Only radio label font matched as expected'); + } else { + errors.push(`Expected: Correlated Only radio label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Correlated Only radio label text font-size matched as expected'); + } else { + errors.push(`Expected: Correlated Only radio label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Correlated Only radio label text color matched as expected'); + } else { + errors.push(`Expected: Correlated Only radio label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Uncorrelated Only radio option + { + description: 'Validate Uncorrelated Only radio option text, font, size, and color', + action: async () => { + const multipleChecks = 'Uncorrelated Only radio option'; + const elementOption = await driver.findElement(By.css('#gap3')); + const element = await driver.findElement(By.css('.form-check:nth-child(3) > .form-check-label')); + + //Get text, font, size, and 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'); + + //Track all errors + const errors = []; + + //icon + if (elementOption) { + console.log('Passed: Uncorrelated Only radio option is present'); + } else { + throw new Error(`Uncorrelated Only radio option was not found; Actual: "${elementOption}"`); + } + + //text + if (elementText === 'Uncorrelated Only') { + console.log('Passed: Uncorrelated Only radio label text matched as expected'); + } else { + errors.push(`Expected: "Uncorrelated Only" radio label text; Actual: "${elementText}"`); + } + + //font-family + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Uncorrelated Only radio label font matched as expected'); + } else { + errors.push(`Expected: Uncorrelated Only radio label font "DM Serif Display, serif"; Actual: ${elementTextFont}`); + } + + //font size + if (elementTextSize === '13px') { + console.log('Passed: Uncorrelated Only radio label text font-size matched as expected'); + } else { + errors.push(`Expected: Uncorrelated Only radio label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //text color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Uncorrelated Only radio label text color matched as expected'); + } else { + errors.push(`Expected: Uncorrelated Only radio label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Subject label + { + description: 'Validate Subject label text, font, size, and color', + action: async () => { + const multipleChecks = 'Subject label'; + const element = await driver.findElement(By.css('.hideSubject > .col-form-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 === 'Subject') { + console.log("Passed: Subject label text matched as expected"); + } else { + errors.push(`Expected: "Subject" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Subject label font-family matched as expected'); + } else { + errors.push(`Expected: Subject label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Subject label text font-size matched as expected'); + } else { + errors.push(`Expected: Subject label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Subject label text color matched as expected'); + } else { + errors.push(`Expected: Subject 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')); + } + } + }, + + //Subject dropdown + { + description: 'Validate Subject dropdown list and value', + action: async () => { + const multipleChecks = 'Subject Dropdown List'; + const select = await driver.findElement(By.css('#selectSubjects')); + + //Get text, font, size, and color + const selectedOption = await select.findElement(By.css('option:checked')); + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + //text + if (elementText === 'Select a subject') { + console.log("Passed: Select a subject default option matched as expected"); + } else { + errors.push(`Expected option: "Select a subject"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Select a subject default text font-family matched as expected'); + } else { + errors.push(`Expected: Select a subject default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Select a subject default text font-size matched as expected'); + } else { + errors.push(`Expected: Select a subject default text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Select a subject default text color matched as expected'); + } else { + errors.push(`Expected: Select a subject default text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const options = await select.findElements(By.css('option')); + const expectedList = [ + 'Select a subject', + 'Health and PE', + 'Language Arts', + "Mathematics", + "Science", + "Social Studies", + "Technology Education" + ]; + const actual = []; + + //Track all errors + const errors = []; + + for (const opt of options) { + const text = (await opt.getText()).trim(); + actual.push(text); + } + + if (JSON.stringify(actual) === JSON.stringify(expectedList)) { + console.log('Passed: Subject Dropdown list matched as expected'); + } else { + errors.push(`Expected: Subject Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //Grade label and dropdown + { + description: 'Validate Grade label and dropdown are hidden', + action: async () => { + const multipleChecks = 'Grade label and dropdown are hidden'; + const errors = []; + + const visibility = await driver.executeScript(` + const hideGradeDiv = document.querySelector('.hideGrade'); + if (!hideGradeDiv) return { found: false }; + const style = window.getComputedStyle(hideGradeDiv); + return { + found: true, + hidden: style.display === 'none', + display: style.display + }; + `); + //console.log('----->| DEBUG hideGrade visibility:', JSON.stringify(visibility)); + + //Both label and dropdown are inside the same hideGrade div + //so we only need to check the parent container once + if (visibility.found && visibility.hidden) { + console.log('Passed: Grade label is hidden as expected'); + console.log('Passed: Grade dropdown is hidden as expected'); + } else { + errors.push(`Expected: Grade label and dropdown to be hidden; Actual: display="${visibility.display}"`); + } + + //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')); + } + } + }, + + //Show Correlations From label + { + description: 'Validate Show Correlations From label text, font, size, and color', + action: async () => { + const multipleChecks = 'Show Correlations From label'; + const element = await driver.findElement(By.css('.form-group:nth-child(3) > .col-form-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 === 'Show Correlations From') { + console.log("Passed: Show Correlations From label text matched as expected"); + } else { + errors.push(`Expected: "Show Correlations From" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Show Correlations From label font-family matched as expected'); + } else { + errors.push(`Expected: Show Correlations From label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Show Correlations From label text font-size matched as expected'); + } else { + errors.push(`Expected: Show Correlations From label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Show Correlations From label text color matched as expected'); + } else { + errors.push(`Expected: Show Correlations From 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')); + } + } + }, + + //Show Correlations From dropdown value + { + description: 'Validate Show Correlations From dropdown value', + action: async () => { + const multipleChecks = 'Show Correlations From dropdown value'; + + //Locate and validate selected (collapsed) value + const dropdownButton = await driver.findElement( + By.css('button.multiselect.dropdown-toggle') + ); + + const selectedOption = await driver.findElement(By.css('#browse-standards > div:nth-child(3) > div > div > div:nth-child(3) > div > div > button > span')); + + //Get text, font, size, and color + const elementText = await selectedOption.getText(''); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'All Content Sets') { + console.log("Passed: All Content Sets default option matched as expected"); + } else { + errors.push(`Expected option: "All Content Sets"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: All Content Sets default text font-family matched as expected'); + } else { + errors.push(`Expected: All Content Sets default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '16px') { + console.log('Passed: All Content Sets default text font-size matched as expected'); + } else { + errors.push(`Expected: All Content Sets default text font-size "16px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: All Content Sets default text color matched as expected'); + } else { + errors.push(`Expected: All Content Sets default text color "rgba(33, 37, 41, 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')); + } + } + }, + + //Term Search label + { + description: 'Validate Term Search label text, font, size, and color', + action: async () => { + const multipleChecks = 'Term Search label'; + const element = await driver.findElement(By.css('.form-group:nth-child(7) > .col-sm-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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Term Search') { + console.log("Passed: Term Search label text matched as expected"); + } else { + errors.push(`Expected: "Term Search" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Term Search label font-family matched as expected'); + } else { + errors.push(`Expected: Term Search label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Term Search label text font-size matched as expected'); + } else { + errors.push(`Expected: Term Search label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Term Search label text color matched as expected'); + } else { + errors.push(`Expected: Term Search 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')); + } + } + }, + + //Term Search placeholder + { + description: 'Validate Term Search placeholder', + action: async () => { + const elementPlaceholder = await driver.findElement(By.css('#searchTerm')).getAttribute('placeholder'); + + if (elementPlaceholder === '') { + console.log('Passed: Term Search "blank" placeholder text matched as expected'); + } else { + throw new Error(`Expected: Term Search "blank" placeholder text; Actual: "${elementPlaceholder}"`); + } + } + }, + + //Include Related Standards checkbox + { + description: 'Validate Include Related Standards checkbox', + action: async () => { + const elementType = await driver.findElement(By.css('#doRel')).getAttribute('type'); + + if (elementType === 'checkbox') { + console.log('Passed: Include Related Standards checkbox type matched as expected'); + } else { + throw new Error(`Include Related Standards checkbox type did not match; Actual: "${elementType}"`); + } + } + }, + + //Include Related Standards label + { + description: 'Validate Include Related Standards label text, font, size, and color', + action: async () => { + const multipleChecks = 'Include Related Standards label'; + const element = await driver.findElement(By.css('.col-sm-offset-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 === 'Include Related Standards') { + console.log("Passed: Include Related Standards label text matched as expected"); + } else { + errors.push(`Expected: "Include Related Standards" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Include Related Standards label font-family matched as expected'); + } else { + errors.push(`Expected: Include Related Standards label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Include Related Standards label text font-size matched as expected'); + } else { + errors.push(`Expected: Include Related Standards label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Include Related Standards label text color matched as expected'); + } else { + errors.push(`Expected: Include Related Standards 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')); + } + } + }, + + //Search button + { + description: 'Validate Search button text, size, and color', + action: async () => { + const multipleChecks = 'Search button'; + const element = await driver.findElement(By.css('#stdsubmit')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('value'); + 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 === 'Search') { + console.log('Passed: Search button text matched as expected'); + } else { + errors.push(`Expected: "Search"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Search button text font-family matched as expected'); + } else { + errors.push(`Expected: Search button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '16px') { + console.log('Passed: Search button text font-size matched as expected'); + } else { + errors.push(`Expected: Search button text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Search button text color matched as expected'); + } else { + errors.push(`Expected: Search button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Search button background color matched as expected'); + } else { + errors.push(`Expected: Search 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')); + } + } + }, + + //NEXT ACTION + { + description: 'Validate alert message', + action: async () => { + const multipleChecks = 'Validate alert message'; + const errors = []; + + //Click delete button + const element = await driver.findElement(By.css('#stdsubmit')).click(); + await driver.sleep(5000); + console.log('----->| NEXT ACTION: Clicked Search button'); + + //Wait for confirm dialog to appear + const alert = await driver.wait(until.alertIsPresent(), 5000); + console.log('----->| NEXT ACTION: Alert dialog appeared as expected'); + + //Get alert text + const alertText = await alert.getText(); + + //Validate alert message text + const expectedText = 'You must select a subject'; + if (alertText === expectedText) { + console.log('Passed: Alert dialog text matched as expected'); + } else { + errors.push(`Expected: "${expectedText}"; Actual: "${alertText}"`); + } + + //Throw summary before dismissing if errors found + if (errors.length > 0) { + await alert.dismiss(); //Cancel the delete if validation failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + + //Accept the alert (click OK) to proceed with deletion + await alert.accept(); + console.log('----->| NEXT ACTION: Clicked alert message OK button'); + await driver.sleep(2000); + } + }, + + //NEXT ACTION + { + description: 'Click Subject dropdown', + action: async () => { + //Select "Mathematics" from dropdown + const subjectDropdown = await driver.findElement(By.css('#selectSubjects')); + const mathematicsOption = await driver.findElement(By.css('#selectSubjects > option:nth-child(4)')); + + await subjectDropdown.click(); + await driver.sleep(2000); + + await mathematicsOption.click(); + await driver.sleep(2000); + console.log('----->| NEXT ACTION: Selected Subject - Mathematics'); + + //Click away to close dropdown + await driver.findElement(By.css('#browse-standards > .form-group:nth-child(1)')).click(); + + //Wait for the dashboard container to exist in DOM + await driver.wait( + until.elementLocated(By.css('#selectGrade')), + 30000, + 'Grade dropdown did not appear within 30 seconds' + ); + + //Wait for it to be visible + await driver.wait(async () => { + try { + const gradeDropdown = await driver.findElement(By.css('#selectGrade')); + return await gradeDropdown.isDisplayed(); + } catch (e) { + return false; + } + }, 30000, 'Grade dropdown did not become visible within 30 seconds'); + }, + }, + + //Grade label + { + description: 'Validate Grade label text, font, size, and color', + action: async () => { + const multipleChecks = 'Grade label'; + const element = await driver.findElement(By.css('.hideGrade > .col-form-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 === 'Grade') { + console.log("Passed: Grade label text matched as expected"); + } else { + errors.push(`Expected: "Grade" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Grade label font-family matched as expected'); + } else { + errors.push(`Expected: Grade label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Grade label text font-size matched as expected'); + } else { + errors.push(`Expected: Grade label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Grade label text color matched as expected'); + } else { + errors.push(`Expected: Grade 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')); + } + } + }, + + //Grade dropdown + { + description: 'Validate Grade dropdown list and value', + action: async () => { + const multipleChecks = 'Grade Dropdown List'; + const select = await driver.findElement(By.css('#selectGrade')); + + //Get text, font, size, and color + const selectedOption = await select.findElement(By.css('option:checked')); + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + //text + if (elementText === 'Select a grade') { + console.log("Passed: Select a grade default option matched as expected"); + } else { + errors.push(`Expected option: "Select a grade"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Select a grade default text font-family matched as expected'); + } else { + errors.push(`Expected: Select a grade default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Select a grade default text font-size matched as expected'); + } else { + errors.push(`Expected: Select a grade default text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Select a grade default text color matched as expected'); + } else { + errors.push(`Expected: Select a grade default text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const options = await select.findElements(By.css('option')); + const expectedList = [ + 'Select a grade', + 'K', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + '10', + '11', + '12' + ]; + const actual = []; + + //Track all errors + const errors = []; + + for (const opt of options) { + const text = (await opt.getText()).trim(); + actual.push(text); + } + + if (JSON.stringify(actual) === JSON.stringify(expectedList)) { + console.log('Passed: Grade Dropdown list matched as expected'); + } else { + errors.push(`Expected: Grade Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); + } + + //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: 'Validate alert message', + action: async () => { + const multipleChecks = 'Validate alert message'; + const errors = []; + + //Click delete button + const element = await driver.findElement(By.css('#stdsubmit')).click(); + await driver.sleep(5000); + console.log('----->| NEXT ACTION: Clicked Search button'); + + //Wait for confirm dialog to appear + const alert = await driver.wait(until.alertIsPresent(), 5000); + console.log('----->| NEXT ACTION: Alert dialog appeared as expected'); + + //Get alert text + const alertText = await alert.getText(); + + //Validate alert message text + const expectedText = 'You must select a grade'; + if (alertText === expectedText) { + console.log('Passed: Alert dialog text matched as expected'); + } else { + errors.push(`Expected: "${expectedText}"; Actual: "${alertText}"`); + } + + //Throw summary before dismissing if errors found + if (errors.length > 0) { + await alert.dismiss(); //Cancel the delete if validation failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + + //Accept the alert (click OK) to proceed with deletion + await alert.accept(); + console.log('----->| NEXT ACTION: Clicked alert message OK button'); + await driver.sleep(2000); + } + }, + + //NEXT ACTION + { + description: 'Select grade', + action: async () => { + //Select "9" from dropdown + await driver.findElement(By.css('#selectGrade')).click(); + await driver.sleep(2000); + await driver.findElement(By.css('#selectGrade > option:nth-child(11)')).click(); + + console.log('----->| NEXT ACTION: Selected grade: 9'); + }, + }, + + //Show Correlations From dropdown + { + description: 'Validate Show Correlations From dropdown list and value', + action: async () => { + const multipleChecks = 'Show Correlations From dropdown list'; + + //Locate and validate selected (collapsed) value + const dropdownButton = await driver.findElement( + By.css('button.multiselect.dropdown-toggle') + ); + + const selectedOption = await driver.findElement(By.css('#browse-standards > div:nth-child(3) > div > div > div:nth-child(3) > div > div > button > span')); + + //Get text, font, size, and color + const elementText = await selectedOption.getText(''); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + //text + if (elementText === 'All Content Sets') { + console.log("Passed: All Content Sets default option matched as expected"); + } else { + errors.push(`Expected option: "All Content Sets"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: All Content Sets default text font-family matched as expected'); + } else { + errors.push(`Expected: All Content Sets default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '16px') { + console.log('Passed: All Content Sets default text font-size matched as expected'); + } else { + errors.push(`Expected: All Content Sets default text font-size "16px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: All Content Sets default text color matched as expected'); + } else { + errors.push(`Expected: All Content Sets default text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //Open dropdown + await driver.findElement(By.css('.col-sm-12 .multiselect-selected-text')).click(); + await driver.sleep(2000); + console.log('----->| NEXT ACTION: Clicked Show Correlations From dropdown'); + + //Wait for dropdown list to become visible + const dropdownMenu = await driver.wait( + until.elementLocated(By.css('ul.multiselect-container.dropdown-menu.show')), + 10000 + ); + + await driver.wait( + until.elementIsVisible(dropdownMenu), + 10000 + ); + + //Now safely get option labels + const optionLabels = await dropdownMenu.findElements( + By.css('li label.checkbox') + ); + + //Extract list values + const actualOptions = []; + for (const label of optionLabels) { + const text = (await label.getText()).trim(); + if (text) { + actualOptions.push(text); + } + } + + const expectedOptions = [ + 'Select all', + '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', + 'Post NIght July26' + ]; + + //Track all errors + const errors = []; + + //Length validation + if (actualOptions.length !== expectedOptions.length) { + errors.push( + `Expected option count ${expectedOptions.length}; Actual ${actualOptions.length}` + ); + } + + //Value-by-value validation + expectedOptions.forEach((expected, i) => { + if (actualOptions[i] !== expected) { + errors.push( + `Index ${i}: Expected "${expected}", Actual "${actualOptions[i]}"` + ); + } + }); + + //Select "Algebra" from dropdown + //Runs even if validation above already failed — errors are thrown after this, + //so log order does not reflect when the failing check actually ran + await driver.findElement(By.css('.show > li:nth-child(5) input')).click(); + await driver.sleep(2000); + + console.log('----->| NEXT ACTION: Selected correlation: Algebra'); + + //Click away to close dropdown using executeScript to bypass interception + await driver.executeScript(` + document.querySelector('.col-sm-12 .multiselect-selected-text').click(); + `); + await driver.sleep(2000); + + //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')); + } + } + }, + + //Related Standards options + { + description: 'Validate Include Related Standards options are hidden', + action: async () => { + const multipleChecks = 'Include Related Standards labels and dropdowns are hidden'; + const errors = []; + + const visibility = await driver.executeScript(` + const elementRelStdnt = document.querySelector('#relsel'); + if (!elementRelStdnt) return { found: false }; + const style = window.getComputedStyle(elementRelStdnt); + return { + found: true, + hidden: style.display === 'none', + display: style.display + }; + `); + //console.log('----->| DEBUG RelStdnt visibility:', JSON.stringify(visibility)); + + //Both label and dropdown are inside the same hideGrade div + //so we only need to check the parent container once + if (visibility.found && visibility.hidden) { + console.log('Passed: Related Standards dropdown is hidden as expected'); + console.log('Passed: Best Match dropdown is hidden as expected'); + } else { + errors.push(`Expected: Related Standards and Best Match dropdowns to be hidden; Actual: display="${visibility.display}"`); + } + + //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')); + } + } + }, + + //NEXT ACTION + { + description: 'Select Include Related Standards checkbox', + action: async () => { + await driver.findElement(By.css('#doRel')).click(); + await driver.sleep(2000); + console.log('----->| NEXT ACTION: Clicked Include Related Standards checkbox'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.col-auto .multiselect-selected-text')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Related Standards dropdown did not become visible within 20 seconds'); + + console.log('Passed: Related Standards dropdown loaded successfully'); + } + }, + + //NEXT ACTION + { + description: 'Validate alert message', + action: async () => { + const multipleChecks = 'Validate alert message'; + const errors = []; + + //Click delete button + const element = await driver.findElement(By.css('#stdsubmit')).click(); + await driver.sleep(5000); + console.log('----->| NEXT ACTION: Clicked Search button'); + + //Wait for confirm dialog to appear + const alert = await driver.wait(until.alertIsPresent(), 5000); + console.log('----->| NEXT ACTION: Alert dialog appeared as expected'); + + //Get alert text + const alertText = await alert.getText(); + + //Validate alert message text + const expectedText = 'You must select at least one set of related standards'; + if (alertText === expectedText) { + console.log('Passed: Alert dialog text matched as expected'); + } else { + errors.push(`Expected: "${expectedText}"; Actual: "${alertText}"`); + } + + //Throw summary before dismissing if errors found + if (errors.length > 0) { + await alert.dismiss(); //Cancel the delete if validation failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + + //Accept the alert (click OK) to proceed with deletion + await alert.accept(); + console.log('----->| NEXT ACTION: Clicked alert message OK button'); + await driver.sleep(2000); + } + }, + + //Related Standards dropdown + { + description: 'Validate Related Standards dropdown list and value', + action: async () => { + const multipleChecks = 'Related Standards dropdown list'; + + //Locate and validate selected (collapsed) value + const dropdownButton = await driver.findElement( + By.css('.col-auto .multiselect-selected-text') + ); + + //Open dropdown - use the element directly, not findElement again + await dropdownButton.click(); + await driver.sleep(2000); + console.log('----->| NEXT ACTION: Clicked Related Standards dropdown'); + + //Track all errors + const errors = []; + + //Get text, font, size, and color + const elementText = await dropdownButton.getText(); + const elementFont = await dropdownButton.getCssValue('font-family'); + const elementSize = await dropdownButton.getCssValue('font-size'); + const elementColor = await dropdownButton.getCssValue('color'); + + //text + if (elementText === 'None Selected') { + console.log("Passed: None Selected default option matched as expected"); + } else { + errors.push(`Expected option: "None Selected"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: None Selected default text font-family matched as expected'); + } else { + errors.push(`Expected: None Selected default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '16px') { + console.log('Passed: None Selected default text font-size matched as expected'); + } else { + errors.push(`Expected: None Selected default text font-size "16px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: None Selected default text color matched as expected'); + } else { + errors.push(`Expected: None Selected default text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //Wait for dropdown list to become visible + const dropdownMenu = await driver.wait( + until.elementLocated(By.css('ul.multiselect-container.dropdown-menu.show')), + 10000 + ); + + await driver.wait( + until.elementIsVisible(dropdownMenu), + 10000 + ); + + //Now safely get option labels + const optionLabels = await dropdownMenu.findElements( + By.css('li label.checkbox') + ); + + //Extract list values + const actualOptions = []; + for (const label of optionLabels) { + const text = (await label.getText()).trim(); + if (text) { + actualOptions.push(text); + } + } + + const expectedOptions = [ + 'Select all', + 'Alabama', + 'Arizona', + 'California', + 'Florida', + 'Georgia', + 'Illinois', + 'New York', + 'Texas', + 'Washington', + 'Common Core State Standards', + 'Alberta Standards', + 'Ontario Curriculum', + 'Australian Curriculum (ACARA) v8', + 'New South Wales', + 'NCSSFL-ACTFL CAN-DO STATEMENTS', + 'WIDA Consortium (2020)', + '5th Grade Import ECS-2732', + 'Imported Framework Updated', + 'ECS-2933 Testing On Prod', + 'Widget Test', + 'California Mathematics 1997', + 'Georgia Archived Language Arts QA', + 'Georgia Current Language Arts QA', + 'Georgia Future Language Arts QA', + 'create group test', + 'IMport Test' + ]; + + //Length validation + if (actualOptions.length !== expectedOptions.length) { + errors.push( + `Expected option count ${expectedOptions.length}; Actual ${actualOptions.length}` + ); + } + + //Value-by-value validation + expectedOptions.forEach((expected, i) => { + if (actualOptions[i] !== expected) { + errors.push( + `Index ${i}: Expected "${expected}", Actual "${actualOptions[i]}"` + ); + } + }); + + //Select "Washington" from dropdown + await driver.findElement(By.css('.show > li:nth-child(12) input')).click(); + await driver.sleep(2000); + + //Select "Common Core State Standards" from dropdown + await driver.findElement(By.css('.show > li:nth-child(14) input')).click(); + await driver.sleep(2000); + + //Select "California Mathematics 1997" from dropdown + await driver.findElement(By.css('.show > li:nth-child(34) input')).click(); + await driver.sleep(2000); + + console.log('----->| NEXT ACTION: Selected Related Standards: Washington, Common Core State Standards, California Mathematics 1997'); + + //Click away to close dropdown using executeScript to bypass interception + await driver.executeScript(` + document.querySelector('.col-auto .multiselect-selected-text').click(); + `); + await driver.sleep(2000); + + //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')); + } + } + }, + + //Selected Related Standards dropdown value + { + description: 'Validate Show Correlations From dropdown value', + action: async () => { + const multipleChecks = 'Show Correlations From dropdown value'; + const selectedOption = await driver.findElement(By.css('.col-auto .multiselect-selected-text')); + + //Get text, font, size, and color + const elementText = await selectedOption.getText(''); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Washington , Common Core State Standards , California Mathematics 1997') { + console.log("Passed: Selected Content Sets dropdown options matched as expected"); + } else { + errors.push(`Expected option: "Washington , Common Core State Standards , California Mathematics 1997"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Selected Content Sets dropdown text font-family matched as expected'); + } else { + errors.push(`Expected: Selected Content Sets dropdown text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '16px') { + console.log('Passed: Selected Content Sets dropdown text font-size matched as expected'); + } else { + errors.push(`Expected: Selected Content Sets dropdown text font-size "16px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Selected Content Sets dropdown text color matched as expected'); + } else { + errors.push(`Expected: Selected Content Sets dropdown text color "rgba(33, 37, 41, 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')); + } + } + }, + + //based on + { + description: 'Validate based on label text, font, size, and color', + action: async () => { + const multipleChecks = 'based on label'; + const element = await driver.findElement(By.css('.col-auto: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'based on') { + console.log("Passed: based on label text matched as expected"); + } else { + errors.push(`Expected: "based on" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: based on label font-family matched as expected'); + } else { + errors.push(`Expected: based on label font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: based on label text font-size matched as expected'); + } else { + errors.push(`Expected: based on label text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: based on label text color matched as expected'); + } else { + errors.push(`Expected: based on 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')); + } + } + }, + + //best match dropdown + { + description: 'Validate best match dropdown list and value', + action: async () => { + const multipleChecks = 'best match Dropdown List'; + const select = await driver.findElement(By.css('.custom-select')); + + //Get text, font, size, and color + const selectedOption = await select.findElement(By.css('option:checked')); + const elementText = await selectedOption.getText(); + const elementFont = await selectedOption.getCssValue('font-family'); + const elementSize = await selectedOption.getCssValue('font-size'); + const elementColor = await selectedOption.getCssValue('color'); + + //text + if (elementText === 'best match') { + console.log("Passed: best match default option matched as expected"); + } else { + errors.push(`Expected option: "best match"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: best match default text font-family matched as expected'); + } else { + errors.push(`Expected: best match default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: best match default text font-size matched as expected'); + } else { + errors.push(`Expected: best match default text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: best match default text color matched as expected'); + } else { + errors.push(`Expected: best match default text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + const options = await select.findElements(By.css('option')); + const expectedList = [ + 'best match', + 'similar text', + 'like concepts' + ]; + const actual = []; + + //Track all errors + const errors = []; + + for (const opt of options) { + const text = (await opt.getText()).trim(); + actual.push(text); + } + + if (JSON.stringify(actual) === JSON.stringify(expectedList)) { + console.log('Passed: best match Dropdown list matched as expected'); + } else { + errors.push(`Expected: best match Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`); + } + + //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')); + } + } + }, + + //Include Related Standards info icon | SPECIAL CASE {title data-original-title} + { + description: 'Validate info icon', + action: async () => { + const multipleChecks = 'info icon'; + const errors = []; + + //Get both text and styles in one executeScript call + const result = await driver.executeScript(` + const el = document.querySelector('[data-toggle="tooltip"][data-placement="right"]'); + if (!el) return null; + const style = window.getComputedStyle(el); + return { + tooltipText: el.getAttribute('data-original-title'), + fontFamily: style.getPropertyValue('font-family'), + fontSize: style.getPropertyValue('font-size'), + color: style.getPropertyValue('color'), + backgroundColor: style.getPropertyValue('background-color') + }; + `); + //console.log('----->| DEBUG result:', JSON.stringify(result)); + + //text + if (result.tooltipText === '"best match" uses a combination of similar text and like concepts') { + console.log('Passed: Tooltip text matched as expected'); + } else { + errors.push(`Expected: Tooltip text: '"best match" uses a combination of similar text and like concepts'; Actual: "${result.tooltipText}"`); + } + + //font + if (result.fontFamily === 'Poppins, sans-serif') { + console.log('Passed: Info icon text font-family matched as expected'); + } else { + errors.push(`Expected: Info icon font-family "Poppins, sans-serif"; Actual: "${result.fontFamily}"`); + } + + //size + if (result.fontSize === '13px') { + console.log('Passed: Info icon text font-size matched as expected'); + } else { + errors.push(`Expected: Info icon font-size "13px"; Actual: "${result.fontSize}"`); + } + + //color + if (result.color === 'rgb(40, 39, 90)') { + console.log('Passed: Info icon text color matched as expected'); + } else { + errors.push(`Expected: Info icon color rgb(40, 39, 90)"; Actual: "${result.color}"`); + } + + //background-color + if (result.backgroundColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Info icon background-color matched as expected'); + } else { + errors.push(`Expected: Info icon background-color "rgba(0, 0, 0, 0)"; Actual: "${result.backgroundColor}"`); + } + + //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')); + } + } + }, + + //note + { + description: 'Validate note text, font, size, and color', + action: async () => { + const multipleChecks = 'note label'; + const element = await driver.findElement(By.css('em')); + + //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 === '** note - including related standards may cause increased page load times') { + console.log("Passed: ** note text matched as expected"); + } else { + errors.push(`Expected: "** note - including related standards may cause increased page load times" label text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: ** note text font-family matched as expected'); + } else { + errors.push(`Expected: ** note text font-family "DM Serif Display, serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '10.4px') { + console.log('Passed: ** note text font-size matched as expected'); + } else { + errors.push(`Expected: **n ote text font-size "10.4px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: ** note text color matched as expected'); + } else { + errors.push(`Expected: ** note text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + errors.push(message) + } + + //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 Search button', + action: async () => { + await driver.findElement(By.css('#stdsubmit')).click(); + console.log('----->| NEXT ACTION: Clicked Search button'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Standards search page did not fully load within 30 seconds'); + console.log('Passed: Standards Search Page loaded successfully'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Standards breadcrumb label did not become visible within 20 seconds'); + + console.log('Passed: Standards breadcrumb label loaded successfully'); + } + }, + + ...myStandardsSearch_AlignedContent(driver), + +]; + +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', 'dashboardMyStandardsResults'); + + const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`; + const screenshotPath = path.join(dir, screenshotFileName); + fs.writeFileSync(screenshotPath, screenshot, 'base64'); + return screenshotPath; +}; + +const clearOldResults = () => { + //Remove old screenshots + const screenshotDir = path.join('screenshots', 'dashboardMyStandardsResults'); + if (fs.existsSync(screenshotDir)) { + fs.rmSync(screenshotDir, { recursive: true, force: true }); + } + fs.mkdirSync(screenshotDir, { recursive: true }); + + //Remove old Excel file + if (fs.existsSync('dashboardMyStandardsResults.xlsx')) { + fs.unlinkSync('dashboardMyStandardsResults.xlsx'); + } +}; + +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 { + await step.action(); + worksheet = logStep( + worksheet, + step.description, + 'Passed', + stepIndex, + timestamp, + null + ); + + } catch (error) { + 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: DASHBOARD - My Standards Widget (dashboardMyStandards); All test steps completed successfully'); + testStatus = 'Passed'; + } else { + console.log('------------->| THE END |<-------------'); + console.log('FAILED: DASHBOARD - My Standards Widget (dashboardMyStandards); 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, 'dashboardMyStandardsResults.xlsx'); +} finally { + await driver.quit(); +} + })(); +} + +export default dashboardMyStandards; diff --git a/tests/myStandardsSearchAlignedContent.js b/tests/myStandardsSearchAlignedContent.js new file mode 100644 index 0000000..4b65030 --- /dev/null +++ b/tests/myStandardsSearchAlignedContent.js @@ -0,0 +1,8412 @@ +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'; +import { brotliCompress } from 'zlib'; +import e from 'express'; + +//Export JUST the steps so other scripts can import them +export const myStandardsSearch_AlignedContent = (driver) => [ + { + description: 'Log Aligned Content start', + action: async () => { + console.log('------------->| MY STANDARDS - ALIGNED CONTENT |<-------------'); + } + }, + + //Search breadcrumb + { + description: 'Validate Search breadcrumb link text, font, size, and color', + action: async () => { + const multipleChecks = 'Search breadcrumb link'; + const element = await driver.findElement(By.linkText('Search')); + + //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 === 'Search') { + console.log("Passed: Search breadcrumb text link matched as expected"); + } else { + errors.push(`Expected: "Search" breadcrumb text link; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Search breadcrumb text link font-family matched as expected'); + } else { + errors.push(`Expected: Search breadcrumb text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Search breadcrumb text link font-size matched as expected'); + } else { + errors.push(`Expected: Search breadcrumb text link font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Search breadcrumb text link color matched as expected'); + } else { + errors.push(`Expected: Search breadcrumb text link color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standards breadcrumb + { + description: 'Validate Standards breadcrumb link text, font, size, and color', + action: async () => { + const multipleChecks = 'Standards breadcrum'; + const element = await driver.findElement(By.css('.breadcrumb-item: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Standards') { + console.log("Passed: Standards breadcrumb text link matched as expected"); + } else { + errors.push(`Expected: "Standards" breadcrumb text link; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standards breadcrumb text link font-family matched as expected'); + } else { + errors.push(`Expected: Standards breadcrumb text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standards breadcrumb text link font-size matched as expected'); + } else { + errors.push(`Expected: Standards breadcrumb text link font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Standards breadcrumb text link color matched as expected'); + } else { + errors.push(`Expected: Standards breadcrumb text link color "rgba(48, 200, 172, 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')); + } + } + }, + + //Save icon + { + description: 'Validate Save icon', + action: async () => { + const multipleChecks = 'Save icon'; + const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div.float-right.ml-1 > a:nth-child(1)')); + + const elementText = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Save icon present'); + } else { + errors.push('Save icon was not found'); + } + + //text + if (elementText === 'Save This Search') { + console.log('Passed: Save icon tool-tip matched as expected'); + } else { + errors.push(`Expected: Save icon tool-tip: "Save This Search"; Actual: "${elementText}"`); + } + + //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')); + } + } + }, + + //Print icon + { + description: 'Validate Print icon', + action: async () => { + const multipleChecks = 'Print icon'; + const element = await driver.findElement(By.css('.icon-link > img')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Print icon present'); + } else { + errors.push('Print icon was not found'); + } + + //text + if (elementText === 'Print This Page') { + console.log('Passed: Print icon tool-tip matched as expected'); + } else { + errors.push(`Expected: Print icon tool-tip: "Print This Page"; Actual: "${elementText}"`); + } + + //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')); + } + } + }, + + //Standard Set title + { + description: 'Validate Standard Set title text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Set title'; + const element = await driver.findElement(By.css('h1')); + + //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 === 'Alabama Courses of Study') { + console.log("Passed: Alabama Courses of Study Standard Set title text link matched as expected"); + } else { + errors.push(`Expected: "Alabama Courses of Study" Standard Set title text link; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Alabama Courses of Study Standard Set title text link font-family matched as expected'); + } else { + errors.push(`Expected: Alabama Courses of Study Standard Set title text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '18.2px') { + console.log('Passed: Alabama Courses of Study Standard Set title text link font-size matched as expected'); + } else { + errors.push(`Expected: Alabama Courses of Study Standard Set title text link font-size "18.2px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Alabama Courses of Study Standard Set title text link color matched as expected'); + } else { + errors.push(`Expected: Alabama Courses of Study Standard Set title text link 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')); + } + } + }, + + //SubjectGrade title + { + description: 'Validate SubjectGrade title text, font, size, and color', + action: async () => { + const multipleChecks = 'SubjectGrade title'; + const element = await driver.findElement(By.css('strong')); + + //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 === 'Mathematics - Grade 9') { + console.log("Passed: Mathematics - Grade 9 SubjectGrade title text link matched as expected"); + } else { + errors.push(`Expected: "Mathematics - Grade 9" SubjectGrade title text link; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link font-family matched as expected'); + } else { + errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link font-size matched as expected'); + } else { + errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link color matched as expected'); + } else { + errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link 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')); + } + } + }, + + //Info icon + { + description: 'Validate Info icon', + action: async () => { + const multipleChecks = 'Info icon'; + const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div:nth-child(5) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Info icon present'); + } else { + errors.push('Info icon was not found'); + } + + //text + if (elementText === 'Alignment Modification Help') { + console.log('Passed: Info icon tool-tip matched as expected'); + } else { + errors.push(`Expected: Info icon tool-tip: "Alignment Modification Help"; Actual: "${elementText}"`); + } + + //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')); + } + } + }, + + //Show All Correlations button + { + description: 'Validate Show All Correlations button text, size, and color', + action: async () => { + const multipleChecks = 'Show All Correlations button'; + const element = await driver.findElement(By.css('.btn-primary:nth-child(2)')); + + //Get text, font, size, and 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 === 'Show All Correlations') { + console.log('Passed: Show All Correlations button text matched as expected'); + } else { + errors.push(`Expected: "Show All Correlations"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Show All Correlations button text font-family matched as expected'); + } else { + errors.push(`Expected: Show All Correlations button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Show All Correlations button text font-size matched as expected'); + } else { + errors.push(`Expected: Show All Correlations button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Show All Correlations button text color matched as expected'); + } else { + errors.push(`Expected: Show All Correlations button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Show All Correlations button background color matched as expected'); + } else { + errors.push(`Expected: Show All Correlations 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')); + } + } + }, + + //Level 1 Standard title + { + description: 'Validate Level 1 Standard title text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Level 1 Standard title'; + const element = await driver.findElement(By.css('.card:nth-child(8) > .card-header')); + + //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 = []; + + //text + if (elementText === 'Mathematical Practices (Grade 9)') { + console.log("Passed: Mathematical Practices (Grade 9) Level 1 Standard title text matched as expected"); + } else { + errors.push(`Expected: "Mathematical Practices (Grade 9)" Level 1 Standard title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text font-family matched as expected'); + } else { + errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text font-size matched as expected'); + } else { + errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text color matched as expected'); + } else { + errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //background-color + if (elementBgColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title background color matched as expected'); + } else { + errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title background color "rgba(48, 200, 172, 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')); + } + } + }, + + //Standard Code 1 title + { + description: 'Validate Standard Code 1, title text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, title'; + const element = await driver.findElement(By.xpath('//div[2]/div/b')); + + //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 === 'MP1') { + console.log("Passed: Standard Code 1, title text matched as expected"); + } else { + errors.push(`Expected: "MP1" Standard Code 1, title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, title text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standard Code 1, title text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, title text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standard Code 1, title text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 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')); + } + } + }, + + //Standard Code 1 Description + { + description: 'Validate Standard Code 1, description text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, description'; + const element = await driver.findElement(By.id('stdbox')); + + //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.includes ('Make sense of problems and persevere in solving them. (Grade 9)')) { + console.log("Passed: Standard Code 1, description text matched as expected"); + } else { + errors.push(`Expected: "Make sense of problems and persevere in solving them. (Grade 9)" Standard Code 1, description text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, description text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, description text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standard Code 1, description text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, description text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standard Code 1, description text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, description 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')); + } + } + }, + + //Standard Code 1 Tools button + { + description: 'Validate Standard Code 1, Tools button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Tools button'; + const elementIcon = await driver.findElement(By.xpath(`//div[@id='stdbox']/div/div/button/i`)); + const element = await driver.findElement(By.css('#stdbox > div.pull-right > div > button')); + const elementExpandIcon = await driver.findElement(By.xpath(`(//button[@type='button'])[4]`)); + + //Get text, font, size, and 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 + if (elementIcon) { + console.log('Passed: Standard Code 1, tools button icon found') + } else { + errors.push('FAILED: Standard Code 1 tools button icon not found') + } + + //text + if (elementText === 'Tools') { + console.log('Passed: Standard Code 1, Tools button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, "Tools"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Tools button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tools button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '16px') { + console.log('Passed: Standard Code 1, Tools button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tools button text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Tools button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tools button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Standard Code 1, Tools button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tools button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`); + } + + //expand icon + if (elementExpandIcon) { + console.log('Passed: Standard Code 1, Tools expand button icon found') + } else { + errors.push('FAILED: Standard Code 1, Tools expand button icon not found') + } + + //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')); + } + } + }, + + //Standard Code 1 Aligned Content button + { + description: 'Validate Standard Code 1, Aligned Content 8 button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Aligned Content 8 button'; + const element = await driver.findElement(By.id('corr-1439152630-tab')); + const elementExpandIcon = await driver.findElement(By.id('colstate1439152630')); + + //Get text, font, size, and 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 === 'Aligned Content 8') { + console.log('Passed: Standard Code 1, Aligned Content 8 button text matched as expected'); + } else { + errors.push(`Expected: "Aligned Content 8"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Aligned Content 8 button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Aligned Content 8 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Standard Code 1, Aligned Content 8 button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Aligned Content 8 button text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Aligned Content 8 button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Aligned Content 8 button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standard Code 1, Aligned Content 8 button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Aligned Content 8 button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`); + } + + //expand icon + if (elementExpandIcon) { + console.log('Passed: Standard Code 1, Aligned Content 8 expand button icon found') + } else { + errors.push('FAILED: Standard Code 1, Aligned Content 8 expand button icon not found') + } + + //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')); + } + } + }, + + //Standard Code 1 Related Standards button + { + description: 'Validate Standard Code 1, Related Standards 26 button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Related Standards 26 button'; + const element = await driver.findElement(By.css('#rel-1439152630-tab')); + + //Get text, font, size, and 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 === 'Related Standards 26') { + console.log('Passed: Standard Code 1, Related Standards 26 button text matched as expected'); + } else { + errors.push(`Expected: "Related Standards 26"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Related Standards 26 button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Related Standards 26 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Standard Code 1, Related Standards 26 button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Related Standards 26 button text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Standard Code 1, Related Standards 26 button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Related Standards 26 button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, Related Standards 26 button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Related Standards 26 button background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + //Standard Code 1 Add Direct Alignment button + { + description: 'Validate Standard Code 1, Add Direct Alignment button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Add Direct Alignment button'; + const elementIcon = await driver.findElement(By.css('#add-1439152630-tab > .fa')); + const element = await driver.findElement(By.css('#add-1439152630-tab')); + + //Get text, font, size, and 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 + if (elementIcon) { + console.log('Passed: Standard Code 1, Add Direct Alignment button icon found') + } else { + errors.push('FAILED: Standard Code 1, Add Direct Alignment button icon not found') + } + + //text + if (elementText === 'Add Direct Alignment') { + console.log('Passed: Standard Code 1, Add Direct Alignment button text matched as expected'); + } else { + errors.push(`Expected: "Add Direct Alignment"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Add Direct Alignment button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Add Direct Alignment button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Standard Code 1, Add Direct Alignment button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Add Direct Alignment button text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Standard Code 1, Add Direct Alignment button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Add Direct Alignment button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, Add Direct Alignment button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Add Direct Alignment button background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + //NEXT ACTION + { + description: 'Click to expand Aligned Content for Standard Code 1', + action: async () => { + //Standard Code 1 Aligned Content + await driver.findElement(By.id('corr-1439152630-tab')).click(); + console.log('----->| NEXT ACTION: Clicked Standard Code 1 Aligned Content button'); + + //Wait until the element exists in the DOM + const openAlignmentNewWindow = await driver.wait( + until.elementLocated(By.css('#opennew1439152630')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(openAlignmentNewWindow), + 30000 + ); + } + }, + + //Standard Code 1 Open Alignments in New Window button + { + description: 'Validate Standard Code 1, Open Alignments in New Window button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1 Open Alignments in New Window button'; + const elementIcon = await driver.findElement(By.css('.fa-external-link')); + const element = await driver.findElement(By.css('#opennew1439152630')); + + //Get text, font, size, and 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 + if (elementIcon) { + console.log('Passed: Standard Code 1, Open Alignments in New Window button icon found') + } else { + errors.push('FAILED: Standard Code 1, Open Alignments in New Window button icon not found') + } + + //text + if (elementText === 'Open Alignments in New Window') { + console.log('Passed: Standard Code 1, Open Alignments in New Window button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, "Open Alignments in New Window"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Open Alignments in New Window button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, "Open Alignments in New Window" button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Open Alignments in New Window button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, "Open Alignments in New Window" button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Open Alignments in New Window button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, "Open Alignments in New Window" button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Standard Code 1, Open Alignments in New Window button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, "Open Alignments in New Window" 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')); + } + } + }, + + //Standard Code 1 Subject column header + { + description: 'Validate Standard Code 1, Subject column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1 Subject column header'; + const element = await driver.findElement(By.css('td > b')); + + //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 = []; + + //text + if (elementText === ('Algebra')) { + console.log("Passed: Standard Code 1, Subject column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Subject column header "Algebra" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Subject column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Subject column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Subject column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Subject column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, Subject column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Subject column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, Subject column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Subject column header text 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')); + } + } + }, + + //Standard Code 1, K column header + { + description: 'Validate Standard Code 1, K column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, K column header'; + const element = await driver.findElement(By.css('.text-center:nth-child(2)')); + + //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 = []; + + //text + if (elementText === ('K')) { + console.log("Passed: Standard Code 1, K column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, K column header "K" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, K column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, K column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, K column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, K column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, K column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, K column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, K column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, K column header text 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')); + } + } + }, + + //Standard Code 1, 1 column header + { + description: 'Validate Standard Code 1, 1 column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, 1 column header'; + const element = await driver.findElement(By.css('.text-center:nth-child(3)')); + + //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 = []; + + //text + if (elementText === ('1')) { + console.log("Passed: Standard Code 1, 1 column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, 1 column header "1" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, 1 column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 1 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, 1 column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 1 column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, 1 column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 1 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, 1 column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 1 column header text 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')); + } + } + }, + + //Standard Code 1, 2 column header + { + description: 'Validate Standard Code 1, 2 column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, 2 column header'; + const element = await driver.findElement(By.css('.text-center:nth-child(4)')); + + //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 = []; + + //text + if (elementText === ('2')) { + console.log("Passed: Standard Code 1, 2 column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, 2 column header "2" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, 2 column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 2 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, 2 column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 2 column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, 2 column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 2 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, 2 column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 2 column header text 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')); + } + } + }, + + //Standard Code 1, 3 column header + { + description: 'Validate Standard Code 1, 3 column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, 3 column header'; + const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5)')); + + //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 = []; + + //text + if (elementText === ('3')) { + console.log("Passed: Standard Code 1, 3 column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, 3 column header "3" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, 3 column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 3 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, 3 column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 3 column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, 3 column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 3 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, 3 column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 3 column header text 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')); + } + } + }, + + //Standard Code 1, 4 column header + { + description: 'Validate Standard Code 1, 4 column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, 4 column header'; + const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(6)')); + + //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 = []; + + //text + if (elementText === ('4')) { + console.log("Passed: Standard Code 1, 4 column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, 4 column header "4" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, 4 column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 4 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, 4 column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 4 column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, 4 column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 4 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, 4 column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 4 column header text 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')); + } + } + }, + + //Standard Code 1, 5 column header + { + description: 'Validate Standard Code 1, 5 column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, 5 column header'; + const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(7)')); + + //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 = []; + + //text + if (elementText === ('5')) { + console.log("Passed: Standard Code 1, 5 column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, 5 column header "5" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, 5 column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 5 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, 5 column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 5 column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, 5 column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 5 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, 5 column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 5 column header text 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')); + } + } + }, + + //Standard Code 1, 6 column header + { + description: 'Validate Standard Code 1, 6 column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, 6 column header'; + const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(8)')); + + //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 = []; + + //text + if (elementText === ('6')) { + console.log("Passed: Standard Code 1, 6 column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, 6 column header "6" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, 6 column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 6 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, 6 column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 6 column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, 6 column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 6 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, 6 column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 6 column header text 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')); + } + } + }, + + //Standard Code 1, 7 column header + { + description: 'Validate Standard Code 1, 7 column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, 7 column header'; + const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(9)')); + + //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 = []; + + //text + if (elementText === ('7')) { + console.log("Passed: Standard Code 1, 7 column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, 7 column header "7" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, 7 column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 7 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, 7 column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 7 column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, 7 column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 7 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, 7 column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 7 column header text 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')); + } + } + }, + + //Standard Code 1, 8 column header + { + description: 'Validate Standard Code 1, 8 column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, 8 column header'; + const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(10)')); + + //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 = []; + + //text + if (elementText === ('8')) { + console.log("Passed: Standard Code 1, 8 column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, 8 column header "8" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, 8 column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 8 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, 8 column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 8 column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, 8 column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 8 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, 8 column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 8 column header text 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')); + } + } + }, + + //Standard Code 1, 9 column header + { + description: 'Validate Standard Code 1, 9 column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, 9 column header'; + const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(11)')); + + //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 = []; + + //text + if (elementText === ('9')) { + console.log("Passed: Standard Code 1, 9 column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, 9 column header "9" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, 9 column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 9 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, 9 column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 9 column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, 9 column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 9 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(237, 250, 238, 1)') { + console.log('Passed: Standard Code 1, 9 column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 9 column header text background color "rgba(237, 250, 238, 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')); + } + } + }, + + //Standard Code 1, 10 column header + { + description: 'Validate Standard Code 1, 10 column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, 10 column header'; + const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(12)')); + + //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 = []; + + //text + if (elementText === ('10')) { + console.log("Passed: Standard Code 1, 10 column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, 10 column header "10" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, 10 column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 10 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, 10 column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 10 column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, 10 column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 10 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, 10 column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 10 column header text 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')); + } + } + }, + + //Standard Code 1, 11 column header + { + description: 'Validate Standard Code 1, 11 column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, 11 column header'; + const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(13)')); + + //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 = []; + + //text + if (elementText === ('11')) { + console.log("Passed: Standard Code 1, 11 column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, 11 column header "11" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, 11 column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 11 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, 11 column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 11 column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, 11 column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 11 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, 11 column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 11 column header text 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')); + } + } + }, + + //Standard Code 1, 12 column header + { + description: 'Validate Standard Code 1, 12 column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, 12 column header'; + const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(14)')); + + //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 = []; + + //text + if (elementText === ('12')) { + console.log("Passed: Standard Code 1, 12 column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, 12 column header "12" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, 12 column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 12 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, 12 column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 12 column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, 12 column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 12 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, 12 column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, 12 column header text 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')); + } + } + }, + + //Standard Code 1, Select column header + { + description: 'Validate Standard Code 1, Select column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, Select column header'; + const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(15)')); + + //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 = []; + + //text + if (elementText === ('Select')) { + console.log("Passed: Standard Code 1, Select column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Select column header "Select" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Select column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Select column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Select column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Select column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, Select column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Select column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, Select column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Select column header text 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')); + } + } + }, + + //Standard Code 1, Clear column header + { + description: 'Validate Standard Code 1, Clear column header text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, Clear column header'; + const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(16)')); + + //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 = []; + + //text + if (elementText === ('Clear')) { + console.log("Passed: Standard Code 1, Clear column header text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Clear column header "Clear" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Clear column header text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Clear column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Clear column header text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Clear column header text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, Clear column header text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Clear column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, Clear column header text background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Clear column header text 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')); + } + } + }, + + //Content Item 1, link title + { + description: 'Validate Content Item 1, link title text, font, size, color, and URL', + action: async () => { + const multipleChecks = 'Content Item 1 link title'; + const element = await driver.findElement(By.linkText('ANOVA 1: Calculating SST (total sum of squares) (Video2)')); + + //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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === ('ANOVA 1: Calculating SST (total sum of squares) (Video2)')) { + console.log("Passed: Content Item 1, link title text matched as expected"); + } else { + errors.push(`Expected: "ANOVA 1: Calculating SST (total sum of squares) (Video2)" Content Item 1, link title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Content Item 1, link title text font-family matched as expected'); + } else { + errors.push(`Expected: Content Item 1, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Content Item 1, link title text font-size matched as expected'); + } else { + errors.push(`Expected: Content Item 1, link title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content Item 1, link title text color matched as expected'); + } else { + errors.push(`Expected: Content Item 1, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`); + } + + //url + if (elementURL === 'https://www.khanacademy.org/math/statistics-probability/analysis-of-variance-anova-library/analysis-of-variance-anova/v/anova-1-calculating-sst-total-sum-of-squares') { + console.log('Passed: Content Item 1, link title URL matched as expected'); + } else { + errors.push(`Expected: Content Item 1, link title URL: "https://www.khanacademy.org/math/statistics-probability/analysis-of-variance-anova-library/analysis-of-variance-anova/v/anova-1-calculating-sst-total-sum-of-squares"; Actual: "${elementURL}"`); + } + + //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 Item 1, Info icon tool-tip + { + description: 'Validate Content Item 1, Info icon tool tip', + action: async () => { + const multipleChecks = 'Content Item 1, Info icon tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119834 > a:nth-child(2)')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 = []; + + //font + if (elementText === 'Click to view item description') { + console.log('Passed: Content Item 1, Info icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Content Item 1, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Content Item 1, Info icon tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Content Item 1, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Content Item 1, Info icon tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Content Item 1, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content Item 1, Info icon tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Content Item 1, Info icon tool-tip text color "rgba(73, 80, 87, 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 to info-icon for Standard Code 1', + action: async () => { + //Standard Code 1 Aligned Content + await driver.findElement(By.css('#title14391526301162119834 > a:nth-child(2)')).click(); + console.log('----->| NEXT ACTION: Clicked Standard Code 1 Info icon'); + + //Wait until the element exists in the DOM + const infoDescription = await driver.wait( + until.elementLocated(By.css('#descr14391526301162119834')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(infoDescription), + 30000 + ); + } + }, + + //Standard Code 1, Info description + { + description: 'Validate Standard Code 1, Info description text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Info description'; + const element = await driver.findElement(By.css('#descr14391526301162119834')); + + //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 === (`You already know a good bit about hypothesis testing with one or two samples. Now we take things further by making inferences based on three or more samples. We'll use the very special F-distribution to do it (F stands for "fabulous").`)) { + console.log("Passed: Standard Code 1, Description text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Description "You already know a good bit about hypothesis testing with one or two samples. Now we take things further by making inferences based on three or more samples. We'll use the very special F-distribution to do it (F stands for "fabulous")." text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Description text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Description text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '12.87px') { + console.log('Passed: Standard Code 1, Description text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Description text font-size "12.87px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, Description text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Description text color "rgba(33, 37, 41, 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')); + } + } + }, + + //Standard Code 1, Content Item 1, Primary badge + { + description: 'Validate Standard Code 1, Content Item 1, Primary badge text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 1, Primary badge'; + const element = await driver.findElement(By.css('#title14391526301162119834 > .badge')); + + //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 = []; + + //font + if (elementText === 'Primary') { + console.log('Passed: Standard Code 1, Content Item 1, Primary badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, Primary badge text font-family "Primary"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 1, Primary badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, Primary badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '12.87px') { + console.log('Passed: Standard Code 1, Content Item 1, Primary badge text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, Primary badge text font-size "12.87px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 1, Primary badge text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, Primary badge text color "rgba(255, 255, 255, 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')); + } + } + }, + + //Standard Code 1, Content Item 1, tags tool-tip + { + description: 'Validate Standard Code 1, Content Item 1, tags tool-tip text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 1, tags tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119834 > .fa')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 === ('View Matching Concepts')) { + console.log("Passed: Standard Code 1, Content Item 1, tags tool-tip text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'FontAwesome') { + console.log('Passed: Standard Code 1, Content Item 1, tags tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '20px') { + console.log('Passed: Standard Code 1, Content Item 1, tags tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 1, tags tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, tags tool-tip text color "rgba(73, 80, 87, 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 to tags icon for Standard Code 1', + action: async () => { + //Standard Code 1 Aligned Content + await driver.findElement(By.css('#title14391526301162119834 > .fa')).click(); + console.log('----->| NEXT ACTION: Clicked Standard Code 1 Tags icon'); + + //Wait until the element exists in the DOM + const tagsDescription = await driver.wait( + until.elementLocated(By.css('#concept_div14391526301162119834 > h6')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(tagsDescription), + 30000 + ); + } + }, + + //Standard Code 1, Tag Title + { + description: 'Validate Standard Code 1, Tag Title text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Tag Title'; + const element = await driver.findElement(By.css('#concept_div14391526301162119834 > h6')); + + //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 created by these matching concepts')) { + console.log("Passed: Standard Code 1, Tag Title text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Tag Title "Alignment created by these matching concepts" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Tag Title text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tag Title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14px') { + console.log('Passed: Standard Code 1, Tag Title text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tag Title text font-size "14px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, Tag Title text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tag Title text color "rgba(33, 37, 41, 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')); + } + } + }, + + //Standard Code 1, Concept 1 Primary toggle button + { + description: 'Verify Standard Code 1, Concept 1 Primary toggle button is present', + action: async () => { + const multipleChecks = 'Standard Code 1, Concept 1 Primary toggle button'; + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('#concept-1162119834-1439152630-168638762'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + + //Get the checkbox input's checked state + const checkboxChecked = await driver.findElement(By.css('#switch1162119834-1439152630-168638762')).getAttribute('checked'); + + //Track all errors + const errors = []; + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Standard Code 1, Concept 1, Primary toggle button toggle switch listed as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, Primary toggle button: "switch-toggle"; Actual: "${toggleClass}"`); + } + + //Validate toggle is disabled (not the primary concept) + if (!checkboxChecked) { + console.log('Passed: Standard Code 1, Concept 1, Primary toggle button is disabled as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, Primary toggle button to be disabled; Actual: checked="${checkboxChecked}"`); + } + + //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')); + } + } + }, + + //Standard Code 1, Concept 1 Tagged alignment 1 breadcrumb + { + description: 'Validate Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Concept 1 Tagged alignment 1 breadcrumb'; + const element = await driver.findElement(By.css('#concept-1162119834-1439152630-168638762 > 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === ('Mathematics | Process Standards | Problem Solving | Methods/Steps/Strategies')) { + console.log("Passed: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb "Mathematics | Process Standards | Problem Solving | Methods/Steps/Strategies" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '12px') { + console.log('Passed: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text font-size "12px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text color "rgba(33, 37, 41, 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 to delete tagged concept 1', + action: async () => { + //Standard Code 1 Aligned Content + await driver.findElement(By.css('#concept-1162119834-1439152630-168638762 .fa')).click(); + console.log('----->| NEXT ACTION: Clicked Standard Code 1, Tagged Concept 1 delete icon'); + + //Wait until the element exists in the DOM + const removeConceptDIV = await driver.wait( + until.elementLocated(By.css('#toast-1162119834-1439152630-168638762 .mr-auto')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(removeConceptDIV), + 30000 + ); + } + }, + + //Standard Code 1, Concept 1, tagged alert DIV + { + description: 'Validate Standard Code 1, Concept 1, tagged alert DIV text, font, size, color, background color, and delete icon', + action: async () => { + const multipleChecks = 'Standard Code 1, Concept 1, tagged alert DIV'; + const element = await driver.findElement(By.css('#toast-1162119834-1439152630-168638762 .mr-auto')); + const elementIcon = await driver.findElement(By.css('#toast-1162119834-1439152630-168638762 span')); + + //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 = []; + + //text + if (elementText === ('Remove Concept')) { + console.log("Passed: Standard Code 1, Concept 1, tagged alert DIV title text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV title "Remove Concept" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV title text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '10px') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV title text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV title text font-size "10px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV title text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV title text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //background color + if (elementBgColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV title background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV title background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`); + } + + //close icon + if (elementIcon) { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV delete icon is present as expected'); + } else { + errors.push('Expected: Standard Code 1, Concept 1, tagged alert DIV delete icon was not found'); + } + + //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')); + } + } + }, + + //Standard Code 1, Concept 1, tagged alert DIV warning message + { + description: 'Validate Standard Code 1, Concept 1, tagged alert DIV warning message text, font, size, color, background color, and delete icon', + action: async () => { + const multipleChecks = 'Standard Code 1, Concept 1, tagged alert DIV warning message'; + const element = await driver.findElement(By.css('#toast-1162119834-1439152630-168638762 > .toast-body > div')); + const elementYesButton = await driver.findElement(By.css('#toast-1162119834-1439152630-168638762 > .toast-body > button:nth-child(2)')); + const elementNoButton = await driver.findElement(By.css('#toast-1162119834-1439152630-168638762 .btn')); + + //Get warning message 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'); + + //Get Yes button text, font, size, color, and background color + const elementYesText = await elementYesButton.getText(); + const elementYesFont = await elementYesButton.getCssValue('font-family'); + const elementYesSize = await elementYesButton.getCssValue('font-size'); + const elementYesColor = await elementYesButton.getCssValue('color'); + const elementYesBgColor = await elementYesButton.getCssValue('background-color'); + + //Get No button text, font, size, color, and background color + const elementNoText = await elementNoButton.getText(); + const elementNoFont = await elementNoButton.getCssValue('font-family'); + const elementNoSize = await elementNoButton.getCssValue('font-size'); + const elementNoColor = await elementNoButton.getCssValue('color'); + const elementNoBgColor = await elementNoButton.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //warning text + if (elementText === ('Are you sure you want to remove this concept from this item? This will affect alignments on other standards as well.')) { + console.log("Passed: Standard Code 1, Concept 1, tagged alert DIV warning message text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV warning message "Are you sure you want to remove this concept from this item? This will affect alignments on other standards as well." text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV warning message text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV warning message text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '12px') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV warning message text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV warning message text font-size "12px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV warning message text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV warning message text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`); + } + + //yes button text + if (elementYesText === ('Yes')) { + console.log("Passed: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV Yes warning button "Yes" text; Actual: "${elementYesText}"`); + } + + //font + if (elementYesFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text font-family "Poppins, sans-serif"; Actual: ${elementYesFont}`); + } + + //size + if (elementYesSize === '10px') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text font-size "10px"; Actual: "${elementYesSize}"`); + } + + //color + if (elementYesColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text color "rgba(255, 255, 255, 1)"; Actual: "${elementYesColor}"`); + } + + //background color + if (elementYesBgColor === 'rgba(255, 26, 26, 1)') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV Yes warning button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV Yes warning button background color "rgba(255, 26, 26, 1)"; Actual: "${elementYesBgColor}"`); + } + + //no button text + if (elementNoText === ('No')) { + console.log("Passed: Standard Code 1, Concept 1, tagged alert DIV No warning button text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV No warning button "No" text; Actual: "${elementNoText}"`); + } + + //font + if (elementNoFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV No warning button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV No warning button text font-family "Poppins, sans-serif"; Actual: ${elementNoFont}`); + } + + //size + if (elementNoSize === '10px') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV No warning button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV No warning button text font-size "10px"; Actual: "${elementNoSize}"`); + } + + //color + if (elementNoColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV No warning button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV No warning button text color "rgba(255, 255, 255, 1)"; Actual: "${elementNoColor}"`); + } + + //background color + if (elementNoBgColor === 'rgba(255, 26, 26, 1)') { + console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV No warning button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV No warning button background color "rgba(255, 26, 26, 1)"; Actual: "${elementNoBgColor}"`); + } + + //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 X icon to close warning message for tagged concept 1', + action: async () => { + //Standard Code 1 Aligned Content + await driver.findElement(By.css('#toast-1162119834-1439152630-168638762 span')).click(); + console.log('----->| NEXT ACTION: Clicked X icon'); + await driver.sleep(2000); + } + }, + + //Standard Code 1, Concept 2, Primary toggle button + { + description: 'Verify Standard Code 1, Concept 2, Primary toggle button is present', + action: async () => { + const multipleChecks = 'Standard Code 1, Concept 2 Primary toggle button'; + + //Get the switch-toggle div class + const toggleClass = await driver.executeScript(` + const listItem = document.querySelector('#concept-1162119834-1439152630-168638753'); + const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null; + return toggle ? toggle.className : 'not found'; + `); + + //Get the checkbox input's checked state + const checkboxChecked = await driver.findElement(By.css('#switch1162119834-1439152630-168638753')).getAttribute('checked'); + + //Track all errors + const errors = []; + + //Validate it's a toggle not a regular button + if (toggleClass.includes('switch-toggle')) { + console.log('Passed: Standard Code 1, Concept 2, Primary toggle button toggle switch listed as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 2, Primary toggle button: "switch-toggle"; Actual: "${toggleClass}"`); + } + + //Validate toggle is enabled (primary concept) + if (checkboxChecked) { + console.log('Passed: Standard Code 1, Concept 2, Primary toggle button is enabled as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 2, Primary toggle button to be enabled; Actual: checked="${checkboxChecked}"`); + } + + //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')); + } + } + }, + + //Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb + { + description: 'Validate Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb'; + const element = await driver.findElement(By.css('#concept-1162119834-1439152630-168638753 > 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'); + + //Track all errors + const errors = []; + + //text + if (elementText === ('Mathematics | Process Standards | Computation | Methods/Steps/Strategies')) { + console.log("Passed: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb "Mathematics | Process Standards | Computation | Methods/Steps/Strategies" text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '12px') { + console.log('Passed: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text font-size "12px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(33, 37, 41, 1)') { + console.log('Passed: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text color "rgba(33, 37, 41, 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')); + } + } + }, + + //Standard Code 1, Content Item 1, Grade 3 checkmark + { + description: 'Validate Standard Code 1, Content Item 1, Grade 3 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 1_1439151975_1162119834 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 1, Grade 3 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 1, Grade 3 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 1, Grade 4 checkmark + { + description: 'Validate Standard Code 1, Content Item 1, Grade 4 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 3_1439152039_1162119834 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 1, Grade 4 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 1, Grade 4 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 1, Grade 5 checkmark + { + description: 'Validate Standard Code 1, Content Item 1, Grade 5 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 4_1439152120_1162119834 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 1, Grade 5 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 1, Grade 5 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 1, Grade 6 checkmark + { + description: 'Validate Standard Code 1, Content Item 1, Grade 6 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 5_1439152196_1162119834 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 1, Grade 6 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 1, Grade 6 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 1, Grade 7 checkmark + { + description: 'Validate Standard Code 1, Content Item 1, Grade 7 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 7_1439152274_1162119834 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 1, Grade 7 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 1, Grade 7 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 1, Grade 8 checkmark + { + description: 'Validate Standard Code 1, Content Item 1, Grade 8 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 8_1439152451_1162119834 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 1, Grade 8 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 1, Grade 8 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 1, Grade 9 checkmark + { + description: 'Validate Standard Code 1, Content Item 1, Grade 9 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119834 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 1, Grade 9 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 1, Grade 9 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 1, Grade 10 checkmark + { + description: 'Validate Standard Code 1, Content Item 1, Grade 10 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119834 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 1, Grade 10 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 1, Grade 10 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 1, Grade 11 checkmark + { + description: 'Validate Standard Code 1, Content Item 1, Grade 11 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119834 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 1, Grade 11 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 1, Grade 11 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 1, Grade 12 checkmark + { + description: 'Validate Standard Code 1, Content Item 1, Grade 12 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119834 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 1, Grade 12 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 1, Grade 12 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 1, All button + { + description: 'Validate Standard Code 1, Content Item 1, All button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 1, All button'; + const element = await driver.findElement(By.css('#tr14391526301162119834 > .align-middle:nth-child(15) > .btn')); + + //Get text, font, size, and 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 === 'All') { + console.log('Passed: Standard Code 1, Content Item 1, All button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, All button text "All"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 1, All button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 1, All button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, All button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 1, All button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 1, All button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, All button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 1, Clear button + { + description: 'Validate Standard Code 1, Content Item 1, Clear button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 1, Clear button'; + const element = await driver.findElement(By.css('#tr14391526301162119834 > .align-middle:nth-child(16) > .btn')); + + //Get text, font, size, and 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 === 'Clear') { + console.log('Passed: Standard Code 1, Content Item 1, Clear button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, Clear button text "Clear"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 1, Clear button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 1, Clear button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, Clear button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 1, Clear button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 1, Clear button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 1, Clear button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 2, link title + { + description: 'Validate Standard Code 1, Content Item 2, link title text, font, size color, and URL', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 2, link title'; + const element = await driver.findElement(By.linkText('Adding complex numbers (Video)')); + + //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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === ('Adding complex numbers (Video)')) { + console.log("Passed: Standard Code 1, Content Item 2, link title text matched as expected"); + } else { + errors.push(`Expected: "Adding complex numbers (Video)" Standard Code 1, Content Item 2, link title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 2, link title text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 2, link title text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, link title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(212, 20, 90, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, link title text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, link title text color "rgba(212, 20, 90, 1)"; Actual: "${elementColor}"`); + } + + //url + if (elementURL === 'https://www.khanacademy.org/math/algebra2-2018/introduction-to-complex-numbers-algebra-2/adding-and-subtracting-complex-numbers-algebra-2/v/adding-complex-numbers') { + console.log('Passed: Standard Code 1, Content Item 2, link title URL matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, link title URL: "https://www.khanacademy.org/math/algebra2-2018/introduction-to-complex-numbers-algebra-2/adding-and-subtracting-complex-numbers-algebra-2/v/adding-complex-numbers"; Actual: "${elementURL}"`); + } + + //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')); + } + } + }, + + //Standard Code 1, Content Item 2, Info icon tool-tip + { + description: 'Validate Standard Code 1, Content Item 2, Info icon tool tip', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 2, Info icon tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119834 > a:nth-child(2)')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 = []; + + //font + if (elementText === 'Click to view item description') { + console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 2, Primary badge + { + description: 'Validate Standard Code 1, Content Item 2, Primary badge text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 2, Primary badge'; + const element = await driver.findElement(By.css('#title14391526301162119829 > .badge')); + + //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 = []; + + //font + if (elementText === 'Primary') { + console.log('Passed: Standard Code 1, Content Item 2, Primary badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text font-family "Primary"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 2, Primary badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '12.87px') { + console.log('Passed: Standard Code 1, Content Item 2, Primary badge text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text font-size "12.87px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, Primary badge text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text color "rgba(255, 255, 255, 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')); + } + } + }, + + //Standard Code 1, Content Item 2, hidden badge + { + description: 'Validate Standard Code 1, Content Item 2, hidden badge text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 2, hidden badge'; + const element = await driver.findElement(By.css('.badge-danger')); + + //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 = []; + + //font + if (elementText === 'hidden') { + console.log('Passed: Standard Code 1, Content Item 2, hidden badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, hidden badge text font-family "hidden"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 2, hidden badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, hidden badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '12.87px') { + console.log('Passed: Standard Code 1, Content Item 2, hidden badge text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, hidden badge text font-size "12.87px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, hidden badge text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, hidden badge text color "rgba(255, 255, 255, 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')); + } + } + }, + + //Standard Code 1, Content Item 2, tags tool-tip + { + description: 'Validate Standard Code 1, Content Item 2, tags tool-tip text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 2, tags tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119829 > .fa')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 === ('View Matching Concepts')) { + console.log("Passed: Standard Code 1, Content Item 2, tags tool-tip text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'FontAwesome') { + console.log('Passed: Standard Code 1, Content Item 2, tags tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '20px') { + console.log('Passed: Standard Code 1, Content Item 2, tags tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, tags tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 2, Grade 9 pause + { + description: 'Validate Standard Code 1, Content Item 2, Grade 9 pause icon', + action: async () => { + const element = await driver.findElement(By.css('.fa-pause-circle')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 2, Grade 9 pause icon was found'); + } else { + errors.push('Standard Code 1, Content Item 2, Grade 9 pause icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 2, Grade 10 checkmark + { + description: 'Validate Standard Code 1, Content Item 2, Grade 10 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119829 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 2, Grade 10 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 2, Grade 10 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 2, Grade 11 checkmark + { + description: 'Validate Standard Code 1, Content Item 2, Grade 11 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119829 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 2, Grade 11 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 2, Grade 11 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 2, Grade 12 checkmark + { + description: 'Validate Standard Code 1, Content Item 2, Grade 12 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119829 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 2, Grade 12 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 2, Grade 12 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 2, All button + { + description: 'Validate Standard Code 1, Content Item 2, All button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 2, All button'; + const element = await driver.findElement(By.css('#tr14391526301162119829 > .align-middle:nth-child(15) > .btn')); + + //Get text, font, size, and 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 === 'All') { + console.log('Passed: Standard Code 1, Content Item 2, All button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, All button text "All"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 2, All button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 2, All button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, All button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, All button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, All button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, All button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 2, Clear button + { + description: 'Validate Standard Code 1, Content Item 2, Clear button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 2, Clear button'; + const element = await driver.findElement(By.css('#tr14391526301162119829 > .align-middle:nth-child(16) > .btn')); + + //Get text, font, size, and 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 === 'Clear') { + console.log('Passed: Standard Code 1, Content Item 2, Clear button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text "Clear"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 2, Clear button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 2, Clear button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, Clear button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, Clear button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Clear button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //NEXT ACTION + { + description: 'Click Standard Code 1, Content Item 2, Grade 9 pause icon', + action: async () => { + const element = await driver.findElement(By.css('.badge-danger')).catch(() => false); + + await driver.findElement(By.css('.fa-pause-circle')).click(); + console.log('----->| NEXT ACTION: Click Standard Code 1, Content Item 2, Grade 9 pause icon'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Search/Standards page did not fully load 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 spinner did not disappear within 30 seconds'); + + //Element may be removed from the DOM entirely or just hidden via CSS - handle both + if (element) { + await driver.wait(async () => { + try { + return !(await element.isDisplayed()); + } catch (e) { + return true; //Stale reference means it was removed from the DOM + } + }, 5000, 'Standard Code 1, Content Item 2, hidden icon did not disappear as expected'); + } + console.log('Passed: Standard Code 1, Content Item 2, hidden icon disappeared as expected'); + } + }, + + //Standard Code 1, Content Item 2, link title + { + description: 'Validate Standard Code 1, Content Item 2, link title text, font, size color, and URL', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 2, link title'; + const element = await driver.findElement(By.linkText('Adding complex numbers (Video)')); + + //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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === ('Adding complex numbers (Video)')) { + console.log("Passed: Standard Code 1, Content Item 2, link title text matched as expected"); + } else { + errors.push(`Expected: "Adding complex numbers (Video)" Standard Code 1, Content Item 2, link title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 2, link title text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 2, link title text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, link title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, link title text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`); + } + + //url + if (elementURL === 'https://www.khanacademy.org/math/algebra2-2018/introduction-to-complex-numbers-algebra-2/adding-and-subtracting-complex-numbers-algebra-2/v/adding-complex-numbers') { + console.log('Passed: Standard Code 1, Content Item 2, link title URL matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, link title URL: "https://www.khanacademy.org/math/algebra2-2018/introduction-to-complex-numbers-algebra-2/adding-and-subtracting-complex-numbers-algebra-2/v/adding-complex-numbers"; Actual: "${elementURL}"`); + } + + //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')); + } + } + }, + + //Standard Code 1, Content Item 2, Info icon tool-tip + { + description: 'Validate Standard Code 1, Content Item 2, Info icon tool tip', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 2, Info icon tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119834 > a:nth-child(2)')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 = []; + + //font + if (elementText === 'Click to view item description') { + console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 2, Primary badge + { + description: 'Validate Standard Code 1, Content Item 2, Primary badge text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 2, Primary badge'; + const element = await driver.findElement(By.css('#title14391526301162119829 > .badge')); + + //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 = []; + + //font + if (elementText === 'Primary') { + console.log('Passed: Standard Code 1, Content Item 2, Primary badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text font-family "Primary"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 2, Primary badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '12.87px') { + console.log('Passed: Standard Code 1, Content Item 2, Primary badge text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text font-size "12.87px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, Primary badge text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text color "rgba(255, 255, 255, 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')); + } + } + }, + + //Standard Code 1, Content Item 2, tags tool-tip + { + description: 'Validate Standard Code 1, Content Item 2, tags tool-tip text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 2, tags tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119829 > .fa')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 === ('View Matching Concepts')) { + console.log("Passed: Standard Code 1, Content Item 2, tags tool-tip text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'FontAwesome') { + console.log('Passed: Standard Code 1, Content Item 2, tags tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '20px') { + console.log('Passed: Standard Code 1, Content Item 2, tags tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, tags tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 2, Grade 9 checkmark + { + description: 'Validate Standard Code 1, Content Item 2, Grade 9 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119829 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 2, Grade 9 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 2, Grade 9 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 2, Grade 10 checkmark + { + description: 'Validate Standard Code 1, Content Item 2, Grade 10 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119829 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 2, Grade 10 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 2, Grade 10 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 2, Grade 11 checkmark + { + description: 'Validate Standard Code 1, Content Item 2, Grade 11 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119829 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 2, Grade 11 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 2, Grade 11 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 2, Grade 12 checkmark + { + description: 'Validate Standard Code 1, Content Item 2, Grade 12 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119829 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 2, Grade 12 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 2, Grade 12 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 2, All button + { + description: 'Validate Standard Code 1, Content Item 2, All button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 2, All button'; + const element = await driver.findElement(By.css('#tr14391526301162119829 > .align-middle:nth-child(15) > .btn')); + + //Get text, font, size, and 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 === 'All') { + console.log('Passed: Standard Code 1, Content Item 2, All button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, All button text "All"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 2, All button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 2, All button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, All button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, All button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, All button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, All button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 2, Clear button + { + description: 'Validate Standard Code 1, Content Item 2, Clear button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 2, Clear button'; + const element = await driver.findElement(By.css('#tr14391526301162119829 > .align-middle:nth-child(16) > .btn')); + + //Get text, font, size, and 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 === 'Clear') { + console.log('Passed: Standard Code 1, Content Item 2, Clear button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text "Clear"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 2, Clear button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 2, Clear button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, Clear button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 2, Clear button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 2, Clear button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + + + + //Standard Code 1, Content Item 3, link title + { + description: 'Validate Standard Code 1, Content Item 3, link title text, font, size color, and URL', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 3, link title'; + const element = await driver.findElement(By.linkText('Analyzing event probability for independence (Video)')); + + //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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === ('Analyzing event probability for independence (Video)')) { + console.log("Passed: Standard Code 1, Content Item 3, link title text matched as expected"); + } else { + errors.push(`Expected: "Analyzing event probability for independence (Video)" Standard Code 1, Content Item 3, link title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 3, link title text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 3, link title text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, link title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 3, link title text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`); + } + + //url + if (elementURL === 'https://www.khanacademy.org/math/statistics-probability/probability-library/conditional-probability-independence/v/independent-dependent-probability') { + console.log('Passed: Standard Code 1, Content Item 3, link title URL matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, link title URL: "https://www.khanacademy.org/math/statistics-probability/probability-library/conditional-probability-independence/v/independent-dependent-probability"; Actual: "${elementURL}"`); + } + + //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')); + } + } + }, + + //Standard Code 1, Content Item 3, Info icon tool-tip + { + description: 'Validate Standard Code 1, Content Item 3, Info icon tool tip', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 3, Info icon tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119831 > a:nth-child(2)')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 = []; + + //font + if (elementText === 'Click to view item description') { + console.log('Passed: Standard Code 1, Content Item 3, Info icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 3, Info icon tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 3, Info icon tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 3, Info icon tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, Info icon tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 3, tags tool-tip + { + description: 'Validate Standard Code 1, Content Item 3, tags tool-tip text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 3, tags tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119831 > .fa')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 === ('View Matching Concepts')) { + console.log("Passed: Standard Code 1, Content Item 3, tags tool-tip text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'FontAwesome') { + console.log('Passed: Standard Code 1, Content Item 3, tags tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '20px') { + console.log('Passed: Standard Code 1, Content Item 3, tags tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 3, tags tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, tags tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 3, Grade 9 checkmark + { + description: 'Validate Standard Code 1, Content Item 3, Grade 9 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119831 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 3, Grade 9 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 3, Grade 9 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 3, Grade 10 checkmark + { + description: 'Validate Standard Code 1, Content Item 3, Grade 10 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119831 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 3, Grade 10 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 3, Grade 10 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 3, Grade 11 checkmark + { + description: 'Validate Standard Code 1, Content Item 3, Grade 11 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119831 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 3, Grade 11 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 3, Grade 11 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 3, Grade 12 checkmark + { + description: 'Validate Standard Code 1, Content Item 3, Grade 12 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119831 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 3, Grade 12 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 3, Grade 12 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 3, All button + { + description: 'Validate Standard Code 1, Content Item 3, All button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 3, All button'; + const element = await driver.findElement(By.css('#tr14391526301162119831 > .align-middle:nth-child(15) > .btn')); + + //Get text, font, size, and 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 === 'All') { + console.log('Passed: Standard Code 1, Content Item 3, All button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, All button text "All"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 3, All button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 3, All button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, All button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 3, All button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 3, All button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, All button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 3, Clear button + { + description: 'Validate Standard Code 1, Content Item 3, Clear button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 3, Clear button'; + const element = await driver.findElement(By.css('#tr14391526301162119831 > .align-middle:nth-child(16) > .btn')); + + //Get text, font, size, and 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 === 'Clear') { + console.log('Passed: Standard Code 1, Content Item 3, Clear button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, Clear button text "Clear"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 3, Clear button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 3, Clear button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, Clear button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 3, Clear button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 3, Clear button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 3, Clear button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 4, link title + { + description: 'Validate Standard Code 1, Content Item 4, link title text, font, size color, and URL', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 4, link title'; + const element = await driver.findElement(By.linkText('Angle relationships example (Video)')); + + //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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === ('Angle relationships example (Video)')) { + console.log("Passed: Standard Code 1, Content Item 4, link title text matched as expected"); + } else { + errors.push(`Expected: "Angle relationships example (Video)" Standard Code 1, Content Item 4, link title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 4, link title text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 4, link title text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, link title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 4, link title text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`); + } + + //url + if (elementURL === 'https://www.khanacademy.org/math/geometry-home/geometry-angles/geometry-vert-comp-supp/v/vertical-adjacent-and-linearly-paired-angles') { + console.log('Passed: Standard Code 1, Content Item 4, link title URL matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, link title URL: "https://www.khanacademy.org/math/geometry-home/geometry-angles/geometry-vert-comp-supp/v/vertical-adjacent-and-linearly-paired-angles"; Actual: "${elementURL}"`); + } + + //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')); + } + } + }, + + //Standard Code 1, Content Item 4, Info icon tool-tip + { + description: 'Validate Standard Code 1, Content Item 4, Info icon tool tip', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 4, Info icon tool-tip'; + const element = await driver.findElement(By.css ('#title14391526301162119832 > a:nth-child(2)')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 = []; + + //font + if (elementText === 'Click to view item description') { + console.log('Passed: Standard Code 1, Content Item 4, Info icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 4, Info icon tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 4, Info icon tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 4, Info icon tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, Info icon tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 4, tags tool-tip + { + description: 'Validate Standard Code 1, Content Item 4, tags tool-tip text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 4, tags tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119832 > .fa')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 === ('View Matching Concepts')) { + console.log("Passed: Standard Code 1, Content Item 4, tags tool-tip text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'FontAwesome') { + console.log('Passed: Standard Code 1, Content Item 4, tags tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '20px') { + console.log('Passed: Standard Code 1, Content Item 4, tags tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 4, tags tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, tags tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 4, Grade 9 checkmark + { + description: 'Validate Standard Code 1, Content Item 4, Grade 9 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119832 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 4, Grade 9 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 4, Grade 9 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 4, Grade 10 checkmark + { + description: 'Validate Standard Code 1, Content Item 4, Grade 10 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119832 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 4, Grade 10 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 4, Grade 10 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 4, Grade 11 checkmark + { + description: 'Validate Standard Code 1, Content Item 4, Grade 11 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119832 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 4, Grade 11 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 4, Grade 11 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 4, Grade 12 checkmark + { + description: 'Validate Standard Code 1, Content Item 4, Grade 12 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119832 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 4, Grade 12 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 4, Grade 12 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 4, All button + { + description: 'Validate Standard Code 1, Content Item 4, All button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 4, All button'; + const element = await driver.findElement(By.css('#tr14391526301162119832 > .align-middle:nth-child(15) > .btn')); + + //Get text, font, size, and 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 === 'All') { + console.log('Passed: Standard Code 1, Content Item 4, All button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, All button text "All"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 4, All button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 4, All button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, All button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 4, All button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 4, All button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, All button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 4, Clear button + { + description: 'Validate Standard Code 1, Content Item 4, Clear button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 4, Clear button'; + const element = await driver.findElement(By.css('#tr14391526301162119832 > .align-middle:nth-child(16) > .btn')); + + //Get text, font, size, and 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 === 'Clear') { + console.log('Passed: Standard Code 1, Content Item 4, Clear button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, Clear button text "Clear"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 4, Clear button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 4, Clear button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, Clear button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 4, Clear button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 4, Clear button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 4, Clear button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 5, link title + { + description: 'Validate Standard Code 1, Content Item 5, link title text, font, size color, and URL', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 5, link title'; + const element = await driver.findElement(By.linkText('Arctic Tern')); + + //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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === ('Arctic Tern')) { + console.log("Passed: Standard Code 1, Content Item 5, link title text matched as expected"); + } else { + errors.push(`Expected: "Arctic Tern" Standard Code 1, Content Item 5, link title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 5, link title text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 5, link title text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, link title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 5, link title text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`); + } + + //url + if (elementURL === 'https://www.nationalgeographic.org/media/tern-wings/') { + console.log('Passed: Standard Code 1, Content Item 5, link title URL matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, link title URL: "https://www.nationalgeographic.org/media/tern-wings/"; Actual: "${elementURL}"`); + } + + //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')); + } + } + }, + + //Standard Code 1, Content Item 5, Info icon tool-tip + { + description: 'Validate Standard Code 1, Content Item 5, Info icon tool tip', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 5, Info icon tool-tip'; + const element = await driver.findElement(By.css ('#title14391526301162119835 > a:nth-child(2)')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 = []; + + //font + if (elementText === 'Click to view item description') { + console.log('Passed: Standard Code 1, Content Item 5, Info icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 5, Info icon tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 5, Info icon tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 5, Info icon tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, Info icon tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 5, tags tool-tip + { + description: 'Validate Standard Code 1, Content Item 5, tags tool-tip text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 5, tags tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119835 > .fa')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 === ('View Matching Concepts')) { + console.log("Passed: Standard Code 1, Content Item 5, tags tool-tip text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'FontAwesome') { + console.log('Passed: Standard Code 1, Content Item 5, tags tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '20px') { + console.log('Passed: Standard Code 1, Content Item 5, tags tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 5, tags tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, tags tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 5, Grade 6 checkmark + { + description: 'Validate Standard Code 1, Content Item 5, Grade 6 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 5_1439152196_1162119835 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 5, Grade 6 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 5, Grade 6 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 5, Grade 7 checkmark + { + description: 'Validate Standard Code 1, Content Item 5, Grade 7 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 7_1439152274_1162119835 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 5, Grade 7 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 5, Grade 7 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 5, Grade 8 checkmark + { + description: 'Validate Standard Code 1, Content Item 5, Grade 8 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 8_1439152451_1162119835 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 5, Grade 8 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 5, Grade 8 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 5, Grade 9 checkmark + { + description: 'Validate Standard Code 1, Content Item 5, Grade 9 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119835 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 5, Grade 9 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 5, Grade 9 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 5, Grade 10 checkmark + { + description: 'Validate Standard Code 1, Content Item 5, Grade 10 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119835 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 5, Grade 10 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 5, Grade 10 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 5, Grade 11 checkmark + { + description: 'Validate Standard Code 1, Content Item 5, Grade 11 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119835 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 5, Grade 11 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 5, Grade 11 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 5, Grade 12 checkmark + { + description: 'Validate Standard Code 1, Content Item 5, Grade 12 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119835 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 5, Grade 12 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 5, Grade 12 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 5, All button + { + description: 'Validate Standard Code 1, Content Item 5, All button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 5, All button'; + const element = await driver.findElement(By.css('#tr14391526301162119835 > .align-middle:nth-child(15) > .btn')); + + //Get text, font, size, and 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 === 'All') { + console.log('Passed: Standard Code 1, Content Item 5, All button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, All button text "All"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 5, All button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 5, All button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, All button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 5, All button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 5, All button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, All button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 5, Clear button + { + description: 'Validate Standard Code 1, Content Item 5, Clear button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 5, Clear button'; + const element = await driver.findElement(By.css('#tr14391526301162119835 > .align-middle:nth-child(16) > .btn')); + + //Get text, font, size, and 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 === 'Clear') { + console.log('Passed: Standard Code 1, Content Item 5, Clear button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, Clear button text "Clear"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 5, Clear button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 5, Clear button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, Clear button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 5, Clear button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 5, Clear button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 5, Clear button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Content Item 6, link title + { + description: 'Validate Content Item 6, link title text, font, size, color, and URL', + action: async () => { + const multipleChecks = 'Content Item 6 link title'; + const element = await driver.findElement(By.linkText('Area of a triangle on a grid (Video)')); + + //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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === ('Area of a triangle on a grid (Video)')) { + console.log("Passed: Content Item 6, link title text matched as expected"); + } else { + errors.push(`Expected: "Area of a triangle on a grid (Video)" Content Item 6, link title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Content Item 6, link title text font-family matched as expected'); + } else { + errors.push(`Expected: Content Item 6, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Content Item 6, link title text font-size matched as expected'); + } else { + errors.push(`Expected: Content Item 6, link title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content Item 6, link title text color matched as expected'); + } else { + errors.push(`Expected: Content Item 6, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`); + } + + //url + if (elementURL === 'https://www.khanacademy.org/math/geometry-home/geometry-area-perimeter/geometry-area-shapes-grids/v/area-of-triangle-in-grid') { + console.log('Passed: Content Item 6, link title URL matched as expected'); + } else { + errors.push(`Expected: Content Item 6, link title URL: "https://www.khanacademy.org/math/geometry-home/geometry-area-perimeter/geometry-area-shapes-grids/v/area-of-triangle-in-grid"; Actual: "${elementURL}"`); + } + + //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 Item 6, Info icon tool-tip + { + description: 'Validate Content Item 6, Info icon tool tip', + action: async () => { + const multipleChecks = 'Content Item 6, Info icon tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119836 > a:nth-child(2)')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 = []; + + //font + if (elementText === 'Click to view item description') { + console.log('Passed: Content Item 6, Info icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Content Item 6, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Content Item 6, Info icon tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Content Item 6, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Content Item 6, Info icon tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Content Item 6, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content Item 6, Info icon tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Content Item 6, Info icon tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 6, Primary badge + { + description: 'Validate Standard Code 1, Content Item 6, Primary badge text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 6, Primary badge'; + const element = await driver.findElement(By.css('#title14391526301162119836 > .badge')); + + //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 = []; + + //font + if (elementText === 'Primary') { + console.log('Passed: Standard Code 1, Content Item 6, Primary badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, Primary badge text font-family "Primary"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 6, Primary badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, Primary badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '12.87px') { + console.log('Passed: Standard Code 1, Content Item 6, Primary badge text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, Primary badge text font-size "12.87px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 6, Primary badge text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, Primary badge text color "rgba(255, 255, 255, 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')); + } + } + }, + + //Standard Code 1, Content Item 6, tags tool-tip + { + description: 'Validate Standard Code 1, Content Item 6, tags tool-tip text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 6, tags tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119836 > .fa')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 === ('View Matching Concepts')) { + console.log("Passed: Standard Code 1, Content Item 6, tags tool-tip text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'FontAwesome') { + console.log('Passed: Standard Code 1, Content Item 6, tags tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '20px') { + console.log('Passed: Standard Code 1, Content Item 6, tags tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 6, tags tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, tags tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 6, Grade 9 checkmark + { + description: 'Validate Standard Code 1, Content Item 6, Grade 9 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119836 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 6, Grade 9 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 6, Grade 9 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 6, Grade 10 checkmark + { + description: 'Validate Standard Code 1, Content Item 6, Grade 10 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119836 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 6, Grade 10 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 6, Grade 10 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 6, Grade 11 checkmark + { + description: 'Validate Standard Code 1, Content Item 6, Grade 11 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119836 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 6, Grade 11 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 6, Grade 11 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 6, Grade 12 checkmark + { + description: 'Validate Standard Code 1, Content Item 6, Grade 12 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119836 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 6, Grade 12 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 6, Grade 12 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 6, All button + { + description: 'Validate Standard Code 1, Content Item 6, All button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 6, All button'; + const element = await driver.findElement(By.css('#tr14391526301162119836 > .align-middle:nth-child(15) > .btn')); + + //Get text, font, size, and 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 === 'All') { + console.log('Passed: Standard Code 1, Content Item 6, All button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, All button text "All"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 6, All button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 6, All button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, All button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 6, All button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 6, All button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, All button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 6, Clear button + { + description: 'Validate Standard Code 1, Content Item 6, Clear button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 6, Clear button'; + const element = await driver.findElement(By.css('#tr14391526301162119836 > .align-middle:nth-child(16) > .btn')); + + //Get text, font, size, and 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 === 'Clear') { + console.log('Passed: Standard Code 1, Content Item 6, Clear button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, Clear button text "Clear"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 6, Clear button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 6, Clear button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, Clear button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 6, Clear button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 6, Clear button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 6, Clear button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 7, link title + { + description: 'Validate Standard Code 1, Content Item 7, link title text, font, size color, and URL', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 7, link title'; + const element = await driver.findElement(By.linkText('Bear Bones')); + + //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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === ('Bear Bones')) { + console.log("Passed: Standard Code 1, Content Item 7, link title text matched as expected"); + } else { + errors.push(`Expected: "Bear Bones" Standard Code 1, Content Item 7, link title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 7, link title text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 7, link title text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, link title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 7, link title text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`); + } + + //url + if (elementURL === 'http://sciencenetlinks.com/science-news/science-updates/bear-bones/') { + console.log('Passed: Standard Code 1, Content Item 7, link title URL matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, link title URL: "http://sciencenetlinks.com/science-news/science-updates/bear-bones/"; Actual: "${elementURL}"`); + } + + //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')); + } + } + }, + + //Standard Code 1, Content Item 7, Info icon tool-tip + { + description: 'Validate Standard Code 1, Content Item 7, Info icon tool tip', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 7, Info icon tool-tip'; + const element = await driver.findElement(By.css ('#title14391526301162119840 > a:nth-child(2)')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 = []; + + //font + if (elementText === 'Click to view item description') { + console.log('Passed: Standard Code 1, Content Item 7, Info icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 7, Info icon tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 7, Info icon tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 7, Info icon tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, Info icon tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 7, tags tool-tip + { + description: 'Validate Standard Code 1, Content Item 7, tags tool-tip text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 7, tags tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119840 > .fa')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 === ('View Matching Concepts')) { + console.log("Passed: Standard Code 1, Content Item 7, tags tool-tip text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'FontAwesome') { + console.log('Passed: Standard Code 1, Content Item 7, tags tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '20px') { + console.log('Passed: Standard Code 1, Content Item 7, tags tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 7, tags tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, tags tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 7, Grade 6 checkmark + { + description: 'Validate Standard Code 1, Content Item 7, Grade 6 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 5_1439152196_1162119840 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 7, Grade 6 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 7, Grade 6 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 7, Grade 7 checkmark + { + description: 'Validate Standard Code 1, Content Item 7, Grade 7 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 7_1439152274_1162119840 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 7 , Grade 7 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 7, Grade 7 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 7, Grade 8 checkmark + { + description: 'Validate Standard Code 1, Content Item 7, Grade 8 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 8_1439152451_1162119840 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 7, Grade 8 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 7, Grade 8 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 7, Grade 9 checkmark + { + description: 'Validate Standard Code 1, Content Item 7, Grade 9 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119840 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 7, Grade 9 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 7, Grade 9 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 7, Grade 10 checkmark + { + description: 'Validate Standard Code 1, Content Item 7, Grade 10 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119840 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 7, Grade 10 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 7, Grade 10 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 7, Grade 11 checkmark + { + description: 'Validate Standard Code 1, Content Item 7, Grade 11 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119840 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 7, Grade 11 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 7, Grade 11 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 7, Grade 12 checkmark + { + description: 'Validate Standard Code 1, Content Item 7, Grade 12 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119840 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 7, Grade 12 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 7, Grade 12 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 7, All button + { + description: 'Validate Standard Code 1, Content Item 7, All button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 7, All button'; + const element = await driver.findElement(By.css('#tr14391526301162119840 > .align-middle:nth-child(15) > .btn')); + + //Get text, font, size, and 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 === 'All') { + console.log('Passed: Standard Code 1, Content Item 7, All button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, All button text "All"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 7, All button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 7, All button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, All button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 7, All button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 7, All button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, All button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 7, Clear button + { + description: 'Validate Standard Code 1, Content Item 7, Clear button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 7, Clear button'; + const element = await driver.findElement(By.css('#tr14391526301162119840 > .align-middle:nth-child(16) > .btn')); + + //Get text, font, size, and 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 === 'Clear') { + console.log('Passed: Standard Code 1, Content Item 7, Clear button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, Clear button text "Clear"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 7, Clear button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 7, Clear button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, Clear button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 7, Clear button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 7, Clear button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 7, Clear button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 8, link title + { + description: 'Validate Standard Code 1, Content Item 8, link title text, font, size color, and URL', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 8, link title'; + const element = await driver.findElement(By.linkText('Touchdown Decisions')); + + //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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === ('Touchdown Decisions')) { + console.log("Passed: Standard Code 1, Content Item 8, link title text matched as expected"); + } else { + errors.push(`Expected: "Touchdown Decisions" Standard Code 1, Content Item 8, link title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 8, link title text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 8, link title text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, link title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 8, link title text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`); + } + + //url + if (elementURL === 'http://sciencenetlinks.com/science-news/science-updates/touchdown-decisions/') { + console.log('Passed: Standard Code 1, Content Item 8, link title URL matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, link title URL: "http://sciencenetlinks.com/science-news/science-updates/touchdown-decisions/"; Actual: "${elementURL}"`); + } + + //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')); + } + } + }, + + //Standard Code 1, Content Item 8, Info icon tool-tip + { + description: 'Validate Standard Code 1, Content Item 8, Info icon tool tip', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 8, Info icon tool-tip'; + const element = await driver.findElement(By.css ('#title14391526301162119993 > a:nth-child(2)')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 = []; + + //font + if (elementText === 'Click to view item description') { + console.log('Passed: Standard Code 1, Content Item 8, Info icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 8, Info icon tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Standard Code 1, Content Item 8, Info icon tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 8, Info icon tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, Info icon tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 8, tags tool-tip + { + description: 'Validate Standard Code 1, Content Item 8, tags tool-tip text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 8, tags tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119993 > .fa')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 === ('View Matching Concepts')) { + console.log("Passed: Standard Code 1, Content Item 8, tags tool-tip text matched as expected"); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'FontAwesome') { + console.log('Passed: Standard Code 1, Content Item 8, tags tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '20px') { + console.log('Passed: Standard Code 1, Content Item 8, tags tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Standard Code 1, Content Item 8, tags tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, tags tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 8, Grade 6 checkmark + { + description: 'Validate Standard Code 1, Content Item 8, Grade 6 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 5_1439152196_1162119993 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 8, Grade 6 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 8, Grade 6 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 8, Grade 7 checkmark + { + description: 'Validate Standard Code 1, Content Item 8, Grade 7 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 7_1439152274_1162119993 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 8, Grade 7 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 8, Grade 7 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 8, Grade 8 checkmark + { + description: 'Validate Standard Code 1, Content Item 8, Grade 8 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 8_1439152451_1162119993 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 8, Grade 8 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 8, Grade 8 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 8, Grade 9 checkmark + { + description: 'Validate Standard Code 1, Content Item 8, Grade 9 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119993 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 8, Grade 9 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 8, Grade 9 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 8, Grade 10 checkmark + { + description: 'Validate Standard Code 1, Content Item 8, Grade 10 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119993 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 8, Grade 10 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 8, Grade 10 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 8, Grade 11 checkmark + { + description: 'Validate Standard Code 1, Content Item 8, Grade 11 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119993 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 8, Grade 11 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 8, Grade 11 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 8, Grade 12 checkmark + { + description: 'Validate Standard Code 1, Content Item 8, Grade 12 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119993 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 8, Grade 12 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 8, Grade 12 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 8, All button + { + description: 'Validate Standard Code 1, Content Item 8, All button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 8, All button'; + const element = await driver.findElement(By.css('#tr14391526301162119993 > .align-middle:nth-child(15) > .btn')); + + //Get text, font, size, and 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 === 'All') { + console.log('Passed: Standard Code 1, Content Item 8, All button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, All button text "All"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 8, All button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 8, All button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, All button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 8, All button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 8, All button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, All button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 8, Clear button + { + description: 'Validate Standard Code 1, Content Item 8, Clear button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 8, Clear button'; + const element = await driver.findElement(By.css('#tr14391526301162119993 > .align-middle:nth-child(16) > .btn')); + + //Get text, font, size, and 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 === 'Clear') { + console.log('Passed: Standard Code 1, Content Item 8, Clear button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, Clear button text "Clear"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 8, Clear button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 8, Clear button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, Clear button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 8, Clear button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 8, Clear button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 8, Clear button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Content Item 9, link title + { + description: 'Validate Content Item 9, link title text, font, size, color, and URL', + action: async () => { + const multipleChecks = 'Content Item 9 link title'; + const element = await driver.findElement(By.linkText('Adding probabilities (Exercise)')); + + //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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === ('Adding probabilities (Exercise)')) { + console.log("Passed: Content Item 9, link title text matched as expected"); + } else { + errors.push(`Expected: "Adding probabilities (Exercise)" Content Item 9, link title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Content Item 9, link title text font-family matched as expected'); + } else { + errors.push(`Expected: Content Item 9, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Content Item 9, link title text font-size matched as expected'); + } else { + errors.push(`Expected: Content Item 9, link title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Content Item 9, link title text color matched as expected'); + } else { + errors.push(`Expected: Content Item 9, link title text color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`); + } + + //url + if (elementURL === 'https://www.khanacademy.org/math/probability/probability-geometry/addition-rule-for-probability/e/adding-probability') { + console.log('Passed: Content Item 9, link title URL matched as expected'); + } else { + errors.push(`Expected: Content Item 9, link title URL: "https://www.khanacademy.org/math/probability/probability-geometry/addition-rule-for-probability/e/adding-probability"; Actual: "${elementURL}"`); + } + + //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 Item 9, Info icon tool-tip + { + description: 'Validate Content Item 9, Info icon tool tip', + action: async () => { + const multipleChecks = 'Content Item 9, Info icon tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119830 > a:nth-child(2)')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 = []; + + //font + if (elementText === 'Click to view item description') { + console.log('Passed: Content Item 9, Info icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Content Item 9, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Content Item 9, Info icon tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Content Item 9, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Content Item 9, Info icon tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Content Item 9, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content Item 9, Info icon tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Content Item 9, Info icon tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 9, added badge + { + description: 'Validate Standard Code 1, Content Item 9, added badge text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 9, added badge'; + const element = await driver.findElement(By.css('.badge-success')); + + //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 = []; + + //font + if (elementText === 'added') { + console.log('Passed: Standard Code 1, Content Item 9, added badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, added badge text font-family "added"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 9, added badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, added badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '12.87px') { + console.log('Passed: Standard Code 1, Content Item 9, added badge text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, added badge text font-size "12.87px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 9, added badge text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, added badge text color "rgba(255, 255, 255, 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')); + } + } + }, + + //Standard Code 1, Content Item 9, Primary badge + { + description: 'Validate Standard Code 1, Content Item 9, Primary badge text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 9, Primary badge'; + const element = await driver.findElement(By.css('.badge: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'); + + //Track all errors + const errors = []; + + //font + if (elementText === 'Primary') { + console.log('Passed: Standard Code 1, Content Item 9, Primary badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Primary badge text font-family "Primary"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 9, Primary badge text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Primary badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '12.87px') { + console.log('Passed: Standard Code 1, Content Item 9, Primary badge text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Primary badge text font-size "12.87px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 9, Primary badge text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Primary badge text color "rgba(255, 255, 255, 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')); + } + } + }, + + //Standard Code 1, Content Item 9, Grade 9 added + { + description: 'Validate Standard Code 1, Content Item 9, Grade 9 added icon', + action: async () => { + const element = await driver.findElement(By.css('.fa-dot-circle-o')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 9, Grade 9 added icon was found'); + } else { + errors.push('Standard Code 1, Content Item 9, Grade 9 added icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 9, Grade 10 checkmark + { + description: 'Validate Standard Code 1, Content Item 9, Grade 10 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119830')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 9, Grade 10 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 9, Grade 10 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 9, Grade 11 checkmark + { + description: 'Validate Standard Code 1, Content Item 9, Grade 11 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119830 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 9, Grade 11 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 9, Grade 11 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 9, Grade 12 checkmark + { + description: 'Validate Standard Code 1, Content Item 9, Grade 12 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119830 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 9, Grade 12 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 9, Grade 12 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 9, All button + { + description: 'Validate Standard Code 1, Content Item 9, All button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 9, All button'; + const element = await driver.findElement(By.css('#tr14391526301162119830 > .align-middle:nth-child(15) > .btn')); + + //Get text, font, size, and 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 === 'All') { + console.log('Passed: Standard Code 1, Content Item 9, All button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, All button text "All"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 9, All button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 9, All button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, All button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 9, All button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 9, All button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, All button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 9, Clear button + { + description: 'Validate Standard Code 1, Content Item 9, Clear button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 9, Clear button'; + const element = await driver.findElement(By.css('#tr14391526301162119830 > .align-middle:nth-child(16) > .btn')); + + //Get text, font, size, and 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 === 'Clear') { + console.log('Passed: Standard Code 1, Content Item 9, Clear button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text "Clear"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 9, Clear button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 9, Clear button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 9, Clear button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 9, Clear button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Clear button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //NEXT ACTION + { + description: 'Click Standard Code 1, Content Item 9, Grade 9 added icon', + action: async () => { + const element = await driver.findElement(By.css('.badge-success')).catch(() => false); + + await driver.findElement(By.css('.fa-dot-circle-o')).click(); + console.log('----->| NEXT ACTION: Click Standard Code 1, Content Item 9, Grade 9 added icon'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Search/Standards page did not fully load 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 spinner did not disappear within 30 seconds'); + + //Element may be removed from the DOM entirely or just hidden via CSS - handle both + if (element) { + await driver.wait(async () => { + try { + return !(await element.isDisplayed()); + } catch (e) { + return true; //Stale reference means it was removed from the DOM + } + }, 5000, 'Standard Code 1, Content Item 9, added icon did not disappear as expected'); + } + console.log('Passed: Standard Code 1, Content Item 9, added icon disappeared as expected'); + } + }, + + //Content Item 9, link title + { + description: 'Validate Content Item 9, link title text, font, size, color, and URL', + action: async () => { + const multipleChecks = 'Content Item 9 link title'; + const element = await driver.findElement(By.linkText('Adding probabilities (Exercise)')); + + //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 elementURL = await element.getAttribute('href'); + + //Track all errors + const errors = []; + + //text + if (elementText === ('Adding probabilities (Exercise)')) { + console.log("Passed: Content Item 9, link title text matched as expected"); + } else { + errors.push(`Expected: "Adding probabilities (Exercise)" Content Item 9, link title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Content Item 9, link title text font-family matched as expected'); + } else { + errors.push(`Expected: Content Item 9, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Content Item 9, link title text font-size matched as expected'); + } else { + errors.push(`Expected: Content Item 9, link title text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(170, 170, 170, 1)') { + console.log('Passed: Content Item 9, link title text color matched as expected'); + } else { + errors.push(`Expected: Content Item 9, link title text color "rgba(170, 170, 170, 1)"; Actual: "${elementColor}"`); + } + + //url + if (elementURL === 'https://www.khanacademy.org/math/probability/probability-geometry/addition-rule-for-probability/e/adding-probability') { + console.log('Passed: Content Item 9, link title URL matched as expected'); + } else { + errors.push(`Expected: Content Item 9, link title URL: "https://www.khanacademy.org/math/probability/probability-geometry/addition-rule-for-probability/e/adding-probability"; Actual: "${elementURL}"`); + } + + //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 Item 9, Info icon tool-tip + { + description: 'Validate Content Item 9, Info icon tool tip', + action: async () => { + const multipleChecks = 'Content Item 9, Info icon tool-tip'; + const element = await driver.findElement(By.css('#title14391526301162119830 > a:nth-child(2)')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + 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 = []; + + //font + if (elementText === 'Click to view item description') { + console.log('Passed: Content Item 9, Info icon tool-tip text matched as expected'); + } else { + errors.push(`Expected: Content Item 9, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Content Item 9, Info icon tool-tip text font-family matched as expected'); + } else { + errors.push(`Expected: Content Item 9, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '14.3px') { + console.log('Passed: Content Item 9, Info icon tool-tip text font-size matched as expected'); + } else { + errors.push(`Expected: Content Item 9, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Content Item 9, Info icon tool-tip text color matched as expected'); + } else { + errors.push(`Expected: Content Item 9, Info icon tool-tip text color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standard Code 1, Content Item 9, not aligned button + { + description: 'Validate Standard Code 1, Content Item 9, not aligned button text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 9, not aligned button'; + const element = await driver.findElement(By.css('.badge-secondary')); + + //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 = []; + + //font + if (elementText === 'not aligned') { + console.log('Passed: Standard Code 1, Content Item 9, not aligned button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, not aligned button text font-family "not aligned"; Actual: ${elementText}`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 9, not aligned button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, not aligned button text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '12.87px') { + console.log('Passed: Standard Code 1, Content Item 9, not aligned button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, not aligned button text font-size "12.87px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 9, not aligned button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, not aligned button text color "rgba(255, 255, 255, 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')); + } + } + }, + + //Standard Code 1, Content Item 9, Grade 9 added + { + description: 'Validate Standard Code 1, Content Item 9, Grade 9 added icon', + action: async () => { + const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119830 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 9, Grade 9 added icon was found'); + } else { + errors.push('Standard Code 1, Content Item 9, Grade 9 added icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 9, Grade 10 checkmark + { + description: 'Validate Standard Code 1, Content Item 9, Grade 10 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119830')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 9, Grade 10 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 9, Grade 10 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 9, Grade 11 checkmark + { + description: 'Validate Standard Code 1, Content Item 9, Grade 11 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119830 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 9, Grade 11 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 9, Grade 11 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 9, Grade 12 checkmark + { + description: 'Validate Standard Code 1, Content Item 9, Grade 12 checkmark icon', + action: async () => { + const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119830 .fa')); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Standard Code 1, Content Item 9, Grade 12 checkmark icon was found'); + } else { + errors.push('Standard Code 1, Content Item 9, Grade 12 checkmark icon was not found'); + } + } + }, + + //Standard Code 1, Content Item 9, All button + { + description: 'Validate Standard Code 1, Content Item 9, All button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 9, All button'; + const element = await driver.findElement(By.css('#tr14391526301162119830 > .align-middle:nth-child(15) > .btn')); + + //Get text, font, size, and 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 === 'All') { + console.log('Passed: Standard Code 1, Content Item 9, All button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, All button text "All"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 9, All button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 9, All button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, All button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 9, All button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 9, All button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, All button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 1, Content Item 9, Clear button + { + description: 'Validate Standard Code 1, Content Item 9, Clear button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Content Item 9, Clear button'; + const element = await driver.findElement(By.css('#tr14391526301162119830 > .align-middle:nth-child(16) > .btn')); + + //Get text, font, size, and 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 === 'Clear') { + console.log('Passed: Standard Code 1, Content Item 9, Clear button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text "Clear"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Content Item 9, Clear button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Standard Code 1, Content Item 9, Clear button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Content Item 9, Clear button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(108, 117, 125, 1)') { + console.log('Passed: Standard Code 1, Content Item 9, Clear button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Content Item 9, Clear button background color: "rgba(108, 117, 125, 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')); + } + } + }, + + //Standard Code 2 title + { + description: 'Validate Standard Code 2, title text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 2, title'; + const element = await driver.findElement(By.xpath(`(//div[@id='stdbox']/b)[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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'MP2') { + console.log("Passed: Standard Code 2, title text matched as expected"); + } else { + errors.push(`Expected: "MP2" Standard Code 2, title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 2, title text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standard Code 2, title text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, title text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standard Code 2, title text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, 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')); + } + } + }, + + //Standard Code 2 Description + { + description: 'Validate Standard Code 2, description text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 2, description'; + const element = await driver.findElement(By.xpath('//div[3]/div[2]/div[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'); + + //Track all errors + const errors = []; + + //text + if (elementText.includes ('Reason abstractly and quantitatively. (Grade 9)')) { + console.log("Passed: Standard Code 2, description text matched as expected"); + } else { + errors.push(`Expected: "Reason abstractly and quantitatively. (Grade 9)" Standard Code 2, description text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 2, description text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, description text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standard Code 2, description text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, description text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standard Code 2, description text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, description 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')); + } + } + }, + + //Standard Code 2 Tools button + { + description: 'Validate Standard Code 2, Tools button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 2, Tools button'; + const elementIcon = await driver.findElement(By.xpath(`//div[@id='stdbox']/div/div/button/i`)); + const element = await driver.findElement(By.css('#stdbox > div.pull-right > div > button')); + const elementExpandIcon = await driver.findElement(By.xpath(`(//button[@type='button'])[20]`)); + + //Get text, font, size, and 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 + if (elementIcon) { + console.log('Passed: Standard Code 2, tools button icon found') + } else { + errors.push('FAILED: Standard Code 2 tools button icon not found') + } + + //text + if (elementText === 'Tools') { + console.log('Passed: Standard Code 2, Tools button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, "Tools"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 2, Tools button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Tools button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '16px') { + console.log('Passed: Standard Code 2, Tools button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Tools button text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 2, Tools button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Tools button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Standard Code 2, Tools button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Tools button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`); + } + + //expand icon + if (elementExpandIcon) { + console.log('Passed: Standard Code 2, Tools expand button icon found') + } else { + errors.push('FAILED: Standard Code 2, Tools expand button icon not found') + } + + //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')); + } + } + }, + + //Standard Code 2 Aligned Content button + { + description: 'Validate Standard Code 2, Aligned Content 8 button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 2, Aligned Content 8 button'; + const element = await driver.findElement(By.id('corr-1439152631-tab')); + const elementExpandIcon = await driver.findElement(By.id('colstate1439152631')); + + //Get text, font, size, and 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 === 'Aligned Content 4') { + console.log('Passed: Standard Code 2, Aligned Content 4 button text matched as expected'); + } else { + errors.push(`Expected: "Aligned Content 4"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 2, Aligned Content 4 button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Aligned Content 4 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Standard Code 2, Aligned Content 4 button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Aligned Content 4 button text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 2, Aligned Content 4 button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Aligned Content 4 button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standard Code 2, Aligned Content 4 button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Aligned Content 4 button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`); + } + + //expand icon + if (elementExpandIcon) { + console.log('Passed: Standard Code 2, Aligned Content 4 expand button icon found') + } else { + errors.push('FAILED: Standard Code 2, Aligned Content 4 expand button icon not found') + } + + //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')); + } + } + }, + + //Standard Code 2 Related Standards button + { + description: 'Validate Standard Code 2, Related Standards 26 button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 2, Related Standards 26 button'; + const element = await driver.findElement(By.css('#rel-1439152631-tab')); + + //Get text, font, size, and 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 === 'Related Standards 26') { + console.log('Passed: Standard Code 2, Related Standards 26 button text matched as expected'); + } else { + errors.push(`Expected: "Related Standards 26"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 2, Related Standards 26 button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Related Standards 26 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Standard Code 2, Related Standards 26 button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Related Standards 26 button text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Standard Code 2, Related Standards 26 button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Related Standards 26 button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 2, Related Standards 26 button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Related Standards 26 button background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + //Standard Code 2 Add Direct Alignment button + { + description: 'Validate Standard Code 2, Add Direct Alignment button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 2, Add Direct Alignment button'; + const elementIcon = await driver.findElement(By.css('#add-1439152631-tab > .fa')); + const element = await driver.findElement(By.css('#add-1439152631-tab')); + + //Get text, font, size, and 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 + if (elementIcon) { + console.log('Passed: Standard Code 2, Add Direct Alignment button icon found') + } else { + errors.push('FAILED: Standard Code 2, Add Direct Alignment button icon not found') + } + + //text + if (elementText === 'Add Direct Alignment') { + console.log('Passed: Standard Code 2, Add Direct Alignment button text matched as expected'); + } else { + errors.push(`Expected: "Add Direct Alignment"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 2, Add Direct Alignment button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Add Direct Alignment button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Standard Code 2, Add Direct Alignment button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Add Direct Alignment button text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Standard Code 2, Add Direct Alignment button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Add Direct Alignment button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 2, Add Direct Alignment button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 2, Add Direct Alignment button background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + + + + + + + //NEXT ACTION - CLEAN UP + { + description: 'Test Case Reset - Click Standard Code 1, Content Item 2, Grade 9 checkmark icon', + action: async () => { + console.log('------------->| RESET TEST CASE |<-------------'); + await driver.findElement(By.css('#\\34 9_1439152630_1162119829 .fa')).click(); + console.log('----->| NEXT ACTION: Click Standard Code 1, Content Item 2, Grade 9 checkmark icon'); + + //Wait until the element exists in the DOM + const element = await driver.wait( + until.elementLocated(By.css('.fa-pause-circle')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(element), + 30000 + ); + + console.log('Passed: Standard Code 1, Content Item 2, hidden icon appeared as expected'); + } + }, + + //NEXT ACTION + { + description: 'Test Case Reset - Click Standard Code 1, Content Item 9, Grade 9 radio icon', + action: async () => { + await driver.findElement(By.css('#\\34 9_1439152630_1162119830 .fa')).click(); + console.log('----->| NEXT ACTION: Click Standard Code 1, Content Item 9, Grade 9 radio icon'); + + //Wait until the element exists in the DOM + const element = await driver.wait( + until.elementLocated(By.css('.fa-dot-circle-o')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(element), + 30000 + ); + + console.log('Passed: Standard Code 1, Content Item 9, radio icon appeared as expected'); + } + }, + + + + + + + + + + //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')); + } + } + }, +]; + +//STAND ALONE +const myStandardsSearch = (req, res) => { + res.send('

    ExACT Automated Test Script: My Standards - Aligned Content (myStandardsSearchAlignedContent) | 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(); + + 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 and navigate to Search Standards page', + action: async () => { + const multipleChecks = 'Log In and navigate to Search Standards page'; + console.log('------------->| NAVIGATE TO SEARCH STANDARDS 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'); + + //Final sleep to allow any remaining dynamic content to settle + await driver.sleep(2000); + + //NEXT ACTION - Click Alabama view icon + await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img')).click(); + console.log('----->| NEXT ACTION: Clicked My Standards widget Alabama View icon'); + + //Wait for page readyState + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Browse standards page did not fully load within 30 seconds'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const subjectDropdown = await driver.findElement(By.css('#selectSubjects')); + return await subjectDropdown.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Browse standards tab did not become visible within 20 seconds'); + + //NEXT ACTION - Select subject Mathematics + await driver.findElement(By.css('#selectSubjects')).click(); + await driver.sleep(2000); + await driver.findElement(By.css('#selectSubjects > option:nth-child(4)')).click(); + console.log('----->| NEXT ACTION: Selected Subject: Mathematics'); + await driver.sleep(2000); + //Click away to close dropdown + await driver.findElement(By.css('#browse-standards > .form-group:nth-child(1)')).click(); + + //Wait for the dashboard container to exist in DOM + await driver.wait( + until.elementLocated(By.css('#selectGrade')), + 30000, + 'Grade dropdown did not appear within 30 seconds' + ); + + //Wait for it to be visible + await driver.wait(async () => { + try { + const gradeDropdown = await driver.findElement(By.css('#selectGrade')); + return await gradeDropdown.isDisplayed(); + } catch (e) { + return false; + } + }, 30000, 'Grade dropdown did not become visible within 30 seconds'); + + //Select grade 9 + await driver.findElement(By.css('#selectGrade')).click(); + await driver.sleep(2000); + await driver.findElement(By.css('#selectGrade > option:nth-child(11)')).click(); + console.log('----->| NEXT ACTION: Selected Grade: 9'); + + //Click Show Correlations From to open dropdow + await driver.findElement(By.css('.col-sm-12 .multiselect-selected-text')).click(); + await driver.sleep(2000); + + //Wait for dropdown list to become visible + const dropdownMenu = await driver.wait( + until.elementLocated(By.css('ul.multiselect-container.dropdown-menu.show')), + 10000 + ); + + await driver.wait( + until.elementIsVisible(dropdownMenu), + 10000 + ); + + //Select "Algebra" from dropdown + await driver.findElement(By.css('.show > li:nth-child(5) input')).click(); + await driver.sleep(2000); + console.log('----->| NEXT ACTION: Selected Show Correlations From: Algebra'); + //Click away to close dropdown using executeScript to bypass interception + await driver.executeScript(` + document.querySelector('.col-sm-12 .multiselect-selected-text').click(); + `); + await driver.sleep(2000); + + //Click Include Related Standards checkbox + await driver.findElement(By.css('#doRel')).click(); + await driver.sleep(2000); + console.log('----->| NEXT ACTION: Clicked Include Related Standards checkbox'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.col-auto .multiselect-selected-text')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Related Standards dropdown did not become visible within 20 seconds'); + + //Locate and validate selected (collapsed) value + const dropdownButton = await driver.findElement( + By.css('.col-auto .multiselect-selected-text') + ); + + //Open dropdown - use the element directly, not findElement again + await dropdownButton.click(); + await driver.sleep(2000); + + //Select "Washington" from dropdown + await driver.findElement(By.css('.show > li:nth-child(12) input')).click(); + await driver.sleep(2000); + //Select "Common Core State Standards" from dropdown + await driver.findElement(By.css('.show > li:nth-child(14) input')).click(); + await driver.sleep(2000); + //Select "California Mathematics 1997" from dropdown + await driver.findElement(By.css('.show > li:nth-child(32) input')).click(); + await driver.sleep(2000); + console.log('----->| NEXT ACTION: Selected Include Related Standards: Washington, Common Core State Standards, California Mathematics 1997'); + //Click away to close dropdown using executeScript to bypass interception + await driver.executeScript(` + document.querySelector('.col-auto .multiselect-selected-text').click(); + `); + await driver.sleep(2000); + + //Click Search button + await driver.findElement(By.css('#stdsubmit')).click(); + console.log('----->| NEXT ACTION: Clicked Search button'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Standards search page did not fully load within 30 seconds'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Standards search page did not become visible within 20 seconds'); + + console.log('Passed: Standards search 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')); + } + } + }, + + //Then spread all your existing steps + ...myStandardsSearch_AlignedContent(driver) + + ]; + + 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', 'myStandardsSearchAlignedContentResults'); + + const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`; + const screenshotPath = path.join(dir, screenshotFileName); + fs.writeFileSync(screenshotPath, screenshot, 'base64'); + return screenshotPath; +}; + +const clearOldResults = () => { + //Remove old screenshots + const screenshotDir = path.join('screenshots', 'myStandardsSearchAlignedContentResults'); + if (fs.existsSync(screenshotDir)) { + fs.rmSync(screenshotDir, { recursive: true, force: true }); + } + fs.mkdirSync(screenshotDir, { recursive: true }); + + //Remove old Excel file + if (fs.existsSync('myStandardsSearchAlignedContentResults.xlsx')) { + fs.unlinkSync('myStandardsSearchAlignedContentResults.xlsx'); + } +}; + +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 { + await step.action(); + worksheet = logStep( + worksheet, + step.description, + 'Passed', + stepIndex, + timestamp, + null + ); + + } catch (error) { + 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: My Standards Search - Aligned Content (myStandardsSearchAlignedContent); All test steps completed successfully'); + testStatus = 'Passed'; + } else { + console.log('------------->| THE END |<-------------'); + console.log('FAILED: My Standards Search - Aligned Content (myStandardsSearchAlignedContent); 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, 'myStandardsSearchAlignedContentResults.xlsx'); +} finally { + await driver.quit(); +} + })(); +}; + +export default myStandardsSearch; diff --git a/tests/myStandardsSearchRelatedStandards.js b/tests/myStandardsSearchRelatedStandards.js new file mode 100644 index 0000000..316d0cb --- /dev/null +++ b/tests/myStandardsSearchRelatedStandards.js @@ -0,0 +1,2749 @@ +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'; +import { brotliCompress } from 'zlib'; +import e from 'express'; + +//Export JUST the steps so other scripts can import them +export const myStandardsSearch_RelatedStandards = (driver) => [ + { + description: 'Log Related Standards start', + action: async () => { + console.log('------------->| MY STANDARDS - RELATED STANDARDS |<-------------'); + } + }, + + //Search breadcrumb + { + description: 'Validate Search breadcrumb link text, font, size, and color', + action: async () => { + const multipleChecks = 'Search breadcrumb link'; + const element = await driver.findElement(By.linkText('Search')); + + //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 === 'Search') { + console.log("Passed: Search breadcrumb text link matched as expected"); + } else { + errors.push(`Expected: "Search" breadcrumb text link; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Search breadcrumb text link font-family matched as expected'); + } else { + errors.push(`Expected: Search breadcrumb text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Search breadcrumb text link font-size matched as expected'); + } else { + errors.push(`Expected: Search breadcrumb text link font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Search breadcrumb text link color matched as expected'); + } else { + errors.push(`Expected: Search breadcrumb text link color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standards breadcrumb + { + description: 'Validate Standards breadcrumb link text, font, size, and color', + action: async () => { + const multipleChecks = 'Standards breadcrum'; + const element = await driver.findElement(By.css('.breadcrumb-item: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Standards') { + console.log("Passed: Standards breadcrumb text link matched as expected"); + } else { + errors.push(`Expected: "Standards" breadcrumb text link; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standards breadcrumb text link font-family matched as expected'); + } else { + errors.push(`Expected: Standards breadcrumb text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standards breadcrumb text link font-size matched as expected'); + } else { + errors.push(`Expected: Standards breadcrumb text link font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Standards breadcrumb text link color matched as expected'); + } else { + errors.push(`Expected: Standards breadcrumb text link color "rgba(48, 200, 172, 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')); + } + } + }, + + //Save icon + { + description: 'Validate Save icon', + action: async () => { + const multipleChecks = 'Save icon'; + const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div.float-right.ml-1 > a:nth-child(1)')); + + const elementText = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Save icon present'); + } else { + errors.push('Save icon was not found'); + } + + //text + if (elementText === 'Save This Search') { + console.log('Passed: Save icon tool-tip matched as expected'); + } else { + errors.push(`Expected: Save icon tool-tip: "Save This Search"; Actual: "${elementText}"`); + } + + //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')); + } + } + }, + + //Print icon + { + description: 'Validate Print icon', + action: async () => { + const multipleChecks = 'Print icon'; + const element = await driver.findElement(By.css('.icon-link > img')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Print icon present'); + } else { + errors.push('Print icon was not found'); + } + + //text + if (elementText === 'Print This Page') { + console.log('Passed: Print icon tool-tip matched as expected'); + } else { + errors.push(`Expected: Print icon tool-tip: "Print This Page"; Actual: "${elementText}"`); + } + + //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')); + } + } + }, + + //Standard Set title + { + description: 'Validate Standard Set title text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Set title'; + const element = await driver.findElement(By.css('h1')); + + //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 === 'Alabama Courses of Study') { + console.log("Passed: Alabama Courses of Study Standard Set title text link matched as expected"); + } else { + errors.push(`Expected: "Alabama Courses of Study" Standard Set title text link; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Alabama Courses of Study Standard Set title text link font-family matched as expected'); + } else { + errors.push(`Expected: Alabama Courses of Study Standard Set title text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '18.2px') { + console.log('Passed: Alabama Courses of Study Standard Set title text link font-size matched as expected'); + } else { + errors.push(`Expected: Alabama Courses of Study Standard Set title text link font-size "18.2px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Alabama Courses of Study Standard Set title text link color matched as expected'); + } else { + errors.push(`Expected: Alabama Courses of Study Standard Set title text link 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')); + } + } + }, + + //SubjectGrade title + { + description: 'Validate SubjectGrade title text, font, size, and color', + action: async () => { + const multipleChecks = 'SubjectGrade title'; + const element = await driver.findElement(By.css('strong')); + + //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 === 'Mathematics - Grade 9') { + console.log("Passed: Mathematics - Grade 9 SubjectGrade title text link matched as expected"); + } else { + errors.push(`Expected: "Mathematics - Grade 9" SubjectGrade title text link; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link font-family matched as expected'); + } else { + errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link font-size matched as expected'); + } else { + errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link color matched as expected'); + } else { + errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link 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')); + } + } + }, + + //Info icon + { + description: 'Validate Info icon', + action: async () => { + const multipleChecks = 'Info icon'; + const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div:nth-child(5) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Info icon present'); + } else { + errors.push('Info icon was not found'); + } + + //text + if (elementText === 'Alignment Modification Help') { + console.log('Passed: Info icon tool-tip matched as expected'); + } else { + errors.push(`Expected: Info icon tool-tip: "Alignment Modification Help"; Actual: "${elementText}"`); + } + + //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')); + } + } + }, + + //Show All Correlations button + { + description: 'Validate Show All Correlations button text, size, and color', + action: async () => { + const multipleChecks = 'Show All Correlations button'; + const element = await driver.findElement(By.css('.btn-primary:nth-child(2)')); + + //Get text, font, size, and 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 === 'Show All Correlations') { + console.log('Passed: Show All Correlations button text matched as expected'); + } else { + errors.push(`Expected: "Show All Correlations"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Show All Correlations button text font-family matched as expected'); + } else { + errors.push(`Expected: Show All Correlations button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Show All Correlations button text font-size matched as expected'); + } else { + errors.push(`Expected: Show All Correlations button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Show All Correlations button text color matched as expected'); + } else { + errors.push(`Expected: Show All Correlations button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Show All Correlations button background color matched as expected'); + } else { + errors.push(`Expected: Show All Correlations 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')); + } + } + }, + + //Level 1 Standard title + { + description: 'Validate Level 1 Standard title text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Level 1 Standard title'; + const element = await driver.findElement(By.css('.card:nth-child(8) > .card-header')); + + //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 = []; + + //text + if (elementText === 'Mathematical Practices (Grade 9)') { + console.log("Passed: Mathematical Practices (Grade 9) Level 1 Standard title text matched as expected"); + } else { + errors.push(`Expected: "Mathematical Practices (Grade 9)" Level 1 Standard title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text font-family matched as expected'); + } else { + errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text font-size matched as expected'); + } else { + errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text color matched as expected'); + } else { + errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //background-color + if (elementBgColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title background color matched as expected'); + } else { + errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title background color "rgba(48, 200, 172, 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')); + } + } + }, + + //Standard Code 1 title + { + description: 'Validate Standard Code 1, title text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, title'; + const element = await driver.findElement(By.xpath('//div[2]/div/b')); + + //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 === 'MP1') { + console.log("Passed: Standard Code 1, title text matched as expected"); + } else { + errors.push(`Expected: "MP1" Standard Code 1, title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, title text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standard Code 1, title text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, title text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standard Code 1, title text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 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')); + } + } + }, + + //Standard Code 1 Description + { + description: 'Validate Standard Code 1, description text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, description'; + const element = await driver.findElement(By.id('stdbox')); + + //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.includes ('Make sense of problems and persevere in solving them. (Grade 9)')) { + console.log("Passed: Standard Code 1, description text matched as expected"); + } else { + errors.push(`Expected: "Make sense of problems and persevere in solving them. (Grade 9)" Standard Code 1, description text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, description text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, description text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standard Code 1, description text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, description text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standard Code 1, description text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, description 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')); + } + } + }, + + //Standard Code 1 Tools button + { + description: 'Validate Standard Code 1, Tools button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Tools button'; + const elementIcon = await driver.findElement(By.xpath(`//div[@id='stdbox']/div/div/button/i`)); + const element = await driver.findElement(By.css('#stdbox > div.pull-right > div > button')); + const elementExpandIcon = await driver.findElement(By.xpath(`(//button[@type='button'])[4]`)); + + //Get text, font, size, and 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 + if (elementIcon) { + console.log('Passed: Standard Code 1, tools button icon found') + } else { + errors.push('FAILED: Standard Code 1 tools button icon not found') + } + + //text + if (elementText === 'Tools') { + console.log('Passed: Standard Code 1, Tools button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, "Tools"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Tools button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tools button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '16px') { + console.log('Passed: Standard Code 1, Tools button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tools button text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Tools button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tools button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Standard Code 1, Tools button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tools button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`); + } + + //expand icon + if (elementExpandIcon) { + console.log('Passed: Standard Code 1, Tools expand button icon found') + } else { + errors.push('FAILED: Standard Code 1, Tools expand button icon not found') + } + + //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')); + } + } + }, + + //Standard Code 1 Aligned Content button + { + description: 'Validate Standard Code 1, Aligned Content 8 button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Aligned Content 8 button'; + const element = await driver.findElement(By.id('corr-1439152630-tab')); + const elementExpandIcon = await driver.findElement(By.id('colstate1439152630')); + + //Get text, font, size, and 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 === 'Aligned Content 8') { + console.log('Passed: Standard Code 1, Aligned Content 8 button text matched as expected'); + } else { + errors.push(`Expected: "Aligned Content 8"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Aligned Content 8 button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Aligned Content 8 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Standard Code 1, Aligned Content 8 button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Aligned Content 8 button text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Aligned Content 8 button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Aligned Content 8 button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standard Code 1, Aligned Content 8 button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Aligned Content 8 button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`); + } + + //expand icon + if (elementExpandIcon) { + console.log('Passed: Standard Code 1, Aligned Content 8 expand button icon found') + } else { + errors.push('FAILED: Standard Code 1, Aligned Content 8 expand button icon not found') + } + + //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')); + } + } + }, + + //Standard Code 1 Related Standards button + { + description: 'Validate Standard Code 1, Related Standards 26 button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Related Standards 26 button'; + const element = await driver.findElement(By.css('#rel-1439152630-tab')); + + //Get text, font, size, and 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 === 'Related Standards 26') { + console.log('Passed: Standard Code 1, Related Standards 26 button text matched as expected'); + } else { + errors.push(`Expected: "Related Standards 26"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Related Standards 26 button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Related Standards 26 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Standard Code 1, Related Standards 26 button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Related Standards 26 button text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Standard Code 1, Related Standards 26 button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Related Standards 26 button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, Related Standards 26 button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Related Standards 26 button background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + //Standard Code 1 Add Direct Alignment button + { + description: 'Validate Standard Code 1, Add Direct Alignment button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Add Direct Alignment button'; + const elementIcon = await driver.findElement(By.css('#add-1439152630-tab > .fa')); + const element = await driver.findElement(By.css('#add-1439152630-tab')); + + //Get text, font, size, and 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 + if (elementIcon) { + console.log('Passed: Standard Code 1, Add Direct Alignment button icon found') + } else { + errors.push('FAILED: Standard Code 1, Add Direct Alignment button icon not found') + } + + //text + if (elementText === 'Add Direct Alignment') { + console.log('Passed: Standard Code 1, Add Direct Alignment button text matched as expected'); + } else { + errors.push(`Expected: "Add Direct Alignment"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Add Direct Alignment button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Add Direct Alignment button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Standard Code 1, Add Direct Alignment button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Add Direct Alignment button text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Standard Code 1, Add Direct Alignment button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Add Direct Alignment button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, Add Direct Alignment button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Add Direct Alignment button background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + //NEXT ACTION + { + description: 'Click to expand Aligned Content for Standard Code 1', + action: async () => { + //Standard Code 1 Aligned Content + await driver.findElement(By.css('#rel-1439152630-tab')).click(); + console.log('----->| NEXT ACTION: Clicked Standard Code 1 Related Standards button'); + + //Wait until the element exists in the DOM + const openAlignmentNewWindow = await driver.wait( + until.elementLocated(By.css('#selectToggle1439152630')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(openAlignmentNewWindow), + 30000 + ); + } + }, + + //Search breadcrumb + { + description: 'Validate Search breadcrumb link text, font, size, and color', + action: async () => { + const multipleChecks = 'Search breadcrumb link'; + const element = await driver.findElement(By.linkText('Search')); + + //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 === 'Search') { + console.log("Passed: Search breadcrumb text link matched as expected"); + } else { + errors.push(`Expected: "Search" breadcrumb text link; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Search breadcrumb text link font-family matched as expected'); + } else { + errors.push(`Expected: Search breadcrumb text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Search breadcrumb text link font-size matched as expected'); + } else { + errors.push(`Expected: Search breadcrumb text link font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(73, 80, 87, 1)') { + console.log('Passed: Search breadcrumb text link color matched as expected'); + } else { + errors.push(`Expected: Search breadcrumb text link color "rgba(73, 80, 87, 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')); + } + } + }, + + //Standards breadcrumb + { + description: 'Validate Standards breadcrumb link text, font, size, and color', + action: async () => { + const multipleChecks = 'Standards breadcrum'; + const element = await driver.findElement(By.css('.breadcrumb-item: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'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Standards') { + console.log("Passed: Standards breadcrumb text link matched as expected"); + } else { + errors.push(`Expected: "Standards" breadcrumb text link; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standards breadcrumb text link font-family matched as expected'); + } else { + errors.push(`Expected: Standards breadcrumb text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standards breadcrumb text link font-size matched as expected'); + } else { + errors.push(`Expected: Standards breadcrumb text link font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Standards breadcrumb text link color matched as expected'); + } else { + errors.push(`Expected: Standards breadcrumb text link color "rgba(48, 200, 172, 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')); + } + } + }, + + //Save icon + { + description: 'Validate Save icon', + action: async () => { + const multipleChecks = 'Save icon'; + const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div.float-right.ml-1 > a:nth-child(1)')); + + const elementText = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Save icon present'); + } else { + errors.push('Save icon was not found'); + } + + //text + if (elementText === 'Save This Search') { + console.log('Passed: Save icon tool-tip matched as expected'); + } else { + errors.push(`Expected: Save icon tool-tip: "Save This Search"; Actual: "${elementText}"`); + } + + //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')); + } + } + }, + + //Print icon + { + description: 'Validate Print icon', + action: async () => { + const multipleChecks = 'Print icon'; + const element = await driver.findElement(By.css('.icon-link > img')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Print icon present'); + } else { + errors.push('Print icon was not found'); + } + + //text + if (elementText === 'Print This Page') { + console.log('Passed: Print icon tool-tip matched as expected'); + } else { + errors.push(`Expected: Print icon tool-tip: "Print This Page"; Actual: "${elementText}"`); + } + + //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')); + } + } + }, + + //Standard Set title + { + description: 'Validate Standard Set title text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Set title'; + const element = await driver.findElement(By.css('h1')); + + //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 === 'Alabama Courses of Study') { + console.log("Passed: Alabama Courses of Study Standard Set title text link matched as expected"); + } else { + errors.push(`Expected: "Alabama Courses of Study" Standard Set title text link; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Alabama Courses of Study Standard Set title text link font-family matched as expected'); + } else { + errors.push(`Expected: Alabama Courses of Study Standard Set title text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '18.2px') { + console.log('Passed: Alabama Courses of Study Standard Set title text link font-size matched as expected'); + } else { + errors.push(`Expected: Alabama Courses of Study Standard Set title text link font-size "18.2px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Alabama Courses of Study Standard Set title text link color matched as expected'); + } else { + errors.push(`Expected: Alabama Courses of Study Standard Set title text link 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')); + } + } + }, + + //SubjectGrade title + { + description: 'Validate SubjectGrade title text, font, size, and color', + action: async () => { + const multipleChecks = 'SubjectGrade title'; + const element = await driver.findElement(By.css('strong')); + + //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 === 'Mathematics - Grade 9') { + console.log("Passed: Mathematics - Grade 9 SubjectGrade title text link matched as expected"); + } else { + errors.push(`Expected: "Mathematics - Grade 9" SubjectGrade title text link; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link font-family matched as expected'); + } else { + errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link font-size matched as expected'); + } else { + errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link color matched as expected'); + } else { + errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link 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')); + } + } + }, + + //Info icon + { + description: 'Validate Info icon', + action: async () => { + const multipleChecks = 'Info icon'; + const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div:nth-child(5) > a')); + + //Get text, font, size, and color + const elementText = await element.getAttribute('title'); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Info icon present'); + } else { + errors.push('Info icon was not found'); + } + + //text + if (elementText === 'Alignment Modification Help') { + console.log('Passed: Info icon tool-tip matched as expected'); + } else { + errors.push(`Expected: Info icon tool-tip: "Alignment Modification Help"; Actual: "${elementText}"`); + } + + //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')); + } + } + }, + + //Show All Correlations button + { + description: 'Validate Show All Correlations button text, size, and color', + action: async () => { + const multipleChecks = 'Show All Correlations button'; + const element = await driver.findElement(By.css('.btn-primary:nth-child(2)')); + + //Get text, font, size, and 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 === 'Show All Correlations') { + console.log('Passed: Show All Correlations button text matched as expected'); + } else { + errors.push(`Expected: "Show All Correlations"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Show All Correlations button text font-family matched as expected'); + } else { + errors.push(`Expected: Show All Correlations button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Show All Correlations button text font-size matched as expected'); + } else { + errors.push(`Expected: Show All Correlations button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Show All Correlations button text color matched as expected'); + } else { + errors.push(`Expected: Show All Correlations button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Show All Correlations button background color matched as expected'); + } else { + errors.push(`Expected: Show All Correlations 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')); + } + } + }, + + //Level 1 Standard title + { + description: 'Validate Level 1 Standard title text, font, size, color, and background color', + action: async () => { + const multipleChecks = 'Level 1 Standard title'; + const element = await driver.findElement(By.css('.card:nth-child(8) > .card-header')); + + //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 = []; + + //text + if (elementText === 'Mathematical Practices (Grade 9)') { + console.log("Passed: Mathematical Practices (Grade 9) Level 1 Standard title text matched as expected"); + } else { + errors.push(`Expected: "Mathematical Practices (Grade 9)" Level 1 Standard title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text font-family matched as expected'); + } else { + errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '15px') { + console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text font-size matched as expected'); + } else { + errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text font-size "15px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text color matched as expected'); + } else { + errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //background-color + if (elementBgColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title background color matched as expected'); + } else { + errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title background color "rgba(48, 200, 172, 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')); + } + } + }, + + //Standard Code 1 title + { + description: 'Validate Standard Code 1, title text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, title'; + const element = await driver.findElement(By.xpath('//div[2]/div/b')); + + //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 === 'MP1') { + console.log("Passed: Standard Code 1, title text matched as expected"); + } else { + errors.push(`Expected: "MP1" Standard Code 1, title text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, title text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standard Code 1, title text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, title text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standard Code 1, title text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 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')); + } + } + }, + + //Standard Code 1 Description + { + description: 'Validate Standard Code 1, description text, font, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, description'; + const element = await driver.findElement(By.id('stdbox')); + + //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.includes ('Make sense of problems and persevere in solving them. (Grade 9)')) { + console.log("Passed: Standard Code 1, description text matched as expected"); + } else { + errors.push(`Expected: "Make sense of problems and persevere in solving them. (Grade 9)" Standard Code 1, description text; Actual: "${elementText}"`); + } + + //font + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, description text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, description text font-family "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //size + if (elementSize === '13px') { + console.log('Passed: Standard Code 1, description text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, description text font-size "13px"; Actual: "${elementSize}"`); + } + + //color + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standard Code 1, description text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, description 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')); + } + } + }, + + //Standard Code 1 Tools button + { + description: 'Validate Standard Code 1, Tools button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Tools button'; + const elementIcon = await driver.findElement(By.xpath(`//div[@id='stdbox']/div/div/button/i`)); + const element = await driver.findElement(By.css('#stdbox > div.pull-right > div > button')); + const elementExpandIcon = await driver.findElement(By.xpath(`(//button[@type='button'])[4]`)); + + //Get text, font, size, and 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 + if (elementIcon) { + console.log('Passed: Standard Code 1, tools button icon found') + } else { + errors.push('FAILED: Standard Code 1 tools button icon not found') + } + + //text + if (elementText === 'Tools') { + console.log('Passed: Standard Code 1, Tools button text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, "Tools"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Tools button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tools button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '16px') { + console.log('Passed: Standard Code 1, Tools button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tools button text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Tools button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tools button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Standard Code 1, Tools button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Tools button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`); + } + + //expand icon + if (elementExpandIcon) { + console.log('Passed: Standard Code 1, Tools expand button icon found') + } else { + errors.push('FAILED: Standard Code 1, Tools expand button icon not found') + } + + //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')); + } + } + }, + + //Standard Code 1 Aligned Content button + { + description: 'Validate Standard Code 1, Aligned Content 8 button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Aligned Content 8 button'; + const element = await driver.findElement(By.id('corr-1439152630-tab')); + const elementExpandIcon = await driver.findElement(By.id('colstate1439152630')); + + //Get text, font, size, and 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 === 'Aligned Content 8') { + console.log('Passed: Standard Code 1, Aligned Content 8 button text matched as expected'); + } else { + errors.push(`Expected: "Aligned Content 8"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Aligned Content 8 button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Aligned Content 8 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Standard Code 1, Aligned Content 8 button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Aligned Content 8 button text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Standard Code 1, Aligned Content 8 button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Aligned Content 8 button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, Aligned Content 8 button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Aligned Content 8 button background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`); + } + + //expand icon + if (elementExpandIcon) { + console.log('Passed: Standard Code 1, Aligned Content 8 expand button icon found') + } else { + errors.push('FAILED: Standard Code 1, Aligned Content 8 expand button icon not found') + } + + //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')); + } + } + }, + + //Standard Code 1 Related Standards button + { + description: 'Validate Standard Code 1, Related Standards 26 button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Related Standards 26 button'; + const element = await driver.findElement(By.css('#rel-1439152630-tab')); + + //Get text, font, size, and 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 === 'Related Standards 26') { + console.log('Passed: Standard Code 1, Related Standards 26 button text matched as expected'); + } else { + errors.push(`Expected: "Related Standards 26"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Related Standards 26 button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Related Standards 26 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Standard Code 1, Related Standards 26 button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Related Standards 26 button text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Standard Code 1, Related Standards 26 button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Related Standards 26 button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standard Code 1, Related Standards 26 button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Related Standards 26 button background color: "rgba(40, 39, 90, 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')); + } + } + }, + + //Standard Code 1 Add Direct Alignment button + { + description: 'Validate Standard Code 1, Add Direct Alignment button text, size, and color', + action: async () => { + const multipleChecks = 'Standard Code 1, Add Direct Alignment button'; + const elementIcon = await driver.findElement(By.css('#add-1439152630-tab > .fa')); + const element = await driver.findElement(By.css('#add-1439152630-tab')); + + //Get text, font, size, and 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 + if (elementIcon) { + console.log('Passed: Standard Code 1, Add Direct Alignment button icon found') + } else { + errors.push('FAILED: Standard Code 1, Add Direct Alignment button icon not found') + } + + //text + if (elementText === 'Add Direct Alignment') { + console.log('Passed: Standard Code 1, Add Direct Alignment button text matched as expected'); + } else { + errors.push(`Expected: "Add Direct Alignment"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Add Direct Alignment button text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Add Direct Alignment button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '15px') { + console.log('Passed: Standard Code 1, Add Direct Alignment button text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Add Direct Alignment button text font-size "15px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(182, 186, 181, 1)') { + console.log('Passed: Standard Code 1, Add Direct Alignment button text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Add Direct Alignment button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Standard Code 1, Add Direct Alignment button background color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, Add Direct Alignment button background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + //Standard Code 1 Related Standards checkbox and label + { + description: 'Validate Standard Code 1, Related Standards checkbox and label', + action: async () => { + const multipleChecks = 'Standard Code 1, Related Standards checkbox and label'; + const elementCheckbox = await driver.findElement(By.css('#selectToggle1439152630')).getAttribute('checked'); + const elementLabel = await driver.findElement(By.css('#rel-std-1439152630 > .ml-2')); + + //Get text, font, size, and color + const elementText = await elementLabel.getText(); + const elementTextFont = await elementLabel.getCssValue('font-family'); + const elementTextSize = await elementLabel.getCssValue('font-size'); + const elementTextColor = await elementLabel.getCssValue('color'); + const elementButtonColor = await elementLabel.getCssValue('background-color'); + + //Track all errors + const errors = []; + + //Validate checkbox is checked or unchecked + if (elementCheckbox) { + console.log('Passed: Standard Code 1, Select All/None checkbox is selected as expected'); + } else { + errors.push(`Expected: Standard Code 1, Select All/None checkbox to be selected; Actual: checked="${elementCheckbox}"`); + } + + //text + if (elementText === 'Select All/None') { + console.log('Passed: Standard Code 1, Select All/None label text matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, "Select All/None"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Standard Code 1, Select All/None label text font-family matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, "Select All/None" label text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '13px') { + console.log('Passed: Standard Code 1, Select All/None label text font-size matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, "Select All/None" label text font-size "13px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Standard Code 1, Select All/None label text color matched as expected'); + } else { + errors.push(`Expected: Standard Code 1, "Select All/None" label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`); + } + + //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')); + } + } + }, + + //Expand All button + { + description: 'Validate Expand All button text, size, and color', + action: async () => { + const multipleChecks = 'Expand All button'; + const element = await driver.findElement(By.css('#rel-std-1439152630 > .btn:nth-child(3)')); + + //Get text, font, size, and 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 === 'Expand All') { + console.log('Passed: Expand All button text matched as expected'); + } else { + errors.push(`Expected: "Expand All"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Expand All button text font-family matched as expected'); + } else { + errors.push(`Expected: Expand All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Expand All button text font-size matched as expected'); + } else { + errors.push(`Expected: Expand All button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Expand All button text color matched as expected'); + } else { + errors.push(`Expected: Expand All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Expand All button background color matched as expected'); + } else { + errors.push(`Expected: Expand All 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')); + } + } + }, + + //Collapse All button + { + description: 'Validate Collapse All button text, size, and color', + action: async () => { + const multipleChecks = 'Collapse All button'; + const element = await driver.findElement(By.css('#rel-std-1439152630 > .btn:nth-child(4)')); + + //Get text, font, size, and 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 === 'Collapse All') { + console.log('Passed: Collapse All button text matched as expected'); + } else { + errors.push(`Expected: "Collapse All"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Collapse All button text font-family matched as expected'); + } else { + errors.push(`Expected: Collapse All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '14px') { + console.log('Passed: Collapse All button text font-size matched as expected'); + } else { + errors.push(`Expected: Collapse All button text font-size "14px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Collapse All button text color matched as expected'); + } else { + errors.push(`Expected: Collapse All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Collapse All button background color matched as expected'); + } else { + errors.push(`Expected: Collapse All 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')); + } + } + }, + + //Related Standards 1 accordion button + { + description: 'Validate Related Standards 1 accordion button text, size, and color', + action: async () => { + const multipleChecks = 'Related Standards 1 accordion button'; + const element = await driver.findElement(By.css('#headingCommon-Core-State-Standards1439152630 > .btn')); + + //Get text, font, size, and 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 === 'Common Core State Standards (13 of 13 selected)') { + console.log('Passed: Related Standards 1 accordion button text matched as expected'); + } else { + errors.push(`Expected: "Common Core State Standards (13 of 13 selected)"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Related Standards 1 accordion button text font-family matched as expected'); + } else { + errors.push(`Expected: Related Standards 1 accordion button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '16px') { + console.log('Passed: Related Standards 1 accordion button text font-size matched as expected'); + } else { + errors.push(`Expected: Related Standards 1 accordion button text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Related Standards 1 accordion button text color matched as expected'); + } else { + errors.push(`Expected: Related Standards 1 accordion button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Related Standards 1 accordion button background color matched as expected'); + } else { + errors.push(`Expected: Related Standards 1 accordion button background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + //Related Standards 2 accordion button + { + description: 'Validate Related Standards 2 accordion button text, size, and color', + action: async () => { + const multipleChecks = 'Related Standards 2 accordion button'; + const element = await driver.findElement(By.css('#headingWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 > .btn')); + + //Get text, font, size, and 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 === 'Washington State K-12 Learning Standards and Guidelines (13 of 13 selected)') { + console.log('Passed: Related Standards 2 accordion button text matched as expected'); + } else { + errors.push(`Expected: "Washington State K-12 Learning Standards and Guidelines (13 of 13 selected)"; Actual: "${elementText}"`); + } + + //font + if (elementTextFont === 'Poppins, sans-serif') { + console.log('Passed: Related Standards 2 accordion button text font-family matched as expected'); + } else { + errors.push(`Expected: Related Standards 2 accordion button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`); + } + + //size + if (elementTextSize === '16px') { + console.log('Passed: Related Standards 2 accordion button text font-size matched as expected'); + } else { + errors.push(`Expected: Related Standards 2 accordion button text font-size "16px"; Actual: "${elementTextSize}"`); + } + + //color + if (elementTextColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Related Standards 2 accordion button text color matched as expected'); + } else { + errors.push(`Expected: Related Standards 2 accordion button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`); + } + + //button color + if (elementButtonColor === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Related Standards 2 accordion button background color matched as expected'); + } else { + errors.push(`Expected: Related Standards 2 accordion button background color: "rgba(0, 0, 0, 0)"; 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')); + } + } + }, + + //NEXT ACTION + { + description: 'Click to expand Related Standards 2 Washington State K-12 Learning Standards and Guidelines accordion', + action: async () => { + //Standard Code 1 Aligned Content + await driver.findElement(By.css('#headingWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 > .btn')).click(); + console.log('----->| NEXT ACTION: Clicked Washington State K-12 Learning Standards and Guidelines accordion to expand'); + + //Wait until the element exists in the DOM + const gradeKTitle = await driver.wait( + until.elementLocated(By.css('#collapseWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 .list-group-item:nth-child(1) > b')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(gradeKTitle), + 30000 + ); + } + }, + + //Related Standard Code 2, Grade k + { + description: 'Validate Related Standard Code 2, Grade K', + action: async () => { + const multipleChecks = 'Related Standard Code 2, Grade K'; + const element = await driver.findElement(By.css('#collapseWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 .list-group-item:nth-child(1) > b')); + const elementCheckbox = await driver.findElement(By.css('#chk1439152630677984548')).getAttribute('checked'); + const elementLabel = await driver.findElement(By.css('#collapseWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 > #rellist1439152630 > .list-group-item:nth-child(2) .form-check-label')); + + //Get text, font, size, and color + const elementTitleText = await element.getText(); + const elementTitleFont = await element.getCssValue('font-family'); + const elementTitleSize = await element.getCssValue('font-size'); + const elementTitleColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementTitleText === 'Grade K') { + console.log("Passed: Related Standard Code 2, Grade K title text matched as expected"); + } else { + errors.push(`Expected: "Grade K" Related Standard Code 2, Grade K title text; Actual: "${elementTitleText}"`); + } + + //font + if (elementTitleFont === 'Poppins, sans-serif') { + console.log('Passed: Related Standard Code 2, Grade K title text font-family matched as expected'); + } else { + errors.push(`Expected: Related Standard Code 2, Grade K title text font-family "Poppins, sans-serif"; Actual: ${elementTitleFont}`); + } + + //size + if (elementTitleSize === '14.3px') { + console.log('Passed: Related Standard Code 2, Grade K title text font-size matched as expected'); + } else { + errors.push(`Expected: Related Standard Code 2, Grade K title text font-size "14.3px"; Actual: "${elementTitleSize}"`); + } + + //color + if (elementTitleColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Related Standard Code 2, Grade K title text color matched as expected'); + } else { + errors.push(`Expected: Related Standard Code 2, Grade K title text color "rgba(40, 39, 90, 1)"; Actual: "${elementTitleColor}"`); + } + + //Get text, font, size, and color + const elementLabelText = await elementLabel.getText(); + const elementLabelTextFont = await elementLabel.getCssValue('font-family'); + const elementLabelTextSize = await elementLabel.getCssValue('font-size'); + const elementLabelTextColor = await elementLabel.getCssValue('color'); + const elementLabelButtonColor = await elementLabel.getCssValue('background-color'); + + //Validate checkbox is checked or unchecked + if (elementCheckbox) { + console.log('Passed: Related Standard Grade K, checkbox is selected as expected'); + } else { + errors.push(`Expected: Related Standard Grade K, checkbox to be selected; Actual: checked="${elementCheckbox}"`); + } + + //text + if (elementLabelText === 'MP.1. Make sense of problems and persevere in solving them.') { + console.log('Passed: Related Standard Grade K, description label text matched as expected'); + } else { + errors.push(`Expected: Related Standard Grade K, "MP.1. Make sense of problems and persevere in solving them."; Actual: "${elementLabelText}"`); + } + + //font + if (elementLabelTextFont === 'Poppins, sans-serif') { + console.log('Passed: Related Standard Grade K, description label text font-family matched as expected'); + } else { + errors.push(`Expected: Related Standard Grade K, description label text font-family "Poppins, sans-serif"; Actual: ${elementLabelTextFont}`); + } + + //size + if (elementLabelTextSize === '14.3px') { + console.log('Passed: Related Standard Grade K, description label text font-size matched as expected'); + } else { + errors.push(`Expected: Related Standard Grade K, description label text font-size "14.3px"; Actual: "${elementLabelTextSize}"`); + } + + //color + if (elementLabelTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Related Standard Grade K, description label text color matched as expected'); + } else { + errors.push(`Expected: Related Standard Grade K, description label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementLabelTextColor}"`); + } + + //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')); + } + } + }, + + //Related Standard Code 2, Grade 1 + { + description: 'Validate Related Standard Code 2, Grade 1', + action: async () => { + const multipleChecks = 'Related Standard Code 2, Grade 1'; + const element = await driver.findElement(By.css('#collapseWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 .list-group-item:nth-child(3) > b')); + const elementCheckbox = await driver.findElement(By.css('#chk1439152630677984596')).getAttribute('checked'); + const elementLabel = await driver.findElement(By.css('#collapseWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 > #rellist1439152630 > .list-group-item:nth-child(4) .form-check-label')); + + //Get text, font, size, and color + const elementTitleText = await element.getText(); + const elementTitleFont = await element.getCssValue('font-family'); + const elementTitleSize = await element.getCssValue('font-size'); + const elementTitleColor = await element.getCssValue('color'); + + //Track all errors + const errors = []; + + //text + if (elementTitleText === 'Grade 1') { + console.log("Passed: Related Standard Code 2, Grade 1 title text matched as expected"); + } else { + errors.push(`Expected: "Grade 1" Related Standard Code 2, Grade 1 title text; Actual: "${elementTitleText}"`); + } + + //font + if (elementTitleFont === 'Poppins, sans-serif') { + console.log('Passed: Related Standard Code 2, Grade 1 title text font-family matched as expected'); + } else { + errors.push(`Expected: Related Standard Code 2, Grade 1 title text font-family "Poppins, sans-serif"; Actual: ${elementTitleFont}`); + } + + //size + if (elementTitleSize === '14.3px') { + console.log('Passed: Related Standard Code 2, Grade 1 title text font-size matched as expected'); + } else { + errors.push(`Expected: Related Standard Code 2, Grade 1 title text font-size "14.3px"; Actual: "${elementTitleSize}"`); + } + + //color + if (elementTitleColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Related Standard Code 2, Grade 1 title text color matched as expected'); + } else { + errors.push(`Expected: Related Standard Code 2, Grade 1 title text color "rgba(40, 39, 90, 1)"; Actual: "${elementTitleColor}"`); + } + + //Get text, font, size, and color + const elementLabelText = await elementLabel.getText(); + const elementLabelTextFont = await elementLabel.getCssValue('font-family'); + const elementLabelTextSize = await elementLabel.getCssValue('font-size'); + const elementLabelTextColor = await elementLabel.getCssValue('color'); + const elementLabelButtonColor = await elementLabel.getCssValue('background-color'); + + //Validate checkbox is checked or unchecked + if (elementCheckbox) { + console.log('Passed: Related Standard Grade 1, checkbox is selected as expected'); + } else { + errors.push(`Expected: Related Standard Grade 1, checkbox to be selected; Actual: checked="${elementCheckbox}"`); + } + + //text + if (elementLabelText === 'MP.1. Make sense of problems and persevere in solving them.') { + console.log('Passed: Related Standard Grade 1, description label text matched as expected'); + } else { + errors.push(`Expected: Related Standard Grade 1, "MP.1. Make sense of problems and persevere in solving them."; Actual: "${elementLabelText}"`); + } + + //font + if (elementLabelTextFont === 'Poppins, sans-serif') { + console.log('Passed: Related Standard Grade 1, description label text font-family matched as expected'); + } else { + errors.push(`Expected: Related Standard Grade 1, description label text font-family "Poppins, sans-serif"; Actual: ${elementLabelTextFont}`); + } + + //size + if (elementLabelTextSize === '14.3px') { + console.log('Passed: Related Standard Grade 1, description label text font-size matched as expected'); + } else { + errors.push(`Expected: Related Standard Grade 1, description label text font-size "14.3px"; Actual: "${elementLabelTextSize}"`); + } + + //color + if (elementLabelTextColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Related Standard Grade 1, description label text color matched as expected'); + } else { + errors.push(`Expected: Related Standard Grade 1, description label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementLabelTextColor}"`); + } + + //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')); + } + } + }, + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]; + +//STAND ALONE +const myStandardsSearchRelatedStandards = (req, res) => { + res.send('

    ExACT Automated Test Script: My Standards Search - Related Standards (myStandardsSearchRelatedStandards) | 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(); + + 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 and navigate to Search Standards page', + action: async () => { + const multipleChecks = 'Log In and navigate to Search Standards page'; + console.log('------------->| NAVIGATE TO SEARCH STANDARDS 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'); + + //Final sleep to allow any remaining dynamic content to settle + await driver.sleep(2000); + + //NEXT ACTION - Click Alabama view icon + await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img')).click(); + console.log('----->| NEXT ACTION: Clicked My Standards widget Alabama View icon'); + + //Wait for page readyState + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Browse standards page did not fully load within 30 seconds'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const subjectDropdown = await driver.findElement(By.css('#selectSubjects')); + return await subjectDropdown.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Browse standards tab did not become visible within 20 seconds'); + + //NEXT ACTION - Select subject Mathematics + await driver.findElement(By.css('#selectSubjects')).click(); + await driver.sleep(2000); + await driver.findElement(By.css('#selectSubjects > option:nth-child(4)')).click(); + console.log('----->| NEXT ACTION: Selected Subject: Mathematics'); + await driver.sleep(2000); + //Click away to close dropdown + await driver.findElement(By.css('#browse-standards > .form-group:nth-child(1)')).click(); + + //Wait for the dashboard container to exist in DOM + await driver.wait( + until.elementLocated(By.css('#selectGrade')), + 30000, + 'Grade dropdown did not appear within 30 seconds' + ); + + //Wait for it to be visible + await driver.wait(async () => { + try { + const gradeDropdown = await driver.findElement(By.css('#selectGrade')); + return await gradeDropdown.isDisplayed(); + } catch (e) { + return false; + } + }, 30000, 'Grade dropdown did not become visible within 30 seconds'); + + //Select grade 9 + await driver.findElement(By.css('#selectGrade')).click(); + await driver.sleep(2000); + await driver.findElement(By.css('#selectGrade > option:nth-child(11)')).click(); + console.log('----->| NEXT ACTION: Selected Grade: 9'); + + //Click Show Correlations From to open dropdow + await driver.findElement(By.css('.col-sm-12 .multiselect-selected-text')).click(); + await driver.sleep(2000); + + //Wait for dropdown list to become visible + const dropdownMenu = await driver.wait( + until.elementLocated(By.css('ul.multiselect-container.dropdown-menu.show')), + 10000 + ); + + await driver.wait( + until.elementIsVisible(dropdownMenu), + 10000 + ); + + //Select "Algebra" from dropdown + await driver.findElement(By.css('.show > li:nth-child(5) input')).click(); + await driver.sleep(2000); + console.log('----->| NEXT ACTION: Selected Show Correlations From: Algebra'); + //Click away to close dropdown using executeScript to bypass interception + await driver.executeScript(` + document.querySelector('.col-sm-12 .multiselect-selected-text').click(); + `); + await driver.sleep(2000); + + //Click Include Related Standards checkbox + await driver.findElement(By.css('#doRel')).click(); + await driver.sleep(2000); + console.log('----->| NEXT ACTION: Clicked Include Related Standards checkbox'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.col-auto .multiselect-selected-text')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Related Standards dropdown did not become visible within 20 seconds'); + + //Locate and validate selected (collapsed) value + const dropdownButton = await driver.findElement( + By.css('.col-auto .multiselect-selected-text') + ); + + //Open dropdown - use the element directly, not findElement again + await dropdownButton.click(); + await driver.sleep(2000); + + //Select "Washington" from dropdown + await driver.findElement(By.css('.show > li:nth-child(12) input')).click(); + await driver.sleep(2000); + //Select "Common Core State Standards" from dropdown + await driver.findElement(By.css('.show > li:nth-child(14) input')).click(); + await driver.sleep(2000); + //Select "California Mathematics 1997" from dropdown + await driver.findElement(By.css('.show > li:nth-child(32) input')).click(); + await driver.sleep(2000); + console.log('----->| NEXT ACTION: Selected Include Related Standards: Washington, Common Core State Standards, California Mathematics 1997'); + //Click away to close dropdown using executeScript to bypass interception + await driver.executeScript(` + document.querySelector('.col-auto .multiselect-selected-text').click(); + `); + await driver.sleep(2000); + + //Click Search button + await driver.findElement(By.css('#stdsubmit')).click(); + console.log('----->| NEXT ACTION: Clicked Search button'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Standards search page did not fully load within 30 seconds'); + + //Wait until the modal title is located AND visible + await driver.wait(async () => { + try { + const element = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)')); + return await element.isDisplayed(); + } catch (e) { + return false; //Element not ready yet, keep waiting + } + }, 20000, 'Standards search page did not become visible within 20 seconds'); + + console.log('Passed: Standards search 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')); + } + } + }, + + //Then spread all your existing steps + ...myStandardsSearch_RelatedStandards(driver) + + ]; + + 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', 'myStandardsSearchRelatedStandardsResults'); + + const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`; + const screenshotPath = path.join(dir, screenshotFileName); + fs.writeFileSync(screenshotPath, screenshot, 'base64'); + return screenshotPath; +}; + +const clearOldResults = () => { + //Remove old screenshots + const screenshotDir = path.join('screenshots', 'myStandardsSearchRelatedStandardsResults'); + if (fs.existsSync(screenshotDir)) { + fs.rmSync(screenshotDir, { recursive: true, force: true }); + } + fs.mkdirSync(screenshotDir, { recursive: true }); + + //Remove old Excel file + if (fs.existsSync('myStandardsSearchRelatedStandardsResults.xlsx')) { + fs.unlinkSync('myStandardsSearchRelatedStandardsResults.xlsx'); + } +}; + +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 { + await step.action(); + worksheet = logStep( + worksheet, + step.description, + 'Passed', + stepIndex, + timestamp, + null + ); + + } catch (error) { + 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: My Standards Search - Related Standards (myStandardsSearchRelatedStandards); All test steps completed successfully'); + testStatus = 'Passed'; + } else { + console.log('------------->| THE END |<-------------'); + console.log('FAILED: My Standards Search - Related Standards (myStandardsSearchRelatedStandards); 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, 'myStandardsSearchRelatedStandardsResults.xlsx'); +} finally { + await driver.quit(); +} + })(); +}; + +export default myStandardsSearchRelatedStandards;