Files
EdGateAutomatedRegression/tests/ExACT_contentPage.js
2026-10-07 15:27:11 -07:00

9238 lines
352 KiB
JavaScript

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('<h2>ExACT Automated Test Script: CONTENT - Content Page (ExACT_contentPage) | Initiated</h2>');
(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('------------->| 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 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
//Dashboard 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 (SPECIAL CASE: with button)
{
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 === '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'));
}
}
},
//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}"`);
}
}
},
//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)') {
console.log('Passed: Search icon color matched as expected');
} else {
errors.push(`Expected: Search icon color did not match; Actual: "${elementStyle}"`);
}
}
},
//Filter textbox placeholder
{
description: 'Validate Filter textbox placeholder text',
action: async () => {
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'));
}
}
},
/*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 (SPECIAL CASE: validate default selection)
{
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 - Biology Content Set
{
description: 'Validate Biology Content Set',
action: async () => {
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'));
}
}
},
//NEXT ACTION
{
description: 'Click Biology content link',
action: async () => {
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');
}
},
//Filter Section
//Filter Results title
{
description: 'Validate Filter Results title',
action: async () => {
const multipleChecks = 'Filter 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: Filter Results title matched as expected');
} else {
errors.push(`Expected: Title: "Filter Results"; Actual: "${elementText}"`);
}
//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}`);
}
//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}"`);
}
//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`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Set filter title
{
description: 'Validate Content Set filter title',
action: async () => {
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'));
}
}
},
//Biology (1493) filter label
{
description: 'Validate Biology filter label',
action: async () => {
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'));
}
}
},
//Grade filter title
{
description: 'Validate Grade filter title',
action: async () => {
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'));
}
}
},
//Grade 9 (1251) filter label
{
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'));
}
}
},
//Grade 10 (1231) filter label
{
description: 'Validate Grade 10 filter label',
action: async () => {
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'));
}
}
},
//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 (1049) 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 (427) 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 (17) 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 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'));
}
}
},
//Detail View button
{
description: 'Validate Detail View button',
action: async () => {
const multipleChecks = 'Detail View button';
const element = await driver.findElement(By.linkText('Detail View'));
//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'));
}
}
},
//Edit View button
{
description: 'Validate Edit View button',
action: async () => {
const multipleChecks = 'Edit View button';
const element = await driver.findElement(By.linkText('Edit View'));
//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'));
}
}
},
//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 > 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'));
}
}
},
//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'));
}
}
},
//Results 1 - 25 of 1493 label
{
description: 'Validate Results 1 - 25 of 1493 label text, size, and color',
action: async () => {
const multipleChecks = 'Results 1 - 25 of 1493 label';
const element = await driver.findElement(By.css('.float-left:nth-child(5)'));
//Get text, font, size, and color
const 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'));
}
}
},
//PAGINATION BUTTONS
//Show button
{
description: 'Validate Show button',
action: async () => {
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'));
}
}
},
//Show dropdown
{
description: 'Validate Show dropdown',
action: async () => {
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'));
}
}
},
//Pagination 1 button
{
description: 'Validate Pagination 1 button',
action: async () => {
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'));
}
}
},
//Pagination 2 button
{
description: 'Validate Pagination 2 button',
action: async () => {
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'));
}
}
},
//Pagination 3 button
{
description: 'Validate Pagination 3 button',
action: async () => {
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'));
}
}
},
//Pagination 4 button
{
description: 'Validate Pagination 4 button',
action: async () => {
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'));
}
}
},
//Pagination 5 button
{
description: 'Validate Pagination 5 button',
action: async () => {
const multipleChecks = 'Pagination 5 button';
const element = await driver.findElement(By.linkText('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 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 icon
{
description: 'Verify Pagination separator icon 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 60 button
{
description: 'Validate Pagination 60 button',
action: async () => {
const multipleChecks = 'Pagination 60 button';
const element = await driver.findElement(By.linkText('60'));
//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 === '60') {
console.log('Passed: Pagination button 60 text matched as expected');
} else {
errors.push(`Expected: Pagination button: "60"; Actual: "${elementText}"`);
}
//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}`);
}
//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}"`);
}
//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}"`);
}
//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}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 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 === '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'));
}
}
},
//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(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'));
}
}
},
//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(/<br>/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(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(/<br>/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');
}
},
//Filter Section
//Filtered Results title
{
description: 'Validate Filtered Results title',
action: async () => {
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}"`);
}
//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}`);
}
//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}"`);
}
//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}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 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 filtered title
{
description: 'Validate Content Set filtered title',
action: async () => {
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'));
}
}
},
//Biology (1063) filtered label
{
description: 'Validate Biology filtered label',
action: async () => {
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'));
}
}
},
//Grade filtered title
{
description: 'Validate Grade filtered title',
action: async () => {
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'));
}
}
},
//Clear filtered link
{
description: 'Validate Clear filtered link',
action: async () => {
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'));
}
}
},
//See All>> filtered link
{
description: 'Validate See All filtered link',
action: async () => {
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'));
}
}
},
//Grade 8 (1063) filtered label
{
description: 'Validate Grade 8 filtered label',
action: async () => {
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'));
}
}
},
//Grade Y9 (1059) filter label
{
description: 'Validate Grade Y9 filter label',
action: async () => {
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'));
}
}
},
//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 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'));
}
}
},
//Detail View button
{
description: 'Validate Detail View button',
action: async () => {
const multipleChecks = 'Detail View button';
const element = await driver.findElement(By.linkText('Detail View'));
//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'));
}
}
},
//Edit View button
{
description: 'Validate Edit View button',
action: async () => {
const multipleChecks = 'Edit View button';
const element = await driver.findElement(By.linkText('Edit View'));
//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'));
}
}
},
//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 > 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'));
}
}
},
//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'));
}
}
},
//Applied filter button
{
description: 'Validate Applied filter button',
action: async () => {
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'));
}
}
},
//Results 1 - 25 of 1063 label
{
description: 'Validate Results 1 - 25 of 1063 label text, size, and color',
action: async () => {
const multipleChecks = 'Results 1 - 25 of 1063 label';
const element = await driver.findElement(By.css('.float-left: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 = [];
//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'));
}
}
},
//PAGINATION BUTTONS
//Show button
{
description: 'Validate Show button',
action: async () => {
const multipleChecks = 'Show button';
const element = await driver.findElement(By.css('.form-group:nth-child(7) #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'));
}
}
},
//Show dropdown
{
description: 'Validate Show dropdown',
action: async () => {
const multipleChecks = 'Show dropdown';
const element = await driver.findElement(By.css('.form-group:nth-child(7) #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'));
}
}
},
//Pagination 1 button
{
description: 'Validate Pagination 1 button',
action: async () => {
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'));
}
}
},
//Pagination 2 button
{
description: 'Validate Pagination 2 button',
action: async () => {
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'));
}
}
},
//Pagination 3 button
{
description: 'Validate Pagination 3 button',
action: async () => {
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'));
}
}
},
//Pagination 4 button
{
description: 'Validate Pagination 4 button',
action: async () => {
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'));
}
}
},
//Pagination 5 button
{
description: 'Validate Pagination 5 button',
action: async () => {
const multipleChecks = 'Pagination 5 button';
const element = await driver.findElement(By.linkText('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 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(/<br>/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(/<br>/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: 'Click Technology Education filter',
action: async () => {
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');
}
},
//Applied filter button
{
description: 'Validate Applied filter button',
action: async () => {
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'));
}
}
},
//Results 1 - 8 of 8 label
{
description: 'Validate Results 1 - 8 of 8 label text, size, and color',
action: async () => {
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'));
}
}
},
//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(`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'));
}
}
},
//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(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'));
}
}
},
//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=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'));
}
}
},
//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(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'));
}
}
},
//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*="content1215718916"]');
if (!viewDetailsBtn) return 'button not found';
const div = viewDetailsBtn.previousElementSibling;
if (!div) return 'div not found';
return div.innerHTML
.replace(/<br>/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'));
}
}
},
//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 === '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'));
}
}
},
//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(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'));
}
}
},
//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('#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'));
}
}
},
//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('#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'));
}
}
},
//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(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'));
}
}
},
//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(`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'));
}
}
},
//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=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'));
}
}
},
//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*="content1215719217"]');
if (!viewDetailsBtn) return 'button not found';
const div = viewDetailsBtn.previousElementSibling;
if (!div) return 'div not found';
return div.innerHTML
.replace(/<br>/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'));
}
}
},
//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 === `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'));
}
}
},
//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(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'));
}
}
},
//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('#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'));
}
}
},
//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('#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'));
}
}
},
//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(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'));
}
}
},
*/
//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', 'contentPage');
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', 'contentPage');
if (fs.existsSync(screenshotDir)) {
fs.rmSync(screenshotDir, { recursive: true, force: true });
}
fs.mkdirSync(screenshotDir, { recursive: true });
//Remove old Excel file
if (fs.existsSync('contentPageResults.xlsx')) {
fs.unlinkSync('contentPageResults.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: CONTENT - Content Page (ExACT_contentPage); All test steps completed successfully');
testStatus = 'Passed';
} else {
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';
}
//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, 'contentPageResults.xlsx');
} finally {
await driver.quit();
}
})();
}
export default ExACT_contentPage;